Earabic.pm

filter: Statementstmt 43.3% 1302 / 3006 Branchbran 40.4% 1056 / 2608 Conditioncond 30.8% 114 / 370 MC/DCmcdc 15.4% 34 / 220 Subroutinesub 69.5% 112 / 161 Podpod 4.6% 3 / 64 totaltotal 40.7% 2621 / 6429 CC 1475 SCAR 97.8
CC
1475
Cov
41%
escape_token
55669.4
e_s1
3320.4
e_split
2070.1
CRAP 17631.6
↑ Summary Arabic.pm »
1 package Earabic;
2 425 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 425 ▶BEGIN { $INC{'warnings.pm'} = '' if $] < 5.006 } use warnings;
Subroutine BEGIN: called CC=2 SCAR=7.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if $] < "5.006" 0 424 424
4 ######################################################################
5 #
6 # Earabic - Run-time routines for Arabic.pm
7 #
8 # http://search.cpan.org/dist/Char-Arabic/
9 #
10 # Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2018, 2019 INABA Hitoshi <ina@cpan.org>
11 ######################################################################
12  
13 425 ▶use 5.00503; # Galapagos Consensus 1998 for primetools
Subroutine BEGIN: called CC=1 SCAR=0.0
14 # use 5.008001; # Lancaster Consensus 2013 for toolchains
15  
16 # 12.3. Delaying use Until Runtime
17 # in Chapter 12. Packages, Libraries, and Modules
18 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
19 # (and so on)
20  
21 # Version numbers should be boring
22 # http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/
23 # For the impatient, the disinterested or those who just want to follow
24 # a recipe, my advice for all modules is this:
25 # our $VERSION = "0.001"; # or "0.001_001" for a dev release
26 # $VERSION = eval $VERSION; # No!! because '1.10' makes '1.1'
27  
28 425 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
29 424 $VERSION = '1.22';
30 424 $VERSION = $VERSION;
31  
32 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
33 425 ▶ if ($^X =~ / jperl /oxmsi) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^X =~ / jperl /imosx) 0 424 424
34 1 die __FILE__, ": needs perl(not jperl) 5.00503 or later. (\$^X==$^X)\n";
35 }
36 425 if (CORE::ord('A') == 193) {
37 die __FILE__, ": is not US-ASCII script (may be EBCDIC or EBCDIK script).\n";
38 }
39 424 if (CORE::ord('A') != 0x41) {
40 die __FILE__, ": is not US-ASCII script (must be US-ASCII script).\n";
41 }
42 }
43  
44 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=9.5
45  
46 # instead of utf8.pm
47 424 ▶ CORE::eval q{
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
48 no warnings qw(redefine);
49 *utf8::upgrade = sub { CORE::length $_[0] };
50 *utf8::downgrade = sub { 1 };
51 *utf8::encode = sub { };
52 *utf8::decode = sub { 1 };
53 *utf8::is_utf8 = sub { };
54 *utf8::valid = sub { 1 };
55 };
56 424 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 424 424
57 0 ▶ *utf8::upgrade = sub { CORE::length $_[0] };
Subroutine __ANON__: not called CC=1 SCAR=6.9
58 0 ▶ *utf8::downgrade = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
59 0 ▶ *utf8::encode = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
60 0 ▶ *utf8::decode = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
61 0 ▶ *utf8::is_utf8 = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
62 0 ▶ *utf8::valid = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
63 }
64 }
65  
66 # instead of Symbol.pm
67 BEGIN {
68 0 ▶ sub gensym () {
Subroutine gensym: not called CC=2 SCAR=17.9
Pod undocumented
69 0 ▶ if ($] < 5.006) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < 5.006) { } 0 0 0
70 0 return \do { local *_ };
71 }
72 else {
73 0 return undef;
74 }
75 }
76  
77 20 ▶ sub qualify ($$) {
Subroutine qualify: called CC=8 SCAR=28.9
Pod undocumented
78 20 my($name) = @_;
79  
80 20 ▶ if (ref $name) {
Branch: 7 branches
BranchTrueFalseTotal
if (ref $name) { } 5 15 20
elsif (&Earabic::index($name, '::') >= 0) { } 0 15 15
elsif (&Earabic::index($name, q[']) >= 0) { } 0 15 15
elsif ($name =~ /\A \^ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+ \z/x) { } 0 15 15
elsif ($name =~ /\A (?: ARGV | ARGVOUT | ENV | INC | SIG | STDERR | STDIN | STDOUT ) \z/x) { } 0 15 15
elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) { } 0 15 15
elsif (defined $_[1]) { } 15 0 15
81 5 return $name;
82 }
83 elsif (Earabic::index($name,'::') >= 0) {
84 0 return $name;
85 }
86 elsif (Earabic::index($name,"'") >= 0) {
87 0 return $name;
88 }
89  
90 # special character, "^xyz"
91 elsif ($name =~ /\A \^ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+ \z/x) {
92  
93 # RGS 2001-11-05 : translate leading ^X to control-char
94 0 $name =~ s{\A \^ ([ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]) }{'qq(\c'.$1.')'}xee;
95 0 return 'main::' . $name;
96 }
97  
98 # Global names
99 elsif ($name =~ /\A (?: ARGV | ARGVOUT | ENV | INC | SIG | STDERR | STDIN | STDOUT ) \z/x) {
100 0 return 'main::' . $name;
101 }
102  
103 # or other
104 elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) {
105 0 return 'main::' . $name;
106 }
107  
108 elsif (defined $_[1]) {
109 15 return $_[1] . '::' . $name;
110 }
111 else {
112 0 return (caller)[0] . '::' . $name;
113 }
114 }
115  
116 20 ▶ sub qualify_to_ref ($;$) {
Subroutine qualify_to_ref: called CC=2 SCAR=7.2
Pod undocumented
117 20 ▶ if (defined $_[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[1]) { } 20 0 20
118 424 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
119 20 return \*{ qualify $_[0], $_[1] };
120 }
121 else {
122 424 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: not called CC=1 SCAR=0.0
123 0 return \*{ qualify $_[0], (caller)[0] };
124 }
125 }
126 }
127  
128 # P.714 29.2.39. flock
129 # in Chapter 29: Functions
130 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
131  
132 # P.863 flock
133 # in Chapter 27: Functions
134 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
135  
136 sub LOCK_SH() {1}
137 sub LOCK_EX() {2}
138 sub LOCK_UN() {8}
139 sub LOCK_NB() {4}
140  
141 # instead of Carp.pm
142 sub carp;
143 sub croak;
144 sub cluck;
145 sub confess;
146  
147 # 6.18. Matching Multiple-Byte Characters
148 # in Chapter 6. Pattern Matching
149 # of ISBN 978-1-56592-243-3 Perl Perl Cookbook.
150 # (and so on)
151  
152 # regexp of character
153 424 my $your_char = q{[\x00-\xFF]};
154 424 ▶use vars qw($qq_char); $qq_char = qr/\\c[\x40-\x5F]|\\?(?:$your_char)/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
155 424 ▶use vars qw($q_char); $q_char = qr/$your_char/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
156  
157 #
158 # Arabic character range per length
159 #
160 424 my %range_tr = ();
161  
162 #
163 # Arabic case conversion
164 #
165 424 my %lc = ();
166 424 @lc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
167 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
168 424 my %uc = ();
169 424 @uc{qw(a b c d e f g h i j k l m n o p q r s t u v w x y z)} =
170 qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z);
171 424 my %fc = ();
172 424 @fc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
173 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
174  
175 424 ▶if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { __PACKAGE__ =~ / \b Earabic \z/mosx }) { } 424 0 424
176 }
177  
178 elsif (__PACKAGE__ =~ / \b Earabic \z/oxms) {
179 424 %range_tr = (
180 1 => [ [0x00..0xFF],
181 ],
182 );
183 }
184  
185 else {
186 0 croak "Don't know my package name '@{[__PACKAGE__]}'";
187 }
188  
189 #
190 # @ARGV wildcard globbing
191 #
192 212 ▶sub import {
Subroutine import: called CC=7 SCAR=28.3
193  
194 212 ▶ if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/mosx) 0 212 212
195 0 my @argv = ();
196 0 for (@ARGV) {
197  
198 # has space
199 0 ▶ if (/\A (?:$q_char)*? [ ] /oxms) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\A (?:$Earabic::q_char)*? [ ] /mosx) { } 0 0 0
elsif (/\A (?:$Earabic::q_char)*? [*?] /mosx) { } 0 0 0
200 0 ▶ if (my @glob = Earabic::glob(qq{"$_"})) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Earabic::glob(qq["$_"])) { } 0 0 0
201 0 push @argv, @glob;
202 }
203 else {
204 0 push @argv, $_;
205 }
206 }
207  
208 # has wildcard metachar
209 elsif (/\A (?:$q_char)*? [*?] /oxms) {
210 0 ▶ if (my @glob = Earabic::glob($_)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Earabic::glob($_)) { } 0 0 0
211 0 push @argv, @glob;
212 }
213 else {
214 0 push @argv, $_;
215 }
216 }
217  
218 # no wildcard globbing
219 else {
220 0 push @argv, $_;
221 }
222 }
223 0 @ARGV = @argv;
224 }
225  
226 212 *Char::ord = \&Arabic::ord;
227 212 *Char::ord_ = \&Arabic::ord_;
228 212 *Char::reverse = \&Arabic::reverse;
229 212 *Char::getc = \&Arabic::getc;
230 212 *Char::length = \&Arabic::length;
231 212 *Char::substr = \&Arabic::substr;
232 212 *Char::index = \&Arabic::index;
233 212 *Char::rindex = \&Arabic::rindex;
234 212 *Char::eval = \&Arabic::eval;
235 212 *Char::escape = \&Arabic::escape;
236 212 *Char::escape_token = \&Arabic::escape_token;
237 212 *Char::escape_script = \&Arabic::escape_script;
238 }
239  
240 # P.230 Care with Prototypes
241 # in Chapter 6: Subroutines
242 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
243 #
244 # If you aren't careful, you can get yourself into trouble with prototypes.
245 # But if you are careful, you can do a lot of neat things with them. This is
246 # all very powerful, of course, and should only be used in moderation to make
247 # the world a better place.
248  
249 # P.332 Care with Prototypes
250 # in Chapter 7: Subroutines
251 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
252 #
253 # If you aren't careful, you can get yourself into trouble with prototypes.
254 # But if you are careful, you can do a lot of neat things with them. This is
255 # all very powerful, of course, and should only be used in moderation to make
256 # the world a better place.
257  
258 #
259 # Prototypes of subroutines
260 #
261 0 ▶sub unimport {}
Subroutine unimport: not called CC=1 SCAR=0.0
262 sub Earabic::split(;$$$);
263 sub Earabic::tr($$$$;$);
264 sub Earabic::chop(@);
265 sub Earabic::index($$;$);
266 sub Earabic::rindex($$;$);
267 sub Earabic::lcfirst(@);
268 sub Earabic::lcfirst_();
269 sub Earabic::lc(@);
270 sub Earabic::lc_();
271 sub Earabic::ucfirst(@);
272 sub Earabic::ucfirst_();
273 sub Earabic::uc(@);
274 sub Earabic::uc_();
275 sub Earabic::fc(@);
276 sub Earabic::fc_();
277 sub Earabic::ignorecase;
278 sub Earabic::classic_character_class;
279 sub Earabic::capture;
280 sub Earabic::chr(;$);
281 sub Earabic::chr_();
282 sub Earabic::glob($);
283 sub Earabic::glob_();
284  
285 sub Arabic::ord(;$);
286 sub Arabic::ord_();
287 sub Arabic::reverse(@);
288 sub Arabic::getc(;*@);
289 sub Arabic::length(;$);
290 sub Arabic::substr($$;$$);
291 sub Arabic::index($$;$);
292 sub Arabic::rindex($$;$);
293 sub Arabic::escape(;$);
294  
295 #
296 # Regexp work
297 #
298 424 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
299 $re_a
300 $re_t
301 $re_n
302 $re_r
303 424 );
304  
305 #
306 # Character class
307 #
308 424 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
309 $dot
310 $dot_s
311 $eD
312 $eS
313 $eW
314 $eH
315 $eV
316 $eR
317 $eN
318 $not_alnum
319 $not_alpha
320 $not_ascii
321 $not_blank
322 $not_cntrl
323 $not_digit
324 $not_graph
325 $not_lower
326 $not_lower_i
327 $not_print
328 $not_punct
329 $not_space
330 $not_upper
331 $not_upper_i
332 $not_word
333 $not_xdigit
334 $eb
335 $eB
336 424 );
337  
338 424 ${Earabic::dot} = qr{(?>[^\x0A])};
339 424 ${Earabic::dot_s} = qr{(?>[\x00-\xFF])};
340 424 ${Earabic::eD} = qr{(?>[^0-9])};
341  
342 # Vertical tabs are now whitespace
343 # \s in a regex now matches a vertical tab in all circumstances.
344 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
345 # ${Earabic::eS} = qr{(?>[^\x09\x0A \x0C\x0D\x20])};
346 # ${Earabic::eS} = qr{(?>[^\x09\x0A\x0B\x0C\x0D\x20])};
347 424 ${Earabic::eS} = qr{(?>[^\s])};
348  
349 424 ${Earabic::eW} = qr{(?>[^0-9A-Z_a-z])};
350 424 ${Earabic::eH} = qr{(?>[^\x09\x20])};
351 424 ${Earabic::eV} = qr{(?>[^\x0A\x0B\x0C\x0D])};
352 424 ${Earabic::eR} = qr{(?>\x0D\x0A|[\x0A\x0D])};
353 424 ${Earabic::eN} = qr{(?>[^\x0A])};
354 424 ${Earabic::not_alnum} = qr{(?>[^\x30-\x39\x41-\x5A\x61-\x7A])};
355 424 ${Earabic::not_alpha} = qr{(?>[^\x41-\x5A\x61-\x7A])};
356 424 ${Earabic::not_ascii} = qr{(?>[^\x00-\x7F])};
357 424 ${Earabic::not_blank} = qr{(?>[^\x09\x20])};
358 424 ${Earabic::not_cntrl} = qr{(?>[^\x00-\x1F\x7F])};
359 424 ${Earabic::not_digit} = qr{(?>[^\x30-\x39])};
360 424 ${Earabic::not_graph} = qr{(?>[^\x21-\x7F])};
361 424 ${Earabic::not_lower} = qr{(?>[^\x61-\x7A])};
362 424 ${Earabic::not_lower_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
363 # ${Earabic::not_lower_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
364 424 ${Earabic::not_print} = qr{(?>[^\x20-\x7F])};
365 424 ${Earabic::not_punct} = qr{(?>[^\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E])};
366 424 ${Earabic::not_space} = qr{(?>[^\s\x0B])};
367 424 ${Earabic::not_upper} = qr{(?>[^\x41-\x5A])};
368 424 ${Earabic::not_upper_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
369 # ${Earabic::not_upper_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
370 424 ${Earabic::not_word} = qr{(?>[^\x30-\x39\x41-\x5A\x5F\x61-\x7A])};
371 424 ${Earabic::not_xdigit} = qr{(?>[^\x30-\x39\x41-\x46\x61-\x66])};
372 424 ${Earabic::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))};
373 424 ${Earabic::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]))};
374  
375 # avoid: Name "Earabic::foo" used only once: possible typo at here.
376 424 ${Earabic::dot} = ${Earabic::dot};
377 424 ${Earabic::dot_s} = ${Earabic::dot_s};
378 424 ${Earabic::eD} = ${Earabic::eD};
379 424 ${Earabic::eS} = ${Earabic::eS};
380 424 ${Earabic::eW} = ${Earabic::eW};
381 424 ${Earabic::eH} = ${Earabic::eH};
382 424 ${Earabic::eV} = ${Earabic::eV};
383 424 ${Earabic::eR} = ${Earabic::eR};
384 424 ${Earabic::eN} = ${Earabic::eN};
385 424 ${Earabic::not_alnum} = ${Earabic::not_alnum};
386 424 ${Earabic::not_alpha} = ${Earabic::not_alpha};
387 424 ${Earabic::not_ascii} = ${Earabic::not_ascii};
388 424 ${Earabic::not_blank} = ${Earabic::not_blank};
389 424 ${Earabic::not_cntrl} = ${Earabic::not_cntrl};
390 424 ${Earabic::not_digit} = ${Earabic::not_digit};
391 424 ${Earabic::not_graph} = ${Earabic::not_graph};
392 424 ${Earabic::not_lower} = ${Earabic::not_lower};
393 424 ${Earabic::not_lower_i} = ${Earabic::not_lower_i};
394 424 ${Earabic::not_print} = ${Earabic::not_print};
395 424 ${Earabic::not_punct} = ${Earabic::not_punct};
396 424 ${Earabic::not_space} = ${Earabic::not_space};
397 424 ${Earabic::not_upper} = ${Earabic::not_upper};
398 424 ${Earabic::not_upper_i} = ${Earabic::not_upper_i};
399 424 ${Earabic::not_word} = ${Earabic::not_word};
400 424 ${Earabic::not_xdigit} = ${Earabic::not_xdigit};
401 424 ${Earabic::eb} = ${Earabic::eb};
402 424 ${Earabic::eB} = ${Earabic::eB};
403  
404 #
405 # Arabic split
406 #
407 72 ▶sub Earabic::split(;$$$) {
Subroutine split: called CC=34 SCAR=38.5
Pod undocumented
408  
409 # P.794 29.2.161. split
410 # in Chapter 29: Functions
411 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
412  
413 # P.951 split
414 # in Chapter 27: Functions
415 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
416  
417 72 my $pattern = $_[0];
418 72 my $string = $_[1];
419 72 my $limit = $_[2];
420  
421 # if $pattern is also omitted or is the literal space, " "
422 72 ▶ if (not defined $pattern) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pattern) 2 70 72
423 2 $pattern = ' ';
424 }
425  
426 # if $string is omitted, the function splits the $_ string
427 72 ▶ if (not defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $string) 6 66 72
428 6 ▶ if (defined $_) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_) { } 0 6 6
429 0 $string = $_;
430 }
431 else {
432 6 $string = '';
433 }
434 }
435  
436 72 my @split = ();
437  
438 # when string is empty
439 72 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 10 62 72
elsif ($pattern eq ' ') { } 2 60 62
440  
441 # resulting list value in list context
442 10 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 5 5 10
443 5 return @split;
444 }
445  
446 # count of substrings in scalar context
447 else {
448 5 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 5 5
449 5 @_ = @split;
450 5 return scalar @_;
451 }
452 }
453  
454 # split's first argument is more consistently interpreted
455 #
456 # After some changes earlier in v5.17, split's behavior has been simplified:
457 # if the PATTERN argument evaluates to a string containing one space, it is
458 # treated the way that a literal string containing one space once was.
459 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#split's_first_argument_is_more_consistently_interpreted
460  
461 # if $pattern is also omitted or is the literal space, " ", the function splits
462 # on whitespace, /\s+/, after skipping any leading whitespace
463 # (and so on)
464  
465 elsif ($pattern eq ' ') {
466 2 ▶ if (not defined $limit) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $limit) { } 2 0 2
467 2 return CORE::split(' ', $string);
468 }
469 else {
470 0 return CORE::split(' ', $string, $limit);
471 }
472 }
473  
474 # if $limit is negative, it is treated as if an arbitrarily large $limit has been specified
475 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
476  
477 # a pattern capable of matching either the null string or something longer than the
478 # null string will split the value of $string into separate characters wherever it
479 # matches the null string between characters
480 # (and so on)
481  
482 60 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 2 58 60
483 2 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
484 2 my $limit = scalar(() = $string =~ /($pattern)/oxmsg);
485  
486 # P.1024 Appendix W.10 Multibyte Processing
487 # of ISBN 1-56592-224-7 CJKV Information Processing
488 # (and so on)
489  
490 # the //m modifier is assumed when you split on the pattern /^/
491 # (and so on)
492  
493 2 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
494 # V
495 2 ▶ while ((--$limit > 0) and ($string =~ s/\A((?:$q_char)+?)$pattern//m)) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$limit > 0 and $string =~ s/\A((?:$Earabic::q_char)+?)$pattern//m) 9 2 11
Condition100%3/3
--$limit > 0 and $string =~ s/\A((?:$Earabic::q_char)+?)$pattern//m
!ll&&!rl&&r
119
MC/DC100%2/2
--$limit > 0 and $string =~ s/\A((?:$Earabic::q_char)+?)$pattern//m
--$limit > 0 $string =~ s/\A((?:$Earabic::q_char)+?)$pattern//m
Truth table100%3/3
A and B
A= --$limit > 0B= $string =~ s/\A((?:$Earabic::q_char)+?)$pattern//m
ABresult
0X0
100
111
496  
497 # if the $pattern contains parentheses, then the substring matched by each pair of parentheses
498 # is included in the resulting list, interspersed with the fields that are ordinarily returned
499 # (and so on)
500  
501 9 local $@;
502 9 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
503 9 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 9 9 18
504 9 push @split, CORE::eval('$' . $digit);
505 }
506 }
507 }
508  
509 else {
510 58 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
511  
512 58 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
513 # V
514 58 ▶ while ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Earabic::q_char)*?)$pattern//m) 163 58 221
515 163 local $@;
516 163 ▶ eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
517 163 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 230 163 393
518 230 push @split, CORE::eval('$' . $digit);
519 }
520 }
521 }
522 }
523  
524 elsif ($limit > 0) {
525 0 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 0 0 0
526 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
527 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
528  
529 0 eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
530 # V
531 0 ▶ if ($string =~ s/\A((?:$q_char)+?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Earabic::q_char)+?)$pattern//m) 0 0 0
532 0 local $@;
533 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
534 0 push @split, CORE::eval('$' . $digit);
535 }
536 }
537 }
538 }
539 else {
540 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
541 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
542  
543 0 eval q{ no warnings }; # avoid: Complex regular subexpression recursion limit (32766) exceeded at ...
544 # V
545 0 ▶ if ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Earabic::q_char)*?)$pattern//m) 0 0 0
546 0 local $@;
547 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
548 0 push @split, CORE::eval('$' . $digit);
549 }
550 }
551 }
552 }
553 }
554  
555 60 ▶ if (CORE::length($string) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $string > 0) 58 2 60
556 58 push @split, $string;
557 }
558  
559 # if $_[2] (NOT "$limit") is omitted or zero, trailing null fields are stripped from the result
560 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
561 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
562 0 pop @split;
563 }
564 }
565  
566 # resulting list value in list context
567 60 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 58 2 60
568 58 return @split;
569 }
570  
571 # count of substrings in scalar context
572 else {
573 2 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 2 2
574 2 @_ = @split;
575 2 return scalar @_;
576 }
577 }
578  
579 #
580 # get last subexpression offsets
581 #
582 60 ▶sub _last_subexpression_offsets {
Subroutine _last_subexpression_offsets: called CC=3 SCAR=11.0
583 60 my $pattern = $_[0];
584  
585 # remove comment
586 60 $pattern =~ s/\(\?\# .*? \)//oxmsg;
587  
588 60 my $modifier = '';
589 60 ▶ if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/mosx) 11 49 60
590 11 $modifier = $1;
591 11 $modifier =~ s/-[A-Za-z]*//;
592 }
593  
594 # with /x modifier
595 60 my @char = ();
596 60 ▶ if ($modifier =~ /x/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /x/mosx) { } 5 55 60
597 5 @char = $pattern =~ /\G((?>
598 [^\\\#\[\(] |
599 \\ $q_char |
600 \# (?>[^\n]*) $ |
601 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
602 \(\? |
603 $q_char
604 ))/oxmsg;
605 }
606  
607 # without /x modifier
608 else {
609 55 @char = $pattern =~ /\G((?>
610 [^\\\[\(] |
611 \\ $q_char |
612 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
613 \(\? |
614 $q_char
615 ))/oxmsg;
616 }
617  
618 60 return scalar grep { $_ eq '(' } @char;
619 }
620  
621 #
622 # Arabic transliteration (tr///)
623 #
624 6 ▶sub Earabic::tr($$$$;$) {
Subroutine tr: called CC=26 SCAR=48.6
Pod undocumented
625  
626 6 my $bind_operator = $_[1];
627 6 my $searchlist = $_[2];
628 6 my $replacementlist = $_[3];
629 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
630  
631 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) 5 1 6
632 5 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 5 5
633 0 croak "Using !~ with tr///r doesn't make sense";
634 }
635 }
636  
637 6 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
638 6 my @searchlist = _charlist_tr($searchlist);
639 6 my @replacementlist = _charlist_tr($replacementlist);
640  
641 6 my %tr = ();
642 6 ▶ for (my $i=0; $i <= $#searchlist; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#searchlist) 19 6 25
643 19 ▶ if (not exists $tr{$searchlist[$i]}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $tr{$searchlist[$i]}) 19 0 19
644 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
645 19 $tr{$searchlist[$i]} = $replacementlist[$i];
646 }
647 elsif ($modifier =~ /d/oxms) {
648 0 $tr{$searchlist[$i]} = '';
649 }
650 ▶ 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
651 0 $tr{$searchlist[$i]} = $replacementlist[-1];
652 }
653 else {
654 0 $tr{$searchlist[$i]} = $searchlist[$i];
655 }
656 }
657 }
658  
659 6 my $tr = 0;
660 6 my $replaced = '';
661 6 ▶ if ($modifier =~ /c/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /c/mosx) { } 0 6 6
662 0 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 0 0 0
663 0 ▶ if (not exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $tr{$char}) { } 0 0 0
664 0 ▶ if (defined $replacementlist[-1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $replacementlist[-1]) 0 0 0
665 0 $replaced .= $replacementlist[-1];
666 }
667 0 $tr++;
668 0 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 0 0
669 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
670 0 shift @char;
671 0 $tr++;
672 }
673 }
674 }
675 else {
676 0 $replaced .= $char;
677 }
678 }
679 }
680 else {
681 6 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 36 6 42
682 36 ▶ if (exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $tr{$char}) { } 19 17 36
683 19 $replaced .= $tr{$char};
684 19 $tr++;
685 19 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 19 19
686 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
687 0 shift @char;
688 0 $tr++;
689 }
690 }
691 }
692 else {
693 17 $replaced .= $char;
694 }
695 }
696 }
697  
698 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) { } 5 1 6
699 5 return $replaced;
700 }
701 else {
702 1 $_[0] = $replaced;
703 1 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) { } 0 1 1
704 0 return not $tr;
705 }
706 else {
707 1 return $tr;
708 }
709 }
710 }
711  
712 #
713 # Arabic chop
714 #
715 0 ▶sub Earabic::chop(@) {
Subroutine chop: not called CC=3 SCAR=24.8
Pod undocumented
716  
717 0 my $chop;
718 0 ▶ if (@_ == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 0) { } 0 0 0
719 0 my @char = /\G (?>$q_char) /oxmsg;
720 0 $chop = pop @char;
721 0 $_ = join '', @char;
722 }
723 else {
724 0 for (@_) {
725 0 my @char = /\G (?>$q_char) /oxmsg;
726 0 $chop = pop @char;
727 0 $_ = join '', @char;
728 }
729 }
730 0 return $chop;
731 }
732  
733 #
734 # Arabic index by octet
735 #
736 30 ▶sub Earabic::index($$;$) {
Subroutine index: called CC=6 SCAR=20.8
Pod documented
737  
738 30 my($str,$substr,$position) = @_;
739 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
740 30 my $pos = 0;
741  
742 30 ▶ while ($pos < CORE::length($str)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < length $str) 130 30 160
743 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
744 0 ▶ if ($pos >= $position) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos >= $position) 0 0 0
745 0 return $pos;
746 }
747 }
748 130 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Earabic::q_char) /mosx) { } 130 0 130
749 130 $pos += CORE::length($1);
750 }
751 else {
752 0 $pos += 1;
753 }
754 }
755 30 return -1;
756 }
757  
758 #
759 # Arabic reverse index
760 #
761 0 ▶sub Earabic::rindex($$;$) {
Subroutine rindex: not called CC=6 SCAR=37.4
Pod undocumented
762  
763 0 my($str,$substr,$position) = @_;
764 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
765 0 my $pos = 0;
766 0 my $rindex = -1;
767  
768 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
769 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
770 0 $rindex = $pos;
771 }
772 0 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Earabic::q_char) /mosx) { } 0 0 0
773 0 $pos += CORE::length($1);
774 }
775 else {
776 0 $pos += 1;
777 }
778 }
779 0 return $rindex;
780 }
781  
782 #
783 # Arabic lower case first with parameter
784 #
785 0 ▶sub Earabic::lcfirst(@) {
Subroutine lcfirst: not called CC=4 SCAR=30.0
Pod undocumented
786 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
787 0 my $s = shift @_;
788 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
789 0 return Earabic::lc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
790 }
791 else {
792 0 return Earabic::lc(CORE::substr($s,0,1)) . CORE::substr($s,1);
793 }
794 }
795 else {
796 0 return Earabic::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
797 }
798 }
799  
800 #
801 # Arabic lower case first without parameter
802 #
803 0 ▶sub Earabic::lcfirst_() {
Subroutine lcfirst_: not called CC=1 SCAR=6.9
Pod undocumented
804 0 return Earabic::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
805 }
806  
807 #
808 # Arabic lower case with parameter
809 #
810 27 ▶sub Earabic::lc(@) {
Subroutine lc: called CC=6 SCAR=24.2
Pod undocumented
811 27 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 27 0 27
812 27 my $s = shift @_;
813 27 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 27 27
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
2700
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
814 0 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
815 }
816 else {
817 27 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 29 0 29
818 }
819 }
820 else {
821 0 return Earabic::lc_();
822 }
823 }
824  
825 #
826 # Arabic lower case without parameter
827 #
828 0 ▶sub Earabic::lc_() {
Subroutine lc_: not called CC=2 SCAR=17.9
Pod undocumented
829 0 my $s = $_;
830 0 ▶ return join '', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
831 }
832  
833 #
834 # Arabic upper case first with parameter
835 #
836 0 ▶sub Earabic::ucfirst(@) {
Subroutine ucfirst: not called CC=4 SCAR=30.0
Pod undocumented
837 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
838 0 my $s = shift @_;
839 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
840 0 return Earabic::uc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
841 }
842 else {
843 0 return Earabic::uc(CORE::substr($s,0,1)) . CORE::substr($s,1);
844 }
845 }
846 else {
847 0 return Earabic::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
848 }
849 }
850  
851 #
852 # Arabic upper case first without parameter
853 #
854 0 ▶sub Earabic::ucfirst_() {
Subroutine ucfirst_: not called CC=1 SCAR=6.9
Pod undocumented
855 0 return Earabic::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
856 }
857  
858 #
859 # Arabic upper case with parameter
860 #
861 246 ▶sub Earabic::uc(@) {
Subroutine uc: called CC=6 SCAR=22.9
Pod undocumented
862 246 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 246 0 246
863 246 my $s = shift @_;
864 246 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 246 246
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
24600
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
865 0 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
866 }
867 else {
868 246 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 53 195 248
869 }
870 }
871 else {
872 0 return Earabic::uc_();
873 }
874 }
875  
876 #
877 # Arabic upper case without parameter
878 #
879 0 ▶sub Earabic::uc_() {
Subroutine uc_: not called CC=2 SCAR=17.9
Pod undocumented
880 0 my $s = $_;
881 0 ▶ return join '', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
882 }
883  
884 #
885 # Arabic fold case with parameter
886 #
887 258 ▶sub Earabic::fc(@) {
Subroutine fc: called CC=6 SCAR=22.9
Pod undocumented
888 258 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 258 0 258
889 258 my $s = shift @_;
890 258 ▶ if (@_ and wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ and wantarray) { } 0 258 258
Condition33%1/3
@_ and wantarray
!ll&&!rl&&r
25800
MC/DC0%0/2
@_ and wantarray
@_ wantarray
Truth table33%1/3
A and B
A= @_B= wantarray
ABresult
0X0
100
111
891 0 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
892 }
893 else {
894 258 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 262 148 410
895 }
896 }
897 else {
898 0 return Earabic::fc_();
899 }
900 }
901  
902 #
903 # Arabic fold case without parameter
904 #
905 0 ▶sub Earabic::fc_() {
Subroutine fc_: not called CC=2 SCAR=17.9
Pod undocumented
906 0 my $s = $_;
907 0 ▶ return join '', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
908 }
909  
910 #
911 # Arabic regexp capture
912 #
913 {
914 0 ▶ sub Earabic::capture {
Subroutine capture: not called CC=1 SCAR=6.9
Pod documented
915 0 return $_[0];
916 }
917 }
918  
919 #
920 # Arabic regexp ignore case modifier
921 #
922 424 ▶sub Earabic::ignorecase {
Subroutine ignorecase: called CC=25 SCAR=53.3
Pod undocumented
923  
924 3 my @string = @_;
925 3 my $metachar = qr/[\@\\|[\]{]/oxms;
926  
927 # ignore case of $scalar or @array
928 3 for my $string (@string) {
929  
930 # split regexp
931 3 my @char = $string =~ /\G (?>\[\^|\\$q_char|$q_char) /oxmsg;
932  
933 # unescape character
934 3 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 15 3 18
935 15 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 15 15
936  
937 # open character class [...]
938 15 ▶ if ($char[$i] eq '[') {
Branch: 4 branches
BranchTrueFalseTotal
if ($char[$i] eq '[') { } 0 15 15
elsif ($char[$i] eq '[^') { } 0 15 15
elsif (my $char = classic_character_class($char[$i])) { } 0 15 15
elsif ($char[$i] =~ /\A [\x00-\xFF] \z/mosx) { } 15 0 15
939 0 my $left = $i;
940  
941 # [] make die "unmatched [] in regexp ...\n"
942  
943 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
944 0 $i++;
945 }
946  
947 0 while (1) {
948 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
949 0 croak "Unmatched [] in regexp";
950 }
951 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
952 0 my $right = $i;
953 0 my @charlist = charlist_qr(@char[$left+1..$right-1], 'i');
954  
955 # escape character
956 0 for my $char (@charlist) {
957 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
958 }
959  
960 0 elsif ($char =~ /\A [.|)] \z/oxms) {
961 0 $char = '\\' . $char;
962 }
963 }
964  
965 # [...]
966 0 splice @char, $left, $right-$left+1, '(?:' . join('|', @charlist) . ')';
967  
968 0 $i = $left;
969 0 last;
970 }
971 }
972 }
973  
974 # open character class [^...]
975 elsif ($char[$i] eq '[^') {
976 0 my $left = $i;
977  
978 # [^] make die "unmatched [] in regexp ...\n"
979  
980 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
981 0 $i++;
982 }
983  
984 0 while (1) {
985 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
986 0 croak "Unmatched [] in regexp";
987 }
988 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
989 0 my $right = $i;
990 0 my @charlist = charlist_not_qr(@char[$left+1..$right-1], 'i');
991  
992 # escape character
993 0 for my $char (@charlist) {
994 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
995 }
996  
997 0 elsif ($char =~ /\A [.|)] \z/oxms) {
998 0 $char = '\\' . $char;
999 }
1000 }
1001  
1002 # [^...]
1003 0 splice @char, $left, $right-$left+1, '(?!' . join('|', @charlist) . ")(?:$your_char)";
1004  
1005 0 $i = $left;
1006 0 last;
1007 }
1008 }
1009 }
1010  
1011 # rewrite classic character class or escape character
1012 elsif (my $char = classic_character_class($char[$i])) {
1013 0 $char[$i] = $char;
1014 }
1015  
1016 # with /i modifier
1017 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1018 15 my $uc = Earabic::uc($char[$i]);
1019 15 my $fc = Earabic::fc($char[$i]);
1020 15 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) 15 0 15
1021 15 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 15 0 15
1022 15 $char[$i] = '[' . $uc . $fc . ']';
1023 }
1024 else {
1025 0 $char[$i] = '(?:' . $uc . '|' . $fc . ')';
1026 }
1027 }
1028 }
1029 }
1030  
1031 # characterize
1032 3 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 15 3 18
1033 15 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 15 15
1034  
1035 15 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx }) 0 18 18
1036 }
1037  
1038 # quote character before ? + * {
1039 0 ▶ elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) {
Condition66%2/3
$i >= 1 && $char[$i] =~ /\A [\?\+\*\{] \z/mosx
!ll&&!rl&&r
3120
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
1040 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
1041 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
1042 }
1043 }
1044 }
1045  
1046 3 $string = join '', @char;
1047 }
1048  
1049 # make regexp string
1050 3 return @string;
1051 }
1052  
1053 #
1054 # classic character class ( \D \S \W \d \s \w \C \X \H \V \h \v \R \N \b \B )
1055 #
1056 1843 ▶sub Earabic::classic_character_class {
Subroutine classic_character_class: called CC=2 SCAR=6.9
Pod undocumented
1057 1843 my($char) = @_;
1058  
1059 return {
1060 '\D' => '${Earabic::eD}',
1061 '\S' => '${Earabic::eS}',
1062 '\W' => '${Earabic::eW}',
1063 '\d' => '[0-9]',
1064  
1065 # Before Perl 5.6, \s only matched the five whitespace characters
1066 # tab, newline, form-feed, carriage return, and the space character
1067 # itself, which, taken together, is the character class [\t\n\f\r ].
1068  
1069 # Vertical tabs are now whitespace
1070 # \s in a regex now matches a vertical tab in all circumstances.
1071 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1072 # \t \n \v \f \r space
1073 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1074 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1075 '\s' => '\s',
1076  
1077 '\w' => '[0-9A-Z_a-z]',
1078 '\C' => '[\x00-\xFF]',
1079 '\X' => 'X',
1080  
1081 # \h \v \H \V
1082  
1083 # P.114 Character Class Shortcuts
1084 # in Chapter 7: In the World of Regular Expressions
1085 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
1086  
1087 # P.357 13.2.3 Whitespace
1088 # in Chapter 13: perlrecharclass: Perl Regular Expression Character Classes
1089 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1090 #
1091 # 0x00009 CHARACTER TABULATION h s
1092 # 0x0000a LINE FEED (LF) vs
1093 # 0x0000b LINE TABULATION v
1094 # 0x0000c FORM FEED (FF) vs
1095 # 0x0000d CARRIAGE RETURN (CR) vs
1096 # 0x00020 SPACE h s
1097  
1098 # P.196 Table 5-9. Alphanumeric regex metasymbols
1099 # in Chapter 5. Pattern Matching
1100 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1101  
1102 # (and so on)
1103  
1104 '\H' => '${Earabic::eH}',
1105 '\V' => '${Earabic::eV}',
1106 '\h' => '[\x09\x20]',
1107 '\v' => '[\x0A\x0B\x0C\x0D]',
1108 '\R' => '${Earabic::eR}',
1109  
1110 # \N
1111 #
1112 # http://perldoc.perl.org/perlre.html
1113 # Character Classes and other Special Escapes
1114 # Any character but \n (experimental). Not affected by /s modifier
1115  
1116 '\N' => '${Earabic::eN}',
1117  
1118 # \b \B
1119  
1120 # P.180 Boundaries: The \b and \B Assertions
1121 # in Chapter 5: Pattern Matching
1122 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1123  
1124 # P.219 Boundaries: The \b and \B Assertions
1125 # in Chapter 5: Pattern Matching
1126 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1127  
1128 # \b really means (?:(?<=\w)(?!\w)|(?<!\w)(?=\w))
1129 # or (?:(?<=\A|\W)(?=\w)|(?<=\w)(?=\W|\z))
1130 '\b' => '${Earabic::eb}',
1131  
1132 # \B really means (?:(?<=\w)(?=\w)|(?<!\w)(?!\w))
1133 # or (?:(?<=\w)(?=\w)|(?<=\W)(?=\W))
1134 '\B' => '${Earabic::eB}',
1135  
1136 1843 ▶ }->{$char} || '';
Condition100%2/2
{'\\D', '${Earabic::eD}', '\\S', '${Earabic::eS}', '\\W', '${Earabic::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Earabic::eH}', '\\V', '${Earabic::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Earabic::eR}', '\\N', '${Earabic::eN}', '\\b', '${Earabic::eb}', '\\B', '${Earabic::eB}'}->{$char} || ''
l!l
1011742
MC/DC100%1/1
{'\\D', '${Earabic::eD}', '\\S', '${Earabic::eS}', '\\W', '${Earabic::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Earabic::eH}', '\\V', '${Earabic::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Earabic::eR}', '\\N', '${Earabic::eN}', '\\b', '${Earabic::eb}', '\\B', '${Earabic::eB}'}->{$char} || ''
{'\\D', '${Earabic::eD}', '\\S', '${Earabic::eS}', '\\W', '${Earabic::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Earabic::eH}', '\\V', '${Earabic::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Earabic::eR}', '\\N', '${Earabic::eN}', '\\b', '${Earabic::eb}', '\\B', '${Earabic::eB}'}->{$char}
Truth table100%2/2
A
A= {'\\D', '${Earabic::eD}', '\\S', '${Earabic::eS}', '\\W', '${Earabic::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Earabic::eH}', '\\V', '${Earabic::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Earabic::eR}', '\\N', '${Earabic::eN}', '\\b', '${Earabic::eb}', '\\B', '${Earabic::eB}'}->{$char}
Aresult
11
00
1137 }
1138  
1139 #
1140 # prepare Arabic characters per length
1141 #
1142  
1143 # 1 octet characters
1144 424 my @chars1 = ();
1145 0 ▶sub chars1 {
Subroutine chars1: not called CC=5 SCAR=34.0
Pod undocumented
1146 0 ▶ if (@chars1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars1) 0 0 0
1147 0 return @chars1;
1148 }
1149 0 ▶ if (exists $range_tr{1}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{1}) 0 0 0
1150 0 my @ranges = @{ $range_tr{1} };
1151 0 ▶ while (my @range = splice(@ranges,0,1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 1)) 0 0 0
1152 0 for my $oct0 (@{$range[0]}) {
1153 0 push @chars1, pack 'C', $oct0;
1154 }
1155 }
1156 }
1157 0 return @chars1;
1158 }
1159  
1160 # 2 octets characters
1161 424 my @chars2 = ();
1162 0 ▶sub chars2 {
Subroutine chars2: not called CC=6 SCAR=37.4
Pod undocumented
1163 0 ▶ if (@chars2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars2) 0 0 0
1164 0 return @chars2;
1165 }
1166 0 ▶ if (exists $range_tr{2}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{2}) 0 0 0
1167 0 my @ranges = @{ $range_tr{2} };
1168 0 ▶ while (my @range = splice(@ranges,0,2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 2)) 0 0 0
1169 0 for my $oct0 (@{$range[0]}) {
1170 0 for my $oct1 (@{$range[1]}) {
1171 0 push @chars2, pack 'CC', $oct0,$oct1;
1172 }
1173 }
1174 }
1175 }
1176 0 return @chars2;
1177 }
1178  
1179 # 3 octets characters
1180 424 my @chars3 = ();
1181 0 ▶sub chars3 {
Subroutine chars3: not called CC=7 SCAR=40.3
Pod undocumented
1182 0 ▶ if (@chars3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars3) 0 0 0
1183 0 return @chars3;
1184 }
1185 0 ▶ if (exists $range_tr{3}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{3}) 0 0 0
1186 0 my @ranges = @{ $range_tr{3} };
1187 0 ▶ while (my @range = splice(@ranges,0,3)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 3)) 0 0 0
1188 0 for my $oct0 (@{$range[0]}) {
1189 0 for my $oct1 (@{$range[1]}) {
1190 0 for my $oct2 (@{$range[2]}) {
1191 0 push @chars3, pack 'CCC', $oct0,$oct1,$oct2;
1192 }
1193 }
1194 }
1195 }
1196 }
1197 0 return @chars3;
1198 }
1199  
1200 # 4 octets characters
1201 424 my @chars4 = ();
1202 0 ▶sub chars4 {
Subroutine chars4: not called CC=8 SCAR=42.8
Pod undocumented
1203 0 ▶ if (@chars4) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars4) 0 0 0
1204 0 return @chars4;
1205 }
1206 0 ▶ if (exists $range_tr{4}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{4}) 0 0 0
1207 0 my @ranges = @{ $range_tr{4} };
1208 0 ▶ while (my @range = splice(@ranges,0,4)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 4)) 0 0 0
1209 0 for my $oct0 (@{$range[0]}) {
1210 0 for my $oct1 (@{$range[1]}) {
1211 0 for my $oct2 (@{$range[2]}) {
1212 0 for my $oct3 (@{$range[3]}) {
1213 0 push @chars4, pack 'CCCC', $oct0,$oct1,$oct2,$oct3;
1214 }
1215 }
1216 }
1217 }
1218 }
1219 }
1220 0 return @chars4;
1221 }
1222  
1223 #
1224 # Arabic open character list for tr
1225 #
1226 12 ▶sub _charlist_tr {
Subroutine _charlist_tr: called CC=35 SCAR=66.4
1227  
1228 12 local $_ = shift @_;
1229  
1230 # unescape character
1231 12 my @char = ();
1232 12 ▶ while (not /\G \z/oxmsgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgmosx) 38 12 50
1233 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 \\ ($Earabic::q_char) /cgmosx) { } 0 38 38
elsif (/\G ($Earabic::q_char) /cgmosx) { } 38 0 38
1234 0 push @char, '\-';
1235 }
1236 elsif (/\G \\ ([0-7]{2,3}) /oxmsgc) {
1237 0 push @char, CORE::chr(oct $1);
1238 }
1239 elsif (/\G \\x ([0-9A-Fa-f]{1,2}) /oxmsgc) {
1240 0 push @char, CORE::chr(hex $1);
1241 }
1242 elsif (/\G \\c ([\x40-\x5F]) /oxmsgc) {
1243 0 push @char, CORE::chr(CORE::ord($1) & 0x1F);
1244 }
1245 elsif (/\G (\\ [0nrtfbae]) /oxmsgc) {
1246 push @char, {
1247 '\0' => "\0",
1248 '\n' => "\n",
1249 '\r' => "\r",
1250 '\t' => "\t",
1251 '\f' => "\f",
1252 '\b' => "\x08", # \b means backspace in character class
1253 '\a' => "\a",
1254 '\e' => "\e",
1255 0 }->{$1};
1256 }
1257 elsif (/\G \\ ($q_char) /oxmsgc) {
1258 0 push @char, $1;
1259 }
1260 elsif (/\G ($q_char) /oxmsgc) {
1261 38 push @char, $1;
1262 }
1263 }
1264  
1265 # join separated multiple-octet
1266 12 @char = join('',@char) =~ /\G (?>\\-|$q_char) /oxmsg;
1267  
1268 # unescape '-'
1269 12 my @i = ();
1270 12 for my $i (0 .. $#char) {
1271 38 ▶ if ($char[$i] eq '\-') {
Branch: 2 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\-') { } 0 38 38
elsif ($char[$i] eq '-') { } 0 38 38
1272 0 $char[$i] = '-';
1273 }
1274 elsif ($char[$i] eq '-') {
1275 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
1276 0 push @i, $i;
1277 }
1278 }
1279 }
1280  
1281 # open character list (reverse for splice)
1282 12 for my $i (CORE::reverse @i) {
1283 0 my @range = ();
1284  
1285 # range error
1286 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
1287 0 croak "Invalid tr/// range \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1288 }
1289  
1290 # range of multiple-octet code
1291 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
1292 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
1293 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
1294 }
1295 elsif (CORE::length($char[$i+1]) == 2) {
1296 0 push @range, grep {$char[$i-1] le $_} chars1();
1297 0 push @range, grep {$_ le $char[$i+1]} chars2();
1298 }
1299 elsif (CORE::length($char[$i+1]) == 3) {
1300 0 push @range, grep {$char[$i-1] le $_} chars1();
1301 0 push @range, chars2();
1302 0 push @range, grep {$_ le $char[$i+1]} chars3();
1303 }
1304 elsif (CORE::length($char[$i+1]) == 4) {
1305 0 push @range, grep {$char[$i-1] le $_} chars1();
1306 0 push @range, chars2();
1307 0 push @range, chars3();
1308 0 push @range, grep {$_ le $char[$i+1]} chars4();
1309 }
1310 else {
1311 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1312 }
1313 }
1314 elsif (CORE::length($char[$i-1]) == 2) {
1315 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
1316 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
1317 }
1318 elsif (CORE::length($char[$i+1]) == 3) {
1319 0 push @range, grep {$char[$i-1] le $_} chars2();
1320 0 push @range, grep {$_ le $char[$i+1]} chars3();
1321 }
1322 elsif (CORE::length($char[$i+1]) == 4) {
1323 0 push @range, grep {$char[$i-1] le $_} chars2();
1324 0 push @range, chars3();
1325 0 push @range, grep {$_ le $char[$i+1]} chars4();
1326 }
1327 else {
1328 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1329 }
1330 }
1331 elsif (CORE::length($char[$i-1]) == 3) {
1332 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
1333 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
1334 }
1335 elsif (CORE::length($char[$i+1]) == 4) {
1336 0 push @range, grep {$char[$i-1] le $_} chars3();
1337 0 push @range, grep {$_ le $char[$i+1]} chars4();
1338 }
1339 else {
1340 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1341 }
1342 }
1343 elsif (CORE::length($char[$i-1]) == 4) {
1344 0 ▶ if (CORE::length($char[$i+1]) == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $char[$i + 1] == 4) { } 0 0 0
1345 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
1346 }
1347 else {
1348 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1349 }
1350 }
1351 else {
1352 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1353 }
1354  
1355 0 splice @char, $i-1, 3, @range;
1356 }
1357  
1358 12 return @char;
1359 }
1360  
1361 #
1362 # Arabic open character class
1363 #
1364 0 ▶sub _cc {
Subroutine _cc: not called CC=7 SCAR=40.3
1365 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
1366 0 die __FILE__, ": subroutine cc got no parameter.\n";
1367 }
1368 elsif (scalar(@_) == 1) {
1369 0 return sprintf('\x%02X',$_[0]);
1370 }
1371 elsif (scalar(@_) == 2) {
1372 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
1373 0 die __FILE__, ": subroutine cc got \$_[0] > \$_[1] parameters).\n";
1374 }
1375 elsif ($_[0] == $_[1]) {
1376 0 return sprintf('\x%02X',$_[0]);
1377 }
1378 elsif (($_[0]+1) == $_[1]) {
1379 0 return sprintf('[\\x%02X\\x%02X]',$_[0],$_[1]);
1380 }
1381 else {
1382 0 return sprintf('[\\x%02X-\\x%02X]',$_[0],$_[1]);
1383 }
1384 }
1385 else {
1386 0 die __FILE__, ": subroutine cc got 3 or more parameters (@{[scalar(@_)]} parameters).\n";
1387 }
1388 }
1389  
1390 #
1391 # Arabic octet range
1392 #
1393 246 ▶sub _octets {
Subroutine _octets: called CC=5 SCAR=19.3
1394 246 my $length = shift @_;
1395  
1396 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1397 246 my($a1) = unpack 'C', $_[0];
1398 246 my($z1) = unpack 'C', $_[1];
1399  
1400 246 ▶ if ($a1 > $z1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($a1 > $z1) 0 246 246
1401 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$a1) . '-\x' . unpack('H*',$z1);
1402 }
1403  
1404 246 ▶ if ($a1 == $z1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($a1 == $z1) { } 0 246 246
elsif ($a1 + 1 == $z1) { } 0 246 246
1405 0 return sprintf('\x%02X',$a1);
1406 }
1407 elsif (($a1+1) == $z1) {
1408 0 return sprintf('\x%02X\x%02X',$a1,$z1);
1409 }
1410 else {
1411 246 return sprintf('\x%02X-\x%02X',$a1,$z1);
1412 }
1413 }
1414 else {
1415 0 die __FILE__, ": subroutine _octets got invalid length ($length).\n";
1416 }
1417 }
1418  
1419 #
1420 # Arabic range regexp
1421 #
1422 246 ▶sub _range_regexp {
Subroutine _range_regexp: called CC=18 SCAR=41.7
1423 246 my($length,$first,$last) = @_;
1424  
1425 246 my @range_regexp = ();
1426 246 ▶ if (not exists $range_tr{$length}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $range_tr{$length}) 0 246 246
1427 0 return @range_regexp;
1428 }
1429  
1430 246 my @ranges = @{ $range_tr{$length} };
1431 246 ▶ while (my @range = splice(@ranges,0,$length)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, $length)) 246 246 492
1432 246 my $min = '';
1433 246 my $max = '';
1434 246 ▶ for (my $i=0; $i < $length; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $length) 246 246 492
1435 246 $min .= pack 'C', $range[$i][0];
1436 246 $max .= pack 'C', $range[$i][-1];
1437 }
1438  
1439 # min___max
1440 # FIRST_____________LAST
1441 # (nothing)
1442  
1443 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
1444 }
1445  
1446 # **********
1447 # min_________max
1448 # FIRST_____________LAST
1449 # **********
1450  
1451 ▶ 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
1452 0 push @range_regexp, _octets($length,$first,$max,$min,$max);
1453 }
1454  
1455 # **********************
1456 # min________________max
1457 # FIRST_____________LAST
1458 # **********************
1459  
1460 ▶ 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
1461 0 push @range_regexp, _octets($length,$first,$last,$min,$max);
1462 }
1463  
1464 # *********
1465 # min___max
1466 # FIRST_____________LAST
1467 # *********
1468  
1469 ▶ 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
1470 0 push @range_regexp, _octets($length,$min,$max,$min,$max);
1471 }
1472  
1473 # **********************
1474 # min__________________________max
1475 # FIRST_____________LAST
1476 # **********************
1477  
1478 ▶ 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
1479 246 push @range_regexp, _octets($length,$first,$last,$min,$max);
1480 }
1481  
1482 # *********
1483 # min________max
1484 # FIRST_____________LAST
1485 # *********
1486  
1487 ▶ 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
1488 0 push @range_regexp, _octets($length,$min,$last,$min,$max);
1489 }
1490  
1491 # min___max
1492 # FIRST_____________LAST
1493 # (nothing)
1494  
1495 elsif ($last lt $min) {
1496 }
1497  
1498 else {
1499 0 die __FILE__, ": subroutine _range_regexp panic.\n";
1500 }
1501 }
1502  
1503 246 return @range_regexp;
1504 }
1505  
1506 #
1507 # Arabic open character list for qr and not qr
1508 #
1509 410 ▶sub _charlist {
Subroutine _charlist: called CC=46 SCAR=49.4
1510  
1511 410 my $modifier = pop @_;
1512 410 my @char = @_;
1513  
1514 410 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 58 352 410
1515  
1516 # unescape character
1517 410 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1293 410 1703
1518  
1519 # escape - to ...
1520 1293 ▶ if ($char[$i] eq '-') {
Branch: 12 branches
BranchTrueFalseTotal
if ($char[$i] eq '-') { } 270 1023 1293
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 0 1023 1023
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 0 1023 1023
elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 1023 1023
elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/mosx) { } 0 1023 1023
elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/mosx) { } 0 1023 1023
elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/mosx) { } 22 1001 1023
elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/mosx) { } 0 1001 1001
elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/mosx) { } 25 976 1001
elsif ($ignorecase and $char[$i] =~ /\A ( \[\: \^? (?:lower|upper) :\] ) \z/mosx) { } 8 968 976
elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/mosx) { } 70 898 968
elsif ($char[$i] =~ /\A \\ ($Earabic::q_char) \z/mosx) { } 7 891 898
1521 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
1522 246 $char[$i] = '...';
1523 }
1524 }
1525  
1526 # octal escape sequence
1527 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
1528 0 $char[$i] = octchr($1);
1529 }
1530  
1531 # hexadecimal escape sequence
1532 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
1533 0 $char[$i] = hexchr($1);
1534 }
1535  
1536 # \b{...} --> b\{...}
1537 # \B{...} --> B\{...}
1538 # \N{CHARNAME} --> N\{CHARNAME}
1539 # \p{PROPERTY} --> p\{PROPERTY}
1540 # \P{PROPERTY} --> P\{PROPERTY}
1541 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
1542 0 $char[$i] = $1 . '\\' . $2;
1543 }
1544  
1545 # \p, \P, \X --> p, P, X
1546 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
1547 0 $char[$i] = $1;
1548 }
1549  
1550 elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/oxms) {
1551 0 $char[$i] = CORE::chr oct $1;
1552 }
1553 elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/oxms) {
1554 22 $char[$i] = CORE::chr hex $1;
1555 }
1556 elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/oxms) {
1557 0 $char[$i] = CORE::chr(CORE::ord($1) & 0x1F);
1558 }
1559 elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/oxms) {
1560 $char[$i] = {
1561 '\0' => "\0",
1562 '\n' => "\n",
1563 '\r' => "\r",
1564 '\t' => "\t",
1565 '\f' => "\f",
1566 '\b' => "\x08", # \b means backspace in character class
1567 '\a' => "\a",
1568 '\e' => "\e",
1569 '\d' => '[0-9]',
1570  
1571 # Vertical tabs are now whitespace
1572 # \s in a regex now matches a vertical tab in all circumstances.
1573 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1574 # \t \n \v \f \r space
1575 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1576 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1577 '\s' => '\s',
1578  
1579 '\w' => '[0-9A-Z_a-z]',
1580 '\D' => '${Earabic::eD}',
1581 '\S' => '${Earabic::eS}',
1582 '\W' => '${Earabic::eW}',
1583  
1584 '\H' => '${Earabic::eH}',
1585 '\V' => '${Earabic::eV}',
1586 '\h' => '[\x09\x20]',
1587 '\v' => '[\x0A\x0B\x0C\x0D]',
1588 '\R' => '${Earabic::eR}',
1589  
1590 25 }->{$1};
1591 }
1592  
1593 # POSIX-style character classes
1594 ▶ 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
878908
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
1595 $char[$i] = {
1596  
1597 '[:lower:]' => '[\x41-\x5A\x61-\x7A]',
1598 '[:upper:]' => '[\x41-\x5A\x61-\x7A]',
1599 '[:^lower:]' => '${Earabic::not_lower_i}',
1600 '[:^upper:]' => '${Earabic::not_upper_i}',
1601  
1602 8 }->{$1};
1603 }
1604 elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/oxms) {
1605 $char[$i] = {
1606  
1607 '[:alnum:]' => '[\x30-\x39\x41-\x5A\x61-\x7A]',
1608 '[:alpha:]' => '[\x41-\x5A\x61-\x7A]',
1609 '[:ascii:]' => '[\x00-\x7F]',
1610 '[:blank:]' => '[\x09\x20]',
1611 '[:cntrl:]' => '[\x00-\x1F\x7F]',
1612 '[:digit:]' => '[\x30-\x39]',
1613 '[:graph:]' => '[\x21-\x7F]',
1614 '[:lower:]' => '[\x61-\x7A]',
1615 '[:print:]' => '[\x20-\x7F]',
1616 '[:punct:]' => '[\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E]',
1617  
1618 # P.174 POSIX-Style Character Classes
1619 # in Chapter 5: Pattern Matching
1620 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1621  
1622 # P.311 11.2.4 Character Classes and other Special Escapes
1623 # in Chapter 11: perlre: Perl regular expressions
1624 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1625  
1626 # P.210 POSIX-Style Character Classes
1627 # in Chapter 5: Pattern Matching
1628 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1629  
1630 '[:space:]' => '[\s\x0B]', # "\s" plus vertical tab ("\cK")
1631  
1632 '[:upper:]' => '[\x41-\x5A]',
1633 '[:word:]' => '[\x30-\x39\x41-\x5A\x5F\x61-\x7A]',
1634 '[:xdigit:]' => '[\x30-\x39\x41-\x46\x61-\x66]',
1635 '[:^alnum:]' => '${Earabic::not_alnum}',
1636 '[:^alpha:]' => '${Earabic::not_alpha}',
1637 '[:^ascii:]' => '${Earabic::not_ascii}',
1638 '[:^blank:]' => '${Earabic::not_blank}',
1639 '[:^cntrl:]' => '${Earabic::not_cntrl}',
1640 '[:^digit:]' => '${Earabic::not_digit}',
1641 '[:^graph:]' => '${Earabic::not_graph}',
1642 '[:^lower:]' => '${Earabic::not_lower}',
1643 '[:^print:]' => '${Earabic::not_print}',
1644 '[:^punct:]' => '${Earabic::not_punct}',
1645 '[:^space:]' => '${Earabic::not_space}',
1646 '[:^upper:]' => '${Earabic::not_upper}',
1647 '[:^word:]' => '${Earabic::not_word}',
1648 '[:^xdigit:]' => '${Earabic::not_xdigit}',
1649  
1650 70 }->{$1};
1651 }
1652 elsif ($char[$i] =~ /\A \\ ($q_char) \z/oxms) {
1653 7 $char[$i] = $1;
1654 }
1655 }
1656  
1657 # open character list
1658 410 my @singleoctet = ();
1659 410 my @multipleoctet = ();
1660 410 ▶ for (my $i=0; $i <= $#char; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1047 410 1457
1661  
1662 # escaped -
1663 1047 ▶ 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 801 1047
elsif ($char[$i] eq '...') { } 246 555 801
elsif ($char[$i] =~ /\A [\x00-\xFF] \z/mosx) { } 469 86 555
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
166635246
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
1664 246 $i += 1;
1665 246 next;
1666 }
1667  
1668 # make range regexp
1669 elsif ($char[$i] eq '...') {
1670  
1671 # range error
1672 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
1673 0 croak 'Invalid [] range in regexp (length(A) > length(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1674 }
1675 elsif (CORE::length($char[$i-1]) == CORE::length($char[$i+1])) {
1676 246 ▶ if ($char[$i-1] gt $char[$i+1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] gt $char[$i + 1]) 0 246 246
1677 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1678 }
1679 }
1680  
1681 # make range regexp per length
1682 246 for my $length (CORE::length($char[$i-1]) .. CORE::length($char[$i+1])) {
1683 246 my @regexp = ();
1684  
1685 # is first and last
1686 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
1687 246 push @regexp, _range_regexp($length, $char[$i-1], $char[$i+1]);
1688 }
1689  
1690 # is first
1691 elsif ($length == CORE::length($char[$i-1])) {
1692 0 push @regexp, _range_regexp($length, $char[$i-1], "\xFF" x $length);
1693 }
1694  
1695 # is inside in first and last
1696 ▶ 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
1697 0 push @regexp, _range_regexp($length, "\x00" x $length, "\xFF" x $length);
1698 }
1699  
1700 # is last
1701 elsif ($length == CORE::length($char[$i+1])) {
1702 0 push @regexp, _range_regexp($length, "\x00" x $length, $char[$i+1]);
1703 }
1704  
1705 else {
1706 0 die __FILE__, ": subroutine make_regexp panic.\n";
1707 }
1708  
1709 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1710 246 push @singleoctet, @regexp;
1711 }
1712 else {
1713 0 push @multipleoctet, @regexp;
1714 }
1715 }
1716  
1717 246 $i += 2;
1718 }
1719  
1720 # with /i modifier
1721 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1722 469 ▶ if ($modifier =~ /i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) { } 0 469 469
1723 0 my $uc = Earabic::uc($char[$i]);
1724 0 my $fc = Earabic::fc($char[$i]);
1725 0 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) { } 0 0 0
1726 0 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 0 0 0
1727 0 push @singleoctet, $uc, $fc;
1728 }
1729 else {
1730 0 push @singleoctet, $uc;
1731 0 push @multipleoctet, $fc;
1732 }
1733 }
1734 else {
1735 0 push @singleoctet, $char[$i];
1736 }
1737 }
1738 else {
1739 469 push @singleoctet, $char[$i];
1740 }
1741 469 $i += 1;
1742 }
1743  
1744 # single character of single octet code
1745 elsif ($char[$i] =~ /\A (?: \\h ) \z/oxms) {
1746 0 push @singleoctet, "\t", "\x20";
1747 0 $i += 1;
1748 }
1749 elsif ($char[$i] =~ /\A (?: \\v ) \z/oxms) {
1750 0 push @singleoctet, "\x0A", "\x0B", "\x0C", "\x0D";
1751 0 $i += 1;
1752 }
1753 elsif ($char[$i] =~ /\A (?: \\d | \\s | \\w ) \z/oxms) {
1754 2 push @singleoctet, $char[$i];
1755 2 $i += 1;
1756 }
1757  
1758 # single character of multiple-octet code
1759 else {
1760 84 push @multipleoctet, $char[$i];
1761 84 $i += 1;
1762 }
1763 }
1764  
1765 # quote metachar
1766 410 for (@singleoctet) {
1767 717 ▶ if ($_ eq '...') {
Branch: 5 branches
BranchTrueFalseTotal
if ($_ eq '...') { } 0 717 717
elsif (/\A \n \z/mosx) { } 8 709 717
elsif (/\A \r \z/mosx) { } 8 701 709
elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/mosx) { } 24 677 701
elsif (/\A [\x00-\xFF] \z/mosx) { } 429 248 677
1768 0 $_ = '-';
1769 }
1770 elsif (/\A \n \z/oxms) {
1771 8 $_ = '\n';
1772 }
1773 elsif (/\A \r \z/oxms) {
1774 8 $_ = '\r';
1775 }
1776 elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/oxms) {
1777 24 $_ = sprintf('\x%02X', CORE::ord $1);
1778 }
1779 elsif (/\A [\x00-\xFF] \z/oxms) {
1780 429 $_ = quotemeta $_;
1781 }
1782 }
1783  
1784 # return character list
1785 410 return \@singleoctet, \@multipleoctet;
1786 }
1787  
1788 #
1789 # Arabic octal escape sequence
1790 #
1791 5 ▶sub octchr {
Subroutine octchr: called CC=2 SCAR=6.9
Pod undocumented
1792 5 my($octdigit) = @_;
1793  
1794 5 my @binary = ();
1795 5 for my $octal (split(//,$octdigit)) {
1796 push @binary, {
1797 '0' => '000',
1798 '1' => '001',
1799 '2' => '010',
1800 '3' => '011',
1801 '4' => '100',
1802 '5' => '101',
1803 '6' => '110',
1804 '7' => '111',
1805 50 }->{$octal};
1806 }
1807 5 my $binary = join '', @binary;
1808  
1809 my $octchr = {
1810 # 1234567
1811 1 => pack('B*', "0000000$binary"),
1812 2 => pack('B*', "000000$binary"),
1813 3 => pack('B*', "00000$binary"),
1814 4 => pack('B*', "0000$binary"),
1815 5 => pack('B*', "000$binary"),
1816 6 => pack('B*', "00$binary"),
1817 7 => pack('B*', "0$binary"),
1818 0 => pack('B*', "$binary"),
1819  
1820 5 }->{CORE::length($binary) % 8};
1821  
1822 5 return $octchr;
1823 }
1824  
1825 #
1826 # Arabic hexadecimal escape sequence
1827 #
1828 5 ▶sub hexchr {
Subroutine hexchr: called CC=1 SCAR=0.0
Pod undocumented
1829 5 my($hexdigit) = @_;
1830  
1831 my $hexchr = {
1832 1 => pack('H*', "0$hexdigit"),
1833 0 => pack('H*', "$hexdigit"),
1834  
1835 5 }->{CORE::length($_[0]) % 2};
1836  
1837 5 return $hexchr;
1838 }
1839  
1840 #
1841 # Arabic open character list for qr
1842 #
1843 336 ▶sub charlist_qr {
Subroutine charlist_qr: called CC=17 SCAR=29.9
Pod undocumented
1844  
1845 336 my $modifier = pop @_;
1846 336 my @char = @_;
1847  
1848 336 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
1849 336 my @singleoctet = @$singleoctet;
1850 336 my @multipleoctet = @$multipleoctet;
1851  
1852 # return character list
1853 336 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) 258 78 336
1854  
1855 # with /i modifier
1856 258 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 25 233 258
1857 25 my %singleoctet_ignorecase = ();
1858 25 for (@singleoctet) {
1859 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
1860 25 for my $ord (hex($1) .. hex($2)) {
1861 75 my $char = CORE::chr($ord);
1862 75 my $uc = Earabic::uc($char);
1863 75 my $fc = Earabic::fc($char);
1864 75 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 0 75 75
1865 0 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
1866 }
1867 else {
1868 75 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 75 0 75
1869 75 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1870 75 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
1871 }
1872 else {
1873 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1874 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
1875 }
1876 }
1877 }
1878 }
1879 25 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 25 25
1880 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
1881 }
1882 }
1883 25 my $i = 0;
1884 25 my @singleoctet_ignorecase = ();
1885 25 for my $ord (0 .. 255) {
1886 6400 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 150 6250 6400
1887 150 push @{$singleoctet_ignorecase[$i]}, $ord;
1888 }
1889 else {
1890 6250 $i++;
1891 }
1892 }
1893 25 @singleoctet = ();
1894 25 for my $range (@singleoctet_ignorecase) {
1895 2400 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 50 2350 2400
1896 50 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 0 50 50
elsif (scalar @{$range;} == 2) { } 0 50 50
1897 0 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
1898 }
1899 50 elsif (scalar(@{$range}) == 2) {
1900 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
1901 }
1902 else {
1903 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
1904 }
1905 }
1906 }
1907 }
1908  
1909 258 my $not_anchor = '';
1910  
1911 258 push @multipleoctet, join('', $not_anchor, '[', @singleoctet, ']' );
1912 }
1913 336 ▶ if (scalar(@multipleoctet) >= 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 2) { } 6 330 336
1914 6 return '(?:' . join('|', @multipleoctet) . ')';
1915 }
1916 else {
1917 330 return $multipleoctet[0];
1918 }
1919 }
1920  
1921 #
1922 # Arabic open character list for not qr
1923 #
1924 74 ▶sub charlist_not_qr {
Subroutine charlist_not_qr: called CC=18 SCAR=33.1
Pod undocumented
1925  
1926 74 my $modifier = pop @_;
1927 74 my @char = @_;
1928  
1929 74 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
1930 74 my @singleoctet = @$singleoctet;
1931 74 my @multipleoctet = @$multipleoctet;
1932  
1933 # with /i modifier
1934 74 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 25 49 74
1935 25 my %singleoctet_ignorecase = ();
1936 25 for (@singleoctet) {
1937 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
1938 25 for my $ord (hex($1) .. hex($2)) {
1939 75 my $char = CORE::chr($ord);
1940 75 my $uc = Earabic::uc($char);
1941 75 my $fc = Earabic::fc($char);
1942 75 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 0 75 75
1943 0 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
1944 }
1945 else {
1946 75 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 75 0 75
1947 75 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1948 75 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
1949 }
1950 else {
1951 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1952 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
1953 }
1954 }
1955 }
1956 }
1957 25 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 25 25
1958 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
1959 }
1960 }
1961 25 my $i = 0;
1962 25 my @singleoctet_ignorecase = ();
1963 25 for my $ord (0 .. 255) {
1964 6400 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 150 6250 6400
1965 150 push @{$singleoctet_ignorecase[$i]}, $ord;
1966 }
1967 else {
1968 6250 $i++;
1969 }
1970 }
1971 25 @singleoctet = ();
1972 25 for my $range (@singleoctet_ignorecase) {
1973 2400 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 50 2350 2400
1974 50 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 0 50 50
elsif (scalar @{$range;} == 2) { } 0 50 50
1975 0 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
1976 }
1977 50 elsif (scalar(@{$range}) == 2) {
1978 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
1979 }
1980 else {
1981 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
1982 }
1983 }
1984 }
1985 }
1986  
1987 # return character list
1988 74 ▶ if (scalar(@multipleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 1) { } 0 74 74
1989 0 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 0 0 0
1990  
1991 # any character other than multiple-octet and single octet character class
1992 0 return '(?!' . join('|', @multipleoctet) . ')(?:[^' . join('', @singleoctet) . '])';
1993 }
1994 else {
1995  
1996 # any character other than multiple-octet character class
1997 0 return '(?!' . join('|', @multipleoctet) . ")(?:$your_char)";
1998 }
1999 }
2000 else {
2001 74 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 74 0 74
2002  
2003 # any character other than single octet character class
2004 74 return '(?:[^' . join('', @singleoctet) . '])';
2005 }
2006 else {
2007  
2008 # any character
2009 0 return "(?:$your_char)";
2010 }
2011 }
2012 }
2013  
2014 #
2015 # open file in read mode
2016 #
2017 424 ▶sub _open_r {
Subroutine _open_r: called CC=1 SCAR=0.0
2018 424 my(undef,$file) = @_;
2019 424 ▶ use Fcntl qw(O_RDONLY);
Subroutine BEGIN: called CC=1 SCAR=0.0
2020 424 return CORE::sysopen($_[0], $file, &O_RDONLY);
2021 }
2022  
2023 #
2024 # open file in append mode
2025 #
2026 212 ▶sub _open_a {
Subroutine _open_a: called CC=1 SCAR=0.0
2027 212 my(undef,$file) = @_;
2028 424 ▶ use Fcntl qw(O_WRONLY O_APPEND O_CREAT);
Subroutine BEGIN: called CC=1 SCAR=0.0
2029 212 return CORE::sysopen($_[0], $file, &O_WRONLY|&O_APPEND|&O_CREAT);
2030 }
2031  
2032 #
2033 # safe system
2034 #
2035 212 ▶sub _systemx {
Subroutine _systemx: called CC=1 SCAR=0.0
2036  
2037 # P.707 29.2.33. exec
2038 # in Chapter 29: Functions
2039 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2040 #
2041 # Be aware that in older releases of Perl, exec (and system) did not flush
2042 # your output buffer, so you needed to enable command buffering by setting $|
2043 # on one or more filehandles to avoid lost output in the case of exec, or
2044 # misordererd output in the case of system. This situation was largely remedied
2045 # in the 5.6 release of Perl. (So, 5.005 release not yet.)
2046  
2047 # P.855 exec
2048 # in Chapter 27: Functions
2049 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2050 #
2051 # In very old release of Perl (before v5.6), exec (and system) did not flush
2052 # your output buffer, so you needed to enable command buffering by setting $|
2053 # on one or more filehandles to avoid lost output with exec or misordered
2054 # output with system.
2055  
2056 212 $| = 1;
2057  
2058 # P.565 23.1.2. Cleaning Up Your Environment
2059 # in Chapter 23: Security
2060 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2061  
2062 # P.656 Cleaning Up Your Environment
2063 # in Chapter 20: Security
2064 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2065  
2066 # local $ENV{'PATH'} = '.';
2067 212 local @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
2068  
2069 # P.707 29.2.33. exec
2070 # in Chapter 29: Functions
2071 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2072 #
2073 # As we mentioned earlier, exec treats a discrete list of arguments as an
2074 # indication that it should bypass shell processing. However, there is one
2075 # place where you might still get tripped up. The exec call (and system, too)
2076 # will not distinguish between a single scalar argument and an array containing
2077 # only one element.
2078 #
2079 # @args = ("echo surprise"); # just one element in list
2080 # exec @args # still subject to shell escapes
2081 # or die "exec: $!"; # because @args == 1
2082 #
2083 # To avoid this, you can use the PATHNAME syntax, explicitly duplicating the
2084 # first argument as the pathname, which forces the rest of the arguments to be
2085 # interpreted as a list, even if there is only one of them:
2086 #
2087 # exec { $args[0] } @args # safe even with one-argument list
2088 # or die "can't exec @args: $!";
2089  
2090 # P.855 exec
2091 # in Chapter 27: Functions
2092 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2093 #
2094 # As we mentioned earlier, exec treats a discrete list of arguments as a
2095 # directive to bypass shell processing. However, there is one place where
2096 # you might still get tripped up. The exec call (and system, too) cannot
2097 # distinguish between a single scalar argument and an array containing
2098 # only one element.
2099 #
2100 # @args = ("echo surprise"); # just one element in list
2101 # exec @args # still subject to shell escapes
2102 # || die "exec: $!"; # because @args == 1
2103 #
2104 # To avoid this, use the PATHNAME syntax, explicitly duplicating the first
2105 # argument as the pathname, which forces the rest of the arguments to be
2106 # interpreted as a list, even if there is only one of them:
2107 #
2108 # exec { $args[0] } @args # safe even with one-argument list
2109 # || die "can't exec @args: $!";
2110  
2111 212 return CORE::system { $_[0] } @_; # safe even with one-argument list
2112 }
2113  
2114 #
2115 # Arabic order to character (with parameter)
2116 #
2117 3469 ▶sub Earabic::chr(;$) {
Subroutine chr: called CC=4 SCAR=13.9
Pod undocumented
2118  
2119 3469 ▶ my $c = @_ ? $_[0] : $_;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 3469 0 3469
2120  
2121 3469 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 24 3445 3469
2122 24 return "\x00";
2123 }
2124 else {
2125 3445 my @chr = ();
2126 3445 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 3445 3445 6890
2127 3445 unshift @chr, ($c % 0x100);
2128 3445 $c = int($c / 0x100);
2129 }
2130 3445 return pack 'C*', @chr;
2131 }
2132 }
2133  
2134 #
2135 # Arabic order to character (without parameter)
2136 #
2137 0 ▶sub Earabic::chr_() {
Subroutine chr_: not called CC=3 SCAR=24.8
Pod undocumented
2138  
2139 0 my $c = $_;
2140  
2141 0 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 0 0 0
2142 0 return "\x00";
2143 }
2144 else {
2145 0 my @chr = ();
2146 0 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 0 0 0
2147 0 unshift @chr, ($c % 0x100);
2148 0 $c = int($c / 0x100);
2149 }
2150 0 return pack 'C*', @chr;
2151 }
2152 }
2153  
2154 #
2155 # Arabic path globbing (with parameter)
2156 #
2157 0 ▶sub Earabic::glob($) {
Subroutine glob: not called CC=3 SCAR=24.8
Pod undocumented
2158  
2159 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2160 0 my @glob = _DOS_like_glob(@_);
2161 0 for my $glob (@glob) {
2162 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2163 }
2164 0 return @glob;
2165 }
2166 else {
2167 0 my $glob = _DOS_like_glob(@_);
2168 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2169 0 return $glob;
2170 }
2171 }
2172  
2173 #
2174 # Arabic path globbing (without parameter)
2175 #
2176 0 ▶sub Earabic::glob_() {
Subroutine glob_: not called CC=3 SCAR=24.8
Pod undocumented
2177  
2178 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2179 0 my @glob = _DOS_like_glob();
2180 0 for my $glob (@glob) {
2181 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2182 }
2183 0 return @glob;
2184 }
2185 else {
2186 0 my $glob = _DOS_like_glob();
2187 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2188 0 return $glob;
2189 }
2190 }
2191  
2192 #
2193 # Arabic path globbing via File::DosGlob 1.10
2194 #
2195 # Often I confuse "_dosglob" and "_doglob".
2196 # So, I renamed "_dosglob" to "_DOS_like_glob".
2197 #
2198 424 my %iter;
2199 my %entries;
2200 0 ▶sub _DOS_like_glob {
Subroutine _DOS_like_glob: not called CC=10 SCAR=47.0
2201  
2202 # context (keyed by second cxix argument provided by core)
2203 0 my($expr,$cxix) = @_;
2204  
2205 # glob without args defaults to $_
2206 0 ▶ $expr = $_ if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2207  
2208 # represents the current user's home directory
2209 #
2210 # 7.3. Expanding Tildes in Filenames
2211 # in Chapter 7. File Access
2212 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2213 #
2214 # and File::HomeDir, File::HomeDir::Windows module
2215  
2216 # DOS-like system
2217 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
2218 0 $expr =~ s{ \A ~ (?= [^/\\] ) }
2219 0 { my_home_MSWin32() }oxmse;
2220 }
2221  
2222 # UNIX-like system
2223 else {
2224 0 $expr =~ s{ \A ~ ( (?:[^/])* ) }
2225 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
2226 }
2227  
2228 # assume global context if not provided one
2229 0 ▶ $cxix = '_G_' if not defined $cxix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cxix 0 0 0
2230 0 ▶ $iter{$cxix} = 0 if not exists $iter{$cxix};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $iter{$cxix} 0 0 0
2231  
2232 # if we're just beginning, do it all first
2233 0 ▶ if ($iter{$cxix} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} == 0) 0 0 0
2234 0 $entries{$cxix} = [ _do_glob(1, _parse_line($expr)) ];
2235 }
2236  
2237 # chuck it all out, quick or slow
2238 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2239 0 delete $iter{$cxix};
2240 0 return @{delete $entries{$cxix}};
2241 }
2242 else {
2243 0 ▶ if ($iter{$cxix} = scalar @{$entries{$cxix}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} = scalar @{$entries{$cxix};}) { } 0 0 0
2244 0 return shift @{$entries{$cxix}};
2245 }
2246 else {
2247 # return undef for EOL
2248 0 delete $iter{$cxix};
2249 0 delete $entries{$cxix};
2250 0 return undef;
2251 }
2252 }
2253 }
2254  
2255 #
2256 # Arabic path globbing subroutine
2257 #
2258 0 ▶sub _do_glob {
Subroutine _do_glob: not called CC=44 SCAR=75.9
2259  
2260 0 my($cond,@expr) = @_;
2261 0 my @glob = ();
2262 0 my $fix_drive_relative_paths = 0;
2263  
2264 OUTER:
2265 0 for my $expr (@expr) {
2266 0 ▶ next OUTER if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2267 0 ▶ next OUTER if $expr eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $expr eq "" 0 0 0
2268  
2269 0 my @matched = ();
2270 0 my @globdir = ();
2271 0 my $head = '.';
2272 0 my $pathsep = '/';
2273 0 my $tail;
2274  
2275 # if argument is within quotes strip em and do no globbing
2276 0 ▶ if ($expr =~ /\A " ((?:$q_char)*?) " \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ /\A " ((?:$Earabic::q_char)*?) " \z/mosx) 0 0 0
2277 0 $expr = $1;
2278 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2279 0 ▶ if (-d $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $expr) 0 0 0
2280 0 push @glob, $expr;
2281 }
2282 }
2283 else {
2284 0 ▶ if (-e $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $expr) 0 0 0
2285 0 push @glob, $expr;
2286 }
2287 }
2288 0 next OUTER;
2289 }
2290  
2291 # wildcards with a drive prefix such as h:*.pm must be changed
2292 # to h:./*.pm to expand correctly
2293 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
2294 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
2295 0 $fix_drive_relative_paths = 1;
2296 }
2297 }
2298  
2299 0 ▶ if (($head, $tail) = _parse_path($expr,$pathsep)) {
Branch: 1 branch
BranchTrueFalseTotal
if (($head, $tail) = _parse_path($expr, $pathsep)) 0 0 0
2300 0 ▶ if ($tail eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tail eq "") 0 0 0
2301 0 push @glob, $expr;
2302 0 next OUTER;
2303 }
2304 0 ▶ if ($head =~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head =~ / \A (?:$Earabic::q_char)*? [*?] /mosx) 0 0 0
2305 0 ▶ if (@globdir = _do_glob('d', $head)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@globdir = _do_glob("d", $head)) 0 0 0
2306 0 push @glob, _do_glob($cond, map {"$_$pathsep$tail"} @globdir);
2307 0 next OUTER;
2308 }
2309 }
2310 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
2311 0 $head .= $pathsep;
2312 }
2313 0 $expr = $tail;
2314 }
2315  
2316 # If file component has no wildcards, we can avoid opendir
2317 0 ▶ if ($expr !~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($expr =~ / \A (?:$Earabic::q_char)*? [*?] /mosx) 0 0 0
2318 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2319 0 $head = '';
2320 }
2321 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Earabic::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Earabic::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Earabic::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Earabic::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Earabic::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2322 0 $head .= $pathsep;
2323 }
2324 0 $head .= $expr;
2325 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2326 0 ▶ if (-d $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $head) 0 0 0
2327 0 push @glob, $head;
2328 }
2329 }
2330 else {
2331 0 ▶ if (-e $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $head) 0 0 0
2332 0 push @glob, $head;
2333 }
2334 }
2335 0 next OUTER;
2336 }
2337 0 ▶ opendir(*DIR, $head) or next OUTER;
Branch: 1 branch
BranchTrueFalseTotal
opendir *DIR, $head or next OUTER 0 0 0
2338 0 my @leaf = readdir DIR;
2339 0 closedir DIR;
2340  
2341 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2342 0 $head = '';
2343 }
2344 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Earabic::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Earabic::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Earabic::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Earabic::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Earabic::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2345 0 $head .= $pathsep;
2346 }
2347  
2348 0 my $pattern = '';
2349 0 ▶ while ($expr =~ / \G ($q_char) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ / \G ($Earabic::q_char) /cgox) 0 0 0
2350 0 my $char = $1;
2351  
2352 # 6.9. Matching Shell Globs as Regular Expressions
2353 # in Chapter 6. Pattern Matching
2354 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2355 # (and so on)
2356  
2357 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
2358 0 $pattern .= "(?:$your_char)*",
2359 }
2360 elsif ($char eq '?') {
2361 0 $pattern .= "(?:$your_char)?", # DOS style
2362 # $pattern .= "(?:$your_char)", # UNIX style
2363 }
2364 elsif ((my $fc = Earabic::fc($char)) ne $char) {
2365 0 $pattern .= $fc;
2366 }
2367 else {
2368 0 $pattern .= quotemeta $char;
2369 }
2370 }
2371 0 ▶ my $matchsub = sub { Earabic::fc($_[0]) =~ /\A $pattern \z/xms };
Subroutine __ANON__: not called CC=1 SCAR=6.9
2372  
2373 # if ($@) {
2374 # print STDERR "$0: $@\n";
2375 # next OUTER;
2376 # }
2377  
2378 INNER:
2379 0 for my $leaf (@leaf) {
2380 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
2381 0 next INNER;
2382 }
2383 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
2384 0 next INNER;
2385 }
2386  
2387 0 ▶ if (&$matchsub($leaf)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub($leaf)) 0 0 0
2388 0 push @matched, "$head$leaf";
2389 0 next INNER;
2390 }
2391  
2392 # [DOS compatibility special case]
2393 # Failed, add a trailing dot and try again, but only...
2394  
2395 0 ▶ if (Earabic::index($leaf,'.') == -1 and # if name does not have a dot in it *and*
Branch: 1 branch
BranchTrueFalseTotal
if (&Earabic::index($leaf, ".") == -1 and length $leaf <= 8 and &Earabic::index($pattern, "\\.") != -1) 0 0 0
Condition0%0/6
&Earabic::index($leaf, ".") == -1 and length $leaf <= 8 and &Earabic::index($pattern, "\\.") != -1
!ll&&!rl&&r
000
&Earabic::index($leaf, ".") == -1 and length $leaf <= 8
!ll&&!rl&&r
000
MC/DC0%0/3
&Earabic::index($leaf, ".") == -1 and length $leaf <= 8 and &Earabic::index($pattern, "\\.") != -1
&Earabic::index($leaf, ".") == -1 length $leaf <= 8 &Earabic::index($pattern, "\\.") != -1
Truth table0%0/4
A and B and C
A= &Earabic::index($leaf, ".") == -1B= length $leaf <= 8C= &Earabic::index($pattern, "\\.") != -1
ABCresult
0XX0
10X0
1100
1111
2396 CORE::length($leaf) <= 8 and # name is shorter than or equal to 8 chars *and*
2397 Earabic::index($pattern,'\\.') != -1 # pattern has a dot.
2398 ) {
2399 0 ▶ if (&$matchsub("$leaf.")) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub("$leaf.")) 0 0 0
2400 0 push @matched, "$head$leaf";
2401 0 next INNER;
2402 }
2403 }
2404 }
2405 0 ▶ if (@matched) {
Branch: 1 branch
BranchTrueFalseTotal
if (@matched) 0 0 0
2406 0 push @glob, @matched;
2407 }
2408 }
2409 0 ▶ if ($fix_drive_relative_paths) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fix_drive_relative_paths) 0 0 0
2410 0 for my $glob (@glob) {
2411 0 $glob =~ s# \A ([A-Za-z]:) \./ #$1#oxms;
2412 }
2413 }
2414 0 return @glob;
2415 }
2416  
2417 #
2418 # Arabic parse line
2419 #
2420 0 ▶sub _parse_line {
Subroutine _parse_line: not called CC=3 SCAR=24.8
2421  
2422 0 my($line) = @_;
2423  
2424 0 $line .= ' ';
2425 0 my @piece = ();
2426 0 ▶ while ($line =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ / " ( (?>(?: [^"] )* ) ) " (?>\s+) | ( (?>(?: [^"\s] )* ) ) (?>\s+) /gmosx) 0 0 0
2427 " ( (?>(?: [^"] )* ) ) " (?>\s+) |
2428 ( (?>(?: [^"\s] )* ) ) (?>\s+)
2429 /oxmsg
2430 ) {
2431 0 ▶ push @piece, defined($1) ? $1 : $2;
Branch: 1 branch
BranchTrueFalseTotal
defined $1 ? : 0 0 0
2432 }
2433 0 return @piece;
2434 }
2435  
2436 #
2437 # Arabic parse path
2438 #
2439 0 ▶sub _parse_path {
Subroutine _parse_path: not called CC=2 SCAR=17.9
2440  
2441 0 my($path,$pathsep) = @_;
2442  
2443 0 $path .= '/';
2444 0 my @subpath = ();
2445 0 ▶ while ($path =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ m( ((?: [^/\\] )+?) [/\\] )gmosx) 0 0 0
2446 ((?: [^\/\\] )+?) [\/\\]
2447 /oxmsg
2448 ) {
2449 0 push @subpath, $1;
2450 }
2451  
2452 0 my $tail = pop @subpath;
2453 0 my $head = join $pathsep, @subpath;
2454 0 return $head, $tail;
2455 }
2456  
2457 #
2458 # via File::HomeDir::Windows 1.00
2459 #
2460 0 ▶sub my_home_MSWin32 {
Subroutine my_home_MSWin32: not called CC=9 SCAR=45.0
Pod undocumented
2461  
2462 # A lot of unix people and unix-derived tools rely on
2463 # the ability to overload HOME. We will support it too
2464 # so that they can replace raw HOME calls with File::HomeDir.
2465 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
2466 0 return $ENV{'HOME'};
2467 }
2468  
2469 # Do we have a user profile?
2470 ▶ 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
2471 0 return $ENV{'USERPROFILE'};
2472 }
2473  
2474 # Some Windows use something like $ENV{'HOME'}
2475 ▶ 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
2476 0 return join '', $ENV{'HOMEDRIVE'}, $ENV{'HOMEPATH'};
2477 }
2478  
2479 0 return undef;
2480 }
2481  
2482 #
2483 # via File::HomeDir::Unix 1.00
2484 #
2485 0 ▶sub my_home {
Subroutine my_home: not called CC=7 SCAR=40.3
Pod undocumented
2486 0 my $home;
2487  
2488 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
2489 0 $home = $ENV{'HOME'};
2490 }
2491  
2492 # This is from the original code, but I'm guessing
2493 # it means "login directory" and exists on some Unixes.
2494 ▶ 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
2495 0 $home = $ENV{'LOGDIR'};
2496 }
2497  
2498 ### More-desperate methods
2499  
2500 # Light desperation on any (Unixish) platform
2501 else {
2502 0 $home = CORE::eval q{ (getpwuid($<))[7] };
2503 }
2504  
2505 # On Unix in general, a non-existant home means "no home"
2506 # For example, "nobody"-like users might use /nonexistant
2507 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
2508 0 $home = undef;
2509 }
2510 0 return $home;
2511 }
2512  
2513 #
2514 # ${^PREMATCH}, $PREMATCH, $` the string preceding what was matched
2515 #
2516 56 ▶sub Earabic::PREMATCH {
Subroutine PREMATCH: called CC=1 SCAR=0.0
Pod undocumented
2517 56 return $`;
2518 }
2519  
2520 #
2521 # ${^MATCH}, $MATCH, $& the string that matched
2522 #
2523 81 ▶sub Earabic::MATCH {
Subroutine MATCH: called CC=1 SCAR=0.0
Pod undocumented
2524 81 return $&;
2525 }
2526  
2527 #
2528 # ${^POSTMATCH}, $POSTMATCH, $' the string following what was matched
2529 #
2530 42 ▶sub Earabic::POSTMATCH {
Subroutine POSTMATCH: called CC=1 SCAR=0.0
Pod undocumented
2531 42 return $';
2532 }
2533  
2534 #
2535 # Arabic character to order (with parameter)
2536 #
2537 0 ▶sub Arabic::ord(;$) {
Subroutine ord: not called CC=4 SCAR=30.0
2538  
2539 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2540  
2541 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Earabic::q_char) /mosx) { } 0 0 0
2542 0 my @ord = unpack 'C*', $1;
2543 0 my $ord = 0;
2544 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2545 0 $ord = $ord * 0x100 + $o;
2546 }
2547 0 return $ord;
2548 }
2549 else {
2550 0 return CORE::ord $_;
2551 }
2552 }
2553  
2554 #
2555 # Arabic character to order (without parameter)
2556 #
2557 0 ▶sub Arabic::ord_() {
Subroutine ord_: not called CC=3 SCAR=24.8
2558  
2559 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Earabic::q_char) /mosx) { } 0 0 0
2560 0 my @ord = unpack 'C*', $1;
2561 0 my $ord = 0;
2562 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2563 0 $ord = $ord * 0x100 + $o;
2564 }
2565 0 return $ord;
2566 }
2567 else {
2568 0 return CORE::ord $_;
2569 }
2570 }
2571  
2572 #
2573 # Arabic reverse
2574 #
2575 0 ▶sub Arabic::reverse(@) {
Subroutine reverse: not called CC=2 SCAR=17.9
2576  
2577 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2578 0 return CORE::reverse @_;
2579 }
2580 else {
2581  
2582 # One of us once cornered Larry in an elevator and asked him what
2583 # problem he was solving with this, but he looked as far off into
2584 # the distance as he could in an elevator and said, "It seemed like
2585 # a good idea at the time."
2586  
2587 0 return join '', CORE::reverse(join('',@_) =~ /\G ($q_char) /oxmsg);
2588 }
2589 }
2590  
2591 #
2592 # Arabic getc (with parameter, without parameter)
2593 #
2594 20 ▶sub Arabic::getc(;*@) {
Subroutine getc: called CC=9 SCAR=26.7
2595  
2596 20 my($package) = caller;
2597 20 ▶ my $fh = @_ ? qualify_to_ref(shift,$package) : \*STDIN;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 20 0 20
2598 20 ▶ croak 'Too many arguments for Arabic::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
2599  
2600 0 my @length = sort { $a <=> $b } keys %range_tr;
2601 20 my $getc = '';
2602 20 for my $length ($length[0] .. $length[-1]) {
2603 20 $getc .= CORE::getc($fh);
2604 20 ▶ if (exists $range_tr{CORE::length($getc)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{length $getc}) 20 0 20
2605 20 ▶ if ($getc =~ /\A ${Earabic::dot_s} \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($getc =~ /\A $Earabic::dot_s \z/mosx) 20 0 20
2606 20 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 20 20
2607 }
2608 }
2609 }
2610 0 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2611 }
2612  
2613 #
2614 # Arabic length by character
2615 #
2616 240 ▶sub Arabic::length(;$) {
Subroutine length: called CC=2 SCAR=7.1
2617  
2618 240 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 240 0 240
2619  
2620 240 local @_ = /\G ($q_char) /oxmsg;
2621 240 return scalar @_;
2622 }
2623  
2624 #
2625 # Arabic substr by character
2626 #
2627 424 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
2628  
2629 # P.232 The lvalue Attribute
2630 # in Chapter 6: Subroutines
2631 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2632  
2633 # P.336 The lvalue Attribute
2634 # in Chapter 7: Subroutines
2635 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2636  
2637 # P.144 8.4 Lvalue subroutines
2638 # in Chapter 8: perlsub: Perl subroutines
2639 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
2640  
2641 0 ▶ CORE::eval sprintf(<<'END', ($] >= 5.014000) ? ':lvalue' : '');
Subroutine __ANON__: not called CC=1 SCAR=0.0
Subroutine __ANON__: not called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: not called CC=1 SCAR=0.0
Subroutine substr: called CC=11 SCAR=24.3
Branch: 10 branches
BranchTrueFalseTotal
$] >= 5.014 ? : 424 0 424
if ($offset > scalar @char or $offset < -1 * scalar(@char)) 2 25 27
if (@_ == 4) { } 1 24 25
elsif (@_ == 3) { } 21 3 24
if ($offset == 0) { } 0 21 21
elsif ($offset > 0) { } 20 1 21
if ($length == 0) { } 0 21 21
elsif ($length > 0) { } 20 1 21
if ($offset == 0) { } 0 3 3
elsif ($offset > 0) { } 2 1 3
Condition66%2/3
$offset > scalar @char or $offset < -1 * scalar(@char)
l!l&&r!l&&!r
2025
MC/DC50%1/2
$offset > scalar @char or $offset < -1 * scalar(@char)
$offset > scalar @char $offset < -1 * scalar(@char)
Truth table66%2/3
A or B
A= $offset > scalar @charB= $offset < -1 * scalar(@char)
ABresult
1X1
011
000
2642 # vv----------------------*******
2643 sub Arabic::substr($$;$$) %s {
2644  
2645 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
2646  
2647 # If the substring is beyond either end of the string, substr() returns the undefined
2648 # value and produces a warning. When used as an lvalue, specifying a substring that
2649 # is entirely outside the string raises an exception.
2650 # http://perldoc.perl.org/functions/substr.html
2651  
2652 # A return with no argument returns the scalar value undef in scalar context,
2653 # an empty list () in list context, and (naturally) nothing at all in void
2654 # context.
2655  
2656 my $offset = $_[1];
2657 if (($offset > scalar(@char)) or ($offset < (-1 * scalar(@char)))) {
2658 return;
2659 }
2660  
2661 # substr($string,$offset,$length,$replacement)
2662 if (@_ == 4) {
2663 my(undef,undef,$length,$replacement) = @_;
2664 my $substr = join '', splice(@char, $offset, $length, $replacement);
2665 $_[0] = join '', @char;
2666  
2667 # return $substr; this doesn't work, don't say "return"
2668 $substr;
2669 }
2670  
2671 # substr($string,$offset,$length)
2672 elsif (@_ == 3) {
2673 my(undef,undef,$length) = @_;
2674 my $octet_offset = 0;
2675 my $octet_length = 0;
2676 if ($offset == 0) {
2677 $octet_offset = 0;
2678 }
2679 elsif ($offset > 0) {
2680 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2681 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2682 }
2683 else {
2684 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2685 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2686 }
2687 if ($length == 0) {
2688 $octet_length = 0;
2689 }
2690 elsif ($length > 0) {
2691 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2692 $octet_length = CORE::length(join '', @char[$offset..$offset+$length-1]);
2693 }
2694 else {
2695 local $SIG{__WARN__} = sub {}; # avoid: Use of uninitialized value in join or string at here
2696 $octet_length = -1 * CORE::length(join '', @char[$#char+$length+1..$#char]);
2697 }
2698 CORE::substr($_[0], $octet_offset, $octet_length);
2699 }
2700  
2701 # substr($string,$offset)
2702 else {
2703 my $octet_offset = 0;
2704 if ($offset == 0) {
2705 $octet_offset = 0;
2706 }
2707 elsif ($offset > 0) {
2708 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2709 }
2710 else {
2711 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2712 }
2713 CORE::substr($_[0], $octet_offset);
2714 }
2715 }
2716 END
2717 }
2718  
2719 #
2720 # Arabic index by character
2721 #
2722 0 ▶sub Arabic::index($$;$) {
Subroutine index: not called CC=3 SCAR=24.8
2723  
2724 0 my $index;
2725 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2726 0 $index = Earabic::index($_[0], $_[1], CORE::length(Arabic::substr($_[0], 0, $_[2])));
2727 }
2728 else {
2729 0 $index = Earabic::index($_[0], $_[1]);
2730 }
2731  
2732 0 ▶ if ($index == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index == -1) { } 0 0 0
2733 0 return -1;
2734 }
2735 else {
2736 0 return Arabic::length(CORE::substr $_[0], 0, $index);
2737 }
2738 }
2739  
2740 #
2741 # Arabic rindex by character
2742 #
2743 0 ▶sub Arabic::rindex($$;$) {
Subroutine rindex: not called CC=3 SCAR=24.8
2744  
2745 0 my $rindex;
2746 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2747 0 $rindex = Earabic::rindex($_[0], $_[1], CORE::length(Arabic::substr($_[0], 0, $_[2])));
2748 }
2749 else {
2750 0 $rindex = Earabic::rindex($_[0], $_[1]);
2751 }
2752  
2753 0 ▶ if ($rindex == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rindex == -1) { } 0 0 0
2754 0 return -1;
2755 }
2756 else {
2757 0 return Arabic::length(CORE::substr $_[0], 0, $rindex);
2758 }
2759 }
2760  
2761 # when 'm//', '/' means regexp match 'm//' and '?' means regexp match '??'
2762 # when 'div', '/' means division operator and '?' means conditional operator (condition ? then : else)
2763 424 ▶use vars qw($slash); $slash = 'm//';
Subroutine BEGIN: called CC=1 SCAR=0.0
2764  
2765 # ord() to ord() or Arabic::ord()
2766 424 my $function_ord = 'ord';
2767  
2768 # ord to ord or Arabic::ord_
2769 424 my $function_ord_ = 'ord';
2770  
2771 # reverse to reverse or Arabic::reverse
2772 424 my $function_reverse = 'reverse';
2773  
2774 # getc to getc or Arabic::getc
2775 424 my $function_getc = 'getc';
2776  
2777 # P.1023 Appendix W.9 Multibyte Anchoring
2778 # of ISBN 1-56592-224-7 CJKV Information Processing
2779  
2780 424 my $anchor = '';
2781  
2782 424 ▶use vars qw($nest);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
2783  
2784 # regexp of nested parens in qqXX
2785  
2786 # P.340 Matching Nested Constructs with Embedded Code
2787 # in Chapter 7: Perl
2788 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2789  
2790 my $qq_paren = qr{(?{local $nest=0}) (?>(?:
2791 [^\\()] |
2792 \( (?{$nest++}) |
2793 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2794 \\ [^c] |
2795 \\c[\x40-\x5F] |
2796 [\x00-\xFF]
2797 424 }xms;
2798  
2799 my $qq_brace = qr{(?{local $nest=0}) (?>(?:
2800 [^\\{}] |
2801 \{ (?{$nest++}) |
2802 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2803 \\ [^c] |
2804 \\c[\x40-\x5F] |
2805 [\x00-\xFF]
2806 424 }xms;
2807  
2808 my $qq_bracket = qr{(?{local $nest=0}) (?>(?:
2809 [^\\\[\]] |
2810 \[ (?{$nest++}) |
2811 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2812 \\ [^c] |
2813 \\c[\x40-\x5F] |
2814 [\x00-\xFF]
2815 424 }xms;
2816  
2817 my $qq_angle = qr{(?{local $nest=0}) (?>(?:
2818 [^\\<>] |
2819 \< (?{$nest++}) |
2820 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2821 \\ [^c] |
2822 \\c[\x40-\x5F] |
2823 [\x00-\xFF]
2824 424 }xms;
2825  
2826 424 my $qq_scalar = qr{(?: \{ (?:$qq_brace)*? \} |
2827 (?: ::)? (?:
2828 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2829 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2830 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2831 ))
2832 }xms;
2833  
2834 424 my $qq_variable = qr{(?: \{ (?:$qq_brace)*? \} |
2835 (?: ::)? (?:
2836 (?>[0-9]+) |
2837 [^a-zA-Z_0-9\[\]] |
2838 ^[A-Z] |
2839 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2840 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2841 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2842 ))
2843 }xms;
2844  
2845 424 my $qq_substr = qr{(?> Char::substr | Arabic::substr | CORE::substr | substr ) (?>\s*) \( $qq_paren \)
2846 }xms;
2847  
2848 # regexp of nested parens in qXX
2849 my $q_paren = qr{(?{local $nest=0}) (?>(?:
2850 [^()] |
2851 \( (?{$nest++}) |
2852 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2853 [\x00-\xFF]
2854 424 }xms;
2855  
2856 my $q_brace = qr{(?{local $nest=0}) (?>(?:
2857 [^\{\}] |
2858 \{ (?{$nest++}) |
2859 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2860 [\x00-\xFF]
2861 424 }xms;
2862  
2863 my $q_bracket = qr{(?{local $nest=0}) (?>(?:
2864 [^\[\]] |
2865 \[ (?{$nest++}) |
2866 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2867 [\x00-\xFF]
2868 424 }xms;
2869  
2870 my $q_angle = qr{(?{local $nest=0}) (?>(?:
2871 [^<>] |
2872 \< (?{$nest++}) |
2873 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2874 [\x00-\xFF]
2875 424 }xms;
2876  
2877 424 my $matched = '';
2878 424 my $s_matched = '';
2879  
2880 424 my $tr_variable = ''; # variable of tr///
2881 424 my $sub_variable = ''; # variable of s///
2882 424 my $bind_operator = ''; # =~ or !~
2883  
2884 424 my @heredoc = (); # here document
2885 424 my @heredoc_delimiter = ();
2886 424 my $here_script = ''; # here script
2887  
2888 #
2889 # escape Arabic script
2890 #
2891 548 ▶sub Arabic::escape(;$) {
Subroutine escape: called CC=3 SCAR=11.0
2892 548 ▶ local($_) = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 292 256 548
2893  
2894 # P.359 The Study Function
2895 # in Chapter 7: Perl
2896 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2897  
2898 548 study $_; # Yes, I studied study yesterday.
2899  
2900 # while all script
2901  
2902 # 6.14. Matching from Where the Last Pattern Left Off
2903 # in Chapter 6. Pattern Matching
2904 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2905 # (and so on)
2906  
2907 # one member of Tag-team
2908 #
2909 # P.128 Start of match (or end of previous match): \G
2910 # P.130 Advanced Use of \G with Perl
2911 # in Chapter 3: Overview of Regular Expression Features and Flavors
2912 # P.255 Use leading anchors
2913 # P.256 Expose ^ and \G at the front expressions
2914 # in Chapter 6: Crafting an Efficient Expression
2915 # P.315 "Tag-team" matching with /gc
2916 # in Chapter 7: Perl
2917 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2918  
2919 548 my $e_script = '';
2920 548 ▶ while (not /\G \z/oxgc) { # member
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 88604 548 89152
2921 88604 $e_script .= Arabic::escape_token();
2922 }
2923  
2924 548 return $e_script;
2925 }
2926  
2927 #
2928 # escape Arabic token of script
2929 #
2930 88604 ▶sub Arabic::escape_token {
Subroutine escape_token: called CC=504 SCAR=109.3
2931  
2932 # \n output here document
2933  
2934 88604 my $ignore_modules = join('|', qw(
2935 utf8
2936 bytes
2937 charnames
2938 I18N::Japanese
2939 I18N::Collate
2940 I18N::JExt
2941 File::DosGlob
2942 Wild
2943 Wildcard
2944 Japanese
2945 ));
2946  
2947 # another member of Tag-team
2948 #
2949 # P.315 "Tag-team" matching with /gc
2950 # in Chapter 7: Perl
2951 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2952  
2953 88604 ▶ if (/\G ( \n ) /oxgc) { # another member (and so on)
Branch: 139 branches
BranchTrueFalseTotal
if (/\G ( \n ) /cgox) { } 12542 76062 88604
elsif (/\G ((?>\s+)|\#.*) /cgox) { } 20579 55483 76062
elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /cgox) { } 1622 53861 55483
elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /cgox) { } 90 53771 53861
elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx) { } 4 53767 53771
elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 28 53739 53767
elsif (/\G ( \$' | \$\{'\} ) /cgmosx) { } 1 53738 53739
elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 3 53735 53738
elsif (/\G ( \$ $qq_scalar | $qq_substr ) /cgox) { } 1751 51984 53735
elsif (/\G ( [,;] ) /cgox) { } 4909 47075 51984
elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 47075 47075
elsif (/\G ( \$ 0 ) /cgmosx) { } 2 47073 47075
elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 47073 47073
elsif (/\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 1 47072 47073
elsif (/\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 4 47068 47072
elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 47068 47068
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 47068 47068
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 47068 47068
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 47068 47068
elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /cgmosx) { } 0 47068 47068
elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 0 47068 47068
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) { } 32 47036 47068
elsif (m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 63 46973 47036
elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /cgox) { } 0 46973 46973
elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /cgox) { } 0 46973 46973
elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /cgox) { } 0 46973 46973
elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /cgox) { } 0 46973 46973
elsif (/\G \b ( if | unless | while | until | for | when ) \b /cgox) { } 251 46722 46973
elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 19 46703 46722
elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 46703 46703
elsif (/\G \b Arabic::eval (?= (?>\s*) \{ ) /cgox) { } 22 46681 46703
elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /cgox) { } 0 46681 46681
elsif (/\G \b Arabic::eval \b (?! (?>\s*) => ) /cgox) { } 168 46513 46681
elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /cgox) { } 2 46511 46513
elsif (/\G \b chop \b (?! (?>\s*) => ) /cgox) { } 0 46511 46511
elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /cgox) { } 2 46509 46511
elsif (/\G \b Char::index \b (?! (?>\s*) => ) /cgox) { } 0 46509 46509
elsif (/\G \b Arabic::index \b (?! (?>\s*) => ) /cgox) { } 0 46509 46509
elsif (/\G \b index \b (?! (?>\s*) => ) /cgox) { } 0 46509 46509
elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /cgox) { } 2 46507 46509
elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /cgox) { } 0 46507 46507
elsif (/\G \b Arabic::rindex \b (?! (?>\s*) => ) /cgox) { } 0 46507 46507
elsif (/\G \b rindex \b (?! (?>\s*) => ) /cgox) { } 0 46507 46507
elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 46506 46507
elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 46506 46506
elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 46505 46506
elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 46505 46505
elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 46503 46505
elsif (/\G -s (?>\s*) (\") ((?:$Earabic::qq_char)+?) (\") /cgox) { } 0 46503 46503
elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Earabic::qq_char)+?) (\#) /cgox) { } 0 46503 46503
elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 46503 46503
elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 46503 46503
elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 46503 46503
elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 46503 46503
elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Earabic::qq_char)+?) (\1) /cgox) { } 0 46503 46503
elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Earabic::q_char)+?) (\') /cgox) { } 0 46503 46503
elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Earabic::q_char)+?) (\#) /cgox) { } 0 46503 46503
elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 46503 46503
elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 46503 46503
elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 46503 46503
elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 46503 46503
elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Earabic::q_char)+?) (\1) /cgox) { } 0 46503 46503
elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /cgox) { } 0 46503 46503
elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 46503 46503
elsif (/\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 46503 46503
elsif (/\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 46503 46503
elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 46501 46503
elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 46499 46501
elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 36 46463 46499
elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 46461 46463
elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 8 46453 46461
elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 46453 46453
elsif (/\G \b lc \b (?! (?>\s*) => ) /cgox) { } 0 46453 46453
elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /cgox) { } 0 46453 46453
elsif (/\G \b uc \b (?! (?>\s*) => ) /cgox) { } 0 46453 46453
elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /cgox) { } 0 46453 46453
elsif (/\G \b fc \b (?! (?>\s*) => ) /cgox) { } 0 46453 46453
elsif (/\G -s \b (?! (?>\s*) => ) /cgox) { } 0 46453 46453
elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /cgox) { } 0 46453 46453
elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /cgox) { } 0 46453 46453
elsif (/\G \b chr \b (?! (?>\s*) => ) /cgox) { } 0 46453 46453
elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /cgox) { } 0 46453 46453
elsif (/\G \b ord \b (?! (?>\s*) => ) /cgox) { } 0 46453 46453
elsif (/\G \b glob \b (?! (?>\s*) => ) /cgox) { } 0 46453 46453
elsif (/\G \b reverse \b (?! (?>\s*) => ) /cgox) { } 0 46453 46453
elsif (/\G \b getc \b (?! (?>\s*) => ) /cgox) { } 8 46445 46453
elsif (/\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 87 46358 46445
elsif (/\G \b ( tr | y ) \b /cgox) { } 4 46354 46358
elsif (/\G \b (qq) \b /cgox) { } 2190 44164 46354
elsif (/\G \b (qr) \b /cgox) { } 0 44164 44164
elsif (/\G \b (qw) \b /cgox) { } 14 44150 44164
elsif (/\G \b (qx) \b /cgox) { } 0 44150 44150
elsif (/\G \b (q) \b /cgox) { } 713 43437 44150
elsif (/\G \b (m) \b /cgox) { } 209 43228 43437
elsif (/\G \b (s) \b /cgox) { } 101 43127 43228
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 43127 43127
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 43127 43127
elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 43127 43127
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /cgmosx) { } 37 43090 43127
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 43090 43090
elsif (/\G \b use ((?>\s+) strict) \b /cgmosx) { } 0 43090 43090
elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 2 43088 43090
elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 0 43088 43088
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 2 43086 43088
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 43086 43086
elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 43086 43086
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 43086 43086
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 43086 43086
elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 43086 43086
elsif (/\G \b use \b /cgmosx) { } 0 43086 43086
elsif (/\G \b no \b /cgmosx) { } 2 43084 43086
elsif (/\G (?<![\w\$\@\%\&\*]) (\') /cgox) { } 922 42162 43084
elsif (/\G (\") /cgox) { } 1645 40517 42162
elsif (/\G (\`) /cgox) { } 1 40516 40517
elsif ($Earabic::slash eq 'm//' and m[\G (/) ]cgox) { } 425 40091 40516
elsif ($Earabic::slash eq 'm//' and /\G (\?) /cgox) { } 0 40091 40091
elsif (/\G ( <<>> ) /cgox) { } 0 40091 40091
elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 40091 40091
elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 6 40085 40091
elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 3 40082 40085
elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 6 40076 40082
elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 3 40073 40076
elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 6 40067 40073
elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 72 39995 40067
elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 39995 39995
elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 36 39959 39995
elsif (/\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 42 39917 39959
elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 39917 39917
elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 12 39905 39917
elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 39905 39905
elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /cgox) { } 0 39905 39905
elsif (/\G ^ ( __DATA__ \n .*) \z /cgmosx) { } 0 39905 39905
elsif (/\G ^ ( __END__ \n .*) \z /cgmosx) { } 210 39695 39905
elsif (/\G ( \cD .*) \z /cgmosx) { } 0 39695 39695
elsif (/\G ( \cZ .*) \z /cgmosx) { } 0 39695 39695
elsif (/\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 6003 33692 39695
elsif (/\G ( \.\.\. ) /cgox) { } 7 33685 33692
elsif (m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 10268 23417 33685
elsif (/\G ($Earabic::q_char) /cgox) { } 23417 0 23417
2954 12542 my $heredoc = '';
2955 12542 ▶ if (scalar(@heredoc_delimiter) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @heredoc_delimiter >= 1) 174 12368 12542
2956 174 $slash = 'm//';
2957  
2958 174 $heredoc = join '', @heredoc;
2959 174 @heredoc = ();
2960  
2961 # skip here document
2962 174 for my $heredoc_delimiter (@heredoc_delimiter) {
2963 174 /\G .*? \n $heredoc_delimiter \n/xmsgc;
2964 }
2965 174 @heredoc_delimiter = ();
2966  
2967 174 $here_script = '';
2968 }
2969 12542 return "\n" . $heredoc;
2970 }
2971  
2972 # ignore space, comment
2973 20579 elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
2974  
2975 # if (, elsif (, unless (, while (, until (, given (, and when (
2976  
2977 # given, when
2978  
2979 # P.225 The given Statement
2980 # in Chapter 15: Smart Matching and given-when
2981 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
2982  
2983 # P.133 The given Statement
2984 # in Chapter 4: Statements and Declarations
2985 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2986  
2987 elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /oxgc) {
2988 1622 $slash = 'm//';
2989 1622 return $1;
2990 }
2991  
2992 # scalar variable ($scalar = ...) =~ tr///;
2993 # scalar variable ($scalar = ...) =~ s///;
2994  
2995 # state
2996  
2997 # P.68 Persistent, Private Variables
2998 # in Chapter 4: Subroutines
2999 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
3000  
3001 # P.160 Persistent Lexically Scoped Variables: state
3002 # in Chapter 4: Statements and Declarations
3003 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
3004  
3005 # (and so on)
3006  
3007 elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /oxgc) {
3008 90 my $e_string = e_string($1);
3009  
3010 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
3011 0 $tr_variable = $e_string . e_string($1);
3012 0 $bind_operator = $2;
3013 0 $slash = 'm//';
3014 0 return '';
3015 }
3016 elsif (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3017 0 $sub_variable = $e_string . e_string($1);
3018 0 $bind_operator = $2;
3019 0 $slash = 'm//';
3020 0 return '';
3021 }
3022 else {
3023 90 $slash = 'div';
3024 90 return $e_string;
3025 }
3026 }
3027  
3028 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Earabic::PREMATCH()
3029 elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
3030 4 $slash = 'div';
3031 4 return q{Earabic::PREMATCH()};
3032 }
3033  
3034 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Earabic::MATCH()
3035 elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
3036 28 $slash = 'div';
3037 28 return q{Earabic::MATCH()};
3038 }
3039  
3040 # $', ${'} --> $', ${'}
3041 elsif (/\G ( \$' | \$\{'\} ) /oxmsgc) {
3042 1 $slash = 'div';
3043 1 return $1;
3044 }
3045  
3046 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Earabic::POSTMATCH()
3047 elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
3048 3 $slash = 'div';
3049 3 return q{Earabic::POSTMATCH()};
3050 }
3051  
3052 # scalar variable $scalar =~ tr///;
3053 # scalar variable $scalar =~ s///;
3054 # substr() =~ tr///;
3055 # substr() =~ s///;
3056 elsif (/\G ( \$ $qq_scalar | $qq_substr ) /oxgc) {
3057 1751 my $scalar = e_string($1);
3058  
3059 1751 ▶ if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /oxgc) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /cgox) { } 2 1749 1751
elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /cgox) { } 65 1684 1749
3060 2 $tr_variable = $scalar;
3061 2 $bind_operator = $1;
3062 2 $slash = 'm//';
3063 2 return '';
3064 }
3065 elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3066 65 $sub_variable = $scalar;
3067 65 $bind_operator = $1;
3068 65 $slash = 'm//';
3069 65 return '';
3070 }
3071 else {
3072 1684 $slash = 'div';
3073 1684 return $scalar;
3074 }
3075 }
3076  
3077 # end of statement
3078 elsif (/\G ( [,;] ) /oxgc) {
3079 4909 $slash = 'm//';
3080  
3081 # clear tr/// variable
3082 4909 $tr_variable = '';
3083  
3084 # clear s/// variable
3085 4909 $sub_variable = '';
3086  
3087 4909 $bind_operator = '';
3088  
3089 4909 return $1;
3090 }
3091  
3092 # bareword
3093 elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
3094 0 return $1;
3095 }
3096  
3097 # $0 --> $0
3098 elsif (/\G ( \$ 0 ) /oxmsgc) {
3099 2 $slash = 'div';
3100 2 return $1;
3101 }
3102 elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
3103 0 $slash = 'div';
3104 0 return $1;
3105 }
3106  
3107 # $$ --> $$
3108 elsif (/\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
3109 1 $slash = 'div';
3110 1 return $1;
3111 }
3112  
3113 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
3114 # $1, $2, $3 --> $1, $2, $3 otherwise
3115 elsif (/\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
3116 4 $slash = 'div';
3117 4 return e_capture($1);
3118 }
3119 elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
3120 0 $slash = 'div';
3121 0 return e_capture($1);
3122 }
3123  
3124 # $$foo[ ... ] --> $ $foo->[ ... ]
3125 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
3126 0 $slash = 'div';
3127 0 return e_capture($1.'->'.$2);
3128 }
3129  
3130 # $$foo{ ... } --> $ $foo->{ ... }
3131 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
3132 0 $slash = 'div';
3133 0 return e_capture($1.'->'.$2);
3134 }
3135  
3136 # $$foo
3137 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
3138 0 $slash = 'div';
3139 0 return e_capture($1);
3140 }
3141  
3142 # ${ foo }
3143 elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /oxmsgc) {
3144 0 $slash = 'div';
3145 0 return '${' . $1 . '}';
3146 }
3147  
3148 # ${ ... }
3149 elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
3150 0 $slash = 'div';
3151 0 return e_capture($1);
3152 }
3153  
3154 # variable or function
3155 # $ @ % & * $ #
3156 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) {
3157 32 $slash = 'div';
3158 32 return $1;
3159 }
3160 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
3161 # $ @ # \ ' " / ? ( ) [ ] < >
3162 elsif (/\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
3163 63 $slash = 'div';
3164 63 return $1;
3165 }
3166  
3167 # while (<FILEHANDLE>)
3168 elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /oxgc) {
3169 0 return $1;
3170 }
3171  
3172 # while (<WILDCARD>) --- glob
3173  
3174 # avoid "Error: Runtime exception" of perl version 5.005_03
3175  
3176 elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /oxgc) {
3177 0 return 'while ($_ = Earabic::glob("' . $1 . '"))';
3178 }
3179  
3180 # while (glob)
3181 elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /oxgc) {
3182 0 return 'while ($_ = Earabic::glob_)';
3183 }
3184  
3185 # while (glob(WILDCARD))
3186 elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /oxgc) {
3187 0 return 'while ($_ = Earabic::glob';
3188 }
3189  
3190 # doit if, doit unless, doit while, doit until, doit for, doit when
3191 251 elsif (/\G \b ( if | unless | while | until | for | when ) \b /oxgc) { $slash = 'm//'; return $1; }
3192  
3193 # subroutines of package Earabic
3194 19 elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $slash = 'm//'; return $1; }
3195 0 elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3196 22 elsif (/\G \b Arabic::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3197 0 elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Char::escape'; }
3198 168 elsif (/\G \b Arabic::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Arabic::escape'; }
3199 2 elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'substr'; }
3200 0 elsif (/\G \b chop \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Earabic::chop'; }
3201 2 elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'index'; }
3202 0 elsif (/\G \b Char::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::index'; }
3203 0 elsif (/\G \b Arabic::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Arabic::index'; }
3204 0 elsif (/\G \b index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Earabic::index'; }
3205 2 elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'rindex'; }
3206 0 elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::rindex'; }
3207 0 elsif (/\G \b Arabic::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Arabic::rindex'; }
3208 0 elsif (/\G \b rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Earabic::rindex'; }
3209 1 elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Earabic::lc'; }
3210 0 elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Earabic::lcfirst'; }
3211 1 elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Earabic::uc'; }
3212 0 elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Earabic::ucfirst'; }
3213 2 elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Earabic::fc'; }
3214  
3215 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
3216 0 elsif (/\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $slash = 'm//'; return '-s ' . e_qq('', $1,$3,$2); }
3217 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3218 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3219 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3220 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3221 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3222 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3223  
3224 0 elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $slash = 'm//'; return '-s ' . e_q ('', $1,$3,$2); }
3225 0 elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3226 0 elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3227 0 elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3228 0 elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3229 0 elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3230 0 elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3231  
3232 elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /oxgc)
3233 0 { $slash = 'm//'; return "-s $1"; }
3234 0 elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $slash = 'm//'; return "-s ($1)"; }
3235 0 elsif (/\G -s (?= (?>\s+) [a-z]+) /oxgc) { $slash = 'm//'; return '-s'; }
3236 0 elsif (/\G -s (?>\s+) ((?>\w+)) /oxgc) { $slash = 'm//'; return "-s $1"; }
3237  
3238 2 elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'length'; }
3239 2 elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'chr'; }
3240 36 elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Earabic::chr'; }
3241 2 elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return 'ord'; }
3242 8 elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return $function_ord; }
3243 0 elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Earabic::glob'; }
3244 0 elsif (/\G \b lc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Earabic::lc_'; }
3245 0 elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Earabic::lcfirst_'; }
3246 0 elsif (/\G \b uc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Earabic::uc_'; }
3247 0 elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Earabic::ucfirst_'; }
3248 0 elsif (/\G \b fc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Earabic::fc_'; }
3249 0 elsif (/\G -s \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return '-s '; }
3250  
3251 0 elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'length'; }
3252 0 elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'chr'; }
3253 0 elsif (/\G \b chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Earabic::chr_'; }
3254 0 elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return 'ord'; }
3255 0 elsif (/\G \b ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return $function_ord_; }
3256 0 elsif (/\G \b glob \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Earabic::glob_'; }
3257 0 elsif (/\G \b reverse \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_reverse; }
3258 8 elsif (/\G \b getc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_getc; }
3259 # split
3260 elsif (/\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
3261 87 $slash = 'm//';
3262  
3263 87 my $e = '';
3264 87 ▶ while (/\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\G ( (?>\s+) | \( | \#.* ) /cgox) 85 87 172
3265 85 $e .= $1;
3266 }
3267  
3268 # end of split
3269 87 ▶ if (/\G (?= [,;\)\}\]] ) /oxgc) { return 'Earabic::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
3270  
3271 # split scalar value
3272 1 elsif (/\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { return 'Earabic::split' . $e . e_string($1); }
3273  
3274 # split literal space
3275 0 elsif (/\G \b qq (\#) [ ] (\#) /oxgc) { return 'Earabic::split' . $e . qq {qq$1 $2}; }
3276 0 elsif (/\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Earabic::split' . $e . qq{$1qq$2 $3}; }
3277 0 elsif (/\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Earabic::split' . $e . qq{$1qq$2 $3}; }
3278 0 elsif (/\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Earabic::split' . $e . qq{$1qq$2 $3}; }
3279 0 elsif (/\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Earabic::split' . $e . qq{$1qq$2 $3}; }
3280 0 elsif (/\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Earabic::split' . $e . qq{$1qq$2 $3}; }
3281 0 elsif (/\G \b q (\#) [ ] (\#) /oxgc) { return 'Earabic::split' . $e . qq {q$1 $2}; }
3282 0 elsif (/\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Earabic::split' . $e . qq {$1q$2 $3}; }
3283 0 elsif (/\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Earabic::split' . $e . qq {$1q$2 $3}; }
3284 0 elsif (/\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Earabic::split' . $e . qq {$1q$2 $3}; }
3285 0 elsif (/\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Earabic::split' . $e . qq {$1q$2 $3}; }
3286 0 elsif (/\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Earabic::split' . $e . qq {$1q$2 $3}; }
3287 10 elsif (/\G ' [ ] ' /oxgc) { return 'Earabic::split' . $e . qq {' '}; }
3288 0 elsif (/\G " [ ] " /oxgc) { return 'Earabic::split' . $e . qq {" "}; }
3289  
3290 # split qq//
3291 elsif (/\G \b (qq) \b /oxgc) {
3292 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Earabic::qq_char)*?) (\#) /cgox) { } 0 0 0
3293 else {
3294 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3295 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 ([*\-:?\\^|]) ((?:$Earabic::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Earabic::qq_char)*?) (\1) /cgox) { } 0 0 0
3296 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq ( ) --> qr ( )
3297 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq { } --> qr { }
3298 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq [ ] --> qr [ ]
3299 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq < > --> qr < >
3300 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr','{','}',$2,''); } # qq | | --> qr { }
3301 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq * * --> qr * *
3302 }
3303 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3304 }
3305 }
3306  
3307 # split qr//
3308 elsif (/\G \b (qr) \b /oxgc) {
3309 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # qr# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Earabic::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 12 12
3310 else {
3311 12 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 12 0 12
3312 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 (\') ((?:$Earabic::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G ([*\-:?\\^|]) ((?:$Earabic::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\S) ((?:$Earabic::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 12 0 12
3313 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr ( )
3314 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr { }
3315 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr [ ]
3316 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr < >
3317 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # qr ' '
3318 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # qr | | --> qr { }
3319 12 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr * *
3320 }
3321 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3322 }
3323 }
3324  
3325 # split q//
3326 elsif (/\G \b (q) \b /oxgc) {
3327 0 ▶ if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:\\\#|\\\\|$Earabic::q_char)*?) (\#) /cgox) { } 0 0 0
3328 else {
3329 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3330 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 ([*\-:?\\^|]) ((?:$Earabic::q_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:\\\\|\\\1| $Earabic::q_char)*?) (\1) /cgox) { } 0 0 0
3331 0 elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q ( ) --> qr ( )
3332 0 elsif (/\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q { } --> qr { }
3333 0 elsif (/\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q [ ] --> qr [ ]
3334 0 elsif (/\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q < > --> qr < >
3335 0 elsif (/\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr','{','}',$2,''); } # q | | --> qr { }
3336 0 elsif (/\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q * * --> qr * *
3337 }
3338 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3339 }
3340 }
3341  
3342 # split m//
3343 elsif (/\G \b (m) \b /oxgc) {
3344 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # m# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Earabic::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
3345 else {
3346 18 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 18 0 18
3347 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 (\') ((?:$Earabic::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G ([*\-:?\\^|]) ((?:$Earabic::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\S) ((?:$Earabic::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 18 0 18
3348 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m ( ) --> qr ( )
3349 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m { } --> qr { }
3350 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m [ ] --> qr [ ]
3351 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m < > --> qr < >
3352 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # m ' ' --> qr ' '
3353 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # m | | --> qr { }
3354 18 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m * * --> qr * *
3355 }
3356 0 die __FILE__, ": Search pattern not terminated\n";
3357 }
3358 }
3359  
3360 # split ''
3361 elsif (/\G (\') /oxgc) {
3362 0 my $q_string = '';
3363 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3364 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 ($Earabic::q_char) /cgox) { } 0 0 0
3365 0 elsif (/\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
3366 0 elsif (/\G \' /oxgc) { return e_split_q($e.q{ qr},"'","'",$q_string,''); } # ' ' --> qr ' '
3367 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3368 }
3369 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3370 }
3371  
3372 # split ""
3373 elsif (/\G (\") /oxgc) {
3374 0 my $qq_string = '';
3375 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3376 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 ($Earabic::q_char) /cgox) { } 0 0 0
3377 0 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
3378 0 elsif (/\G \" /oxgc) { return e_split($e.q{ qr},'"','"',$qq_string,''); } # " " --> qr " "
3379 0 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
3380 }
3381 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3382 }
3383  
3384 # split //
3385 elsif (/\G (\/) /oxgc) {
3386 44 my $regexp = '';
3387 44 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 381 0 381
3388 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 ($Earabic::q_char) /cgox) { } 337 0 337
3389 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
3390 44 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_split($e.q{ qr}, '/','/',$regexp,$1); } # / / --> qr / /
3391 337 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3392 }
3393 0 die __FILE__, ": Search pattern not terminated\n";
3394 }
3395 }
3396  
3397 # tr/// or y///
3398  
3399 # about [cdsrbB]* (/B modifier)
3400 #
3401 # P.559 appendix C
3402 # of ISBN 4-89052-384-7 Programming perl
3403 # (Japanese title is: Perl puroguramingu)
3404  
3405 elsif (/\G \b ( tr | y ) \b /oxgc) {
3406 4 my $ope = $1;
3407  
3408 # $1 $2 $3 $4 $5 $6
3409 4 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cdsrbB]*) /oxgc) { # tr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Earabic::qq_char)*?) (\#) ((?:$Earabic::qq_char)*?) (\#) ([cdsrbB]*) /cgox) { } 0 4 4
3410 0 my @tr = ($tr_variable,$2);
3411 0 return e_tr(@tr,'',$4,$6);
3412 }
3413 else {
3414 4 my $e = '';
3415 4 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 4 0 4
3416 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) ((?:$Earabic::qq_char)*?) (\1) ((?:$Earabic::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 4 0 4
3417 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3418 0 my @tr = ($tr_variable,$2);
3419 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3420 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) ((?:$Earabic::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3421 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) ( )
3422 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) { }
3423 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) [ ]
3424 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) < >
3425 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) * *
3426 }
3427 0 die __FILE__, ": Transliteration replacement not terminated\n";
3428 }
3429 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3430 0 my @tr = ($tr_variable,$2);
3431 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3432 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) ((?:$Earabic::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3433 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } ( )
3434 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } { }
3435 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } [ ]
3436 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } < >
3437 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } * *
3438 }
3439 0 die __FILE__, ": Transliteration replacement not terminated\n";
3440 }
3441 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3442 0 my @tr = ($tr_variable,$2);
3443 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3444 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) ((?:$Earabic::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3445 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] ( )
3446 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] { }
3447 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] [ ]
3448 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] < >
3449 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] * *
3450 }
3451 0 die __FILE__, ": Transliteration replacement not terminated\n";
3452 }
3453 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3454 0 my @tr = ($tr_variable,$2);
3455 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3456 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) ((?:$Earabic::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3457 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > ( )
3458 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > { }
3459 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > [ ]
3460 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > < >
3461 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > * *
3462 }
3463 0 die __FILE__, ": Transliteration replacement not terminated\n";
3464 }
3465 # $1 $2 $3 $4 $5 $6
3466 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { # tr * * *
3467 4 my @tr = ($tr_variable,$2);
3468 4 return e_tr(@tr,'',$4,$6);
3469 }
3470 }
3471 0 die __FILE__, ": Transliteration pattern not terminated\n";
3472 }
3473 }
3474  
3475 # qq//
3476 elsif (/\G \b (qq) \b /oxgc) {
3477 2190 my $ope = $1;
3478  
3479 # if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_qq($ope,$1,$3,$2); } # qq# #
3480 2190 ▶ if (/\G (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 2190 2190
3481 0 my $qq_string = '';
3482 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3483 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 ($Earabic::qq_char) /cgox) { } 0 0 0
3484 0 elsif (/\G (\\\#) /oxgc) { $qq_string .= $1; }
3485 0 elsif (/\G (\#) /oxgc) { return e_qq($ope,'#','#',$qq_string); }
3486 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3487 }
3488 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3489 }
3490  
3491 else {
3492 2190 my $e = '';
3493 2190 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 2190 0 2190
3494 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 2190 2190
elsif (/\G (\() /cgox) { } 0 2190 2190
elsif (/\G (\{) /cgox) { } 2160 30 2190
elsif (/\G (\[) /cgox) { } 0 30 30
elsif (/\G (\<) /cgox) { } 30 0 30
elsif (/\G (\S) /cgox) { } 0 0 0
3495  
3496 # elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq ( )
3497 elsif (/\G (\() /oxgc) { # qq ( )
3498 0 my $qq_string = '';
3499 0 local $nest = 1;
3500 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3501 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 ($Earabic::qq_char) /cgox) { } 0 0 0
3502 0 elsif (/\G (\\\)) /oxgc) { $qq_string .= $1; }
3503 0 elsif (/\G (\() /oxgc) { $qq_string .= $1; $nest++; }
3504 elsif (/\G (\)) /oxgc) {
3505 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'(',')',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Earabic::nest == 0) { } 0 0 0
3506 0 else { $qq_string .= $1; }
3507 }
3508 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3509 }
3510 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3511 }
3512  
3513 # elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq { }
3514 elsif (/\G (\{) /oxgc) { # qq { }
3515 2160 my $qq_string = '';
3516 2160 local $nest = 1;
3517 2160 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 85352 0 85352
3518 85352 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 5 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 610 84742 85352
elsif (/\G (\\\}) /cgox) { } 0 84742 84742
elsif (/\G (\{) /cgox) { } 1227 83515 84742
elsif (/\G (\}) /cgox) { } 3387 80128 83515
elsif (/\G ($Earabic::qq_char) /cgox) { } 80128 0 80128
3519 0 elsif (/\G (\\\}) /oxgc) { $qq_string .= $1; }
3520 1227 elsif (/\G (\{) /oxgc) { $qq_string .= $1; $nest++; }
3521 elsif (/\G (\}) /oxgc) {
3522 3387 ▶ if (--$nest == 0) { return $e . e_qq($ope,'{','}',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Earabic::nest == 0) { } 2160 1227 3387
3523 1227 else { $qq_string .= $1; }
3524 }
3525 80128 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3526 }
3527 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3528 }
3529  
3530 # elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq [ ]
3531 elsif (/\G (\[) /oxgc) { # qq [ ]
3532 0 my $qq_string = '';
3533 0 local $nest = 1;
3534 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3535 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 ($Earabic::qq_char) /cgox) { } 0 0 0
3536 0 elsif (/\G (\\\]) /oxgc) { $qq_string .= $1; }
3537 0 elsif (/\G (\[) /oxgc) { $qq_string .= $1; $nest++; }
3538 elsif (/\G (\]) /oxgc) {
3539 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'[',']',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Earabic::nest == 0) { } 0 0 0
3540 0 else { $qq_string .= $1; }
3541 }
3542 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3543 }
3544 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3545 }
3546  
3547 # elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq < >
3548 elsif (/\G (\<) /oxgc) { # qq < >
3549 30 my $qq_string = '';
3550 30 local $nest = 1;
3551 30 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 1166 0 1166
3552 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 ($Earabic::qq_char) /cgox) { } 1114 0 1114
3553 0 elsif (/\G (\\\>) /oxgc) { $qq_string .= $1; }
3554 0 elsif (/\G (\<) /oxgc) { $qq_string .= $1; $nest++; }
3555 elsif (/\G (\>) /oxgc) {
3556 30 ▶ if (--$nest == 0) { return $e . e_qq($ope,'<','>',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Earabic::nest == 0) { } 30 0 30
3557 0 else { $qq_string .= $1; }
3558 }
3559 1114 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3560 }
3561 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3562 }
3563  
3564 # elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq * *
3565 elsif (/\G (\S) /oxgc) { # qq * *
3566 0 my $delimiter = $1;
3567 0 my $qq_string = '';
3568 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3569 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 ($Earabic::qq_char) /cgox) { } 0 0 0
3570 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $qq_string .= $1; }
3571 0 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_qq($ope,$delimiter,$delimiter,$qq_string); }
3572 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3573 }
3574 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3575 }
3576 }
3577 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3578 }
3579 }
3580  
3581 # qr//
3582 elsif (/\G \b (qr) \b /oxgc) {
3583 0 my $ope = $1;
3584 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { # qr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Earabic::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3585 0 return e_qr($ope,$1,$3,$2,$4);
3586 }
3587 else {
3588 0 my $e = '';
3589 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3590 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 (\') ((?:$Earabic::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G ([*\-:?\\^|]) ((?:$Earabic::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Earabic::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3591 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr ( )
3592 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr { }
3593 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr [ ]
3594 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr < >
3595 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # qr ' '
3596 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # qr | | --> qr { }
3597 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr * *
3598 }
3599 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3600 }
3601 }
3602  
3603 # qw//
3604 elsif (/\G \b (qw) \b /oxgc) {
3605 14 my $ope = $1;
3606 14 ▶ if (/\G (\#) (.*?) (\#) /oxmsgc) { # qw# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) (.*?) (\#) /cgmosx) { } 0 14 14
3607 0 return e_qw($ope,$1,$3,$2);
3608 }
3609 else {
3610 14 my $e = '';
3611 14 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 14 0 14
3612 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 11 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 14 14
elsif (/\G (\() ([^(]*?) (\)) /cgmosx) { } 14 0 14
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) ((?:$Earabic::q_char)*?) (\1) /cgmosx) { } 0 0 0
3613  
3614 14 elsif (/\G (\() ([^(]*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3615 0 elsif (/\G (\() ((?:$q_paren)*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3616  
3617 0 elsif (/\G (\{) ([^{]*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3618 0 elsif (/\G (\{) ((?:$q_brace)*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3619  
3620 0 elsif (/\G (\[) ([^[]*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3621 0 elsif (/\G (\[) ((?:$q_bracket)*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3622  
3623 0 elsif (/\G (\<) ([^<]*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3624 0 elsif (/\G (\<) ((?:$q_angle)*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3625  
3626 0 elsif (/\G ([\x21-\x3F]) (.*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3627 0 elsif (/\G (\S) ((?:$q_char)*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3628 }
3629 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3630 }
3631 }
3632  
3633 # qx//
3634 elsif (/\G \b (qx) \b /oxgc) {
3635 0 my $ope = $1;
3636 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Earabic::qq_char)*?) (\#) /cgox) { } 0 0 0
3637 0 return e_qq($ope,$1,$3,$2);
3638 }
3639 else {
3640 0 my $e = '';
3641 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3642 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 (\') ((?:$Earabic::qq_char)*?) (\') /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Earabic::qq_char)*?) (\1) /cgox) { } 0 0 0
3643 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx ( )
3644 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx { }
3645 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx [ ]
3646 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx < >
3647 0 elsif (/\G (\') ((?:$qq_char)*?) (\') /oxgc) { return $e . e_q ($ope,$1,$3,$2); } # qx ' '
3648 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx * *
3649 }
3650 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3651 }
3652 }
3653  
3654 # q//
3655 elsif (/\G \b (q) \b /oxgc) {
3656 713 my $ope = $1;
3657  
3658 # if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_q($ope,$1,$3,$2); } # q# #
3659  
3660 # avoid "Error: Runtime exception" of perl version 5.005_03
3661 # (and so on)
3662  
3663 713 ▶ if (/\G (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 713 713
3664 0 my $q_string = '';
3665 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3666 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 ($Earabic::q_char) /cgox) { } 0 0 0
3667 0 elsif (/\G (\\\#) /oxgc) { $q_string .= $1; }
3668 0 elsif (/\G (\#) /oxgc) { return e_q($ope,'#','#',$q_string); }
3669 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3670 }
3671 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3672 }
3673  
3674 else {
3675 713 my $e = '';
3676 713 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 713 0 713
3677 0 ▶ if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G ((?>\s+)|\#.*) /cgox) { } 0 713 713
elsif (/\G (\() /cgox) { } 0 713 713
elsif (/\G (\{) /cgox) { } 707 6 713
elsif (/\G (\[) /cgox) { } 0 6 6
elsif (/\G (\<) /cgox) { } 5 1 6
elsif (/\G (\S) /cgox) { } 1 0 1
3678  
3679 # elsif (/\G (\() ((?:\\\)|\\\\|$q_paren)*?) (\)) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q ( )
3680 elsif (/\G (\() /oxgc) { # q ( )
3681 0 my $q_string = '';
3682 0 local $nest = 1;
3683 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3684 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 ($Earabic::q_char) /cgox) { } 0 0 0
3685 0 elsif (/\G (\\\)) /oxgc) { $q_string .= $1; }
3686 0 elsif (/\G (\\\() /oxgc) { $q_string .= $1; }
3687 0 elsif (/\G (\() /oxgc) { $q_string .= $1; $nest++; }
3688 elsif (/\G (\)) /oxgc) {
3689 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'(',')',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Earabic::nest == 0) { } 0 0 0
3690 0 else { $q_string .= $1; }
3691 }
3692 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3693 }
3694 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3695 }
3696  
3697 # elsif (/\G (\{) ((?:\\\}|\\\\|$q_brace)*?) (\}) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q { }
3698 elsif (/\G (\{) /oxgc) { # q { }
3699 707 my $q_string = '';
3700 707 local $nest = 1;
3701 707 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 23645 0 23645
3702 0 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 6 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 23645 23645
elsif (/\G (\\\}) /cgox) { } 0 23645 23645
elsif (/\G (\\\{) /cgox) { } 0 23645 23645
elsif (/\G (\{) /cgox) { } 227 23418 23645
elsif (/\G (\}) /cgox) { } 934 22484 23418
elsif (/\G ($Earabic::q_char) /cgox) { } 22484 0 22484
3703 0 elsif (/\G (\\\}) /oxgc) { $q_string .= $1; }
3704 0 elsif (/\G (\\\{) /oxgc) { $q_string .= $1; }
3705 227 elsif (/\G (\{) /oxgc) { $q_string .= $1; $nest++; }
3706 elsif (/\G (\}) /oxgc) {
3707 934 ▶ if (--$nest == 0) { return $e . e_q($ope,'{','}',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Earabic::nest == 0) { } 707 227 934
3708 227 else { $q_string .= $1; }
3709 }
3710 22484 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3711 }
3712 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3713 }
3714  
3715 # elsif (/\G (\[) ((?:\\\]|\\\\|$q_bracket)*?) (\]) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q [ ]
3716 elsif (/\G (\[) /oxgc) { # q [ ]
3717 0 my $q_string = '';
3718 0 local $nest = 1;
3719 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3720 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 ($Earabic::q_char) /cgox) { } 0 0 0
3721 0 elsif (/\G (\\\]) /oxgc) { $q_string .= $1; }
3722 0 elsif (/\G (\\\[) /oxgc) { $q_string .= $1; }
3723 0 elsif (/\G (\[) /oxgc) { $q_string .= $1; $nest++; }
3724 elsif (/\G (\]) /oxgc) {
3725 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'[',']',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Earabic::nest == 0) { } 0 0 0
3726 0 else { $q_string .= $1; }
3727 }
3728 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3729 }
3730 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3731 }
3732  
3733 # elsif (/\G (\<) ((?:\\\>|\\\\|$q_angle)*?) (\>) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q < >
3734 elsif (/\G (\<) /oxgc) { # q < >
3735 5 my $q_string = '';
3736 5 local $nest = 1;
3737 5 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 88 0 88
3738 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 ($Earabic::q_char) /cgox) { } 83 0 83
3739 0 elsif (/\G (\\\>) /oxgc) { $q_string .= $1; }
3740 0 elsif (/\G (\\\<) /oxgc) { $q_string .= $1; }
3741 0 elsif (/\G (\<) /oxgc) { $q_string .= $1; $nest++; }
3742 elsif (/\G (\>) /oxgc) {
3743 5 ▶ if (--$nest == 0) { return $e . e_q($ope,'<','>',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Earabic::nest == 0) { } 5 0 5
3744 0 else { $q_string .= $1; }
3745 }
3746 83 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3747 }
3748 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3749 }
3750  
3751 # elsif (/\G (\S) ((?:\\\1|\\\\|$q_char)*?) (\1) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q * *
3752 elsif (/\G (\S) /oxgc) { # q * *
3753 1 my $delimiter = $1;
3754 1 my $q_string = '';
3755 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 14 0 14
3756 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 ($Earabic::q_char) /cgox) { } 13 0 13
3757 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $q_string .= $1; }
3758 1 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_q($ope,$delimiter,$delimiter,$q_string); }
3759 13 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3760 }
3761 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3762 }
3763 }
3764 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3765 }
3766 }
3767  
3768 # m//
3769 elsif (/\G \b (m) \b /oxgc) {
3770 209 my $ope = $1;
3771 209 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { # m# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Earabic::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
3772 0 return e_qr($ope,$1,$3,$2,$4);
3773 }
3774 else {
3775 209 my $e = '';
3776 209 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 209 0 209
3777 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 (\?) ((?:$Earabic::qq_char)*?) (\?) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\') ((?:$Earabic::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 10 199 209
elsif (/\G ([*\-:\\^|]) ((?:$Earabic::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 199 199
elsif (/\G (\S) ((?:$Earabic::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 199 0 199
3778 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ( )
3779 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m { }
3780 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m [ ]
3781 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m < >
3782 0 elsif (/\G (\?) ((?:$qq_char)*?) (\?) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ? ?
3783 10 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # m ' '
3784 0 elsif (/\G ([*\-:\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # m | | --> m { }
3785 199 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m * *
3786 }
3787 0 die __FILE__, ": Search pattern not terminated\n";
3788 }
3789 }
3790  
3791 # s///
3792  
3793 # about [cegimosxpradlunbB]* (/cg modifier)
3794 #
3795 # P.67 Pattern-Matching Operators
3796 # of ISBN 0-596-00241-6 Perl in a Nutshell, Second Edition.
3797  
3798 elsif (/\G \b (s) \b /oxgc) {
3799 101 my $ope = $1;
3800  
3801 # $1 $2 $3 $4 $5 $6
3802 101 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cegimosxpradlunbB]*) /oxgc) { # s# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Earabic::qq_char)*?) (\#) ((?:$Earabic::qq_char)*?) (\#) ([cegimosxpradlunbB]*) /cgox) { } 1 100 101
3803 1 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3804 }
3805 else {
3806 100 my $e = '';
3807 100 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 100 0 100
3808 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 (\') ((?:$Earabic::qq_char)*?) (\') ((?:$Earabic::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 21 79 100
elsif (/\G ([*\-:?\\^|]) ((?:$Earabic::qq_char)*?) (\1) ((?:$Earabic::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\$) ((?:$Earabic::qq_char)*?) (\1) ((?:$Earabic::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\S) ((?:$Earabic::qq_char)*?) (\1) ((?:$Earabic::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 79 0 79
3809 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3810 0 my @s = ($1,$2,$3);
3811 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3812 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 (\') ((?:$Earabic::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Earabic::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Earabic::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Earabic::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Earabic::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3813 # $1 $2 $3 $4
3814 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3815 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3816 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3817 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3818 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3819 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3820 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3821 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3822 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3823 }
3824 0 die __FILE__, ": Substitution replacement not terminated\n";
3825 }
3826 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3827 0 my @s = ($1,$2,$3);
3828 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3829 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 (\') ((?:$Earabic::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Earabic::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Earabic::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Earabic::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Earabic::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3830 # $1 $2 $3 $4
3831 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3832 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3833 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3834 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3835 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3836 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3837 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3838 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3839 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3840 }
3841 0 die __FILE__, ": Substitution replacement not terminated\n";
3842 }
3843 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3844 0 my @s = ($1,$2,$3);
3845 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3846 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 (\') ((?:$Earabic::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Earabic::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Earabic::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3847 # $1 $2 $3 $4
3848 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3849 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3850 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3851 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3852 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3853 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3854 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3855 }
3856 0 die __FILE__, ": Substitution replacement not terminated\n";
3857 }
3858 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3859 0 my @s = ($1,$2,$3);
3860 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3861 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 (\') ((?:$Earabic::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Earabic::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Earabic::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Earabic::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Earabic::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3862 # $1 $2 $3 $4
3863 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3864 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3865 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3866 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3867 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3868 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3869 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3870 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3871 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3872 }
3873 0 die __FILE__, ": Substitution replacement not terminated\n";
3874 }
3875 # $1 $2 $3 $4 $5 $6
3876 elsif (/\G (\') ((?:$qq_char)*?) (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) {
3877 21 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3878 }
3879 # $1 $2 $3 $4 $5 $6
3880 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3881 0 return e_sub($sub_variable,'{',$2,'}','{',$4,'}',$6); # s | | | --> s { } { }
3882 }
3883 # $1 $2 $3 $4 $5 $6
3884 elsif (/\G (\$) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3885 0 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3886 }
3887 # $1 $2 $3 $4 $5 $6
3888 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3889 79 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3890 }
3891 }
3892 0 die __FILE__, ": Substitution pattern not terminated\n";
3893 }
3894 }
3895  
3896 # require ignore module
3897 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# require$1$2"; }
3898 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# require$1\n$2"; }
3899 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# require$1"; }
3900  
3901 # use strict; --> use strict; no strict qw(refs);
3902 37 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "use$1 no strict qw(refs);$2"; }
3903 0 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /oxmsgc) { return "use$1 no strict qw(refs);\n$2"; }
3904 0 elsif (/\G \b use ((?>\s+) strict) \b /oxmsgc) { return "use$1; no strict qw(refs)"; }
3905  
3906 # use 5.12.0; --> use 5.12.0; no strict qw(refs);
3907 elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
3908 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
3909 0 return "use $1; no strict qw(refs);";
3910 }
3911 else {
3912 2 return "use $1;";
3913 }
3914 }
3915 elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
3916 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
3917 0 return "use $1; no strict qw(refs);";
3918 }
3919 else {
3920 0 return "use $1;";
3921 }
3922 }
3923  
3924 # ignore use module
3925 2 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# use$1$2"; }
3926 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# use$1\n$2"; }
3927 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# use$1"; }
3928  
3929 # ignore no module
3930 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# no$1$2"; }
3931 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# no$1\n$2"; }
3932 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# no$1"; }
3933  
3934 # use else
3935 0 elsif (/\G \b use \b /oxmsgc) { return "use"; }
3936  
3937 # use else
3938 2 elsif (/\G \b no \b /oxmsgc) { return "no"; }
3939  
3940 # ''
3941 elsif (/\G (?<![\w\$\@\%\&\*]) (\') /oxgc) {
3942 922 my $q_string = '';
3943 922 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 11755 0 11755
3944 11755 ▶ if (/\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 4 11751 11755
elsif (/\G (\\\') /cgox) { } 12 11739 11751
elsif (/\G \' /cgox) { } 922 10817 11739
elsif (/\G ($Earabic::q_char) /cgox) { } 10817 0 10817
3945 12 elsif (/\G (\\\') /oxgc) { $q_string .= $1; }
3946 922 elsif (/\G \' /oxgc) { return e_q('', "'","'",$q_string); }
3947 10817 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3948 }
3949 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3950 }
3951  
3952 # ""
3953 elsif (/\G (\") /oxgc) {
3954 1645 my $qq_string = '';
3955 1645 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 38928 0 38928
3956 38928 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 67 38861 38928
elsif (/\G (\\\") /cgox) { } 12 38849 38861
elsif (/\G \" /cgox) { } 1645 37204 38849
elsif (/\G ($Earabic::q_char) /cgox) { } 37204 0 37204
3957 12 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; }
3958 1645 elsif (/\G \" /oxgc) { return e_qq('', '"','"',$qq_string); }
3959 37204 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
3960 }
3961 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3962 }
3963  
3964 # ``
3965 elsif (/\G (\`) /oxgc) {
3966 1 my $qx_string = '';
3967 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 19 0 19
3968 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 ($Earabic::q_char) /cgox) { } 18 0 18
3969 0 elsif (/\G (\\\`) /oxgc) { $qx_string .= $1; }
3970 1 elsif (/\G \` /oxgc) { return e_qq('', '`','`',$qx_string); }
3971 18 elsif (/\G ($q_char) /oxgc) { $qx_string .= $1; }
3972 }
3973 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3974 }
3975  
3976 # // --- not divide operator (num / num), not defined-or
3977 ▶ elsif (($slash eq 'm//') and /\G (\/) /oxgc) {
Condition100%3/3
$Earabic::slash eq "m//" and m[\G (/) ]cgox
!ll&&!rl&&r
303899702425
MC/DC100%2/2
$Earabic::slash eq "m//" and m[\G (/) ]cgox
$Earabic::slash eq "m//" m[\G (/) ]cgox
Truth table100%3/3
A and B
A= $Earabic::slash eq "m//"B= m[\G (/) ]cgox
ABresult
0X0
100
111
3978 425 my $regexp = '';
3979 425 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 4222 0 4222
3980 0 ▶ if (/\G (\\\\) /oxgc) { $regexp .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 0 4222 4222
elsif (m[\G (\\/) ]cgox) { } 0 4222 4222
elsif (m[\G / ([cgimosxpadlunbB]*) ]cgox) { } 425 3797 4222
elsif (/\G ($Earabic::q_char) /cgox) { } 3797 0 3797
3981 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; }
3982 425 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_qr('', '/','/',$regexp,$1); }
3983 3797 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3984 }
3985 0 die __FILE__, ": Search pattern not terminated\n";
3986 }
3987  
3988 # ?? --- not conditional operator (condition ? then : else)
3989 ▶ elsif (($slash eq 'm//') and /\G (\?) /oxgc) {
Condition66%2/3
$Earabic::slash eq "m//" and /\G (\?) /cgox
!ll&&!rl&&r
3038997020
MC/DC0%0/2
$Earabic::slash eq "m//" and /\G (\?) /cgox
$Earabic::slash eq "m//" /\G (\?) /cgox
Truth table66%2/3
A and B
A= $Earabic::slash eq "m//"B= /\G (\?) /cgox
ABresult
0X0
100
111
3990 0 my $regexp = '';
3991 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3992 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 ($Earabic::q_char) /cgox) { } 0 0 0
3993 0 elsif (/\G (\\\?) /oxgc) { $regexp .= $1; }
3994 0 elsif (/\G \? ([cgimosxpadlunbB]*) /oxgc) { return e_qr('m','?','?',$regexp,$1); }
3995 0 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3996 }
3997 0 die __FILE__, ": Search pattern not terminated\n";
3998 }
3999  
4000 # <<>> (a safer ARGV)
4001 0 elsif (/\G ( <<>> ) /oxgc) { $slash = 'm//'; return $1; }
4002  
4003 # << (bit shift) --- not here document
4004 0 elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) { $slash = 'm//'; return $1; }
4005  
4006 # <<~'HEREDOC'
4007 elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4008 6 $slash = 'm//';
4009 6 my $here_quote = $1;
4010 6 my $delimiter = $2;
4011  
4012 # get here document
4013 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4014 6 $here_script = CORE::substr $_, pos $_;
4015 6 $here_script =~ s/.*?\n//oxm;
4016 }
4017 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
4018 6 my $heredoc = $1;
4019 6 my $indent = $2;
4020 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4021 6 push @heredoc, $heredoc . qq{\n$delimiter\n};
4022 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4023 }
4024 else {
4025 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4026 }
4027 6 return qq{<<'$delimiter'};
4028 }
4029  
4030 # <<~\HEREDOC
4031  
4032 # P.66 2.6.6. "Here" Documents
4033 # in Chapter 2: Bits and Pieces
4034 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4035  
4036 # P.73 "Here" Documents
4037 # in Chapter 2: Bits and Pieces
4038 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4039  
4040 elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4041 3 $slash = 'm//';
4042 3 my $here_quote = $1;
4043 3 my $delimiter = $2;
4044  
4045 # get here document
4046 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4047 3 $here_script = CORE::substr $_, pos $_;
4048 3 $here_script =~ s/.*?\n//oxm;
4049 }
4050 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
4051 3 my $heredoc = $1;
4052 3 my $indent = $2;
4053 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4054 3 push @heredoc, $heredoc . qq{\n$delimiter\n};
4055 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4056 }
4057 else {
4058 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4059 }
4060 3 return qq{<<\\$delimiter};
4061 }
4062  
4063 # <<~"HEREDOC"
4064 elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4065 6 $slash = 'm//';
4066 6 my $here_quote = $1;
4067 6 my $delimiter = $2;
4068  
4069 # get here document
4070 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4071 6 $here_script = CORE::substr $_, pos $_;
4072 6 $here_script =~ s/.*?\n//oxm;
4073 }
4074 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
4075 6 my $heredoc = $1;
4076 6 my $indent = $2;
4077 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4078 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4079 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4080 }
4081 else {
4082 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4083 }
4084 6 return qq{<<"$delimiter"};
4085 }
4086  
4087 # <<~HEREDOC
4088 elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4089 3 $slash = 'm//';
4090 3 my $here_quote = $1;
4091 3 my $delimiter = $2;
4092  
4093 # get here document
4094 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4095 3 $here_script = CORE::substr $_, pos $_;
4096 3 $here_script =~ s/.*?\n//oxm;
4097 }
4098 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
4099 3 my $heredoc = $1;
4100 3 my $indent = $2;
4101 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4102 3 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4103 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4104 }
4105 else {
4106 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4107 }
4108 3 return qq{<<$delimiter};
4109 }
4110  
4111 # <<~`HEREDOC`
4112 elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4113 6 $slash = 'm//';
4114 6 my $here_quote = $1;
4115 6 my $delimiter = $2;
4116  
4117 # get here document
4118 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4119 6 $here_script = CORE::substr $_, pos $_;
4120 6 $here_script =~ s/.*?\n//oxm;
4121 }
4122 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
4123 6 my $heredoc = $1;
4124 6 my $indent = $2;
4125 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4126 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4127 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4128 }
4129 else {
4130 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4131 }
4132 6 return qq{<<`$delimiter`};
4133 }
4134  
4135 # <<'HEREDOC'
4136 elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
4137 72 $slash = 'm//';
4138 72 my $here_quote = $1;
4139 72 my $delimiter = $2;
4140  
4141 # get here document
4142 72 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 72 0 72
4143 72 $here_script = CORE::substr $_, pos $_;
4144 72 $here_script =~ s/.*?\n//oxm;
4145 }
4146 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
4147 72 push @heredoc, $1 . qq{\n$delimiter\n};
4148 72 push @heredoc_delimiter, $delimiter;
4149 }
4150 else {
4151 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4152 }
4153 72 return $here_quote;
4154 }
4155  
4156 # <<\HEREDOC
4157  
4158 # P.66 2.6.6. "Here" Documents
4159 # in Chapter 2: Bits and Pieces
4160 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4161  
4162 # P.73 "Here" Documents
4163 # in Chapter 2: Bits and Pieces
4164 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4165  
4166 elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
4167 0 $slash = 'm//';
4168 0 my $here_quote = $1;
4169 0 my $delimiter = $2;
4170  
4171 # get here document
4172 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4173 0 $here_script = CORE::substr $_, pos $_;
4174 0 $here_script =~ s/.*?\n//oxm;
4175 }
4176 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
4177 0 push @heredoc, $1 . qq{\n$delimiter\n};
4178 0 push @heredoc_delimiter, $delimiter;
4179 }
4180 else {
4181 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4182 }
4183 0 return $here_quote;
4184 }
4185  
4186 # <<"HEREDOC"
4187 elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
4188 36 $slash = 'm//';
4189 36 my $here_quote = $1;
4190 36 my $delimiter = $2;
4191  
4192 # get here document
4193 36 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 36 0 36
4194 36 $here_script = CORE::substr $_, pos $_;
4195 36 $here_script =~ s/.*?\n//oxm;
4196 }
4197 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
4198 36 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4199 36 push @heredoc_delimiter, $delimiter;
4200 }
4201 else {
4202 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4203 }
4204 36 return $here_quote;
4205 }
4206  
4207 # <<HEREDOC
4208 elsif (/\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
4209 42 $slash = 'm//';
4210 42 my $here_quote = $1;
4211 42 my $delimiter = $2;
4212  
4213 # get here document
4214 42 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 42 0 42
4215 42 $here_script = CORE::substr $_, pos $_;
4216 42 $here_script =~ s/.*?\n//oxm;
4217 }
4218 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
4219 42 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4220 42 push @heredoc_delimiter, $delimiter;
4221 }
4222 else {
4223 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4224 }
4225 42 return $here_quote;
4226 }
4227  
4228 # <<`HEREDOC`
4229 elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
4230 0 $slash = 'm//';
4231 0 my $here_quote = $1;
4232 0 my $delimiter = $2;
4233  
4234 # get here document
4235 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4236 0 $here_script = CORE::substr $_, pos $_;
4237 0 $here_script =~ s/.*?\n//oxm;
4238 }
4239 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
4240 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4241 0 push @heredoc_delimiter, $delimiter;
4242 }
4243 else {
4244 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4245 }
4246 0 return $here_quote;
4247 }
4248  
4249 # <<= <=> <= < operator
4250 elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) {
4251 12 return $1;
4252 }
4253  
4254 # <FILEHANDLE>
4255 elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) {
4256 0 return $1;
4257 }
4258  
4259 # <WILDCARD> --- glob
4260  
4261 # avoid "Error: Runtime exception" of perl version 5.005_03
4262  
4263 elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /oxgc) {
4264 0 return 'Earabic::glob("' . $1 . '")';
4265 }
4266  
4267 # __DATA__
4268 0 elsif (/\G ^ ( __DATA__ \n .*) \z /oxmsgc) { return $1; }
4269  
4270 # __END__
4271 210 elsif (/\G ^ ( __END__ \n .*) \z /oxmsgc) { return $1; }
4272  
4273 # \cD Control-D
4274  
4275 # P.68 2.6.8. Other Literal Tokens
4276 # in Chapter 2: Bits and Pieces
4277 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4278  
4279 # P.76 Other Literal Tokens
4280 # in Chapter 2: Bits and Pieces
4281 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4282  
4283 0 elsif (/\G ( \cD .*) \z /oxmsgc) { return $1; }
4284  
4285 # \cZ Control-Z
4286 0 elsif (/\G ( \cZ .*) \z /oxmsgc) { return $1; }
4287  
4288 # any operator before div
4289 elsif (/\G (
4290 -- | \+\+ |
4291 [\)\}\]]
4292  
4293 6003 ) /oxgc) { $slash = 'div'; return $1; }
4294  
4295 # yada-yada or triple-dot operator
4296 elsif (/\G (
4297 \.\.\.
4298  
4299 7 ) /oxgc) { $slash = 'm//'; return q{die('Unimplemented')}; }
4300  
4301 # any operator before m//
4302  
4303 # //, //= (defined-or)
4304  
4305 # P.164 Logical Operators
4306 # in Chapter 10: More Control Structures
4307 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4308  
4309 # P.119 C-Style Logical (Short-Circuit) Operators
4310 # in Chapter 3: Unary and Binary Operators
4311 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4312  
4313 # (and so on)
4314  
4315 # ~~
4316  
4317 # P.221 The Smart Match Operator
4318 # in Chapter 15: Smart Matching and given-when
4319 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4320  
4321 # P.112 Smartmatch Operator
4322 # in Chapter 3: Unary and Binary Operators
4323 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4324  
4325 # (and so on)
4326  
4327 elsif (/\G ((?>
4328  
4329 !~~ | !~ | != | ! |
4330 %= | % |
4331 &&= | && | &= | &\.= | &\. | & |
4332 -= | -> | - |
4333 :(?>\s*)= |
4334 : |
4335 <<>> |
4336 <<= | <=> | <= | < |
4337 == | => | =~ | = |
4338 >>= | >> | >= | > |
4339 \*\*= | \*\* | \*= | \* |
4340 \+= | \+ |
4341 \.\. | \.= | \. |
4342 \/\/= | \/\/ |
4343 \/= | \/ |
4344 \? |
4345 \\ |
4346 \^= | \^\.= | \^\. | \^ |
4347 \b x= |
4348 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
4349 ~~ | ~\. | ~ |
4350 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
4351 \b(?: print )\b |
4352  
4353 [,;\(\{\[]
4354  
4355 10268 )) /oxgc) { $slash = 'm//'; return $1; }
4356  
4357 # other any character
4358 23417 elsif (/\G ($q_char) /oxgc) { $slash = 'div'; return $1; }
4359  
4360 # system error
4361 else {
4362 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4363 }
4364 }
4365  
4366 # escape Arabic string
4367 1854 ▶sub e_string {
Subroutine e_string: called CC=54 SCAR=72.5
Pod documented
4368 1854 my($string) = @_;
4369 1854 my $e_string = '';
4370  
4371 1854 local $slash = 'm//';
4372  
4373 # P.1024 Appendix W.10 Multibyte Processing
4374 # of ISBN 1-56592-224-7 CJKV Information Processing
4375 # (and so on)
4376  
4377 1854 my @char = $string =~ / \G (?>[^\\]|\\$q_char|$q_char) /oxmsg;
4378  
4379 # without { ... }
4380 1854 ▶ 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) 1836 18 1854
Condition66%2/3
grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char
!ll&&!rl&&r
1836018
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
4381 1836 ▶ if ($string !~ /<</oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /<</mosx) 1836 0 1836
4382 1836 return $string;
4383 }
4384 }
4385  
4386 E_STRING_LOOP:
4387 18 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 218 18 236
4388 218 ▶ if (0) {
Branch: 24 branches
BranchTrueFalseTotal
if (do { $string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx }) { } 0 218 218
elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 0 218 218
elsif ($string =~ /\G ( \$' | \$\{'\} ) /cgmosx) { } 0 218 218
elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 0 218 218
elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 218 218
elsif ($string =~ /\G ( \$ 0 ) /cgmosx) { } 0 218 218
elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 218 218
elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 0 218 218
elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 0 218 218
elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 218 218
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 218 218
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 218 218
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 218 218
elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /cgmosx) { } 0 218 218
elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 3 215 218
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) { } 6 209 215
elsif ($string =~ m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 0 209 209
elsif ($string =~ /\G \b (qq) \b /cgox) { } 0 209 209
elsif ($string =~ /\G \b (qx) \b /cgox) { } 0 209 209
elsif ($string =~ /\G \b (q) \b /cgox) { } 0 209 209
elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$Earabic::q_char)*?) (\') /cgox) { } 0 209 209
elsif ($string =~ /\G (\") ((?:$Earabic::qq_char)*?) (\") /cgox) { } 0 209 209
elsif ($string =~ /\G (\`) ((?:$Earabic::qq_char)*?) (\`) /cgox) { } 0 209 209
elsif ($string =~ /\G ($Earabic::q_char) /cgox) { } 209 0 209
4389 }
4390  
4391 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> @{[Earabic::PREMATCH()]}
4392 elsif ($string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
4393 0 $e_string .= q{Earabic::PREMATCH()};
4394 0 $slash = 'div';
4395 }
4396  
4397 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> @{[Earabic::MATCH()]}
4398 elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
4399 0 $e_string .= q{Earabic::MATCH()};
4400 0 $slash = 'div';
4401 }
4402  
4403 # $', ${'} --> $', ${'}
4404 elsif ($string =~ /\G ( \$' | \$\{'\} ) /oxmsgc) {
4405 0 $e_string .= $1;
4406 0 $slash = 'div';
4407 }
4408  
4409 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> @{[Earabic::POSTMATCH()]}
4410 elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
4411 0 $e_string .= q{Earabic::POSTMATCH()};
4412 0 $slash = 'div';
4413 }
4414  
4415 # bareword
4416 elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
4417 0 $e_string .= $1;
4418 0 $slash = 'div';
4419 }
4420  
4421 # $0 --> $0
4422 elsif ($string =~ /\G ( \$ 0 ) /oxmsgc) {
4423 0 $e_string .= $1;
4424 0 $slash = 'div';
4425 }
4426 elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
4427 0 $e_string .= $1;
4428 0 $slash = 'div';
4429 }
4430  
4431 # $$ --> $$
4432 elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
4433 0 $e_string .= $1;
4434 0 $slash = 'div';
4435 }
4436  
4437 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4438 # $1, $2, $3 --> $1, $2, $3 otherwise
4439 elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
4440 0 $e_string .= e_capture($1);
4441 0 $slash = 'div';
4442 }
4443 elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
4444 0 $e_string .= e_capture($1);
4445 0 $slash = 'div';
4446 }
4447  
4448 # $$foo[ ... ] --> $ $foo->[ ... ]
4449 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
4450 0 $e_string .= e_capture($1.'->'.$2);
4451 0 $slash = 'div';
4452 }
4453  
4454 # $$foo{ ... } --> $ $foo->{ ... }
4455 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
4456 0 $e_string .= e_capture($1.'->'.$2);
4457 0 $slash = 'div';
4458 }
4459  
4460 # $$foo
4461 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
4462 0 $e_string .= e_capture($1);
4463 0 $slash = 'div';
4464 }
4465  
4466 # ${ foo }
4467 elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /oxmsgc) {
4468 0 $e_string .= '${' . $1 . '}';
4469 0 $slash = 'div';
4470 }
4471  
4472 # ${ ... }
4473 elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
4474 3 $e_string .= e_capture($1);
4475 3 $slash = 'div';
4476 }
4477  
4478 # variable or function
4479 # $ @ % & * $ #
4480 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) {
4481 6 $e_string .= $1;
4482 6 $slash = 'div';
4483 }
4484 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
4485 # $ @ # \ ' " / ? ( ) [ ] < >
4486 elsif ($string =~ /\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
4487 0 $e_string .= $1;
4488 0 $slash = 'div';
4489 }
4490  
4491 # qq//
4492 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4493 0 my $ope = $1;
4494 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Earabic::qq_char)*?) (\#) /cgox) { } 0 0 0
4495 0 $e_string .= e_qq($ope,$1,$3,$2);
4496 }
4497 else {
4498 0 my $e = '';
4499 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4500 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) ((?:$Earabic::qq_char)*?) (\1) /cgox) { } 0 0 0
4501 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq ( )
4502 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq { }
4503 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq [ ]
4504 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq < >
4505 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq * *
4506 }
4507 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4508 }
4509 }
4510  
4511 # qx//
4512 elsif ($string =~ /\G \b (qx) \b /oxgc) {
4513 0 my $ope = $1;
4514 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Earabic::qq_char)*?) (\#) /cgox) { } 0 0 0
4515 0 $e_string .= e_qq($ope,$1,$3,$2);
4516 }
4517 else {
4518 0 my $e = '';
4519 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4520 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 (\') ((?:$Earabic::qq_char)*?) (\') /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Earabic::qq_char)*?) (\1) /cgox) { } 0 0 0
4521 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ( )
4522 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx { }
4523 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx [ ]
4524 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx < >
4525 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') /oxgc) { $e_string .= $e . e_q ($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ' '
4526 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx * *
4527 }
4528 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4529 }
4530 }
4531  
4532 # q//
4533 elsif ($string =~ /\G \b (q) \b /oxgc) {
4534 0 my $ope = $1;
4535 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Earabic::q_char)*?) (\#) /cgox) { } 0 0 0
4536 0 $e_string .= e_q($ope,$1,$3,$2);
4537 }
4538 else {
4539 0 my $e = '';
4540 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4541 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| $Earabic::q_char)*?) (\1) /cgox) { } 0 0 0
4542 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q ( )
4543 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q { }
4544 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q [ ]
4545 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q < >
4546 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q * *
4547 }
4548 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4549 }
4550 }
4551  
4552 # ''
4553 0 elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$q_char)*?) (\') /oxgc) { $e_string .= e_q('',$1,$3,$2); }
4554  
4555 # ""
4556 0 elsif ($string =~ /\G (\") ((?:$qq_char)*?) (\") /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4557  
4558 # ``
4559 0 elsif ($string =~ /\G (\`) ((?:$qq_char)*?) (\`) /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4560  
4561 # other any character
4562 209 elsif ($string =~ /\G ($q_char) /oxgc) { $e_string .= $1; }
4563  
4564 # system error
4565 else {
4566 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4567 }
4568 }
4569  
4570 18 return $e_string;
4571 }
4572  
4573 #
4574 # character class
4575 #
4576 1880 ▶sub character_class {
Subroutine character_class: called CC=3 SCAR=11.0
Pod undocumented
4577 1880 my($char,$modifier) = @_;
4578  
4579 1880 ▶ if ($char eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char eq '.') { } 52 1828 1880
4580 52 ▶ if ($modifier =~ /s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/) { } 17 35 52
4581 17 return '${Earabic::dot_s}';
4582 }
4583 else {
4584 35 return '${Earabic::dot}';
4585 }
4586 }
4587 else {
4588 1828 return Earabic::classic_character_class($char);
4589 }
4590 }
4591  
4592 #
4593 # escape capture ($1, $2, $3, ...)
4594 #
4595 212 ▶sub e_capture {
Subroutine e_capture: called CC=1 SCAR=0.0
Pod undocumented
4596  
4597 212 return join '', '${', $_[0], '}';
4598 }
4599  
4600 #
4601 # escape transliteration (tr/// or y///)
4602 #
4603 4 ▶sub e_tr {
Subroutine e_tr: called CC=5 SCAR=16.8
Pod undocumented
4604 4 my($variable,$charclass,$e,$charclass2,$modifier) = @_;
4605 4 my $e_tr = '';
4606 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
4607  
4608 4 $slash = 'div';
4609  
4610 # quote character class 1
4611 4 $charclass = q_tr($charclass);
4612  
4613 # quote character class 2
4614 4 $charclass2 = q_tr($charclass2);
4615  
4616 # /b /B modifier
4617 4 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) { } 0 4 4
4618 0 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 0 0 0
4619 0 $e_tr = qq{tr$charclass$e$charclass2$modifier};
4620 }
4621 else {
4622 0 $e_tr = qq{$variable${bind_operator}tr$charclass$e$charclass2$modifier};
4623 }
4624 }
4625 else {
4626 4 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 2 2 4
4627 2 $e_tr = qq{Earabic::tr(\$_,' =~ ',$charclass,$e$charclass2,'$modifier')};
4628 }
4629 else {
4630 2 $e_tr = qq{Earabic::tr($variable,'$bind_operator',$charclass,$e$charclass2,'$modifier')};
4631 }
4632 }
4633  
4634 # clear tr/// variable
4635 4 $tr_variable = '';
4636 4 $bind_operator = '';
4637  
4638 4 return $e_tr;
4639 }
4640  
4641 #
4642 # quote for escape transliteration (tr/// or y///)
4643 #
4644 8 ▶sub q_tr {
Subroutine q_tr: called CC=9 SCAR=40.6
Pod undocumented
4645 8 my($charclass) = @_;
4646  
4647 # quote character class
4648 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
4649 8 return e_q('', "'", "'", $charclass); # --> q' '
4650 }
4651 elsif ($charclass !~ /\//oxms) {
4652 0 return e_q('q', '/', '/', $charclass); # --> q/ /
4653 }
4654 elsif ($charclass !~ /\#/oxms) {
4655 0 return e_q('q', '#', '#', $charclass); # --> q# #
4656 }
4657 elsif ($charclass !~ /[\<\>]/oxms) {
4658 0 return e_q('q', '<', '>', $charclass); # --> q< >
4659 }
4660 elsif ($charclass !~ /[\(\)]/oxms) {
4661 0 return e_q('q', '(', ')', $charclass); # --> q( )
4662 }
4663 elsif ($charclass !~ /[\{\}]/oxms) {
4664 0 return e_q('q', '{', '}', $charclass); # --> q{ }
4665 }
4666 else {
4667 0 for my $char (qw( ! " $ % & * + . : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
4668 0 ▶ if ($charclass !~ /\Q$char\E/xms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($charclass =~ /\Q$char\E/msx) 0 0 0
4669 0 return e_q('q', $char, $char, $charclass);
4670 }
4671 }
4672 }
4673  
4674 0 return e_q('q', '{', '}', $charclass);
4675 }
4676  
4677 #
4678 # escape q string (q//, '')
4679 #
4680 1643 ▶sub e_q {
Subroutine e_q: called CC=1 SCAR=0.0
Pod undocumented
4681 1643 my($ope,$delimiter,$end_delimiter,$string) = @_;
4682  
4683 1643 $slash = 'div';
4684  
4685 1643 return join '', $ope, $delimiter, $string, $end_delimiter;
4686 }
4687  
4688 #
4689 # escape qq string (qq//, "", qx//, ``)
4690 #
4691 3921 ▶sub e_qq {
Subroutine e_qq: called CC=37 SCAR=50.9
Pod undocumented
4692 3921 my($ope,$delimiter,$end_delimiter,$string) = @_;
4693  
4694 3921 $slash = 'div';
4695  
4696 3921 my $left_e = 0;
4697 3921 my $right_e = 0;
4698  
4699 # split regexp
4700 3921 my @char = $string =~ /\G((?>
4701 [^\\\$] |
4702 \\x\{ (?>[0-9A-Fa-f]+) \} |
4703 \\o\{ (?>[0-7]+) \} |
4704 \\N\{ (?>[^0-9\}][^\}]*) \} |
4705 \\ $q_char |
4706 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
4707 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
4708 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
4709 \$ (?>\s* [0-9]+) |
4710 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
4711 \$ \$ (?![\w\{]) |
4712 \$ (?>\s*) \$ (?>\s*) $qq_variable |
4713 $q_char
4714 ))/oxmsg;
4715  
4716 3921 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 119300 3921 123221
4717  
4718 # "\L\u" --> "\u\L"
4719 119300 ▶ 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 119300 119300
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 119300 119300
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 119299 119300
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 119298 119299
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 119298 119298
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
11930000
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
4720 0 @char[$i,$i+1] = @char[$i+1,$i];
4721 }
4722  
4723 # "\U\l" --> "\l\U"
4724 ▶ 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
11930000
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
4725 0 @char[$i,$i+1] = @char[$i+1,$i];
4726 }
4727  
4728 # octal escape sequence
4729 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
4730 1 $char[$i] = Earabic::octchr($1);
4731 }
4732  
4733 # hexadecimal escape sequence
4734 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
4735 1 $char[$i] = Earabic::hexchr($1);
4736 }
4737  
4738 # \N{CHARNAME} --> N{CHARNAME}
4739 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
4740 0 $char[$i] = $1;
4741 }
4742  
4743 119300 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 484 118816 119300
elsif ($char[$i] eq '\\u') { } 0 118816 118816
elsif ($char[$i] eq '\\l') { } 0 118816 118816
elsif ($char[$i] eq '\\U') { } 0 118816 118816
elsif ($char[$i] eq '\\L') { } 0 118816 118816
elsif ($char[$i] eq '\\F') { } 8 118808 118816
elsif ($char[$i] eq '\\Q') { } 0 118808 118808
elsif ($char[$i] eq '\\E') { } 8 118800 118808
elsif ($char[$i] eq '\\Q') { } 0 118800 118800
elsif ($char[$i] eq '\\E') { } 0 118800 118800
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 4 118796 118800
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 118796 118796
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 118796 118796
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 205 118591 118796
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 118591 118591
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 118591 118591
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 118591 118591
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 118591 118591
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 44 118547 118591
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 45 118502 118547
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 33 118469 118502
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 118469 118469
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 118469 118469
4744 }
4745  
4746 # \F
4747 #
4748 # P.69 Table 2-6. Translation escapes
4749 # in Chapter 2: Bits and Pieces
4750 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4751 # (and so on)
4752  
4753 # \u \l \U \L \F \Q \E
4754 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
4755 484 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 484 484
4756 0 $char[$i] = '\\' . $char[$i];
4757 }
4758 }
4759 elsif ($char[$i] eq '\u') {
4760  
4761 # "STRING @{[ LIST EXPR ]} MORE STRING"
4762  
4763 # P.257 Other Tricks You Can Do with Hard References
4764 # in Chapter 8: References
4765 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4766  
4767 # P.353 Other Tricks You Can Do with Hard References
4768 # in Chapter 8: References
4769 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4770  
4771 # (and so on)
4772  
4773 0 $char[$i] = '@{[Earabic::ucfirst qq<';
4774 0 $left_e++;
4775 }
4776 elsif ($char[$i] eq '\l') {
4777 0 $char[$i] = '@{[Earabic::lcfirst qq<';
4778 0 $left_e++;
4779 }
4780 elsif ($char[$i] eq '\U') {
4781 0 $char[$i] = '@{[Earabic::uc qq<';
4782 0 $left_e++;
4783 }
4784 elsif ($char[$i] eq '\L') {
4785 0 $char[$i] = '@{[Earabic::lc qq<';
4786 0 $left_e++;
4787 }
4788 elsif ($char[$i] eq '\F') {
4789 8 $char[$i] = '@{[Earabic::fc qq<';
4790 8 $left_e++;
4791 }
4792 elsif ($char[$i] eq '\Q') {
4793 0 $char[$i] = '@{[CORE::quotemeta qq<';
4794 0 $left_e++;
4795 }
4796 elsif ($char[$i] eq '\E') {
4797 8 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 8 0 8
4798 8 $char[$i] = '>]}';
4799 8 $right_e++;
4800 }
4801 else {
4802 0 $char[$i] = '';
4803 }
4804 }
4805 elsif ($char[$i] eq '\Q') {
4806 0 while (1) {
4807 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
4808 0 last;
4809 }
4810 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
4811 0 last;
4812 }
4813 }
4814 }
4815 elsif ($char[$i] eq '\E') {
4816 }
4817  
4818 # $0 --> $0
4819 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
4820 }
4821 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
4822 }
4823  
4824 # $$ --> $$
4825 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
4826 }
4827  
4828 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4829 # $1, $2, $3 --> $1, $2, $3 otherwise
4830 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
4831 205 $char[$i] = e_capture($1);
4832 }
4833 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
4834 0 $char[$i] = e_capture($1);
4835 }
4836  
4837 # $$foo[ ... ] --> $ $foo->[ ... ]
4838 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
4839 0 $char[$i] = e_capture($1.'->'.$2);
4840 }
4841  
4842 # $$foo{ ... } --> $ $foo->{ ... }
4843 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
4844 0 $char[$i] = e_capture($1.'->'.$2);
4845 }
4846  
4847 # $$foo
4848 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
4849 0 $char[$i] = e_capture($1);
4850 }
4851  
4852 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Earabic::PREMATCH()
4853 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
4854 44 $char[$i] = '@{[Earabic::PREMATCH()]}';
4855 }
4856  
4857 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Earabic::MATCH()
4858 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
4859 45 $char[$i] = '@{[Earabic::MATCH()]}';
4860 }
4861  
4862 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Earabic::POSTMATCH()
4863 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
4864 33 $char[$i] = '@{[Earabic::POSTMATCH()]}';
4865 }
4866  
4867 # ${ foo } --> ${ foo }
4868 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
4869 }
4870  
4871 # ${ ... }
4872 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
4873 0 $char[$i] = e_capture($1);
4874 }
4875 }
4876  
4877 # return string
4878 3921 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 3921 3921
4879 0 return join '', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter;
4880 }
4881 3921 return join '', $ope, $delimiter, @char, $end_delimiter;
4882 }
4883  
4884 #
4885 # escape qw string (qw//)
4886 #
4887 14 ▶sub e_qw {
Subroutine e_qw: called CC=11 SCAR=43.1
Pod undocumented
4888 14 my($ope,$delimiter,$end_delimiter,$string) = @_;
4889  
4890 14 $slash = 'div';
4891  
4892 # choice again delimiter
4893 14 my %octet = map {$_ => 1} ($string =~ /\G ([\x00-\xFF]) /oxmsg);
4894 14 ▶ if (not $octet{$end_delimiter}) {
Branch: 5 branches
BranchTrueFalseTotal
if (not $octet{$end_delimiter}) { } 14 0 14
elsif (not $octet{')'}) { } 0 0 0
elsif (not $octet{'}'}) { } 0 0 0
elsif (not $octet{']'}) { } 0 0 0
elsif (not $octet{'>'}) { } 0 0 0
4895 14 return join '', $ope, $delimiter, $string, $end_delimiter;
4896 }
4897 elsif (not $octet{')'}) {
4898 0 return join '', $ope, '(', $string, ')';
4899 }
4900 elsif (not $octet{'}'}) {
4901 0 return join '', $ope, '{', $string, '}';
4902 }
4903 elsif (not $octet{']'}) {
4904 0 return join '', $ope, '[', $string, ']';
4905 }
4906 elsif (not $octet{'>'}) {
4907 0 return join '', $ope, '<', $string, '>';
4908 }
4909 else {
4910 0 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
4911 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
4912 0 return join '', $ope, $char, $string, $char;
4913 }
4914 }
4915 }
4916  
4917 # qw/AAA BBB C'CC/ --> ('AAA', 'BBB', 'C\'CC')
4918 0 my @string = CORE::split(/\s+/, $string);
4919 0 for my $string (@string) {
4920 0 my @octet = $string =~ /\G ([\x00-\xFF]) /oxmsg;
4921 0 for my $octet (@octet) {
4922 0 ▶ if ($octet =~ /\A (['\\]) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($octet =~ /\A (['\\]) \z/mosx) 0 0 0
4923 0 $octet = '\\' . $1;
4924 }
4925 }
4926 0 $string = join '', @octet;
4927 }
4928 0 return join '', '(', (join ', ', map { "'$_'" } @string), ')';
4929 }
4930  
4931 #
4932 # escape here document (<<"HEREDOC", <<HEREDOC, <<`HEREDOC`, <<~"HEREDOC", <<~HEREDOC, <<~`HEREDOC`)
4933 #
4934 93 ▶sub e_heredoc {
Subroutine e_heredoc: called CC=37 SCAR=56.3
Pod undocumented
4935 93 my($string) = @_;
4936  
4937 93 $slash = 'm//';
4938  
4939 93 my $metachar = qr/[\@\\|]/oxms; # '|' is for <<`HEREDOC`
4940  
4941 93 my $left_e = 0;
4942 93 my $right_e = 0;
4943  
4944 # split regexp
4945 93 my @char = $string =~ /\G((?>
4946 [^\\\$] |
4947 \\x\{ (?>[0-9A-Fa-f]+) \} |
4948 \\o\{ (?>[0-7]+) \} |
4949 \\N\{ (?>[^0-9\}][^\}]*) \} |
4950 \\ $q_char |
4951 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
4952 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
4953 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
4954 \$ (?>\s* [0-9]+) |
4955 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
4956 \$ \$ (?![\w\{]) |
4957 \$ (?>\s*) \$ (?>\s*) $qq_variable |
4958 $q_char
4959 ))/oxmsg;
4960  
4961 93 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 5449 93 5542
4962  
4963 # "\L\u" --> "\u\L"
4964 5449 ▶ 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 5449 5449
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 5449 5449
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 5448 5449
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 5447 5448
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 5447 5447
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
544900
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
4965 0 @char[$i,$i+1] = @char[$i+1,$i];
4966 }
4967  
4968 # "\U\l" --> "\l\U"
4969 ▶ 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
544900
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
4970 0 @char[$i,$i+1] = @char[$i+1,$i];
4971 }
4972  
4973 # octal escape sequence
4974 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
4975 1 $char[$i] = Earabic::octchr($1);
4976 }
4977  
4978 # hexadecimal escape sequence
4979 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
4980 1 $char[$i] = Earabic::hexchr($1);
4981 }
4982  
4983 # \N{CHARNAME} --> N{CHARNAME}
4984 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
4985 0 $char[$i] = $1;
4986 }
4987  
4988 5449 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 0 5449 5449
elsif ($char[$i] eq '\\u') { } 0 5449 5449
elsif ($char[$i] eq '\\l') { } 0 5449 5449
elsif ($char[$i] eq '\\U') { } 0 5449 5449
elsif ($char[$i] eq '\\L') { } 0 5449 5449
elsif ($char[$i] eq '\\F') { } 0 5449 5449
elsif ($char[$i] eq '\\Q') { } 0 5449 5449
elsif ($char[$i] eq '\\E') { } 0 5449 5449
elsif ($char[$i] eq '\\Q') { } 0 5449 5449
elsif ($char[$i] eq '\\E') { } 0 5449 5449
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 0 5449 5449
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 5449 5449
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 5449 5449
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 0 5449 5449
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 5449 5449
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 5449 5449
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 5449 5449
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 5449 5449
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 8 5441 5449
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 8 5433 5441
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 6 5427 5433
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 5427 5427
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 5427 5427
4989 }
4990  
4991 # \u \l \U \L \F \Q \E
4992 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
4993 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
4994 0 $char[$i] = '\\' . $char[$i];
4995 }
4996 }
4997 elsif ($char[$i] eq '\u') {
4998 0 $char[$i] = '@{[Earabic::ucfirst qq<';
4999 0 $left_e++;
5000 }
5001 elsif ($char[$i] eq '\l') {
5002 0 $char[$i] = '@{[Earabic::lcfirst qq<';
5003 0 $left_e++;
5004 }
5005 elsif ($char[$i] eq '\U') {
5006 0 $char[$i] = '@{[Earabic::uc qq<';
5007 0 $left_e++;
5008 }
5009 elsif ($char[$i] eq '\L') {
5010 0 $char[$i] = '@{[Earabic::lc qq<';
5011 0 $left_e++;
5012 }
5013 elsif ($char[$i] eq '\F') {
5014 0 $char[$i] = '@{[Earabic::fc qq<';
5015 0 $left_e++;
5016 }
5017 elsif ($char[$i] eq '\Q') {
5018 0 $char[$i] = '@{[CORE::quotemeta qq<';
5019 0 $left_e++;
5020 }
5021 elsif ($char[$i] eq '\E') {
5022 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
5023 0 $char[$i] = '>]}';
5024 0 $right_e++;
5025 }
5026 else {
5027 0 $char[$i] = '';
5028 }
5029 }
5030 elsif ($char[$i] eq '\Q') {
5031 0 while (1) {
5032 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5033 0 last;
5034 }
5035 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5036 0 last;
5037 }
5038 }
5039 }
5040 elsif ($char[$i] eq '\E') {
5041 }
5042  
5043 # $0 --> $0
5044 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5045 }
5046 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5047 }
5048  
5049 # $$ --> $$
5050 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5051 }
5052  
5053 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5054 # $1, $2, $3 --> $1, $2, $3 otherwise
5055 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5056 0 $char[$i] = e_capture($1);
5057 }
5058 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5059 0 $char[$i] = e_capture($1);
5060 }
5061  
5062 # $$foo[ ... ] --> $ $foo->[ ... ]
5063 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5064 0 $char[$i] = e_capture($1.'->'.$2);
5065 }
5066  
5067 # $$foo{ ... } --> $ $foo->{ ... }
5068 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5069 0 $char[$i] = e_capture($1.'->'.$2);
5070 }
5071  
5072 # $$foo
5073 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5074 0 $char[$i] = e_capture($1);
5075 }
5076  
5077 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Earabic::PREMATCH()
5078 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5079 8 $char[$i] = '@{[Earabic::PREMATCH()]}';
5080 }
5081  
5082 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Earabic::MATCH()
5083 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5084 8 $char[$i] = '@{[Earabic::MATCH()]}';
5085 }
5086  
5087 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Earabic::POSTMATCH()
5088 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5089 6 $char[$i] = '@{[Earabic::POSTMATCH()]}';
5090 }
5091  
5092 # ${ foo } --> ${ foo }
5093 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5094 }
5095  
5096 # ${ ... }
5097 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5098 0 $char[$i] = e_capture($1);
5099 }
5100 }
5101  
5102 # return string
5103 93 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 93 93
5104 0 return join '', @char, '>]}' x ($left_e - $right_e);
5105 }
5106 93 return join '', @char;
5107 }
5108  
5109 #
5110 # escape regexp (m//, qr//)
5111 #
5112 624 ▶sub e_qr {
Subroutine e_qr: called CC=110 SCAR=73.6
Pod undocumented
5113 624 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5114 624 ▶ $modifier ||= '';
Condition100%2/2
$modifier ||= ""
l!l
118506
MC/DC100%1/1
$modifier ||= ""
$modifier
Truth table100%2/2
A
A= $modifier
Aresult
11
00
5115  
5116 624 $modifier =~ tr/p//d;
5117 624 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 624 624
5118 0 my $line = 0;
5119 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5120 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5121 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5122 0 last;
5123 }
5124 }
5125 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5126 }
5127  
5128 624 $slash = 'div';
5129  
5130 # literal null string pattern
5131 624 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 616 624
elsif ($modifier =~ tr/Bb//d) { } 2 614 616
5132 8 $modifier =~ tr/bB//d;
5133 8 $modifier =~ tr/i//d;
5134 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5135 }
5136  
5137 # /b /B modifier
5138 elsif ($modifier =~ tr/bB//d) {
5139  
5140 # choice again delimiter
5141 2 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 2 2
5142 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5143 0 my %octet = map {$_ => 1} @char;
5144 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
5145 0 $delimiter = '(';
5146 0 $end_delimiter = ')';
5147 }
5148 elsif (not $octet{'}'}) {
5149 0 $delimiter = '{';
5150 0 $end_delimiter = '}';
5151 }
5152 elsif (not $octet{']'}) {
5153 0 $delimiter = '[';
5154 0 $end_delimiter = ']';
5155 }
5156 elsif (not $octet{'>'}) {
5157 0 $delimiter = '<';
5158 0 $end_delimiter = '>';
5159 }
5160 else {
5161 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5162 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5163 0 $delimiter = $char;
5164 0 $end_delimiter = $char;
5165 0 last;
5166 }
5167 }
5168 }
5169 }
5170  
5171 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
5172 0 return join '', $ope, $delimiter, $string, $matched, $end_delimiter, $modifier;
5173 }
5174 else {
5175 2 return join '', $ope, $delimiter, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5176 }
5177 }
5178  
5179 614 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 64 550 614
5180 614 my $metachar = qr/[\@\\|[\]{^]/oxms;
5181  
5182 # split regexp
5183 614 my @char = $string =~ /\G((?>
5184 [^\\\$\@\[\(] |
5185 \\x (?>[0-9A-Fa-f]{1,2}) |
5186 \\ (?>[0-7]{2,3}) |
5187 \\c [\x40-\x5F] |
5188 \\x\{ (?>[0-9A-Fa-f]+) \} |
5189 \\o\{ (?>[0-7]+) \} |
5190 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5191 \\ $q_char |
5192 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5193 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5194 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5195 [\$\@] $qq_variable |
5196 \$ (?>\s* [0-9]+) |
5197 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5198 \$ \$ (?![\w\{]) |
5199 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5200 \[\^ |
5201 \[\: (?>[a-z]+) :\] |
5202 \[\:\^ (?>[a-z]+) :\] |
5203 \(\? |
5204 $q_char
5205 ))/oxmsg;
5206  
5207 # choice again delimiter
5208 614 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 614 614
5209 0 my %octet = map {$_ => 1} @char;
5210 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
5211 0 $delimiter = '(';
5212 0 $end_delimiter = ')';
5213 }
5214 elsif (not $octet{'}'}) {
5215 0 $delimiter = '{';
5216 0 $end_delimiter = '}';
5217 }
5218 elsif (not $octet{']'}) {
5219 0 $delimiter = '[';
5220 0 $end_delimiter = ']';
5221 }
5222 elsif (not $octet{'>'}) {
5223 0 $delimiter = '<';
5224 0 $end_delimiter = '>';
5225 }
5226 else {
5227 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5228 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5229 0 $delimiter = $char;
5230 0 $end_delimiter = $char;
5231 0 last;
5232 }
5233 }
5234 }
5235 }
5236  
5237 614 my $left_e = 0;
5238 614 my $right_e = 0;
5239 614 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1820 614 2434
5240  
5241 # "\L\u" --> "\u\L"
5242 1820 ▶ 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 1820 1820
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 1820 1820
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 1819 1820
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 1818 1819
elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 6 1812 1818
elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/mosx) { } 4 1808 1812
Condition66%2/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
181910
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
5243 0 @char[$i,$i+1] = @char[$i+1,$i];
5244 }
5245  
5246 # "\U\l" --> "\l\U"
5247 ▶ 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
181910
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
5248 0 @char[$i,$i+1] = @char[$i+1,$i];
5249 }
5250  
5251 # octal escape sequence
5252 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5253 1 $char[$i] = Earabic::octchr($1);
5254 }
5255  
5256 # hexadecimal escape sequence
5257 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5258 1 $char[$i] = Earabic::hexchr($1);
5259 }
5260  
5261 # \b{...} --> b\{...}
5262 # \B{...} --> B\{...}
5263 # \N{CHARNAME} --> N\{CHARNAME}
5264 # \p{PROPERTY} --> p\{PROPERTY}
5265 # \P{PROPERTY} --> P\{PROPERTY}
5266 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5267 6 $char[$i] = $1 . '\\' . $2;
5268 }
5269  
5270 # \p, \P, \X --> p, P, X
5271 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
5272 4 $char[$i] = $1;
5273 }
5274  
5275 1820 ▶ 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 1814 1820
elsif ($char[$i] eq '[') { } 316 1498 1814
elsif ($char[$i] eq '[^') { } 74 1424 1498
elsif (my $char = character_class($char[$i], $modifier)) { } 139 1285 1424
elsif ($ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Earabic::uc($char[$i]) ne &fc($char[$i])) { } 20 1265 1285
elsif ($char[$i] =~ /\A [<>] \z/mosx) { } 1 1264 1265
elsif ($char[$i] eq '\\u') { } 0 1264 1264
elsif ($char[$i] eq '\\l') { } 0 1264 1264
elsif ($char[$i] eq '\\U') { } 1 1263 1264
elsif ($char[$i] eq '\\L') { } 1 1262 1263
elsif ($char[$i] eq '\\F') { } 6 1256 1262
elsif ($char[$i] eq '\\Q') { } 1 1255 1256
elsif ($char[$i] eq '\\E') { } 9 1246 1255
elsif ($char[$i] eq '\\Q') { } 0 1246 1246
elsif ($char[$i] eq '\\E') { } 0 1246 1246
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 0 1246 1246
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 1246 1246
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 1246 1246
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 0 1246 1246
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 1246 1246
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 1246 1246
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 1246 1246
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 1246 1246
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 8 1238 1246
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 8 1230 1238
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 6 1224 1230
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/mosx) { } 0 1224 1224
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 1224 1224
elsif ($char[$i] =~ /\A [\$\@].+ /mosx) { } 5 1219 1224
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 138 1377 1515
5276 }
5277  
5278 # join separated multiple-octet
5279 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
5280 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 $Earabic::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 $Earabic::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 $Earabic::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 $Earabic::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 $Earabic::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 $Earabic::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 $Earabic::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5281 0 $char[$i] .= join '', splice @char, $i+1, 3;
5282 }
5283 ▶ 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 $Earabic::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 $Earabic::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 $Earabic::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 $Earabic::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5284 0 $char[$i] .= join '', splice @char, $i+1, 2;
5285 }
5286 ▶ 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 $Earabic::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 $Earabic::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 $Earabic::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 $Earabic::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5287 0 $char[$i] .= join '', splice @char, $i+1, 1;
5288 }
5289 }
5290  
5291 # open character class [...]
5292 elsif ($char[$i] eq '[') {
5293 316 my $left = $i;
5294  
5295 # [] make die "Unmatched [] in regexp ...\n"
5296 # (and so on)
5297  
5298 316 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 3 313 316
5299 3 $i++;
5300 }
5301  
5302 316 while (1) {
5303 1343 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 1343 1343
5304 0 die __FILE__, ": Unmatched [] in regexp\n";
5305 }
5306 1343 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 316 1027 1343
5307 316 my $right = $i;
5308  
5309 # [...]
5310 316 ▶ 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 286 316
5311 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Earabic::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5312 }
5313 else {
5314 286 splice @char, $left, $right-$left+1, Earabic::charlist_qr(@char[$left+1..$right-1], $modifier);
5315 }
5316  
5317 316 $i = $left;
5318 316 last;
5319 }
5320 }
5321 }
5322  
5323 # open character class [^...]
5324 elsif ($char[$i] eq '[^') {
5325 74 my $left = $i;
5326  
5327 # [^] make die "Unmatched [] in regexp ...\n"
5328 # (and so on)
5329  
5330 74 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 4 70 74
5331 4 $i++;
5332 }
5333  
5334 74 while (1) {
5335 272 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 272 272
5336 0 die __FILE__, ": Unmatched [] in regexp\n";
5337 }
5338 272 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 74 198 272
5339 74 my $right = $i;
5340  
5341 # [^...]
5342 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
5343 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Earabic::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5344 }
5345 else {
5346 44 splice @char, $left, $right-$left+1, Earabic::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5347 }
5348  
5349 74 $i = $left;
5350 74 last;
5351 }
5352 }
5353 }
5354  
5355 # rewrite character class or escape character
5356 elsif (my $char = character_class($char[$i],$modifier)) {
5357 139 $char[$i] = $char;
5358 }
5359  
5360 # /i modifier
5361 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Earabic::uc($char[$i]) ne Earabic::fc($char[$i]))) {
Condition100%6/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Earabic::uc($char[$i]) ne &fc($char[$i])
!ll&&!rl&&r
1257820
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx
!ll&&!rl&&r
12461128
MC/DC100%3/3
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Earabic::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Earabic::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= &Earabic::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5362 20 ▶ if (CORE::length(Earabic::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 20 0 20
5363 20 $char[$i] = '[' . Earabic::uc($char[$i]) . Earabic::fc($char[$i]) . ']';
5364 }
5365 else {
5366 0 $char[$i] = '(?:' . Earabic::uc($char[$i]) . '|' . Earabic::fc($char[$i]) . ')';
5367 }
5368 }
5369  
5370 # \u \l \U \L \F \Q \E
5371 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
5372 1 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 1 1
5373 0 $char[$i] = '\\' . $char[$i];
5374 }
5375 }
5376 elsif ($char[$i] eq '\u') {
5377 0 $char[$i] = '@{[Earabic::ucfirst qq<';
5378 0 $left_e++;
5379 }
5380 elsif ($char[$i] eq '\l') {
5381 0 $char[$i] = '@{[Earabic::lcfirst qq<';
5382 0 $left_e++;
5383 }
5384 elsif ($char[$i] eq '\U') {
5385 1 $char[$i] = '@{[Earabic::uc qq<';
5386 1 $left_e++;
5387 }
5388 elsif ($char[$i] eq '\L') {
5389 1 $char[$i] = '@{[Earabic::lc qq<';
5390 1 $left_e++;
5391 }
5392 elsif ($char[$i] eq '\F') {
5393 6 $char[$i] = '@{[Earabic::fc qq<';
5394 6 $left_e++;
5395 }
5396 elsif ($char[$i] eq '\Q') {
5397 1 $char[$i] = '@{[CORE::quotemeta qq<';
5398 1 $left_e++;
5399 }
5400 elsif ($char[$i] eq '\E') {
5401 9 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 9 0 9
5402 9 $char[$i] = '>]}';
5403 9 $right_e++;
5404 }
5405 else {
5406 0 $char[$i] = '';
5407 }
5408 }
5409 elsif ($char[$i] eq '\Q') {
5410 0 while (1) {
5411 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5412 0 last;
5413 }
5414 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5415 0 last;
5416 }
5417 }
5418 }
5419 elsif ($char[$i] eq '\E') {
5420 }
5421  
5422 # $0 --> $0
5423 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5424 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5425 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
5426 }
5427 }
5428 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5429 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5430 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
5431 }
5432 }
5433  
5434 # $$ --> $$
5435 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5436 }
5437  
5438 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5439 # $1, $2, $3 --> $1, $2, $3 otherwise
5440 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5441 0 $char[$i] = e_capture($1);
5442 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5443 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
5444 }
5445 }
5446 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5447 0 $char[$i] = e_capture($1);
5448 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5449 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
5450 }
5451 }
5452  
5453 # $$foo[ ... ] --> $ $foo->[ ... ]
5454 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5455 0 $char[$i] = e_capture($1.'->'.$2);
5456 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5457 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
5458 }
5459 }
5460  
5461 # $$foo{ ... } --> $ $foo->{ ... }
5462 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5463 0 $char[$i] = e_capture($1.'->'.$2);
5464 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5465 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
5466 }
5467 }
5468  
5469 # $$foo
5470 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5471 0 $char[$i] = e_capture($1);
5472 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5473 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
5474 }
5475 }
5476  
5477 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Earabic::PREMATCH()
5478 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5479 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
5480 0 $char[$i] = '@{[Earabic::ignorecase(Earabic::PREMATCH())]}';
5481 }
5482 else {
5483 8 $char[$i] = '@{[Earabic::PREMATCH()]}';
5484 }
5485 }
5486  
5487 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Earabic::MATCH()
5488 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5489 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
5490 0 $char[$i] = '@{[Earabic::ignorecase(Earabic::MATCH())]}';
5491 }
5492 else {
5493 8 $char[$i] = '@{[Earabic::MATCH()]}';
5494 }
5495 }
5496  
5497 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Earabic::POSTMATCH()
5498 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5499 6 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 6 6
5500 0 $char[$i] = '@{[Earabic::ignorecase(Earabic::POSTMATCH())]}';
5501 }
5502 else {
5503 6 $char[$i] = '@{[Earabic::POSTMATCH()]}';
5504 }
5505 }
5506  
5507 # ${ foo }
5508 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
5509 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5510 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
5511 }
5512 }
5513  
5514 # ${ ... }
5515 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5516 0 $char[$i] = e_capture($1);
5517 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5518 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
5519 }
5520 }
5521  
5522 # $scalar or @array
5523 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
5524 5 $char[$i] = e_string($char[$i]);
5525 5 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 3 2 5
5526 3 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
5527 }
5528 }
5529  
5530 # quote character before ? + * {
5531 ▶ 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
5532 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
5533 }
5534 ▶ 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
5535 0 my $char = $char[$i-1];
5536 0 ▶ if ($char[$i] eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq '{') { } 0 0 0
5537 0 die __FILE__, qq{: "MULTIBYTE{n}" should be "(MULTIBYTE){n}" in m?? (and shift \$1,\$2,\$3,...) ($char){n}\n};
5538 }
5539 else {
5540 0 die __FILE__, qq{: "MULTIBYTE$char[$i]" should be "(MULTIBYTE)$char[$i]" in m?? (and shift \$1,\$2,\$3,...) ($char)$char[$i]\n};
5541 }
5542 }
5543 else {
5544 127 $char[$i-1] = '(?:' . $char[$i-1] . ')';
5545 }
5546 }
5547 }
5548  
5549 # make regexp string
5550 614 $modifier =~ tr/i//d;
5551 614 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 614 614
5552 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
5553 0 return join '', $ope, $delimiter, $anchor, @char, '>]}' x ($left_e - $right_e), $matched, $end_delimiter, $modifier;
5554 }
5555 else {
5556 0 return join '', $ope, $delimiter, $anchor, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
5557 }
5558 }
5559 614 ▶ if (($ope =~ /\A m? \z/oxms) and ($delimiter eq '?')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ope =~ /\A m? \z/mosx and $delimiter eq '?') { } 0 614 614
Condition33%1/3
$ope =~ /\A m? \z/mosx and $delimiter eq "?"
!ll&&!rl&&r
06140
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
5560 0 return join '', $ope, $delimiter, $anchor, @char, $matched, $end_delimiter, $modifier;
5561 }
5562 else {
5563 614 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5564 }
5565 }
5566  
5567 #
5568 # double quote stuff
5569 #
5570 180 ▶sub qq_stuff {
Subroutine qq_stuff: called CC=6 SCAR=18.5
Pod undocumented
5571 180 my($delimiter,$end_delimiter,$stuff) = @_;
5572  
5573 # scalar variable or array variable
5574 180 ▶ if ($stuff =~ /\A [\$\@] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stuff =~ /\A [\$\@] /mosx) 100 80 180
5575 100 return $stuff;
5576 }
5577  
5578 # quote by delimiter
5579 80 my %octet = map {$_ => 1} ($stuff =~ /\G ([\x00-\xFF]) /oxmsg);
5580 80 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5581 80 ▶ next if $char eq $delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $delimiter 0 80 80
5582 80 ▶ next if $char eq $end_delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $end_delimiter 0 80 80
5583 80 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 80 0 80
5584 80 return join '', 'qq', $char, $stuff, $char;
5585 }
5586 }
5587 0 return join '', 'qq', '<', $stuff, '>';
5588 }
5589  
5590 #
5591 # escape regexp (m'', qr'', and m''b, qr''b)
5592 #
5593 10 ▶sub e_qr_q {
Subroutine e_qr_q: called CC=7 SCAR=25.3
Pod undocumented
5594 10 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5595 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
5596  
5597 10 $modifier =~ tr/p//d;
5598 10 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 10 10
5599 0 my $line = 0;
5600 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5601 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5602 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5603 0 last;
5604 }
5605 }
5606 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5607 }
5608  
5609 10 $slash = 'div';
5610  
5611 # literal null string pattern
5612 10 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 2 10
elsif ($modifier =~ tr/Bb//d) { } 0 2 2
5613 8 $modifier =~ tr/bB//d;
5614 8 $modifier =~ tr/i//d;
5615 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5616 }
5617  
5618 # with /b /B modifier
5619 elsif ($modifier =~ tr/bB//d) {
5620 0 return e_qr_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
5621 }
5622  
5623 # without /b /B modifier
5624 else {
5625 2 return e_qr_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
5626 }
5627 }
5628  
5629 #
5630 # escape regexp (m'', qr'')
5631 #
5632 2 ▶sub e_qr_qt {
Subroutine e_qr_qt: called CC=20 SCAR=51.8
Pod undocumented
5633 2 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5634  
5635 2 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 2 2
5636  
5637 # split regexp
5638 2 my @char = $string =~ /\G((?>
5639 [^\\\[\$\@\/] |
5640 [\x00-\xFF] |
5641 \[\^ |
5642 \[\: (?>[a-z]+) \:\] |
5643 \[\:\^ (?>[a-z]+) \:\] |
5644 [\$\@\/] |
5645 \\ (?:$q_char) |
5646 (?:$q_char)
5647 ))/oxmsg;
5648  
5649 # unescape character
5650 2 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2 2 4
5651 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 &Earabic::uc($char[$i]) ne &fc($char[$i])) { } 0 2 2
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 4 4
5652 }
5653  
5654 # open character class [...]
5655 elsif ($char[$i] eq '[') {
5656 0 my $left = $i;
5657 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
5658 0 $i++;
5659 }
5660 0 while (1) {
5661 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5662 0 die __FILE__, ": Unmatched [] in regexp\n";
5663 }
5664 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
5665 0 my $right = $i;
5666  
5667 # [...]
5668 0 splice @char, $left, $right-$left+1, Earabic::charlist_qr(@char[$left+1..$right-1], $modifier);
5669  
5670 0 $i = $left;
5671 0 last;
5672 }
5673 }
5674 }
5675  
5676 # open character class [^...]
5677 elsif ($char[$i] eq '[^') {
5678 0 my $left = $i;
5679 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
5680 0 $i++;
5681 }
5682 0 while (1) {
5683 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5684 0 die __FILE__, ": Unmatched [] in regexp\n";
5685 }
5686 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
5687 0 my $right = $i;
5688  
5689 # [^...]
5690 0 splice @char, $left, $right-$left+1, Earabic::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5691  
5692 0 $i = $left;
5693 0 last;
5694 }
5695 }
5696 }
5697  
5698 # escape $ @ / and \
5699 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
5700 0 $char[$i] = '\\' . $char[$i];
5701 }
5702  
5703 # rewrite character class or escape character
5704 elsif (my $char = character_class($char[$i],$modifier)) {
5705 0 $char[$i] = $char;
5706 }
5707  
5708 # /i modifier
5709 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Earabic::uc($char[$i]) ne Earabic::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Earabic::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 &Earabic::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Earabic::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= &Earabic::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5710 0 ▶ if (CORE::length(Earabic::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
5711 0 $char[$i] = '[' . Earabic::uc($char[$i]) . Earabic::fc($char[$i]) . ']';
5712 }
5713 else {
5714 0 $char[$i] = '(?:' . Earabic::uc($char[$i]) . '|' . Earabic::fc($char[$i]) . ')';
5715 }
5716 }
5717  
5718 # quote character before ? + * {
5719 ▶ 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
5720 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
5721 }
5722 else {
5723 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
5724 }
5725 }
5726 }
5727  
5728 2 $delimiter = '/';
5729 2 $end_delimiter = '/';
5730  
5731 2 $modifier =~ tr/i//d;
5732 2 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5733 }
5734  
5735 #
5736 # escape regexp (m''b, qr''b)
5737 #
5738 0 ▶sub e_qr_qb {
Subroutine e_qr_qb: not called CC=4 SCAR=30.0
Pod undocumented
5739 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5740  
5741 # split regexp
5742 0 my @char = $string =~ /\G ((?>[^\\]|\\\\)) /oxmsg;
5743  
5744 # unescape character
5745 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
5746 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
5747 }
5748  
5749 # remain \\
5750 elsif ($char[$i] eq '\\\\') {
5751 }
5752  
5753 # escape $ @ / and \
5754 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
5755 0 $char[$i] = '\\' . $char[$i];
5756 }
5757 }
5758  
5759 0 $delimiter = '/';
5760 0 $end_delimiter = '/';
5761 0 return join '', $ope, $delimiter, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
5762 }
5763  
5764 #
5765 # escape regexp (s/here//)
5766 #
5767 80 ▶sub e_s1 {
Subroutine e_s1: called CC=106 SCAR=81.1
Pod undocumented
5768 80 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5769 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
5770  
5771 80 $modifier =~ tr/p//d;
5772 80 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 80 80
5773 0 my $line = 0;
5774 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5775 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5776 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5777 0 last;
5778 }
5779 }
5780 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5781 }
5782  
5783 80 $slash = 'div';
5784  
5785 # literal null string pattern
5786 80 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 72 80
elsif ($modifier =~ tr/Bb//d) { } 0 72 72
5787 8 $modifier =~ tr/bB//d;
5788 8 $modifier =~ tr/i//d;
5789 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5790 }
5791  
5792 # /b /B modifier
5793 elsif ($modifier =~ tr/bB//d) {
5794  
5795 # choice again delimiter
5796 0 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 0 0
5797 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5798 0 my %octet = map {$_ => 1} @char;
5799 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
5800 0 $delimiter = '(';
5801 0 $end_delimiter = ')';
5802 }
5803 elsif (not $octet{'}'}) {
5804 0 $delimiter = '{';
5805 0 $end_delimiter = '}';
5806 }
5807 elsif (not $octet{']'}) {
5808 0 $delimiter = '[';
5809 0 $end_delimiter = ']';
5810 }
5811 elsif (not $octet{'>'}) {
5812 0 $delimiter = '<';
5813 0 $end_delimiter = '>';
5814 }
5815 else {
5816 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5817 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5818 0 $delimiter = $char;
5819 0 $end_delimiter = $char;
5820 0 last;
5821 }
5822 }
5823 }
5824 }
5825  
5826 0 my $prematch = '';
5827 0 return join '', $ope, $delimiter, $prematch, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5828 }
5829  
5830 72 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 1 71 72
5831 72 my $metachar = qr/[\@\\|[\]{^]/oxms;
5832  
5833 # split regexp
5834 72 my @char = $string =~ /\G((?>
5835 [^\\\$\@\[\(] |
5836 \\ (?>[1-9][0-9]*) |
5837 \\g (?>\s*) (?>[1-9][0-9]*) |
5838 \\g (?>\s*) \{ (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
5839 \\g (?>\s*) \{ (?>\s*) - (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
5840 \\x (?>[0-9A-Fa-f]{1,2}) |
5841 \\ (?>[0-7]{2,3}) |
5842 \\c [\x40-\x5F] |
5843 \\x\{ (?>[0-9A-Fa-f]+) \} |
5844 \\o\{ (?>[0-7]+) \} |
5845 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5846 \\ $q_char |
5847 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5848 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5849 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5850 [\$\@] $qq_variable |
5851 \$ (?>\s* [0-9]+) |
5852 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5853 \$ \$ (?![\w\{]) |
5854 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5855 \[\^ |
5856 \[\: (?>[a-z]+) :\] |
5857 \[\:\^ (?>[a-z]+) :\] |
5858 \(\? |
5859 $q_char
5860 ))/oxmsg;
5861  
5862 # choice again delimiter
5863 72 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 72 72
5864 0 my %octet = map {$_ => 1} @char;
5865 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
5866 0 $delimiter = '(';
5867 0 $end_delimiter = ')';
5868 }
5869 elsif (not $octet{'}'}) {
5870 0 $delimiter = '{';
5871 0 $end_delimiter = '}';
5872 }
5873 elsif (not $octet{']'}) {
5874 0 $delimiter = '[';
5875 0 $end_delimiter = ']';
5876 }
5877 elsif (not $octet{'>'}) {
5878 0 $delimiter = '<';
5879 0 $end_delimiter = '>';
5880 }
5881 else {
5882 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5883 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5884 0 $delimiter = $char;
5885 0 $end_delimiter = $char;
5886 0 last;
5887 }
5888 }
5889 }
5890 }
5891  
5892 # count '('
5893 72 my $parens = grep { $_ eq '(' } @char;
5894  
5895 72 my $left_e = 0;
5896 72 my $right_e = 0;
5897 72 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 200 72 272
5898  
5899 # "\L\u" --> "\u\L"
5900 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
5901 0 @char[$i,$i+1] = @char[$i+1,$i];
5902 }
5903  
5904 # "\U\l" --> "\l\U"
5905 ▶ 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
5906 0 @char[$i,$i+1] = @char[$i+1,$i];
5907 }
5908  
5909 # octal escape sequence
5910 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5911 1 $char[$i] = Earabic::octchr($1);
5912 }
5913  
5914 # hexadecimal escape sequence
5915 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5916 1 $char[$i] = Earabic::hexchr($1);
5917 }
5918  
5919 # \b{...} --> b\{...}
5920 # \B{...} --> B\{...}
5921 # \N{CHARNAME} --> N\{CHARNAME}
5922 # \p{PROPERTY} --> p\{PROPERTY}
5923 # \P{PROPERTY} --> P\{PROPERTY}
5924 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5925 0 $char[$i] = $1 . '\\' . $2;
5926 }
5927  
5928 # \p, \P, \X --> p, P, X
5929 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
5930 0 $char[$i] = $1;
5931 }
5932  
5933 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 &Earabic::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
5934 }
5935  
5936 # join separated multiple-octet
5937 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
5938 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 $Earabic::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 $Earabic::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 $Earabic::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 $Earabic::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 $Earabic::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 $Earabic::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 $Earabic::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5939 0 $char[$i] .= join '', splice @char, $i+1, 3;
5940 }
5941 ▶ 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 $Earabic::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 $Earabic::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 $Earabic::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 $Earabic::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5942 0 $char[$i] .= join '', splice @char, $i+1, 2;
5943 }
5944 ▶ 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 $Earabic::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 $Earabic::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 $Earabic::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 $Earabic::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5945 0 $char[$i] .= join '', splice @char, $i+1, 1;
5946 }
5947 }
5948  
5949 # open character class [...]
5950 elsif ($char[$i] eq '[') {
5951 17 my $left = $i;
5952 17 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 17 17
5953 0 $i++;
5954 }
5955 17 while (1) {
5956 74 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 74 74
5957 0 die __FILE__, ": Unmatched [] in regexp\n";
5958 }
5959 74 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 17 57 74
5960 17 my $right = $i;
5961  
5962 # [...]
5963 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
5964 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Earabic::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5965 }
5966 else {
5967 17 splice @char, $left, $right-$left+1, Earabic::charlist_qr(@char[$left+1..$right-1], $modifier);
5968 }
5969  
5970 17 $i = $left;
5971 17 last;
5972 }
5973 }
5974 }
5975  
5976 # open character class [^...]
5977 elsif ($char[$i] eq '[^') {
5978 0 my $left = $i;
5979 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
5980 0 $i++;
5981 }
5982 0 while (1) {
5983 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5984 0 die __FILE__, ": Unmatched [] in regexp\n";
5985 }
5986 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
5987 0 my $right = $i;
5988  
5989 # [^...]
5990 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
5991 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Earabic::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5992 }
5993 else {
5994 0 splice @char, $left, $right-$left+1, Earabic::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5995 }
5996  
5997 0 $i = $left;
5998 0 last;
5999 }
6000 }
6001 }
6002  
6003 # rewrite character class or escape character
6004 elsif (my $char = character_class($char[$i],$modifier)) {
6005 7 $char[$i] = $char;
6006 }
6007  
6008 # /i modifier
6009 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Earabic::uc($char[$i]) ne Earabic::fc($char[$i]))) {
Condition66%4/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Earabic::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 &Earabic::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Earabic::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= &Earabic::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6010 3 ▶ if (CORE::length(Earabic::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 3 0 3
6011 3 $char[$i] = '[' . Earabic::uc($char[$i]) . Earabic::fc($char[$i]) . ']';
6012 }
6013 else {
6014 0 $char[$i] = '(?:' . Earabic::uc($char[$i]) . '|' . Earabic::fc($char[$i]) . ')';
6015 }
6016 }
6017  
6018 # \u \l \U \L \F \Q \E
6019 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
6020 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6021 0 $char[$i] = '\\' . $char[$i];
6022 }
6023 }
6024 elsif ($char[$i] eq '\u') {
6025 0 $char[$i] = '@{[Earabic::ucfirst qq<';
6026 0 $left_e++;
6027 }
6028 elsif ($char[$i] eq '\l') {
6029 0 $char[$i] = '@{[Earabic::lcfirst qq<';
6030 0 $left_e++;
6031 }
6032 elsif ($char[$i] eq '\U') {
6033 0 $char[$i] = '@{[Earabic::uc qq<';
6034 0 $left_e++;
6035 }
6036 elsif ($char[$i] eq '\L') {
6037 0 $char[$i] = '@{[Earabic::lc qq<';
6038 0 $left_e++;
6039 }
6040 elsif ($char[$i] eq '\F') {
6041 0 $char[$i] = '@{[Earabic::fc qq<';
6042 0 $left_e++;
6043 }
6044 elsif ($char[$i] eq '\Q') {
6045 0 $char[$i] = '@{[CORE::quotemeta qq<';
6046 0 $left_e++;
6047 }
6048 elsif ($char[$i] eq '\E') {
6049 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6050 0 $char[$i] = '>]}';
6051 0 $right_e++;
6052 }
6053 else {
6054 0 $char[$i] = '';
6055 }
6056 }
6057 elsif ($char[$i] eq '\Q') {
6058 0 while (1) {
6059 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6060 0 last;
6061 }
6062 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6063 0 last;
6064 }
6065 }
6066 }
6067 elsif ($char[$i] eq '\E') {
6068 }
6069  
6070 # \0 --> \0
6071 elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/oxms) {
6072 }
6073  
6074 # \g{N}, \g{-N}
6075  
6076 # P.108 Using Simple Patterns
6077 # in Chapter 7: In the World of Regular Expressions
6078 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
6079  
6080 # P.221 Capturing
6081 # in Chapter 5: Pattern Matching
6082 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6083  
6084 # \g{-1}, \g{-2}, \g{-3} --> \g{-1}, \g{-2}, \g{-3}
6085 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6086 }
6087  
6088 # \g{1}, \g{2}, \g{3} --> \g{2}, \g{3}, \g{4} (only when multibyte anchoring is enable)
6089 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6090 }
6091  
6092 # \g1, \g2, \g3 --> \g2, \g3, \g4 (only when multibyte anchoring is enable)
6093 elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6094 }
6095  
6096 # \1, \2, \3 --> \2, \3, \4 (only when multibyte anchoring is enable)
6097 elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6098 }
6099  
6100 # $0 --> $0
6101 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6102 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6103 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
6104 }
6105 }
6106 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6107 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6108 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
6109 }
6110 }
6111  
6112 # $$ --> $$
6113 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6114 }
6115  
6116 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6117 # $1, $2, $3 --> $1, $2, $3 otherwise
6118 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6119 0 $char[$i] = e_capture($1);
6120 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6121 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
6122 }
6123 }
6124 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6125 0 $char[$i] = e_capture($1);
6126 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6127 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
6128 }
6129 }
6130  
6131 # $$foo[ ... ] --> $ $foo->[ ... ]
6132 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6133 0 $char[$i] = e_capture($1.'->'.$2);
6134 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6135 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
6136 }
6137 }
6138  
6139 # $$foo{ ... } --> $ $foo->{ ... }
6140 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6141 0 $char[$i] = e_capture($1.'->'.$2);
6142 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6143 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
6144 }
6145 }
6146  
6147 # $$foo
6148 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6149 0 $char[$i] = e_capture($1);
6150 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6151 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
6152 }
6153 }
6154  
6155 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Earabic::PREMATCH()
6156 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6157 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6158 0 $char[$i] = '@{[Earabic::ignorecase(Earabic::PREMATCH())]}';
6159 }
6160 else {
6161 4 $char[$i] = '@{[Earabic::PREMATCH()]}';
6162 }
6163 }
6164  
6165 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Earabic::MATCH()
6166 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6167 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6168 0 $char[$i] = '@{[Earabic::ignorecase(Earabic::MATCH())]}';
6169 }
6170 else {
6171 4 $char[$i] = '@{[Earabic::MATCH()]}';
6172 }
6173 }
6174  
6175 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Earabic::POSTMATCH()
6176 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6177 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 3 3
6178 0 $char[$i] = '@{[Earabic::ignorecase(Earabic::POSTMATCH())]}';
6179 }
6180 else {
6181 3 $char[$i] = '@{[Earabic::POSTMATCH()]}';
6182 }
6183 }
6184  
6185 # ${ foo }
6186 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6187 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6188 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
6189 }
6190 }
6191  
6192 # ${ ... }
6193 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6194 0 $char[$i] = e_capture($1);
6195 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6196 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
6197 }
6198 }
6199  
6200 # $scalar or @array
6201 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6202 4 $char[$i] = e_string($char[$i]);
6203 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 4 4
6204 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
6205 }
6206 }
6207  
6208 # quote character before ? + * {
6209 ▶ 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
6210 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
6211 }
6212 else {
6213 14 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6214 }
6215 }
6216 }
6217  
6218 # make regexp string
6219 72 my $prematch = '';
6220 72 $modifier =~ tr/i//d;
6221 72 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 72 72
6222 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6223 }
6224 72 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6225 }
6226  
6227 #
6228 # escape regexp (s'here'' or s'here''b)
6229 #
6230 21 ▶sub e_s1_q {
Subroutine e_s1_q: called CC=7 SCAR=24.3
Pod undocumented
6231 21 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6232 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
6233  
6234 21 $modifier =~ tr/p//d;
6235 21 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 21 21
6236 0 my $line = 0;
6237 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6238 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6239 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6240 0 last;
6241 }
6242 }
6243 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6244 }
6245  
6246 21 $slash = 'div';
6247  
6248 # literal null string pattern
6249 21 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 13 21
elsif ($modifier =~ tr/Bb//d) { } 0 13 13
6250 8 $modifier =~ tr/bB//d;
6251 8 $modifier =~ tr/i//d;
6252 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6253 }
6254  
6255 # with /b /B modifier
6256 elsif ($modifier =~ tr/bB//d) {
6257 0 return e_s1_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6258 }
6259  
6260 # without /b /B modifier
6261 else {
6262 13 return e_s1_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6263 }
6264 }
6265  
6266 #
6267 # escape regexp (s'here'')
6268 #
6269 13 ▶sub e_s1_qt {
Subroutine e_s1_qt: called CC=20 SCAR=50.1
Pod undocumented
6270 13 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6271  
6272 13 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 13 13
6273  
6274 # split regexp
6275 13 my @char = $string =~ /\G((?>
6276 [^\\\[\$\@\/] |
6277 [\x00-\xFF] |
6278 \[\^ |
6279 \[\: (?>[a-z]+) \:\] |
6280 \[\:\^ (?>[a-z]+) \:\] |
6281 [\$\@\/] |
6282 \\ (?:$q_char) |
6283 (?:$q_char)
6284 ))/oxmsg;
6285  
6286 # unescape character
6287 13 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 25 13 38
6288 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 &Earabic::uc($char[$i]) ne &fc($char[$i])) { } 0 19 19
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 32 32
6289 }
6290  
6291 # open character class [...]
6292 elsif ($char[$i] eq '[') {
6293 0 my $left = $i;
6294 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6295 0 $i++;
6296 }
6297 0 while (1) {
6298 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6299 0 die __FILE__, ": Unmatched [] in regexp\n";
6300 }
6301 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6302 0 my $right = $i;
6303  
6304 # [...]
6305 0 splice @char, $left, $right-$left+1, Earabic::charlist_qr(@char[$left+1..$right-1], $modifier);
6306  
6307 0 $i = $left;
6308 0 last;
6309 }
6310 }
6311 }
6312  
6313 # open character class [^...]
6314 elsif ($char[$i] eq '[^') {
6315 0 my $left = $i;
6316 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6317 0 $i++;
6318 }
6319 0 while (1) {
6320 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6321 0 die __FILE__, ": Unmatched [] in regexp\n";
6322 }
6323 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6324 0 my $right = $i;
6325  
6326 # [^...]
6327 0 splice @char, $left, $right-$left+1, Earabic::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6328  
6329 0 $i = $left;
6330 0 last;
6331 }
6332 }
6333 }
6334  
6335 # escape $ @ / and \
6336 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6337 0 $char[$i] = '\\' . $char[$i];
6338 }
6339  
6340 # rewrite character class or escape character
6341 elsif (my $char = character_class($char[$i],$modifier)) {
6342 6 $char[$i] = $char;
6343 }
6344  
6345 # /i modifier
6346 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Earabic::uc($char[$i]) ne Earabic::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Earabic::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 &Earabic::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Earabic::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= &Earabic::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6347 0 ▶ if (CORE::length(Earabic::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6348 0 $char[$i] = '[' . Earabic::uc($char[$i]) . Earabic::fc($char[$i]) . ']';
6349 }
6350 else {
6351 0 $char[$i] = '(?:' . Earabic::uc($char[$i]) . '|' . Earabic::fc($char[$i]) . ')';
6352 }
6353 }
6354  
6355 # quote character before ? + * {
6356 ▶ 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
6357 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
6358 }
6359 else {
6360 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6361 }
6362 }
6363 }
6364  
6365 13 $modifier =~ tr/i//d;
6366 13 $delimiter = '/';
6367 13 $end_delimiter = '/';
6368 13 my $prematch = '';
6369 13 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6370 }
6371  
6372 #
6373 # escape regexp (s'here''b)
6374 #
6375 0 ▶sub e_s1_qb {
Subroutine e_s1_qb: not called CC=4 SCAR=30.0
Pod undocumented
6376 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6377  
6378 # split regexp
6379 0 my @char = $string =~ /\G (?>[^\\]|\\\\) /oxmsg;
6380  
6381 # unescape character
6382 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6383 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
6384 }
6385  
6386 # remain \\
6387 elsif ($char[$i] eq '\\\\') {
6388 }
6389  
6390 # escape $ @ / and \
6391 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6392 0 $char[$i] = '\\' . $char[$i];
6393 }
6394 }
6395  
6396 0 $delimiter = '/';
6397 0 $end_delimiter = '/';
6398 0 my $prematch = '';
6399 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6400 }
6401  
6402 #
6403 # escape regexp (s''here')
6404 #
6405 16 ▶sub e_s2_q {
Subroutine e_s2_q: called CC=4 SCAR=13.9
Pod undocumented
6406 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
6407  
6408 16 $slash = 'div';
6409  
6410 16 my @char = $string =~ / \G (?>[^\\]|\\\\|$q_char) /oxmsg;
6411 16 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 9 16 25
6412 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
6413 }
6414  
6415 # not escape \\
6416 elsif ($char[$i] =~ /\A \\\\ \z/oxms) {
6417 }
6418  
6419 # escape $ @ / and \
6420 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6421 5 $char[$i] = '\\' . $char[$i];
6422 }
6423 }
6424  
6425 16 return join '', $ope, $delimiter, @char, $end_delimiter;
6426 }
6427  
6428 #
6429 # escape regexp (s/here/and here/modifier)
6430 #
6431 101 ▶sub e_sub {
Subroutine e_sub: called CC=20 SCAR=32.6
Pod undocumented
6432 101 my($variable,$delimiter1,$pattern,$end_delimiter1,$delimiter2,$replacement,$end_delimiter2,$modifier) = @_;
6433 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
6434  
6435 101 $modifier =~ tr/p//d;
6436 101 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 101 101
6437 0 my $line = 0;
6438 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6439 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6440 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6441 0 last;
6442 }
6443 }
6444 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6445 }
6446  
6447 101 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq "") 36 65 101
6448 36 $variable = '$_';
6449 36 $bind_operator = ' =~ ';
6450 }
6451  
6452 101 $slash = 'div';
6453  
6454 # P.128 Start of match (or end of previous match): \G
6455 # P.130 Advanced Use of \G with Perl
6456 # in Chapter 3: Overview of Regular Expression Features and Flavors
6457 # P.312 Iterative Matching: Scalar Context, with /g
6458 # in Chapter 7: Perl
6459 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
6460  
6461 # P.181 Where You Left Off: The \G Assertion
6462 # in Chapter 5: Pattern Matching
6463 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
6464  
6465 # P.220 Where You Left Off: The \G Assertion
6466 # in Chapter 5: Pattern Matching
6467 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6468  
6469 101 my $e_modifier = $modifier =~ tr/e//d;
6470 101 my $r_modifier = $modifier =~ tr/r//d;
6471  
6472 101 my $my = '';
6473 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
6474 0 $my = $variable;
6475 0 $variable =~ s/ (?: local \b | my \b | our \b | state \b ) (?>\s*) //oxms;
6476 0 $variable =~ s/ = .+ \z//oxms;
6477 }
6478  
6479 101 (my $variable_basename = $variable) =~ s/ [\[\{].* \z//oxms;
6480 101 $variable_basename =~ s/ \s+ \z//oxms;
6481  
6482 # quote replacement string
6483 101 my $e_replacement = '';
6484 101 ▶ if ($e_modifier >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e_modifier >= 1) { } 17 84 101
6485 17 $e_replacement = e_qq('', '', '', $replacement);
6486 17 $e_modifier--;
6487 }
6488 else {
6489 84 ▶ if ($delimiter2 eq "'") {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter2 eq q[']) { } 16 68 84
6490 16 $e_replacement = e_s2_q('qq', '/', '/', $replacement);
6491 }
6492 else {
6493 68 $e_replacement = e_qq ('qq', $delimiter2, $end_delimiter2, $replacement);
6494 }
6495 }
6496  
6497 101 my $sub = '';
6498  
6499 # with /r
6500 101 ▶ if ($r_modifier) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r_modifier) { } 10 91 101
6501 10 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 5 5 10
6502 }
6503  
6504 # s///gr without multibyte anchoring
6505 elsif ($modifier =~ /g/oxms) {
6506 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
6507 # 1 2 3 4 5
6508 q<CORE::eval{local $Earabic::re_t=%s; while($Earabic::re_t =~ %s){%s local $^W=0; local $Earabic::re_r=%s; %s$Earabic::re_t="$`$Earabic::re_r$'"; pos($Earabic::re_t)=length "$`$Earabic::re_r"; } return $Earabic::re_t}>,
6509  
6510 $variable, # 1
6511 ($delimiter1 eq "'") ? # 2
6512 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6513 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6514 $s_matched, # 3
6515 $e_replacement, # 4
6516 '$Earabic::re_r=CORE::eval $Earabic::re_r; ' x $e_modifier, # 5
6517 );
6518 }
6519  
6520 # s///r
6521 else {
6522  
6523 5 my $prematch = q{$`};
6524  
6525 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
6526 # 1 2 3 4 5 6 7
6527 q<(%s =~ %s) ? CORE::eval{%s local $^W=0; local $Earabic::re_r=%s; %s"%s$Earabic::re_r$'" } : %s>,
6528  
6529 $variable, # 1
6530 ($delimiter1 eq "'") ? # 2
6531 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6532 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6533 $s_matched, # 3
6534 $e_replacement, # 4
6535 '$Earabic::re_r=CORE::eval $Earabic::re_r; ' x $e_modifier, # 5
6536 $prematch, # 6
6537 $variable, # 7
6538 );
6539 }
6540  
6541 # $var !~ s///r doesn't make sense
6542 10 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 10 10
6543 0 $sub = q{die("$0: Using !~ with s///r doesn't make sense"), } . $sub;
6544 }
6545 }
6546  
6547 # without /r
6548 else {
6549 91 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 23 68 91
6550 }
6551  
6552 # s///g without multibyte anchoring
6553 elsif ($modifier =~ /g/oxms) {
6554 23 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 3 20 23
$bind_operator =~ / !~ /mosx ? : 3 20 23
6555 # 1 2 3 4 5 6 7 8
6556 q<CORE::eval{local $Earabic::re_n=0; while(%s =~ %s){%s local $^W=0; local $Earabic::re_r=%s; %s%s="$`$Earabic::re_r$'"; pos(%s)=length "$`$Earabic::re_r"; $Earabic::re_n++} return %s$Earabic::re_n}>,
6557  
6558 $variable, # 1
6559 ($delimiter1 eq "'") ? # 2
6560 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6561 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6562 $s_matched, # 3
6563 $e_replacement, # 4
6564 '$Earabic::re_r=CORE::eval $Earabic::re_r; ' x $e_modifier, # 5
6565 $variable, # 6
6566 $variable, # 7
6567 ($bind_operator =~ / !~ /oxms) ? '!' : '', # 8
6568 );
6569 }
6570  
6571 # s///
6572 else {
6573  
6574 68 my $prematch = q{$`};
6575  
6576 68 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$bind_operator =~ / =~ /mosx ? : 65 3 68
$delimiter1 eq q['] ? : 18 50 68
6577  
6578 ($bind_operator =~ / =~ /oxms) ?
6579  
6580 # 1 2 3 4 5 6 7 8
6581 q<(%s%s%s) ? CORE::eval{%s local $^W=0; local $Earabic::re_r=%s; %s%s="%s$Earabic::re_r$'"; 1 } : undef> :
6582  
6583 # 1 2 3 4 5 6 7 8
6584 q<(%s%s%s) ? 1 : CORE::eval{%s local $^W=0; local $Earabic::re_r=%s; %s%s="%s$Earabic::re_r$'"; undef }>,
6585  
6586 $variable, # 1
6587 $bind_operator, # 2
6588 ($delimiter1 eq "'") ? # 3
6589 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6590 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6591 $s_matched, # 4
6592 $e_replacement, # 5
6593 '$Earabic::re_r=CORE::eval $Earabic::re_r; ' x $e_modifier, # 6
6594 $variable, # 7
6595 $prematch, # 8
6596 );
6597 }
6598 }
6599  
6600 # (my $foo = $bar) =~ s/// --> (my $foo = $bar, CORE::eval { ... })[1]
6601 101 ▶ if ($my ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($my ne "") 0 101 101
6602 0 $sub = "($my, $sub)[1]";
6603 }
6604  
6605 # clear s/// variable
6606 101 $sub_variable = '';
6607 101 $bind_operator = '';
6608  
6609 101 return $sub;
6610 }
6611  
6612 #
6613 # escape regexp of split qr//
6614 #
6615 74 ▶sub e_split {
Subroutine e_split: called CC=88 SCAR=76.4
Pod undocumented
6616 74 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6617 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
6618  
6619 74 $modifier =~ tr/p//d;
6620 74 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 74 74
6621 0 my $line = 0;
6622 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6623 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6624 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6625 0 last;
6626 }
6627 }
6628 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6629 }
6630  
6631 74 $slash = 'div';
6632  
6633 # /b /B modifier
6634 74 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 74 74
6635 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
6636 }
6637  
6638 74 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 74 74
6639 74 my $metachar = qr/[\@\\|[\]{^]/oxms;
6640  
6641 # split regexp
6642 74 my @char = $string =~ /\G((?>
6643 [^\\\$\@\[\(] |
6644 \\x (?>[0-9A-Fa-f]{1,2}) |
6645 \\ (?>[0-7]{2,3}) |
6646 \\c [\x40-\x5F] |
6647 \\x\{ (?>[0-9A-Fa-f]+) \} |
6648 \\o\{ (?>[0-7]+) \} |
6649 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
6650 \\ $q_char |
6651 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
6652 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
6653 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
6654 [\$\@] $qq_variable |
6655 \$ (?>\s* [0-9]+) |
6656 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
6657 \$ \$ (?![\w\{]) |
6658 \$ (?>\s*) \$ (?>\s*) $qq_variable |
6659 \[\^ |
6660 \[\: (?>[a-z]+) :\] |
6661 \[\:\^ (?>[a-z]+) :\] |
6662 \(\? |
6663 $q_char
6664 ))/oxmsg;
6665  
6666 74 my $left_e = 0;
6667 74 my $right_e = 0;
6668 74 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 249 74 323
6669  
6670 # "\L\u" --> "\u\L"
6671 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
6672 0 @char[$i,$i+1] = @char[$i+1,$i];
6673 }
6674  
6675 # "\U\l" --> "\l\U"
6676 ▶ 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
6677 0 @char[$i,$i+1] = @char[$i+1,$i];
6678 }
6679  
6680 # octal escape sequence
6681 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6682 1 $char[$i] = Earabic::octchr($1);
6683 }
6684  
6685 # hexadecimal escape sequence
6686 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6687 1 $char[$i] = Earabic::hexchr($1);
6688 }
6689  
6690 # \b{...} --> b\{...}
6691 # \B{...} --> B\{...}
6692 # \N{CHARNAME} --> N\{CHARNAME}
6693 # \p{PROPERTY} --> p\{PROPERTY}
6694 # \P{PROPERTY} --> P\{PROPERTY}
6695 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6696 0 $char[$i] = $1 . '\\' . $2;
6697 }
6698  
6699 # \p, \P, \X --> p, P, X
6700 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6701 0 $char[$i] = $1;
6702 }
6703  
6704 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 &Earabic::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
6705 }
6706  
6707 # join separated multiple-octet
6708 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6709 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 $Earabic::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 $Earabic::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 $Earabic::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 $Earabic::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 $Earabic::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 $Earabic::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 $Earabic::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6710 0 $char[$i] .= join '', splice @char, $i+1, 3;
6711 }
6712 ▶ 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 $Earabic::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 $Earabic::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 $Earabic::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 $Earabic::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6713 0 $char[$i] .= join '', splice @char, $i+1, 2;
6714 }
6715 ▶ 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 $Earabic::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 $Earabic::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 $Earabic::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 $Earabic::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6716 0 $char[$i] .= join '', splice @char, $i+1, 1;
6717 }
6718 }
6719  
6720 # open character class [...]
6721 elsif ($char[$i] eq '[') {
6722 3 my $left = $i;
6723 3 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 3 3
6724 0 $i++;
6725 }
6726 3 while (1) {
6727 7 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 7 7
6728 0 die __FILE__, ": Unmatched [] in regexp\n";
6729 }
6730 7 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 3 4 7
6731 3 my $right = $i;
6732  
6733 # [...]
6734 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
6735 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Earabic::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6736 }
6737 else {
6738 3 splice @char, $left, $right-$left+1, Earabic::charlist_qr(@char[$left+1..$right-1], $modifier);
6739 }
6740  
6741 3 $i = $left;
6742 3 last;
6743 }
6744 }
6745 }
6746  
6747 # open character class [^...]
6748 elsif ($char[$i] eq '[^') {
6749 0 my $left = $i;
6750 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6751 0 $i++;
6752 }
6753 0 while (1) {
6754 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6755 0 die __FILE__, ": Unmatched [] in regexp\n";
6756 }
6757 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6758 0 my $right = $i;
6759  
6760 # [^...]
6761 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
6762 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Earabic::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6763 }
6764 else {
6765 0 splice @char, $left, $right-$left+1, Earabic::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6766 }
6767  
6768 0 $i = $left;
6769 0 last;
6770 }
6771 }
6772 }
6773  
6774 # rewrite character class or escape character
6775 elsif (my $char = character_class($char[$i],$modifier)) {
6776 1 $char[$i] = $char;
6777 }
6778  
6779 # P.794 29.2.161. split
6780 # in Chapter 29: Functions
6781 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
6782  
6783 # P.951 split
6784 # in Chapter 27: Functions
6785 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6786  
6787 # said "The //m modifier is assumed when you split on the pattern /^/",
6788 # but perl5.008 is not so. Therefore, this software adds //m.
6789 # (and so on)
6790  
6791 # split(m/^/) --> split(m/^/m)
6792 ▶ 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
6793 7 $modifier .= 'm';
6794 }
6795  
6796 # /i modifier
6797 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Earabic::uc($char[$i]) ne Earabic::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Earabic::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 &Earabic::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Earabic::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= &Earabic::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6798 0 ▶ if (CORE::length(Earabic::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6799 0 $char[$i] = '[' . Earabic::uc($char[$i]) . Earabic::fc($char[$i]) . ']';
6800 }
6801 else {
6802 0 $char[$i] = '(?:' . Earabic::uc($char[$i]) . '|' . Earabic::fc($char[$i]) . ')';
6803 }
6804 }
6805  
6806 # \u \l \U \L \F \Q \E
6807 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
6808 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6809 0 $char[$i] = '\\' . $char[$i];
6810 }
6811 }
6812 elsif ($char[$i] eq '\u') {
6813 0 $char[$i] = '@{[Earabic::ucfirst qq<';
6814 0 $left_e++;
6815 }
6816 elsif ($char[$i] eq '\l') {
6817 0 $char[$i] = '@{[Earabic::lcfirst qq<';
6818 0 $left_e++;
6819 }
6820 elsif ($char[$i] eq '\U') {
6821 0 $char[$i] = '@{[Earabic::uc qq<';
6822 0 $left_e++;
6823 }
6824 elsif ($char[$i] eq '\L') {
6825 0 $char[$i] = '@{[Earabic::lc qq<';
6826 0 $left_e++;
6827 }
6828 elsif ($char[$i] eq '\F') {
6829 0 $char[$i] = '@{[Earabic::fc qq<';
6830 0 $left_e++;
6831 }
6832 elsif ($char[$i] eq '\Q') {
6833 0 $char[$i] = '@{[CORE::quotemeta qq<';
6834 0 $left_e++;
6835 }
6836 elsif ($char[$i] eq '\E') {
6837 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6838 0 $char[$i] = '>]}';
6839 0 $right_e++;
6840 }
6841 else {
6842 0 $char[$i] = '';
6843 }
6844 }
6845 elsif ($char[$i] eq '\Q') {
6846 0 while (1) {
6847 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6848 0 last;
6849 }
6850 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6851 0 last;
6852 }
6853 }
6854 }
6855 elsif ($char[$i] eq '\E') {
6856 }
6857  
6858 # $0 --> $0
6859 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6860 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6861 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
6862 }
6863 }
6864 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6865 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6866 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
6867 }
6868 }
6869  
6870 # $$ --> $$
6871 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6872 }
6873  
6874 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6875 # $1, $2, $3 --> $1, $2, $3 otherwise
6876 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6877 0 $char[$i] = e_capture($1);
6878 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6879 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
6880 }
6881 }
6882 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6883 0 $char[$i] = e_capture($1);
6884 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6885 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
6886 }
6887 }
6888  
6889 # $$foo[ ... ] --> $ $foo->[ ... ]
6890 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6891 0 $char[$i] = e_capture($1.'->'.$2);
6892 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6893 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
6894 }
6895 }
6896  
6897 # $$foo{ ... } --> $ $foo->{ ... }
6898 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6899 0 $char[$i] = e_capture($1.'->'.$2);
6900 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6901 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
6902 }
6903 }
6904  
6905 # $$foo
6906 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6907 0 $char[$i] = e_capture($1);
6908 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6909 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
6910 }
6911 }
6912  
6913 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Earabic::PREMATCH()
6914 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6915 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
6916 0 $char[$i] = '@{[Earabic::ignorecase(Earabic::PREMATCH())]}';
6917 }
6918 else {
6919 12 $char[$i] = '@{[Earabic::PREMATCH()]}';
6920 }
6921 }
6922  
6923 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Earabic::MATCH()
6924 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6925 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
6926 0 $char[$i] = '@{[Earabic::ignorecase(Earabic::MATCH())]}';
6927 }
6928 else {
6929 12 $char[$i] = '@{[Earabic::MATCH()]}';
6930 }
6931 }
6932  
6933 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Earabic::POSTMATCH()
6934 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6935 9 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 9 9
6936 0 $char[$i] = '@{[Earabic::ignorecase(Earabic::POSTMATCH())]}';
6937 }
6938 else {
6939 9 $char[$i] = '@{[Earabic::POSTMATCH()]}';
6940 }
6941 }
6942  
6943 # ${ foo }
6944 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6945 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6946 0 $char[$i] = '@{[Earabic::ignorecase(' . $1 . ')]}';
6947 }
6948 }
6949  
6950 # ${ ... }
6951 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6952 0 $char[$i] = e_capture($1);
6953 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6954 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
6955 }
6956 }
6957  
6958 # $scalar or @array
6959 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6960 3 $char[$i] = e_string($char[$i]);
6961 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 3 3
6962 0 $char[$i] = '@{[Earabic::ignorecase(' . $char[$i] . ')]}';
6963 }
6964 }
6965  
6966 # quote character before ? + * {
6967 ▶ 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
6968 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
6969 }
6970 else {
6971 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6972 }
6973 }
6974 }
6975  
6976 # make regexp string
6977 74 $modifier =~ tr/i//d;
6978 74 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 74 74
6979 0 return join '', 'Earabic::split', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter, $modifier;
6980 }
6981 74 return join '', 'Earabic::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
6982 }
6983  
6984 #
6985 # escape regexp of split qr''
6986 #
6987 0 ▶sub e_split_q {
Subroutine e_split_q: not called CC=26 SCAR=65.5
Pod undocumented
6988 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6989 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
6990  
6991 0 $modifier =~ tr/p//d;
6992 0 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 0 0
6993 0 my $line = 0;
6994 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6995 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6996 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6997 0 last;
6998 }
6999 }
7000 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7001 }
7002  
7003 0 $slash = 'div';
7004  
7005 # /b /B modifier
7006 0 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 0 0
7007 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7008 }
7009  
7010 0 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 0 0
7011  
7012 # split regexp
7013 0 my @char = $string =~ /\G((?>
7014 [^\\\[] |
7015 [\x00-\xFF] |
7016 \[\^ |
7017 \[\: (?>[a-z]+) \:\] |
7018 \[\:\^ (?>[a-z]+) \:\] |
7019 \\ (?:$q_char) |
7020 (?:$q_char)
7021 ))/oxmsg;
7022  
7023 # unescape character
7024 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
7025 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 &Earabic::uc($char[$i]) ne &fc($char[$i])) { } 0 0 0
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 0 0
7026 }
7027  
7028 # open character class [...]
7029 elsif ($char[$i] eq '[') {
7030 0 my $left = $i;
7031 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7032 0 $i++;
7033 }
7034 0 while (1) {
7035 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7036 0 die __FILE__, ": Unmatched [] in regexp\n";
7037 }
7038 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7039 0 my $right = $i;
7040  
7041 # [...]
7042 0 splice @char, $left, $right-$left+1, Earabic::charlist_qr(@char[$left+1..$right-1], $modifier);
7043  
7044 0 $i = $left;
7045 0 last;
7046 }
7047 }
7048 }
7049  
7050 # open character class [^...]
7051 elsif ($char[$i] eq '[^') {
7052 0 my $left = $i;
7053 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7054 0 $i++;
7055 }
7056 0 while (1) {
7057 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7058 0 die __FILE__, ": Unmatched [] in regexp\n";
7059 }
7060 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7061 0 my $right = $i;
7062  
7063 # [^...]
7064 0 splice @char, $left, $right-$left+1, Earabic::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7065  
7066 0 $i = $left;
7067 0 last;
7068 }
7069 }
7070 }
7071  
7072 # rewrite character class or escape character
7073 elsif (my $char = character_class($char[$i],$modifier)) {
7074 0 $char[$i] = $char;
7075 }
7076  
7077 # split(m/^/) --> split(m/^/m)
7078 ▶ 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
7079 0 $modifier .= 'm';
7080 }
7081  
7082 # /i modifier
7083 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Earabic::uc($char[$i]) ne Earabic::fc($char[$i]))) {
Condition0%0/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Earabic::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 &Earabic::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Earabic::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= &Earabic::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7084 0 ▶ if (CORE::length(Earabic::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7085 0 $char[$i] = '[' . Earabic::uc($char[$i]) . Earabic::fc($char[$i]) . ']';
7086 }
7087 else {
7088 0 $char[$i] = '(?:' . Earabic::uc($char[$i]) . '|' . Earabic::fc($char[$i]) . ')';
7089 }
7090 }
7091  
7092 # quote character before ? + * {
7093 ▶ 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
7094 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
7095 }
7096 else {
7097 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7098 }
7099 }
7100 }
7101  
7102 0 $modifier =~ tr/i//d;
7103 0 return join '', 'Earabic::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7104 }
7105  
7106 #
7107 # instead of Carp::carp
7108 #
7109 0 ▶sub carp {
Subroutine carp: not called CC=1 SCAR=6.9
Pod undocumented
7110 0 my($package,$filename,$line) = caller(1);
7111 0 print STDERR "@_ at $filename line $line.\n";
7112 }
7113  
7114 #
7115 # instead of Carp::croak
7116 #
7117 0 ▶sub croak {
Subroutine croak: not called CC=1 SCAR=6.9
Pod undocumented
7118 0 my($package,$filename,$line) = caller(1);
7119 0 print STDERR "@_ at $filename line $line.\n";
7120 0 die "\n";
7121 }
7122  
7123 #
7124 # instead of Carp::cluck
7125 #
7126 0 ▶sub cluck {
Subroutine cluck: not called CC=2 SCAR=17.9
Pod undocumented
7127 0 my $i = 0;
7128 0 my @cluck = ();
7129 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7130 0 push @cluck, "[$i] $filename($line) $package::$subroutine\n";
7131 0 $i++;
7132 }
7133 0 print STDERR CORE::reverse @cluck;
7134 0 print STDERR "\n";
7135 0 print STDERR @_;
7136 }
7137  
7138 #
7139 # instead of Carp::confess
7140 #
7141 0 ▶sub confess {
Subroutine confess: not called CC=2 SCAR=17.9
Pod undocumented
7142 0 my $i = 0;
7143 0 my @confess = ();
7144 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7145 0 push @confess, "[$i] $filename($line) $package::$subroutine\n";
7146 0 $i++;
7147 }
7148 0 print STDERR CORE::reverse @confess;
7149 0 print STDERR "\n";
7150 0 print STDERR @_;
7151 0 die "\n";
7152 }
7153  
7154 424 1;
7155  
7156 __END__
↑ Summary Arabic.pm »