blib/lib/Etis620.pm

filter: Statementstmt 36.1% 1188 / 3283 Branchbran 38.3% 1134 / 2954 Conditioncond 30.8% 114 / 370 MC/DCmcdc 15.4% 34 / 220 Subroutinesub 61.6% 74 / 120 Podpod 4.6% 3 / 64 totaltotal 36.3% 2547 / 7011 CC 1648 SCAR 99.4
CC
1648
Cov
37%
escape_token
55669.4
e_string
33636.6
e_s1
3320.4
CRAP 20711.0
↑ Summary blib/lib/TIS620.pm »
1 package Etis620;
2 422 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 ######################################################################
4 #
5 # Etis620 - Run-time routines for TIS620.pm
6 #
7 # http://search.cpan.org/dist/Char-TIS620/
8 #
9 # Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2018, 2019 INABA Hitoshi <ina@cpan.org>
10 ######################################################################
11  
12 422 ▶use 5.00503; # Galapagos Consensus 1998 for primetools
Subroutine BEGIN: called CC=1 SCAR=0.0
13 # use 5.008001; # Lancaster Consensus 2013 for toolchains
14  
15 # 12.3. Delaying use Until Runtime
16 # in Chapter 12. Packages, Libraries, and Modules
17 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
18 # (and so on)
19  
20 # Version numbers should be boring
21 # http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/
22 # For the impatient, the disinterested or those who just want to follow
23 # a recipe, my advice for all modules is this:
24 # our $VERSION = "0.001"; # or "0.001_001" for a dev release
25 # $VERSION = eval $VERSION; # No!! because '1.10' makes '1.1'
26  
27 422 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
28 422 $VERSION = '1.15';
29 422 $VERSION = $VERSION;
30  
31 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.6
32 422 ▶ if ($^X =~ / jperl /oxmsi) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^X =~ / jperl /imosx) 0 422 422
33 0 die __FILE__, ": needs perl(not jperl) 5.00503 or later. (\$^X==$^X)\n";
34 }
35 422 if (CORE::ord('A') == 193) {
36 die __FILE__, ": is not US-ASCII script (may be EBCDIC or EBCDIK script).\n";
37 }
38 422 if (CORE::ord('A') != 0x41) {
39 die __FILE__, ": is not US-ASCII script (must be US-ASCII script).\n";
40 }
41 }
42  
43 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=9.5
44  
45 # instead of utf8.pm
46 422 ▶ CORE::eval q{
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
47 no warnings qw(redefine);
48 *utf8::upgrade = sub { CORE::length $_[0] };
49 *utf8::downgrade = sub { 1 };
50 *utf8::encode = sub { };
51 *utf8::decode = sub { 1 };
52 *utf8::is_utf8 = sub { };
53 *utf8::valid = sub { 1 };
54 };
55 422 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 422 422
56 0 ▶ *utf8::upgrade = sub { CORE::length $_[0] };
Subroutine __ANON__: not called CC=1 SCAR=6.9
57 0 ▶ *utf8::downgrade = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
58 0 ▶ *utf8::encode = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
59 0 ▶ *utf8::decode = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
60 0 ▶ *utf8::is_utf8 = sub { };
Subroutine __ANON__: not called CC=1 SCAR=6.9
61 0 ▶ *utf8::valid = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=6.9
62 }
63 }
64  
65 # instead of Symbol.pm
66 BEGIN {
67 0 ▶ sub gensym () {
Subroutine gensym: not called CC=2 SCAR=17.9
Pod undocumented
68 0 ▶ if ($] < 5.006) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < 5.006) { } 0 0 0
69 0 return \do { local *_ };
70 }
71 else {
72 0 return undef;
73 }
74 }
75  
76 20 ▶ sub qualify ($$) {
Subroutine qualify: called CC=8 SCAR=28.9
Pod undocumented
77 20 my($name) = @_;
78  
79 20 ▶ if (ref $name) {
Branch: 7 branches
BranchTrueFalseTotal
if (ref $name) { } 5 15 20
elsif (&Etis620::index($name, '::') >= 0) { } 0 15 15
elsif (&Etis620::index($name, q[']) >= 0) { } 0 15 15
elsif ($name =~ /\A \^ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+ \z/x) { } 0 15 15
elsif ($name =~ /\A (?: ARGV | ARGVOUT | ENV | INC | SIG | STDERR | STDIN | STDOUT ) \z/x) { } 0 15 15
elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) { } 0 15 15
elsif (defined $_[1]) { } 15 0 15
80 5 return $name;
81 }
82 elsif (Etis620::index($name,'::') >= 0) {
83 0 return $name;
84 }
85 elsif (Etis620::index($name,"'") >= 0) {
86 0 return $name;
87 }
88  
89 # special character, "^xyz"
90 elsif ($name =~ /\A \^ [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]+ \z/x) {
91  
92 # RGS 2001-11-05 : translate leading ^X to control-char
93 0 $name =~ s{\A \^ ([ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]) }{'qq(\c'.$1.')'}xee;
94 0 return 'main::' . $name;
95 }
96  
97 # Global names
98 elsif ($name =~ /\A (?: ARGV | ARGVOUT | ENV | INC | SIG | STDERR | STDIN | STDOUT ) \z/x) {
99 0 return 'main::' . $name;
100 }
101  
102 # or other
103 elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) {
104 0 return 'main::' . $name;
105 }
106  
107 elsif (defined $_[1]) {
108 15 return $_[1] . '::' . $name;
109 }
110 else {
111 0 return (caller)[0] . '::' . $name;
112 }
113 }
114  
115 20 ▶ sub qualify_to_ref ($;$) {
Subroutine qualify_to_ref: called CC=2 SCAR=7.2
Pod undocumented
116 20 ▶ if (defined $_[1]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[1]) { } 20 0 20
117 422 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
118 20 return \*{ qualify $_[0], $_[1] };
119 }
120 else {
121 422 ▶ no strict qw(refs);
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: not called CC=1 SCAR=0.0
122 0 return \*{ qualify $_[0], (caller)[0] };
123 }
124 }
125 }
126  
127 # P.714 29.2.39. flock
128 # in Chapter 29: Functions
129 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
130  
131 # P.863 flock
132 # in Chapter 27: Functions
133 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
134  
135 sub LOCK_SH() {1}
136 sub LOCK_EX() {2}
137 sub LOCK_UN() {8}
138 sub LOCK_NB() {4}
139  
140 # instead of Carp.pm
141 sub carp;
142 sub croak;
143 sub cluck;
144 sub confess;
145  
146 # 6.18. Matching Multiple-Byte Characters
147 # in Chapter 6. Pattern Matching
148 # of ISBN 978-1-56592-243-3 Perl Perl Cookbook.
149 # (and so on)
150  
151 # regexp of character
152 422 my $your_char = q{[\x00-\xFF]};
153 422 ▶use vars qw($qq_char); $qq_char = qr/\\c[\x40-\x5F]|\\?(?:$your_char)/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
154 422 ▶use vars qw($q_char); $q_char = qr/$your_char/oxms;
Subroutine BEGIN: called CC=1 SCAR=0.0
155  
156 #
157 # TIS-620 character range per length
158 #
159 422 my %range_tr = ();
160  
161 #
162 # TIS-620 case conversion
163 #
164 422 my %lc = ();
165 422 @lc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
166 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
167 422 my %uc = ();
168 422 @uc{qw(a b c d e f g h i j k l m n o p q r s t u v w x y z)} =
169 qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z);
170 422 my %fc = ();
171 422 @fc{qw(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)} =
172 qw(a b c d e f g h i j k l m n o p q r s t u v w x y z);
173  
174 422 ▶if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { __PACKAGE__ =~ / \b Etis620 \z/mosx }) { } 422 0 422
175 }
176  
177 elsif (__PACKAGE__ =~ / \b Etis620 \z/oxms) {
178 422 %range_tr = (
179 1 => [ [0x00..0xFF],
180 ],
181 );
182 }
183  
184 else {
185 0 croak "Don't know my package name '@{[__PACKAGE__]}'";
186 }
187  
188 #
189 # @ARGV wildcard globbing
190 #
191 211 ▶sub import {
Subroutine import: called CC=7 SCAR=28.3
192  
193 211 ▶ if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/mosx) 0 211 211
194 0 my @argv = ();
195 0 for (@ARGV) {
196  
197 # has space
198 0 ▶ if (/\A (?:$q_char)*? [ ] /oxms) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\A (?:$Etis620::q_char)*? [ ] /mosx) { } 0 0 0
elsif (/\A (?:$Etis620::q_char)*? [*?] /mosx) { } 0 0 0
199 0 ▶ if (my @glob = Etis620::glob(qq{"$_"})) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Etis620::glob(qq["$_"])) { } 0 0 0
200 0 push @argv, @glob;
201 }
202 else {
203 0 push @argv, $_;
204 }
205 }
206  
207 # has wildcard metachar
208 elsif (/\A (?:$q_char)*? [*?] /oxms) {
209 0 ▶ if (my @glob = Etis620::glob($_)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@glob) = &Etis620::glob($_)) { } 0 0 0
210 0 push @argv, @glob;
211 }
212 else {
213 0 push @argv, $_;
214 }
215 }
216  
217 # no wildcard globbing
218 else {
219 0 push @argv, $_;
220 }
221 }
222 0 @ARGV = @argv;
223 }
224  
225 211 *Char::ord = \&TIS620::ord;
226 211 *Char::ord_ = \&TIS620::ord_;
227 211 *Char::reverse = \&TIS620::reverse;
228 211 *Char::getc = \&TIS620::getc;
229 211 *Char::length = \&TIS620::length;
230 211 *Char::substr = \&TIS620::substr;
231 211 *Char::index = \&TIS620::index;
232 211 *Char::rindex = \&TIS620::rindex;
233 211 *Char::eval = \&TIS620::eval;
234 211 *Char::escape = \&TIS620::escape;
235 211 *Char::escape_token = \&TIS620::escape_token;
236 211 *Char::escape_script = \&TIS620::escape_script;
237 }
238  
239 # P.230 Care with Prototypes
240 # in Chapter 6: Subroutines
241 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
242 #
243 # If you aren't careful, you can get yourself into trouble with prototypes.
244 # But if you are careful, you can do a lot of neat things with them. This is
245 # all very powerful, of course, and should only be used in moderation to make
246 # the world a better place.
247  
248 # P.332 Care with Prototypes
249 # in Chapter 7: Subroutines
250 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
251 #
252 # If you aren't careful, you can get yourself into trouble with prototypes.
253 # But if you are careful, you can do a lot of neat things with them. This is
254 # all very powerful, of course, and should only be used in moderation to make
255 # the world a better place.
256  
257 #
258 # Prototypes of subroutines
259 #
260 0 ▶sub unimport {}
Subroutine unimport: not called CC=1 SCAR=0.0
261 sub Etis620::split(;$$$);
262 sub Etis620::tr($$$$;$);
263 sub Etis620::chop(@);
264 sub Etis620::index($$;$);
265 sub Etis620::rindex($$;$);
266 sub Etis620::lcfirst(@);
267 sub Etis620::lcfirst_();
268 sub Etis620::lc(@);
269 sub Etis620::lc_();
270 sub Etis620::ucfirst(@);
271 sub Etis620::ucfirst_();
272 sub Etis620::uc(@);
273 sub Etis620::uc_();
274 sub Etis620::fc(@);
275 sub Etis620::fc_();
276 sub Etis620::ignorecase;
277 sub Etis620::classic_character_class;
278 sub Etis620::capture;
279 sub Etis620::chr(;$);
280 sub Etis620::chr_();
281 sub Etis620::glob($);
282 sub Etis620::glob_();
283  
284 sub TIS620::ord(;$);
285 sub TIS620::ord_();
286 sub TIS620::reverse(@);
287 sub TIS620::getc(;*@);
288 sub TIS620::length(;$);
289 sub TIS620::substr($$;$$);
290 sub TIS620::index($$;$);
291 sub TIS620::rindex($$;$);
292 sub TIS620::escape(;$);
293  
294 #
295 # Regexp work
296 #
297 422 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
298 $re_a
299 $re_t
300 $re_n
301 $re_r
302 422 );
303  
304 #
305 # Character class
306 #
307 422 ▶use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
308 $dot
309 $dot_s
310 $eD
311 $eS
312 $eW
313 $eH
314 $eV
315 $eR
316 $eN
317 $not_alnum
318 $not_alpha
319 $not_ascii
320 $not_blank
321 $not_cntrl
322 $not_digit
323 $not_graph
324 $not_lower
325 $not_lower_i
326 $not_print
327 $not_punct
328 $not_space
329 $not_upper
330 $not_upper_i
331 $not_word
332 $not_xdigit
333 $eb
334 $eB
335 422 );
336  
337 422 ${Etis620::dot} = qr{(?>[^\x0A])};
338 422 ${Etis620::dot_s} = qr{(?>[\x00-\xFF])};
339 422 ${Etis620::eD} = qr{(?>[^0-9])};
340  
341 # Vertical tabs are now whitespace
342 # \s in a regex now matches a vertical tab in all circumstances.
343 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
344 # ${Etis620::eS} = qr{(?>[^\x09\x0A \x0C\x0D\x20])};
345 # ${Etis620::eS} = qr{(?>[^\x09\x0A\x0B\x0C\x0D\x20])};
346 422 ${Etis620::eS} = qr{(?>[^\s])};
347  
348 422 ${Etis620::eW} = qr{(?>[^0-9A-Z_a-z])};
349 422 ${Etis620::eH} = qr{(?>[^\x09\x20])};
350 422 ${Etis620::eV} = qr{(?>[^\x0A\x0B\x0C\x0D])};
351 422 ${Etis620::eR} = qr{(?>\x0D\x0A|[\x0A\x0D])};
352 422 ${Etis620::eN} = qr{(?>[^\x0A])};
353 422 ${Etis620::not_alnum} = qr{(?>[^\x30-\x39\x41-\x5A\x61-\x7A])};
354 422 ${Etis620::not_alpha} = qr{(?>[^\x41-\x5A\x61-\x7A])};
355 422 ${Etis620::not_ascii} = qr{(?>[^\x00-\x7F])};
356 422 ${Etis620::not_blank} = qr{(?>[^\x09\x20])};
357 422 ${Etis620::not_cntrl} = qr{(?>[^\x00-\x1F\x7F])};
358 422 ${Etis620::not_digit} = qr{(?>[^\x30-\x39])};
359 422 ${Etis620::not_graph} = qr{(?>[^\x21-\x7F])};
360 422 ${Etis620::not_lower} = qr{(?>[^\x61-\x7A])};
361 422 ${Etis620::not_lower_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
362 # ${Etis620::not_lower_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
363 422 ${Etis620::not_print} = qr{(?>[^\x20-\x7F])};
364 422 ${Etis620::not_punct} = qr{(?>[^\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E])};
365 422 ${Etis620::not_space} = qr{(?>[^\s\x0B])};
366 422 ${Etis620::not_upper} = qr{(?>[^\x41-\x5A])};
367 422 ${Etis620::not_upper_i} = qr{(?>[^\x41-\x5A\x61-\x7A])}; # Perl 5.16 compatible
368 # ${Etis620::not_upper_i} = qr{(?>[\x00-\xFF])}; # older Perl compatible
369 422 ${Etis620::not_word} = qr{(?>[^\x30-\x39\x41-\x5A\x5F\x61-\x7A])};
370 422 ${Etis620::not_xdigit} = qr{(?>[^\x30-\x39\x41-\x46\x61-\x66])};
371 422 ${Etis620::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))};
372 422 ${Etis620::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]))};
373  
374 # avoid: Name "Etis620::foo" used only once: possible typo at here.
375 422 ${Etis620::dot} = ${Etis620::dot};
376 422 ${Etis620::dot_s} = ${Etis620::dot_s};
377 422 ${Etis620::eD} = ${Etis620::eD};
378 422 ${Etis620::eS} = ${Etis620::eS};
379 422 ${Etis620::eW} = ${Etis620::eW};
380 422 ${Etis620::eH} = ${Etis620::eH};
381 422 ${Etis620::eV} = ${Etis620::eV};
382 422 ${Etis620::eR} = ${Etis620::eR};
383 422 ${Etis620::eN} = ${Etis620::eN};
384 422 ${Etis620::not_alnum} = ${Etis620::not_alnum};
385 422 ${Etis620::not_alpha} = ${Etis620::not_alpha};
386 422 ${Etis620::not_ascii} = ${Etis620::not_ascii};
387 422 ${Etis620::not_blank} = ${Etis620::not_blank};
388 422 ${Etis620::not_cntrl} = ${Etis620::not_cntrl};
389 422 ${Etis620::not_digit} = ${Etis620::not_digit};
390 422 ${Etis620::not_graph} = ${Etis620::not_graph};
391 422 ${Etis620::not_lower} = ${Etis620::not_lower};
392 422 ${Etis620::not_lower_i} = ${Etis620::not_lower_i};
393 422 ${Etis620::not_print} = ${Etis620::not_print};
394 422 ${Etis620::not_punct} = ${Etis620::not_punct};
395 422 ${Etis620::not_space} = ${Etis620::not_space};
396 422 ${Etis620::not_upper} = ${Etis620::not_upper};
397 422 ${Etis620::not_upper_i} = ${Etis620::not_upper_i};
398 422 ${Etis620::not_word} = ${Etis620::not_word};
399 422 ${Etis620::not_xdigit} = ${Etis620::not_xdigit};
400 422 ${Etis620::eb} = ${Etis620::eb};
401 422 ${Etis620::eB} = ${Etis620::eB};
402  
403 #
404 # TIS-620 split
405 #
406 72 ▶sub Etis620::split(;$$$) {
Subroutine split: called CC=34 SCAR=46.9
Pod undocumented
407  
408 # P.794 29.2.161. split
409 # in Chapter 29: Functions
410 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
411  
412 # P.951 split
413 # in Chapter 27: Functions
414 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
415  
416 72 my $pattern = $_[0];
417 72 my $string = $_[1];
418 72 my $limit = $_[2];
419  
420 # if $pattern is also omitted or is the literal space, " "
421 72 ▶ if (not defined $pattern) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pattern) 2 70 72
422 2 $pattern = ' ';
423 }
424  
425 # if $string is omitted, the function splits the $_ string
426 72 ▶ if (not defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $string) 6 66 72
427 6 ▶ if (defined $_) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_) { } 0 6 6
428 0 $string = $_;
429 }
430 else {
431 6 $string = '';
432 }
433 }
434  
435 72 my @split = ();
436  
437 # when string is empty
438 72 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 10 62 72
elsif ($pattern eq ' ') { } 2 60 62
439  
440 # resulting list value in list context
441 10 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 5 5 10
442 5 return @split;
443 }
444  
445 # count of substrings in scalar context
446 else {
447 5 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 5 5
448 5 @_ = @split;
449 5 return scalar @_;
450 }
451 }
452  
453 # split's first argument is more consistently interpreted
454 #
455 # After some changes earlier in v5.17, split's behavior has been simplified:
456 # if the PATTERN argument evaluates to a string containing one space, it is
457 # treated the way that a literal string containing one space once was.
458 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#split's_first_argument_is_more_consistently_interpreted
459  
460 # if $pattern is also omitted or is the literal space, " ", the function splits
461 # on whitespace, /\s+/, after skipping any leading whitespace
462 # (and so on)
463  
464 elsif ($pattern eq ' ') {
465 2 ▶ if (not defined $limit) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $limit) { } 2 0 2
466 2 return CORE::split(' ', $string);
467 }
468 else {
469 0 return CORE::split(' ', $string, $limit);
470 }
471 }
472  
473 # if $limit is negative, it is treated as if an arbitrarily large $limit has been specified
474 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
475  
476 # a pattern capable of matching either the null string or something longer than the
477 # null string will split the value of $string into separate characters wherever it
478 # matches the null string between characters
479 # (and so on)
480  
481 60 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 2 58 60
482 2 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
483 2 my $limit = scalar(() = $string =~ /($pattern)/oxmsg);
484  
485 # P.1024 Appendix W.10 Multibyte Processing
486 # of ISBN 1-56592-224-7 CJKV Information Processing
487 # (and so on)
488  
489 # the //m modifier is assumed when you split on the pattern /^/
490 # (and so on)
491  
492 # V
493 2 ▶ while ((--$limit > 0) and ($string =~ s/\A((?:$q_char)+?)$pattern//m)) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$limit > 0 and $string =~ s/\A((?:$Etis620::q_char)+?)$pattern//m) 9 2 11
Condition100%3/3
--$limit > 0 and $string =~ s/\A((?:$Etis620::q_char)+?)$pattern//m
!ll&&!rl&&r
119
MC/DC100%2/2
--$limit > 0 and $string =~ s/\A((?:$Etis620::q_char)+?)$pattern//m
--$limit > 0 $string =~ s/\A((?:$Etis620::q_char)+?)$pattern//m
Truth table100%3/3
A and B
A= --$limit > 0B= $string =~ s/\A((?:$Etis620::q_char)+?)$pattern//m
ABresult
0X0
100
111
494  
495 # if the $pattern contains parentheses, then the substring matched by each pair of parentheses
496 # is included in the resulting list, interspersed with the fields that are ordinarily returned
497 # (and so on)
498  
499 9 local $@;
500 9 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 9 9 18
501 9 push @split, CORE::eval('$' . $digit);
502 }
503 }
504 }
505  
506 else {
507 58 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
508  
509 # V
510 58 ▶ while ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Etis620::q_char)*?)$pattern//m) 163 58 221
511 163 local $@;
512 163 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 230 163 393
513 230 push @split, CORE::eval('$' . $digit);
514 }
515 }
516 }
517 }
518  
519 elsif ($limit > 0) {
520 0 ▶ if ('' =~ / \A $pattern \z /xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ('' =~ / \A $pattern \z /msx) { } 0 0 0
521 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
522 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
523  
524 # V
525 0 ▶ if ($string =~ s/\A((?:$q_char)+?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Etis620::q_char)+?)$pattern//m) 0 0 0
526 0 local $@;
527 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
528 0 push @split, CORE::eval('$' . $digit);
529 }
530 }
531 }
532 }
533 else {
534 0 my $last_subexpression_offsets = _last_subexpression_offsets($pattern);
535 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
536  
537 # V
538 0 ▶ if ($string =~ s/\A((?:$q_char)*?)$pattern//m) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\A((?:$Etis620::q_char)*?)$pattern//m) 0 0 0
539 0 local $@;
540 0 ▶ for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($digit <= $last_subexpression_offsets + 1) 0 0 0
541 0 push @split, CORE::eval('$' . $digit);
542 }
543 }
544 }
545 }
546 }
547  
548 60 ▶ if (CORE::length($string) > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $string > 0) 58 2 60
549 58 push @split, $string;
550 }
551  
552 # if $_[2] (NOT "$limit") is omitted or zero, trailing null fields are stripped from the result
553 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
554 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
555 0 pop @split;
556 }
557 }
558  
559 # resulting list value in list context
560 60 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 58 2 60
561 58 return @split;
562 }
563  
564 # count of substrings in scalar context
565 else {
566 2 ▶ carp "Use of implicit split to \@_ is deprecated" if $^W;
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 2 2
567 2 @_ = @split;
568 2 return scalar @_;
569 }
570 }
571  
572 #
573 # get last subexpression offsets
574 #
575 60 ▶sub _last_subexpression_offsets {
Subroutine _last_subexpression_offsets: called CC=3 SCAR=11.0
576 60 my $pattern = $_[0];
577  
578 # remove comment
579 60 $pattern =~ s/\(\?\# .*? \)//oxmsg;
580  
581 60 my $modifier = '';
582 60 ▶ if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/mosx) 11 49 60
583 11 $modifier = $1;
584 11 $modifier =~ s/-[A-Za-z]*//;
585 }
586  
587 # with /x modifier
588 60 my @char = ();
589 60 ▶ if ($modifier =~ /x/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /x/mosx) { } 5 55 60
590 5 @char = $pattern =~ /\G((?>
591 [^\\\#\[\(] |
592 \\ $q_char |
593 \# (?>[^\n]*) $ |
594 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
595 \(\? |
596 $q_char
597 ))/oxmsg;
598 }
599  
600 # without /x modifier
601 else {
602 55 @char = $pattern =~ /\G((?>
603 [^\\\[\(] |
604 \\ $q_char |
605 \[ (?>(?:[^\\\]]|\\\\|\\\]|$q_char)+) \] |
606 \(\? |
607 $q_char
608 ))/oxmsg;
609 }
610  
611 60 return scalar grep { $_ eq '(' } @char;
612 }
613  
614 #
615 # TIS-620 transliteration (tr///)
616 #
617 6 ▶sub Etis620::tr($$$$;$) {
Subroutine tr: called CC=26 SCAR=48.6
Pod undocumented
618  
619 6 my $bind_operator = $_[1];
620 6 my $searchlist = $_[2];
621 6 my $replacementlist = $_[3];
622 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
623  
624 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) 5 1 6
625 5 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 5 5
626 0 croak "Using !~ with tr///r doesn't make sense";
627 }
628 }
629  
630 6 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
631 6 my @searchlist = _charlist_tr($searchlist);
632 6 my @replacementlist = _charlist_tr($replacementlist);
633  
634 6 my %tr = ();
635 6 ▶ for (my $i=0; $i <= $#searchlist; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#searchlist) 19 6 25
636 19 ▶ if (not exists $tr{$searchlist[$i]}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $tr{$searchlist[$i]}) 19 0 19
637 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
638 19 $tr{$searchlist[$i]} = $replacementlist[$i];
639 }
640 elsif ($modifier =~ /d/oxms) {
641 0 $tr{$searchlist[$i]} = '';
642 }
643 ▶ 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
644 0 $tr{$searchlist[$i]} = $replacementlist[-1];
645 }
646 else {
647 0 $tr{$searchlist[$i]} = $searchlist[$i];
648 }
649 }
650 }
651  
652 6 my $tr = 0;
653 6 my $replaced = '';
654 6 ▶ if ($modifier =~ /c/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /c/mosx) { } 0 6 6
655 0 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 0 0 0
656 0 ▶ if (not exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $tr{$char}) { } 0 0 0
657 0 ▶ if (defined $replacementlist[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $replacementlist[0]) 0 0 0
658 0 $replaced .= $replacementlist[0];
659 }
660 0 $tr++;
661 0 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 0 0
662 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
663 0 shift @char;
664 0 $tr++;
665 }
666 }
667 }
668 else {
669 0 $replaced .= $char;
670 }
671 }
672 }
673 else {
674 6 ▶ while (defined(my $char = shift @char)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $char = shift @char)) 36 6 42
675 36 ▶ if (exists $tr{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $tr{$char}) { } 19 17 36
676 19 $replaced .= $tr{$char};
677 19 $tr++;
678 19 ▶ if ($modifier =~ /s/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/mosx) 0 19 19
679 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
680 0 shift @char;
681 0 $tr++;
682 }
683 }
684 }
685 else {
686 17 $replaced .= $char;
687 }
688 }
689 }
690  
691 6 ▶ if ($modifier =~ /r/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /r/mosx) { } 5 1 6
692 5 return $replaced;
693 }
694 else {
695 1 $_[0] = $replaced;
696 1 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) { } 0 1 1
697 0 return not $tr;
698 }
699 else {
700 1 return $tr;
701 }
702 }
703 }
704  
705 #
706 # TIS-620 chop
707 #
708 0 ▶sub Etis620::chop(@) {
Subroutine chop: not called CC=3 SCAR=24.8
Pod undocumented
709  
710 0 my $chop;
711 0 ▶ if (@_ == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 0) { } 0 0 0
712 0 my @char = /\G (?>$q_char) /oxmsg;
713 0 $chop = pop @char;
714 0 $_ = join '', @char;
715 }
716 else {
717 0 for (@_) {
718 0 my @char = /\G (?>$q_char) /oxmsg;
719 0 $chop = pop @char;
720 0 $_ = join '', @char;
721 }
722 }
723 0 return $chop;
724 }
725  
726 #
727 # TIS-620 index by octet
728 #
729 30 ▶sub Etis620::index($$;$) {
Subroutine index: called CC=6 SCAR=20.8
Pod documented
730  
731 30 my($str,$substr,$position) = @_;
732 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
733 30 my $pos = 0;
734  
735 30 ▶ while ($pos < CORE::length($str)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos < length $str) 130 30 160
736 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
737 0 ▶ if ($pos >= $position) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos >= $position) 0 0 0
738 0 return $pos;
739 }
740 }
741 130 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Etis620::q_char) /mosx) { } 130 0 130
742 130 $pos += CORE::length($1);
743 }
744 else {
745 0 $pos += 1;
746 }
747 }
748 30 return -1;
749 }
750  
751 #
752 # TIS-620 reverse index
753 #
754 0 ▶sub Etis620::rindex($$;$) {
Subroutine rindex: not called CC=6 SCAR=37.4
Pod undocumented
755  
756 0 my($str,$substr,$position) = @_;
757 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
758 0 my $pos = 0;
759 0 my $rindex = -1;
760  
761 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
762 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
763 0 $rindex = $pos;
764 }
765 0 ▶ if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($str, $pos) =~ /\A ($Etis620::q_char) /mosx) { } 0 0 0
766 0 $pos += CORE::length($1);
767 }
768 else {
769 0 $pos += 1;
770 }
771 }
772 0 return $rindex;
773 }
774  
775 #
776 # TIS-620 lower case first with parameter
777 #
778 0 ▶sub Etis620::lcfirst(@) {
Subroutine lcfirst: not called CC=4 SCAR=30.0
Pod undocumented
779 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
780 0 my $s = shift @_;
781 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
782 0 return Etis620::lc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
783 }
784 else {
785 0 return Etis620::lc(CORE::substr($s,0,1)) . CORE::substr($s,1);
786 }
787 }
788 else {
789 0 return Etis620::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
790 }
791 }
792  
793 #
794 # TIS-620 lower case first without parameter
795 #
796 0 ▶sub Etis620::lcfirst_() {
Subroutine lcfirst_: not called CC=1 SCAR=6.9
Pod undocumented
797 0 return Etis620::lc(CORE::substr($_,0,1)) . CORE::substr($_,1);
798 }
799  
800 #
801 # TIS-620 lower case with parameter
802 #
803 27 ▶sub Etis620::lc(@) {
Subroutine lc: called CC=6 SCAR=24.2
Pod undocumented
804 27 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 27 0 27
805 27 my $s = shift @_;
806 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
807 0 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
808 }
809 else {
810 27 ▶ return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 29 0 29
811 }
812 }
813 else {
814 0 return Etis620::lc_();
815 }
816 }
817  
818 #
819 # TIS-620 lower case without parameter
820 #
821 0 ▶sub Etis620::lc_() {
Subroutine lc_: not called CC=2 SCAR=17.9
Pod undocumented
822 0 my $s = $_;
823 0 ▶ return join '', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $lc{$_} ? : 0 0 0
824 }
825  
826 #
827 # TIS-620 upper case first with parameter
828 #
829 0 ▶sub Etis620::ucfirst(@) {
Subroutine ucfirst: not called CC=4 SCAR=30.0
Pod undocumented
830 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
831 0 my $s = shift @_;
832 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
833 0 return Etis620::uc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_;
834 }
835 else {
836 0 return Etis620::uc(CORE::substr($s,0,1)) . CORE::substr($s,1);
837 }
838 }
839 else {
840 0 return Etis620::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
841 }
842 }
843  
844 #
845 # TIS-620 upper case first without parameter
846 #
847 0 ▶sub Etis620::ucfirst_() {
Subroutine ucfirst_: not called CC=1 SCAR=6.9
Pod undocumented
848 0 return Etis620::uc(CORE::substr($_,0,1)) . CORE::substr($_,1);
849 }
850  
851 #
852 # TIS-620 upper case with parameter
853 #
854 246 ▶sub Etis620::uc(@) {
Subroutine uc: called CC=6 SCAR=22.9
Pod undocumented
855 246 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 246 0 246
856 246 my $s = shift @_;
857 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
858 0 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
859 }
860 else {
861 246 ▶ return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 53 195 248
862 }
863 }
864 else {
865 0 return Etis620::uc_();
866 }
867 }
868  
869 #
870 # TIS-620 upper case without parameter
871 #
872 0 ▶sub Etis620::uc_() {
Subroutine uc_: not called CC=2 SCAR=17.9
Pod undocumented
873 0 my $s = $_;
874 0 ▶ return join '', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $uc{$_} ? : 0 0 0
875 }
876  
877 #
878 # TIS-620 fold case with parameter
879 #
880 258 ▶sub Etis620::fc(@) {
Subroutine fc: called CC=6 SCAR=22.9
Pod undocumented
881 258 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 258 0 258
882 258 my $s = shift @_;
883 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
884 0 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_;
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
885 }
886 else {
887 258 ▶ return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg));
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 262 148 410
888 }
889 }
890 else {
891 0 return Etis620::fc_();
892 }
893 }
894  
895 #
896 # TIS-620 fold case without parameter
897 #
898 0 ▶sub Etis620::fc_() {
Subroutine fc_: not called CC=2 SCAR=17.9
Pod undocumented
899 0 my $s = $_;
900 0 ▶ return join '', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg);
Branch: 1 branch
BranchTrueFalseTotal
defined $fc{$_} ? : 0 0 0
901 }
902  
903 #
904 # TIS-620 regexp capture
905 #
906 {
907 0 ▶ sub Etis620::capture {
Subroutine capture: not called CC=1 SCAR=6.9
Pod documented
908 0 return $_[0];
909 }
910 }
911  
912 #
913 # TIS-620 regexp ignore case modifier
914 #
915 422 ▶sub Etis620::ignorecase {
Subroutine ignorecase: called CC=25 SCAR=53.3
Pod undocumented
916  
917 3 my @string = @_;
918 3 my $metachar = qr/[\@\\|[\]{]/oxms;
919  
920 # ignore case of $scalar or @array
921 3 for my $string (@string) {
922  
923 # split regexp
924 3 my @char = $string =~ /\G (?>\[\^|\\$q_char|$q_char) /oxmsg;
925  
926 # unescape character
927 3 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 15 3 18
928 15 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 15 15
929  
930 # open character class [...]
931 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
932 0 my $left = $i;
933  
934 # [] make die "unmatched [] in regexp ...\n"
935  
936 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
937 0 $i++;
938 }
939  
940 0 while (1) {
941 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
942 0 croak "Unmatched [] in regexp";
943 }
944 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
945 0 my $right = $i;
946 0 my @charlist = charlist_qr(@char[$left+1..$right-1], 'i');
947  
948 # escape character
949 0 for my $char (@charlist) {
950 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
951 }
952  
953 0 elsif ($char =~ /\A [.|)] \z/oxms) {
954 0 $char = '\\' . $char;
955 }
956 }
957  
958 # [...]
959 0 splice @char, $left, $right-$left+1, '(?:' . join('|', @charlist) . ')';
960  
961 0 $i = $left;
962 0 last;
963 }
964 }
965 }
966  
967 # open character class [^...]
968 elsif ($char[$i] eq '[^') {
969 0 my $left = $i;
970  
971 # [^] make die "unmatched [] in regexp ...\n"
972  
973 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
974 0 $i++;
975 }
976  
977 0 while (1) {
978 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
979 0 croak "Unmatched [] in regexp";
980 }
981 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
982 0 my $right = $i;
983 0 my @charlist = charlist_not_qr(@char[$left+1..$right-1], 'i');
984  
985 # escape character
986 0 for my $char (@charlist) {
987 0 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $char =~ /\A [.|)] \z/mosx }) 0 0 0
988 }
989  
990 0 elsif ($char =~ /\A [.|)] \z/oxms) {
991 0 $char = '\\' . $char;
992 }
993 }
994  
995 # [^...]
996 0 splice @char, $left, $right-$left+1, '(?!' . join('|', @charlist) . ")(?:$your_char)";
997  
998 0 $i = $left;
999 0 last;
1000 }
1001 }
1002 }
1003  
1004 # rewrite classic character class or escape character
1005 elsif (my $char = classic_character_class($char[$i])) {
1006 0 $char[$i] = $char;
1007 }
1008  
1009 # with /i modifier
1010 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1011 15 my $uc = Etis620::uc($char[$i]);
1012 15 my $fc = Etis620::fc($char[$i]);
1013 15 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) 15 0 15
1014 15 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 15 0 15
1015 15 $char[$i] = '[' . $uc . $fc . ']';
1016 }
1017 else {
1018 0 $char[$i] = '(?:' . $uc . '|' . $fc . ')';
1019 }
1020 }
1021 }
1022 }
1023  
1024 # characterize
1025 3 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 15 3 18
1026 15 ▶ next if not defined $char[$i];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $char[$i] 0 15 15
1027  
1028 15 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx }) 0 18 18
1029 }
1030  
1031 # quote character before ? + * {
1032 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
1033 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
1034 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
1035 }
1036 }
1037 }
1038  
1039 3 $string = join '', @char;
1040 }
1041  
1042 # make regexp string
1043 3 return @string;
1044 }
1045  
1046 #
1047 # classic character class ( \D \S \W \d \s \w \C \X \H \V \h \v \R \N \b \B )
1048 #
1049 1843 ▶sub Etis620::classic_character_class {
Subroutine classic_character_class: called CC=2 SCAR=6.9
Pod undocumented
1050 1843 my($char) = @_;
1051  
1052 return {
1053 '\D' => '${Etis620::eD}',
1054 '\S' => '${Etis620::eS}',
1055 '\W' => '${Etis620::eW}',
1056 '\d' => '[0-9]',
1057  
1058 # Before Perl 5.6, \s only matched the five whitespace characters
1059 # tab, newline, form-feed, carriage return, and the space character
1060 # itself, which, taken together, is the character class [\t\n\f\r ].
1061  
1062 # Vertical tabs are now whitespace
1063 # \s in a regex now matches a vertical tab in all circumstances.
1064 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1065 # \t \n \v \f \r space
1066 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1067 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1068 '\s' => '\s',
1069  
1070 '\w' => '[0-9A-Z_a-z]',
1071 '\C' => '[\x00-\xFF]',
1072 '\X' => 'X',
1073  
1074 # \h \v \H \V
1075  
1076 # P.114 Character Class Shortcuts
1077 # in Chapter 7: In the World of Regular Expressions
1078 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
1079  
1080 # P.357 13.2.3 Whitespace
1081 # in Chapter 13: perlrecharclass: Perl Regular Expression Character Classes
1082 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1083 #
1084 # 0x00009 CHARACTER TABULATION h s
1085 # 0x0000a LINE FEED (LF) vs
1086 # 0x0000b LINE TABULATION v
1087 # 0x0000c FORM FEED (FF) vs
1088 # 0x0000d CARRIAGE RETURN (CR) vs
1089 # 0x00020 SPACE h s
1090  
1091 # P.196 Table 5-9. Alphanumeric regex metasymbols
1092 # in Chapter 5. Pattern Matching
1093 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1094  
1095 # (and so on)
1096  
1097 '\H' => '${Etis620::eH}',
1098 '\V' => '${Etis620::eV}',
1099 '\h' => '[\x09\x20]',
1100 '\v' => '[\x0A\x0B\x0C\x0D]',
1101 '\R' => '${Etis620::eR}',
1102  
1103 # \N
1104 #
1105 # http://perldoc.perl.org/perlre.html
1106 # Character Classes and other Special Escapes
1107 # Any character but \n (experimental). Not affected by /s modifier
1108  
1109 '\N' => '${Etis620::eN}',
1110  
1111 # \b \B
1112  
1113 # P.180 Boundaries: The \b and \B Assertions
1114 # in Chapter 5: Pattern Matching
1115 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1116  
1117 # P.219 Boundaries: The \b and \B Assertions
1118 # in Chapter 5: Pattern Matching
1119 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1120  
1121 # \b really means (?:(?<=\w)(?!\w)|(?<!\w)(?=\w))
1122 # or (?:(?<=\A|\W)(?=\w)|(?<=\w)(?=\W|\z))
1123 '\b' => '${Etis620::eb}',
1124  
1125 # \B really means (?:(?<=\w)(?=\w)|(?<!\w)(?!\w))
1126 # or (?:(?<=\w)(?=\w)|(?<=\W)(?=\W))
1127 '\B' => '${Etis620::eB}',
1128  
1129 1843 ▶ }->{$char} || '';
Condition100%2/2
{'\\D', '${Etis620::eD}', '\\S', '${Etis620::eS}', '\\W', '${Etis620::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Etis620::eH}', '\\V', '${Etis620::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Etis620::eR}', '\\N', '${Etis620::eN}', '\\b', '${Etis620::eb}', '\\B', '${Etis620::eB}'}->{$char} || ''
l!l
1011742
MC/DC100%1/1
{'\\D', '${Etis620::eD}', '\\S', '${Etis620::eS}', '\\W', '${Etis620::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Etis620::eH}', '\\V', '${Etis620::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Etis620::eR}', '\\N', '${Etis620::eN}', '\\b', '${Etis620::eb}', '\\B', '${Etis620::eB}'}->{$char} || ''
{'\\D', '${Etis620::eD}', '\\S', '${Etis620::eS}', '\\W', '${Etis620::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Etis620::eH}', '\\V', '${Etis620::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Etis620::eR}', '\\N', '${Etis620::eN}', '\\b', '${Etis620::eb}', '\\B', '${Etis620::eB}'}->{$char}
Truth table100%2/2
A
A= {'\\D', '${Etis620::eD}', '\\S', '${Etis620::eS}', '\\W', '${Etis620::eW}', '\\d', '[0-9]', '\\s', '\\s', '\\w', '[0-9A-Z_a-z]', '\\C', '[\\x00-\\xFF]', '\\X', 'X', '\\H', '${Etis620::eH}', '\\V', '${Etis620::eV}', '\\h', '[\\x09\\x20]', '\\v', '[\\x0A\\x0B\\x0C\\x0D]', '\\R', '${Etis620::eR}', '\\N', '${Etis620::eN}', '\\b', '${Etis620::eb}', '\\B', '${Etis620::eB}'}->{$char}
Aresult
11
00
1130 }
1131  
1132 #
1133 # prepare TIS-620 characters per length
1134 #
1135  
1136 # 1 octet characters
1137 422 my @chars1 = ();
1138 0 ▶sub chars1 {
Subroutine chars1: not called CC=5 SCAR=34.0
Pod undocumented
1139 0 ▶ if (@chars1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars1) 0 0 0
1140 0 return @chars1;
1141 }
1142 0 ▶ if (exists $range_tr{1}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{1}) 0 0 0
1143 0 my @ranges = @{ $range_tr{1} };
1144 0 ▶ while (my @range = splice(@ranges,0,1)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 1)) 0 0 0
1145 0 for my $oct0 (@{$range[0]}) {
1146 0 push @chars1, pack 'C', $oct0;
1147 }
1148 }
1149 }
1150 0 return @chars1;
1151 }
1152  
1153 # 2 octets characters
1154 422 my @chars2 = ();
1155 0 ▶sub chars2 {
Subroutine chars2: not called CC=6 SCAR=37.4
Pod undocumented
1156 0 ▶ if (@chars2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars2) 0 0 0
1157 0 return @chars2;
1158 }
1159 0 ▶ if (exists $range_tr{2}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{2}) 0 0 0
1160 0 my @ranges = @{ $range_tr{2} };
1161 0 ▶ while (my @range = splice(@ranges,0,2)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 2)) 0 0 0
1162 0 for my $oct0 (@{$range[0]}) {
1163 0 for my $oct1 (@{$range[1]}) {
1164 0 push @chars2, pack 'CC', $oct0,$oct1;
1165 }
1166 }
1167 }
1168 }
1169 0 return @chars2;
1170 }
1171  
1172 # 3 octets characters
1173 422 my @chars3 = ();
1174 0 ▶sub chars3 {
Subroutine chars3: not called CC=7 SCAR=40.3
Pod undocumented
1175 0 ▶ if (@chars3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars3) 0 0 0
1176 0 return @chars3;
1177 }
1178 0 ▶ if (exists $range_tr{3}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{3}) 0 0 0
1179 0 my @ranges = @{ $range_tr{3} };
1180 0 ▶ while (my @range = splice(@ranges,0,3)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 3)) 0 0 0
1181 0 for my $oct0 (@{$range[0]}) {
1182 0 for my $oct1 (@{$range[1]}) {
1183 0 for my $oct2 (@{$range[2]}) {
1184 0 push @chars3, pack 'CCC', $oct0,$oct1,$oct2;
1185 }
1186 }
1187 }
1188 }
1189 }
1190 0 return @chars3;
1191 }
1192  
1193 # 4 octets characters
1194 422 my @chars4 = ();
1195 0 ▶sub chars4 {
Subroutine chars4: not called CC=8 SCAR=42.8
Pod undocumented
1196 0 ▶ if (@chars4) {
Branch: 1 branch
BranchTrueFalseTotal
if (@chars4) 0 0 0
1197 0 return @chars4;
1198 }
1199 0 ▶ if (exists $range_tr{4}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{4}) 0 0 0
1200 0 my @ranges = @{ $range_tr{4} };
1201 0 ▶ while (my @range = splice(@ranges,0,4)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, 4)) 0 0 0
1202 0 for my $oct0 (@{$range[0]}) {
1203 0 for my $oct1 (@{$range[1]}) {
1204 0 for my $oct2 (@{$range[2]}) {
1205 0 for my $oct3 (@{$range[3]}) {
1206 0 push @chars4, pack 'CCCC', $oct0,$oct1,$oct2,$oct3;
1207 }
1208 }
1209 }
1210 }
1211 }
1212 }
1213 0 return @chars4;
1214 }
1215  
1216 #
1217 # TIS-620 open character list for tr
1218 #
1219 12 ▶sub _charlist_tr {
Subroutine _charlist_tr: called CC=35 SCAR=66.4
1220  
1221 12 local $_ = shift @_;
1222  
1223 # unescape character
1224 12 my @char = ();
1225 12 ▶ while (not /\G \z/oxmsgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgmosx) 38 12 50
1226 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 \\ ($Etis620::q_char) /cgmosx) { } 0 38 38
elsif (/\G ($Etis620::q_char) /cgmosx) { } 38 0 38
1227 0 push @char, '\-';
1228 }
1229 elsif (/\G \\ ([0-7]{2,3}) /oxmsgc) {
1230 0 push @char, CORE::chr(oct $1);
1231 }
1232 elsif (/\G \\x ([0-9A-Fa-f]{1,2}) /oxmsgc) {
1233 0 push @char, CORE::chr(hex $1);
1234 }
1235 elsif (/\G \\c ([\x40-\x5F]) /oxmsgc) {
1236 0 push @char, CORE::chr(CORE::ord($1) & 0x1F);
1237 }
1238 elsif (/\G (\\ [0nrtfbae]) /oxmsgc) {
1239 push @char, {
1240 '\0' => "\0",
1241 '\n' => "\n",
1242 '\r' => "\r",
1243 '\t' => "\t",
1244 '\f' => "\f",
1245 '\b' => "\x08", # \b means backspace in character class
1246 '\a' => "\a",
1247 '\e' => "\e",
1248 0 }->{$1};
1249 }
1250 elsif (/\G \\ ($q_char) /oxmsgc) {
1251 0 push @char, $1;
1252 }
1253 elsif (/\G ($q_char) /oxmsgc) {
1254 38 push @char, $1;
1255 }
1256 }
1257  
1258 # join separated multiple-octet
1259 12 @char = join('',@char) =~ /\G (?>\\-|$q_char) /oxmsg;
1260  
1261 # unescape '-'
1262 12 my @i = ();
1263 12 for my $i (0 .. $#char) {
1264 38 ▶ if ($char[$i] eq '\-') {
Branch: 2 branches
BranchTrueFalseTotal
if ($char[$i] eq '\\-') { } 0 38 38
elsif ($char[$i] eq '-') { } 0 38 38
1265 0 $char[$i] = '-';
1266 }
1267 elsif ($char[$i] eq '-') {
1268 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
1269 0 push @i, $i;
1270 }
1271 }
1272 }
1273  
1274 # open character list (reverse for splice)
1275 12 for my $i (CORE::reverse @i) {
1276 0 my @range = ();
1277  
1278 # range error
1279 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
1280 0 croak "Invalid tr/// range \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1281 }
1282  
1283 # range of multiple-octet code
1284 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
1285 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
1286 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
1287 }
1288 elsif (CORE::length($char[$i+1]) == 2) {
1289 0 push @range, grep {$char[$i-1] le $_} chars1();
1290 0 push @range, grep {$_ le $char[$i+1]} chars2();
1291 }
1292 elsif (CORE::length($char[$i+1]) == 3) {
1293 0 push @range, grep {$char[$i-1] le $_} chars1();
1294 0 push @range, chars2();
1295 0 push @range, grep {$_ le $char[$i+1]} chars3();
1296 }
1297 elsif (CORE::length($char[$i+1]) == 4) {
1298 0 push @range, grep {$char[$i-1] le $_} chars1();
1299 0 push @range, chars2();
1300 0 push @range, chars3();
1301 0 push @range, grep {$_ le $char[$i+1]} chars4();
1302 }
1303 else {
1304 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1305 }
1306 }
1307 elsif (CORE::length($char[$i-1]) == 2) {
1308 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
1309 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
1310 }
1311 elsif (CORE::length($char[$i+1]) == 3) {
1312 0 push @range, grep {$char[$i-1] le $_} chars2();
1313 0 push @range, grep {$_ le $char[$i+1]} chars3();
1314 }
1315 elsif (CORE::length($char[$i+1]) == 4) {
1316 0 push @range, grep {$char[$i-1] le $_} chars2();
1317 0 push @range, chars3();
1318 0 push @range, grep {$_ le $char[$i+1]} chars4();
1319 }
1320 else {
1321 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1322 }
1323 }
1324 elsif (CORE::length($char[$i-1]) == 3) {
1325 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
1326 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
1327 }
1328 elsif (CORE::length($char[$i+1]) == 4) {
1329 0 push @range, grep {$char[$i-1] le $_} chars3();
1330 0 push @range, grep {$_ le $char[$i+1]} chars4();
1331 }
1332 else {
1333 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1334 }
1335 }
1336 elsif (CORE::length($char[$i-1]) == 4) {
1337 0 ▶ if (CORE::length($char[$i+1]) == 4) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $char[$i + 1] == 4) { } 0 0 0
1338 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
1339 }
1340 else {
1341 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1342 }
1343 }
1344 else {
1345 0 croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"';
1346 }
1347  
1348 0 splice @char, $i-1, 3, @range;
1349 }
1350  
1351 12 return @char;
1352 }
1353  
1354 #
1355 # TIS-620 open character class
1356 #
1357 0 ▶sub _cc {
Subroutine _cc: not called CC=7 SCAR=40.3
1358 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
1359 0 die __FILE__, ": subroutine cc got no parameter.\n";
1360 }
1361 elsif (scalar(@_) == 1) {
1362 0 return sprintf('\x%02X',$_[0]);
1363 }
1364 elsif (scalar(@_) == 2) {
1365 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
1366 0 die __FILE__, ": subroutine cc got \$_[0] > \$_[1] parameters).\n";
1367 }
1368 elsif ($_[0] == $_[1]) {
1369 0 return sprintf('\x%02X',$_[0]);
1370 }
1371 elsif (($_[0]+1) == $_[1]) {
1372 0 return sprintf('[\\x%02X\\x%02X]',$_[0],$_[1]);
1373 }
1374 else {
1375 0 return sprintf('[\\x%02X-\\x%02X]',$_[0],$_[1]);
1376 }
1377 }
1378 else {
1379 0 die __FILE__, ": subroutine cc got 3 or more parameters (@{[scalar(@_)]} parameters).\n";
1380 }
1381 }
1382  
1383 #
1384 # TIS-620 octet range
1385 #
1386 246 ▶sub _octets {
Subroutine _octets: called CC=5 SCAR=19.3
1387 246 my $length = shift @_;
1388  
1389 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1390 246 my($a1) = unpack 'C', $_[0];
1391 246 my($z1) = unpack 'C', $_[1];
1392  
1393 246 ▶ if ($a1 > $z1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($a1 > $z1) 0 246 246
1394 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$a1) . '-\x' . unpack('H*',$z1);
1395 }
1396  
1397 246 ▶ if ($a1 == $z1) {
Branch: 2 branches
BranchTrueFalseTotal
if ($a1 == $z1) { } 0 246 246
elsif ($a1 + 1 == $z1) { } 0 246 246
1398 0 return sprintf('\x%02X',$a1);
1399 }
1400 elsif (($a1+1) == $z1) {
1401 0 return sprintf('\x%02X\x%02X',$a1,$z1);
1402 }
1403 else {
1404 246 return sprintf('\x%02X-\x%02X',$a1,$z1);
1405 }
1406 }
1407 else {
1408 0 die __FILE__, ": subroutine _octets got invalid length ($length).\n";
1409 }
1410 }
1411  
1412 #
1413 # TIS-620 range regexp
1414 #
1415 246 ▶sub _range_regexp {
Subroutine _range_regexp: called CC=18 SCAR=41.7
1416 246 my($length,$first,$last) = @_;
1417  
1418 246 my @range_regexp = ();
1419 246 ▶ if (not exists $range_tr{$length}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $range_tr{$length}) 0 246 246
1420 0 return @range_regexp;
1421 }
1422  
1423 246 my @ranges = @{ $range_tr{$length} };
1424 246 ▶ while (my @range = splice(@ranges,0,$length)) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@range) = splice(@ranges, 0, $length)) 246 246 492
1425 246 my $min = '';
1426 246 my $max = '';
1427 246 ▶ for (my $i=0; $i < $length; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $length) 246 246 492
1428 246 $min .= pack 'C', $range[$i][0];
1429 246 $max .= pack 'C', $range[$i][-1];
1430 }
1431  
1432 # min___max
1433 # FIRST_____________LAST
1434 # (nothing)
1435  
1436 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
1437 }
1438  
1439 # **********
1440 # min_________max
1441 # FIRST_____________LAST
1442 # **********
1443  
1444 ▶ 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
1445 0 push @range_regexp, _octets($length,$first,$max,$min,$max);
1446 }
1447  
1448 # **********************
1449 # min________________max
1450 # FIRST_____________LAST
1451 # **********************
1452  
1453 ▶ 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
1454 0 push @range_regexp, _octets($length,$first,$last,$min,$max);
1455 }
1456  
1457 # *********
1458 # min___max
1459 # FIRST_____________LAST
1460 # *********
1461  
1462 ▶ 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
1463 0 push @range_regexp, _octets($length,$min,$max,$min,$max);
1464 }
1465  
1466 # **********************
1467 # min__________________________max
1468 # FIRST_____________LAST
1469 # **********************
1470  
1471 ▶ 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
1472 246 push @range_regexp, _octets($length,$first,$last,$min,$max);
1473 }
1474  
1475 # *********
1476 # min________max
1477 # FIRST_____________LAST
1478 # *********
1479  
1480 ▶ 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
1481 0 push @range_regexp, _octets($length,$min,$last,$min,$max);
1482 }
1483  
1484 # min___max
1485 # FIRST_____________LAST
1486 # (nothing)
1487  
1488 elsif ($last lt $min) {
1489 }
1490  
1491 else {
1492 0 die __FILE__, ": subroutine _range_regexp panic.\n";
1493 }
1494 }
1495  
1496 246 return @range_regexp;
1497 }
1498  
1499 #
1500 # TIS-620 open character list for qr and not qr
1501 #
1502 410 ▶sub _charlist {
Subroutine _charlist: called CC=46 SCAR=49.4
1503  
1504 410 my $modifier = pop @_;
1505 410 my @char = @_;
1506  
1507 410 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 58 352 410
1508  
1509 # unescape character
1510 410 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1293 410 1703
1511  
1512 # escape - to ...
1513 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 \\ ($Etis620::q_char) \z/mosx) { } 7 891 898
1514 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
1515 246 $char[$i] = '...';
1516 }
1517 }
1518  
1519 # octal escape sequence
1520 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
1521 0 $char[$i] = octchr($1);
1522 }
1523  
1524 # hexadecimal escape sequence
1525 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
1526 0 $char[$i] = hexchr($1);
1527 }
1528  
1529 # \b{...} --> b\{...}
1530 # \B{...} --> B\{...}
1531 # \N{CHARNAME} --> N\{CHARNAME}
1532 # \p{PROPERTY} --> p\{PROPERTY}
1533 # \P{PROPERTY} --> P\{PROPERTY}
1534 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
1535 0 $char[$i] = $1 . '\\' . $2;
1536 }
1537  
1538 # \p, \P, \X --> p, P, X
1539 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
1540 0 $char[$i] = $1;
1541 }
1542  
1543 elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/oxms) {
1544 0 $char[$i] = CORE::chr oct $1;
1545 }
1546 elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/oxms) {
1547 22 $char[$i] = CORE::chr hex $1;
1548 }
1549 elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/oxms) {
1550 0 $char[$i] = CORE::chr(CORE::ord($1) & 0x1F);
1551 }
1552 elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/oxms) {
1553 $char[$i] = {
1554 '\0' => "\0",
1555 '\n' => "\n",
1556 '\r' => "\r",
1557 '\t' => "\t",
1558 '\f' => "\f",
1559 '\b' => "\x08", # \b means backspace in character class
1560 '\a' => "\a",
1561 '\e' => "\e",
1562 '\d' => '[0-9]',
1563  
1564 # Vertical tabs are now whitespace
1565 # \s in a regex now matches a vertical tab in all circumstances.
1566 # http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace
1567 # \t \n \v \f \r space
1568 # '\s' => '[\x09\x0A \x0C\x0D\x20]',
1569 # '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]',
1570 '\s' => '\s',
1571  
1572 '\w' => '[0-9A-Z_a-z]',
1573 '\D' => '${Etis620::eD}',
1574 '\S' => '${Etis620::eS}',
1575 '\W' => '${Etis620::eW}',
1576  
1577 '\H' => '${Etis620::eH}',
1578 '\V' => '${Etis620::eV}',
1579 '\h' => '[\x09\x20]',
1580 '\v' => '[\x0A\x0B\x0C\x0D]',
1581 '\R' => '${Etis620::eR}',
1582  
1583 25 }->{$1};
1584 }
1585  
1586 # POSIX-style character classes
1587 ▶ 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
1588 $char[$i] = {
1589  
1590 '[:lower:]' => '[\x41-\x5A\x61-\x7A]',
1591 '[:upper:]' => '[\x41-\x5A\x61-\x7A]',
1592 '[:^lower:]' => '${Etis620::not_lower_i}',
1593 '[:^upper:]' => '${Etis620::not_upper_i}',
1594  
1595 8 }->{$1};
1596 }
1597 elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/oxms) {
1598 $char[$i] = {
1599  
1600 '[:alnum:]' => '[\x30-\x39\x41-\x5A\x61-\x7A]',
1601 '[:alpha:]' => '[\x41-\x5A\x61-\x7A]',
1602 '[:ascii:]' => '[\x00-\x7F]',
1603 '[:blank:]' => '[\x09\x20]',
1604 '[:cntrl:]' => '[\x00-\x1F\x7F]',
1605 '[:digit:]' => '[\x30-\x39]',
1606 '[:graph:]' => '[\x21-\x7F]',
1607 '[:lower:]' => '[\x61-\x7A]',
1608 '[:print:]' => '[\x20-\x7F]',
1609 '[:punct:]' => '[\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E]',
1610  
1611 # P.174 POSIX-Style Character Classes
1612 # in Chapter 5: Pattern Matching
1613 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
1614  
1615 # P.311 11.2.4 Character Classes and other Special Escapes
1616 # in Chapter 11: perlre: Perl regular expressions
1617 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
1618  
1619 # P.210 POSIX-Style Character Classes
1620 # in Chapter 5: Pattern Matching
1621 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
1622  
1623 '[:space:]' => '[\s\x0B]', # "\s" plus vertical tab ("\cK")
1624  
1625 '[:upper:]' => '[\x41-\x5A]',
1626 '[:word:]' => '[\x30-\x39\x41-\x5A\x5F\x61-\x7A]',
1627 '[:xdigit:]' => '[\x30-\x39\x41-\x46\x61-\x66]',
1628 '[:^alnum:]' => '${Etis620::not_alnum}',
1629 '[:^alpha:]' => '${Etis620::not_alpha}',
1630 '[:^ascii:]' => '${Etis620::not_ascii}',
1631 '[:^blank:]' => '${Etis620::not_blank}',
1632 '[:^cntrl:]' => '${Etis620::not_cntrl}',
1633 '[:^digit:]' => '${Etis620::not_digit}',
1634 '[:^graph:]' => '${Etis620::not_graph}',
1635 '[:^lower:]' => '${Etis620::not_lower}',
1636 '[:^print:]' => '${Etis620::not_print}',
1637 '[:^punct:]' => '${Etis620::not_punct}',
1638 '[:^space:]' => '${Etis620::not_space}',
1639 '[:^upper:]' => '${Etis620::not_upper}',
1640 '[:^word:]' => '${Etis620::not_word}',
1641 '[:^xdigit:]' => '${Etis620::not_xdigit}',
1642  
1643 70 }->{$1};
1644 }
1645 elsif ($char[$i] =~ /\A \\ ($q_char) \z/oxms) {
1646 7 $char[$i] = $1;
1647 }
1648 }
1649  
1650 # open character list
1651 410 my @singleoctet = ();
1652 410 my @multipleoctet = ();
1653 410 ▶ for (my $i=0; $i <= $#char; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1047 410 1457
1654  
1655 # escaped -
1656 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
1657 246 $i += 1;
1658 246 next;
1659 }
1660  
1661 # make range regexp
1662 elsif ($char[$i] eq '...') {
1663  
1664 # range error
1665 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
1666 0 croak 'Invalid [] range in regexp (length(A) > length(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1667 }
1668 elsif (CORE::length($char[$i-1]) == CORE::length($char[$i+1])) {
1669 246 ▶ if ($char[$i-1] gt $char[$i+1]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i - 1] gt $char[$i + 1]) 0 246 246
1670 0 croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]);
1671 }
1672 }
1673  
1674 # make range regexp per length
1675 246 for my $length (CORE::length($char[$i-1]) .. CORE::length($char[$i+1])) {
1676 246 my @regexp = ();
1677  
1678 # is first and last
1679 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
1680 246 push @regexp, _range_regexp($length, $char[$i-1], $char[$i+1]);
1681 }
1682  
1683 # is first
1684 elsif ($length == CORE::length($char[$i-1])) {
1685 0 push @regexp, _range_regexp($length, $char[$i-1], "\xFF" x $length);
1686 }
1687  
1688 # is inside in first and last
1689 ▶ 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
1690 0 push @regexp, _range_regexp($length, "\x00" x $length, "\xFF" x $length);
1691 }
1692  
1693 # is last
1694 elsif ($length == CORE::length($char[$i+1])) {
1695 0 push @regexp, _range_regexp($length, "\x00" x $length, $char[$i+1]);
1696 }
1697  
1698 else {
1699 0 die __FILE__, ": subroutine make_regexp panic.\n";
1700 }
1701  
1702 246 ▶ if ($length == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($length == 1) { } 246 0 246
1703 246 push @singleoctet, @regexp;
1704 }
1705 else {
1706 0 push @multipleoctet, @regexp;
1707 }
1708 }
1709  
1710 246 $i += 2;
1711 }
1712  
1713 # with /i modifier
1714 elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) {
1715 469 ▶ if ($modifier =~ /i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) { } 0 469 469
1716 0 my $uc = Etis620::uc($char[$i]);
1717 0 my $fc = Etis620::fc($char[$i]);
1718 0 ▶ if ($uc ne $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc ne $fc) { } 0 0 0
1719 0 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 0 0 0
1720 0 push @singleoctet, $uc, $fc;
1721 }
1722 else {
1723 0 push @singleoctet, $uc;
1724 0 push @multipleoctet, $fc;
1725 }
1726 }
1727 else {
1728 0 push @singleoctet, $char[$i];
1729 }
1730 }
1731 else {
1732 469 push @singleoctet, $char[$i];
1733 }
1734 469 $i += 1;
1735 }
1736  
1737 # single character of single octet code
1738 elsif ($char[$i] =~ /\A (?: \\h ) \z/oxms) {
1739 0 push @singleoctet, "\t", "\x20";
1740 0 $i += 1;
1741 }
1742 elsif ($char[$i] =~ /\A (?: \\v ) \z/oxms) {
1743 0 push @singleoctet, "\x0A", "\x0B", "\x0C", "\x0D";
1744 0 $i += 1;
1745 }
1746 elsif ($char[$i] =~ /\A (?: \\d | \\s | \\w ) \z/oxms) {
1747 2 push @singleoctet, $char[$i];
1748 2 $i += 1;
1749 }
1750  
1751 # single character of multiple-octet code
1752 else {
1753 84 push @multipleoctet, $char[$i];
1754 84 $i += 1;
1755 }
1756 }
1757  
1758 # quote metachar
1759 410 for (@singleoctet) {
1760 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
1761 0 $_ = '-';
1762 }
1763 elsif (/\A \n \z/oxms) {
1764 8 $_ = '\n';
1765 }
1766 elsif (/\A \r \z/oxms) {
1767 8 $_ = '\r';
1768 }
1769 elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/oxms) {
1770 24 $_ = sprintf('\x%02X', CORE::ord $1);
1771 }
1772 elsif (/\A [\x00-\xFF] \z/oxms) {
1773 429 $_ = quotemeta $_;
1774 }
1775 }
1776  
1777 # return character list
1778 410 return \@singleoctet, \@multipleoctet;
1779 }
1780  
1781 #
1782 # TIS-620 octal escape sequence
1783 #
1784 5 ▶sub octchr {
Subroutine octchr: called CC=2 SCAR=6.9
Pod undocumented
1785 5 my($octdigit) = @_;
1786  
1787 5 my @binary = ();
1788 5 for my $octal (split(//,$octdigit)) {
1789 push @binary, {
1790 '0' => '000',
1791 '1' => '001',
1792 '2' => '010',
1793 '3' => '011',
1794 '4' => '100',
1795 '5' => '101',
1796 '6' => '110',
1797 '7' => '111',
1798 50 }->{$octal};
1799 }
1800 5 my $binary = join '', @binary;
1801  
1802 my $octchr = {
1803 # 1234567
1804 1 => pack('B*', "0000000$binary"),
1805 2 => pack('B*', "000000$binary"),
1806 3 => pack('B*', "00000$binary"),
1807 4 => pack('B*', "0000$binary"),
1808 5 => pack('B*', "000$binary"),
1809 6 => pack('B*', "00$binary"),
1810 7 => pack('B*', "0$binary"),
1811 0 => pack('B*', "$binary"),
1812  
1813 5 }->{CORE::length($binary) % 8};
1814  
1815 5 return $octchr;
1816 }
1817  
1818 #
1819 # TIS-620 hexadecimal escape sequence
1820 #
1821 5 ▶sub hexchr {
Subroutine hexchr: called CC=1 SCAR=0.0
Pod undocumented
1822 5 my($hexdigit) = @_;
1823  
1824 my $hexchr = {
1825 1 => pack('H*', "0$hexdigit"),
1826 0 => pack('H*', "$hexdigit"),
1827  
1828 5 }->{CORE::length($_[0]) % 2};
1829  
1830 5 return $hexchr;
1831 }
1832  
1833 #
1834 # TIS-620 open character list for qr
1835 #
1836 336 ▶sub charlist_qr {
Subroutine charlist_qr: called CC=17 SCAR=29.9
Pod undocumented
1837  
1838 336 my $modifier = pop @_;
1839 336 my @char = @_;
1840  
1841 336 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
1842 336 my @singleoctet = @$singleoctet;
1843 336 my @multipleoctet = @$multipleoctet;
1844  
1845 # return character list
1846 336 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) 258 78 336
1847  
1848 # with /i modifier
1849 258 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 25 233 258
1850 25 my %singleoctet_ignorecase = ();
1851 25 for (@singleoctet) {
1852 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
1853 25 for my $ord (hex($1) .. hex($2)) {
1854 75 my $char = CORE::chr($ord);
1855 75 my $uc = Etis620::uc($char);
1856 75 my $fc = Etis620::fc($char);
1857 75 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 0 75 75
1858 0 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
1859 }
1860 else {
1861 75 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 75 0 75
1862 75 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1863 75 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
1864 }
1865 else {
1866 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1867 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
1868 }
1869 }
1870 }
1871 }
1872 25 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 25 25
1873 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
1874 }
1875 }
1876 25 my $i = 0;
1877 25 my @singleoctet_ignorecase = ();
1878 25 for my $ord (0 .. 255) {
1879 6400 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 150 6250 6400
1880 150 push @{$singleoctet_ignorecase[$i]}, $ord;
1881 }
1882 else {
1883 6250 $i++;
1884 }
1885 }
1886 25 @singleoctet = ();
1887 25 for my $range (@singleoctet_ignorecase) {
1888 2400 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 50 2350 2400
1889 50 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 0 50 50
elsif (scalar @{$range;} == 2) { } 0 50 50
1890 0 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
1891 }
1892 50 elsif (scalar(@{$range}) == 2) {
1893 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
1894 }
1895 else {
1896 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
1897 }
1898 }
1899 }
1900 }
1901  
1902 258 my $not_anchor = '';
1903  
1904 258 push @multipleoctet, join('', $not_anchor, '[', @singleoctet, ']' );
1905 }
1906 336 ▶ if (scalar(@multipleoctet) >= 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 2) { } 6 330 336
1907 6 return '(?:' . join('|', @multipleoctet) . ')';
1908 }
1909 else {
1910 330 return $multipleoctet[0];
1911 }
1912 }
1913  
1914 #
1915 # TIS-620 open character list for not qr
1916 #
1917 74 ▶sub charlist_not_qr {
Subroutine charlist_not_qr: called CC=18 SCAR=33.1
Pod undocumented
1918  
1919 74 my $modifier = pop @_;
1920 74 my @char = @_;
1921  
1922 74 my($singleoctet, $multipleoctet) = _charlist(@char, $modifier);
1923 74 my @singleoctet = @$singleoctet;
1924 74 my @multipleoctet = @$multipleoctet;
1925  
1926 # with /i modifier
1927 74 ▶ if ($modifier =~ m/i/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /i/mosx) 25 49 74
1928 25 my %singleoctet_ignorecase = ();
1929 25 for (@singleoctet) {
1930 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
1931 25 for my $ord (hex($1) .. hex($2)) {
1932 75 my $char = CORE::chr($ord);
1933 75 my $uc = Etis620::uc($char);
1934 75 my $fc = Etis620::fc($char);
1935 75 ▶ if ($uc eq $fc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uc eq $fc) { } 0 75 75
1936 0 $singleoctet_ignorecase{unpack 'C*', $char} = 1;
1937 }
1938 else {
1939 75 ▶ if (CORE::length($fc) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fc == 1) { } 75 0 75
1940 75 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1941 75 $singleoctet_ignorecase{unpack 'C*', $fc} = 1;
1942 }
1943 else {
1944 0 $singleoctet_ignorecase{unpack 'C*', $uc} = 1;
1945 0 push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc;
1946 }
1947 }
1948 }
1949 }
1950 25 ▶ if ($_ ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ ne "") 0 25 25
1951 0 $singleoctet_ignorecase{unpack 'C*', $_} = 1;
1952 }
1953 }
1954 25 my $i = 0;
1955 25 my @singleoctet_ignorecase = ();
1956 25 for my $ord (0 .. 255) {
1957 6400 ▶ if (exists $singleoctet_ignorecase{$ord}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $singleoctet_ignorecase{$ord}) { } 150 6250 6400
1958 150 push @{$singleoctet_ignorecase[$i]}, $ord;
1959 }
1960 else {
1961 6250 $i++;
1962 }
1963 }
1964 25 @singleoctet = ();
1965 25 for my $range (@singleoctet_ignorecase) {
1966 2400 ▶ if (ref $range) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $range) 50 2350 2400
1967 50 ▶ if (scalar(@{$range}) == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$range;} == 1) { } 0 50 50
elsif (scalar @{$range;} == 2) { } 0 50 50
1968 0 push @singleoctet, sprintf('\x%02X', @{$range}[0]);
1969 }
1970 50 elsif (scalar(@{$range}) == 2) {
1971 0 push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]);
1972 }
1973 else {
1974 50 push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]);
1975 }
1976 }
1977 }
1978 }
1979  
1980 # return character list
1981 74 ▶ if (scalar(@multipleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @multipleoctet >= 1) { } 0 74 74
1982 0 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 0 0 0
1983  
1984 # any character other than multiple-octet and single octet character class
1985 0 return '(?!' . join('|', @multipleoctet) . ')(?:[^' . join('', @singleoctet) . '])';
1986 }
1987 else {
1988  
1989 # any character other than multiple-octet character class
1990 0 return '(?!' . join('|', @multipleoctet) . ")(?:$your_char)";
1991 }
1992 }
1993 else {
1994 74 ▶ if (scalar(@singleoctet) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @singleoctet >= 1) { } 74 0 74
1995  
1996 # any character other than single octet character class
1997 74 return '(?:[^' . join('', @singleoctet) . '])';
1998 }
1999 else {
2000  
2001 # any character
2002 0 return "(?:$your_char)";
2003 }
2004 }
2005 }
2006  
2007 #
2008 # open file in read mode
2009 #
2010 422 ▶sub _open_r {
Subroutine _open_r: called CC=1 SCAR=0.0
2011 422 my(undef,$file) = @_;
2012 422 ▶ use Fcntl qw(O_RDONLY);
Subroutine BEGIN: called CC=1 SCAR=0.0
2013 422 return CORE::sysopen($_[0], $file, &O_RDONLY);
2014 }
2015  
2016 #
2017 # open file in append mode
2018 #
2019 211 ▶sub _open_a {
Subroutine _open_a: called CC=1 SCAR=0.0
2020 211 my(undef,$file) = @_;
2021 422 ▶ use Fcntl qw(O_WRONLY O_APPEND O_CREAT);
Subroutine BEGIN: called CC=1 SCAR=0.0
2022 211 return CORE::sysopen($_[0], $file, &O_WRONLY|&O_APPEND|&O_CREAT);
2023 }
2024  
2025 #
2026 # safe system
2027 #
2028 211 ▶sub _systemx {
Subroutine _systemx: called CC=1 SCAR=0.0
2029  
2030 # P.707 29.2.33. exec
2031 # in Chapter 29: Functions
2032 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2033 #
2034 # Be aware that in older releases of Perl, exec (and system) did not flush
2035 # your output buffer, so you needed to enable command buffering by setting $|
2036 # on one or more filehandles to avoid lost output in the case of exec, or
2037 # misordererd output in the case of system. This situation was largely remedied
2038 # in the 5.6 release of Perl. (So, 5.005 release not yet.)
2039  
2040 # P.855 exec
2041 # in Chapter 27: Functions
2042 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2043 #
2044 # In very old release of Perl (before v5.6), exec (and system) did not flush
2045 # your output buffer, so you needed to enable command buffering by setting $|
2046 # on one or more filehandles to avoid lost output with exec or misordered
2047 # output with system.
2048  
2049 211 $| = 1;
2050  
2051 # P.565 23.1.2. Cleaning Up Your Environment
2052 # in Chapter 23: Security
2053 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2054  
2055 # P.656 Cleaning Up Your Environment
2056 # in Chapter 20: Security
2057 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2058  
2059 # local $ENV{'PATH'} = '.';
2060 211 local @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer
2061  
2062 # P.707 29.2.33. exec
2063 # in Chapter 29: Functions
2064 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2065 #
2066 # As we mentioned earlier, exec treats a discrete list of arguments as an
2067 # indication that it should bypass shell processing. However, there is one
2068 # place where you might still get tripped up. The exec call (and system, too)
2069 # will not distinguish between a single scalar argument and an array containing
2070 # only one element.
2071 #
2072 # @args = ("echo surprise"); # just one element in list
2073 # exec @args # still subject to shell escapes
2074 # or die "exec: $!"; # because @args == 1
2075 #
2076 # To avoid this, you can use the PATHNAME syntax, explicitly duplicating the
2077 # first argument as the pathname, which forces the rest of the arguments to be
2078 # interpreted as a list, even if there is only one of them:
2079 #
2080 # exec { $args[0] } @args # safe even with one-argument list
2081 # or die "can't exec @args: $!";
2082  
2083 # P.855 exec
2084 # in Chapter 27: Functions
2085 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2086 #
2087 # As we mentioned earlier, exec treats a discrete list of arguments as a
2088 # directive to bypass shell processing. However, there is one place where
2089 # you might still get tripped up. The exec call (and system, too) cannot
2090 # distinguish between a single scalar argument and an array containing
2091 # only one element.
2092 #
2093 # @args = ("echo surprise"); # just one element in list
2094 # exec @args # still subject to shell escapes
2095 # || die "exec: $!"; # because @args == 1
2096 #
2097 # To avoid this, use the PATHNAME syntax, explicitly duplicating the first
2098 # argument as the pathname, which forces the rest of the arguments to be
2099 # interpreted as a list, even if there is only one of them:
2100 #
2101 # exec { $args[0] } @args # safe even with one-argument list
2102 # || die "can't exec @args: $!";
2103  
2104 211 return CORE::system { $_[0] } @_; # safe even with one-argument list
2105 }
2106  
2107 #
2108 # TIS-620 order to character (with parameter)
2109 #
2110 3469 ▶sub Etis620::chr(;$) {
Subroutine chr: called CC=4 SCAR=13.9
Pod undocumented
2111  
2112 3469 ▶ my $c = @_ ? $_[0] : $_;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 3469 0 3469
2113  
2114 3469 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 24 3445 3469
2115 24 return "\x00";
2116 }
2117 else {
2118 3445 my @chr = ();
2119 3445 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 3445 3445 6890
2120 3445 unshift @chr, ($c % 0x100);
2121 3445 $c = int($c / 0x100);
2122 }
2123 3445 return pack 'C*', @chr;
2124 }
2125 }
2126  
2127 #
2128 # TIS-620 order to character (without parameter)
2129 #
2130 0 ▶sub Etis620::chr_() {
Subroutine chr_: not called CC=3 SCAR=24.8
Pod undocumented
2131  
2132 0 my $c = $_;
2133  
2134 0 ▶ if ($c == 0x00) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c == 0) { } 0 0 0
2135 0 return "\x00";
2136 }
2137 else {
2138 0 my @chr = ();
2139 0 ▶ while ($c > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 0 0 0
2140 0 unshift @chr, ($c % 0x100);
2141 0 $c = int($c / 0x100);
2142 }
2143 0 return pack 'C*', @chr;
2144 }
2145 }
2146  
2147 #
2148 # TIS-620 path globbing (with parameter)
2149 #
2150 0 ▶sub Etis620::glob($) {
Subroutine glob: not called CC=3 SCAR=24.8
Pod undocumented
2151  
2152 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2153 0 my @glob = _DOS_like_glob(@_);
2154 0 for my $glob (@glob) {
2155 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2156 }
2157 0 return @glob;
2158 }
2159 else {
2160 0 my $glob = _DOS_like_glob(@_);
2161 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2162 0 return $glob;
2163 }
2164 }
2165  
2166 #
2167 # TIS-620 path globbing (without parameter)
2168 #
2169 0 ▶sub Etis620::glob_() {
Subroutine glob_: not called CC=3 SCAR=24.8
Pod undocumented
2170  
2171 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2172 0 my @glob = _DOS_like_glob();
2173 0 for my $glob (@glob) {
2174 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2175 }
2176 0 return @glob;
2177 }
2178 else {
2179 0 my $glob = _DOS_like_glob();
2180 0 $glob =~ s{ \A (?:\./)+ }{}oxms;
2181 0 return $glob;
2182 }
2183 }
2184  
2185 #
2186 # TIS-620 path globbing via File::DosGlob 1.10
2187 #
2188 # Often I confuse "_dosglob" and "_doglob".
2189 # So, I renamed "_dosglob" to "_DOS_like_glob".
2190 #
2191 422 my %iter;
2192 my %entries;
2193 0 ▶sub _DOS_like_glob {
Subroutine _DOS_like_glob: not called CC=10 SCAR=47.0
2194  
2195 # context (keyed by second cxix argument provided by core)
2196 0 my($expr,$cxix) = @_;
2197  
2198 # glob without args defaults to $_
2199 0 ▶ $expr = $_ if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2200  
2201 # represents the current user's home directory
2202 #
2203 # 7.3. Expanding Tildes in Filenames
2204 # in Chapter 7. File Access
2205 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2206 #
2207 # and File::HomeDir, File::HomeDir::Windows module
2208  
2209 # DOS-like system
2210 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
2211 0 $expr =~ s{ \A ~ (?= [^/\\] ) }
2212 0 { my_home_MSWin32() }oxmse;
2213 }
2214  
2215 # UNIX-like system
2216 else {
2217 0 $expr =~ s{ \A ~ ( (?:[^/])* ) }
2218 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
2219 }
2220  
2221 # assume global context if not provided one
2222 0 ▶ $cxix = '_G_' if not defined $cxix;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $cxix 0 0 0
2223 0 ▶ $iter{$cxix} = 0 if not exists $iter{$cxix};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $iter{$cxix} 0 0 0
2224  
2225 # if we're just beginning, do it all first
2226 0 ▶ if ($iter{$cxix} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} == 0) 0 0 0
2227 0 $entries{$cxix} = [ _do_glob(1, _parse_line($expr)) ];
2228 }
2229  
2230 # chuck it all out, quick or slow
2231 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2232 0 delete $iter{$cxix};
2233 0 return @{delete $entries{$cxix}};
2234 }
2235 else {
2236 0 ▶ if ($iter{$cxix} = scalar @{$entries{$cxix}}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($iter{$cxix} = scalar @{$entries{$cxix};}) { } 0 0 0
2237 0 return shift @{$entries{$cxix}};
2238 }
2239 else {
2240 # return undef for EOL
2241 0 delete $iter{$cxix};
2242 0 delete $entries{$cxix};
2243 0 return undef;
2244 }
2245 }
2246 }
2247  
2248 #
2249 # TIS-620 path globbing subroutine
2250 #
2251 0 ▶sub _do_glob {
Subroutine _do_glob: not called CC=44 SCAR=75.9
2252  
2253 0 my($cond,@expr) = @_;
2254 0 my @glob = ();
2255 0 my $fix_drive_relative_paths = 0;
2256  
2257 OUTER:
2258 0 for my $expr (@expr) {
2259 0 ▶ next OUTER if not defined $expr;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expr 0 0 0
2260 0 ▶ next OUTER if $expr eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $expr eq "" 0 0 0
2261  
2262 0 my @matched = ();
2263 0 my @globdir = ();
2264 0 my $head = '.';
2265 0 my $pathsep = '/';
2266 0 my $tail;
2267  
2268 # if argument is within quotes strip em and do no globbing
2269 0 ▶ if ($expr =~ /\A " ((?:$q_char)*?) " \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ /\A " ((?:$Etis620::q_char)*?) " \z/mosx) 0 0 0
2270 0 $expr = $1;
2271 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2272 0 ▶ if (-d $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $expr) 0 0 0
2273 0 push @glob, $expr;
2274 }
2275 }
2276 else {
2277 0 ▶ if (-e $expr) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $expr) 0 0 0
2278 0 push @glob, $expr;
2279 }
2280 }
2281 0 next OUTER;
2282 }
2283  
2284 # wildcards with a drive prefix such as h:*.pm must be changed
2285 # to h:./*.pm to expand correctly
2286 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
2287 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
2288 0 $fix_drive_relative_paths = 1;
2289 }
2290 }
2291  
2292 0 ▶ if (($head, $tail) = _parse_path($expr,$pathsep)) {
Branch: 1 branch
BranchTrueFalseTotal
if (($head, $tail) = _parse_path($expr, $pathsep)) 0 0 0
2293 0 ▶ if ($tail eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tail eq "") 0 0 0
2294 0 push @glob, $expr;
2295 0 next OUTER;
2296 }
2297 0 ▶ if ($head =~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head =~ / \A (?:$Etis620::q_char)*? [*?] /mosx) 0 0 0
2298 0 ▶ if (@globdir = _do_glob('d', $head)) {
Branch: 1 branch
BranchTrueFalseTotal
if (@globdir = _do_glob("d", $head)) 0 0 0
2299 0 push @glob, _do_glob($cond, map {"$_$pathsep$tail"} @globdir);
2300 0 next OUTER;
2301 }
2302 }
2303 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
2304 0 $head .= $pathsep;
2305 }
2306 0 $expr = $tail;
2307 }
2308  
2309 # If file component has no wildcards, we can avoid opendir
2310 0 ▶ if ($expr !~ / \A (?:$q_char)*? [*?] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($expr =~ / \A (?:$Etis620::q_char)*? [*?] /mosx) 0 0 0
2311 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2312 0 $head = '';
2313 }
2314 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Etis620::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Etis620::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Etis620::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Etis620::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Etis620::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2315 0 $head .= $pathsep;
2316 }
2317 0 $head .= $expr;
2318 0 ▶ if ($cond eq 'd') {
Branch: 1 branch
BranchTrueFalseTotal
if ($cond eq 'd') { } 0 0 0
2319 0 ▶ if (-d $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $head) 0 0 0
2320 0 push @glob, $head;
2321 }
2322 }
2323 else {
2324 0 ▶ if (-e $head) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e $head) 0 0 0
2325 0 push @glob, $head;
2326 }
2327 }
2328 0 next OUTER;
2329 }
2330 0 ▶ opendir(*DIR, $head) or next OUTER;
Branch: 1 branch
BranchTrueFalseTotal
opendir *DIR, $head or next OUTER 0 0 0
2331 0 my @leaf = readdir DIR;
2332 0 closedir DIR;
2333  
2334 0 ▶ if ($head eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($head eq ".") 0 0 0
2335 0 $head = '';
2336 }
2337 0 ▶ if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) {
Branch: 1 branch
BranchTrueFalseTotal
if ($head ne "" and ($head =~ / \G ($Etis620::q_char) /gmosx)[-1] ne $pathsep) 0 0 0
Condition0%0/3
$head ne "" and ($head =~ / \G ($Etis620::q_char) /gmosx)[-1] ne $pathsep
!ll&&!rl&&r
000
MC/DC0%0/2
$head ne "" and ($head =~ / \G ($Etis620::q_char) /gmosx)[-1] ne $pathsep
$head ne "" ($head =~ / \G ($Etis620::q_char) /gmosx)[-1] ne $pathsep
Truth table0%0/3
A and B
A= $head ne ""B= ($head =~ / \G ($Etis620::q_char) /gmosx)[-1] ne $pathsep
ABresult
0X0
100
111
2338 0 $head .= $pathsep;
2339 }
2340  
2341 0 my $pattern = '';
2342 0 ▶ while ($expr =~ / \G ($q_char) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ / \G ($Etis620::q_char) /cgox) 0 0 0
2343 0 my $char = $1;
2344  
2345 # 6.9. Matching Shell Globs as Regular Expressions
2346 # in Chapter 6. Pattern Matching
2347 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2348 # (and so on)
2349  
2350 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
2351 0 $pattern .= "(?:$your_char)*",
2352 }
2353 elsif ($char eq '?') {
2354 0 $pattern .= "(?:$your_char)?", # DOS style
2355 # $pattern .= "(?:$your_char)", # UNIX style
2356 }
2357 elsif ((my $fc = Etis620::fc($char)) ne $char) {
2358 0 $pattern .= $fc;
2359 }
2360 else {
2361 0 $pattern .= quotemeta $char;
2362 }
2363 }
2364 0 ▶ my $matchsub = sub { Etis620::fc($_[0]) =~ /\A $pattern \z/xms };
Subroutine __ANON__: not called CC=1 SCAR=6.9
2365  
2366 # if ($@) {
2367 # print STDERR "$0: $@\n";
2368 # next OUTER;
2369 # }
2370  
2371 INNER:
2372 0 for my $leaf (@leaf) {
2373 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
2374 0 next INNER;
2375 }
2376 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
2377 0 next INNER;
2378 }
2379  
2380 0 ▶ if (&$matchsub($leaf)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub($leaf)) 0 0 0
2381 0 push @matched, "$head$leaf";
2382 0 next INNER;
2383 }
2384  
2385 # [DOS compatibility special case]
2386 # Failed, add a trailing dot and try again, but only...
2387  
2388 0 ▶ if (Etis620::index($leaf,'.') == -1 and # if name does not have a dot in it *and*
Branch: 1 branch
BranchTrueFalseTotal
if (&Etis620::index($leaf, ".") == -1 and length $leaf <= 8 and &Etis620::index($pattern, "\\.") != -1) 0 0 0
Condition0%0/6
&Etis620::index($leaf, ".") == -1 and length $leaf <= 8 and &Etis620::index($pattern, "\\.") != -1
!ll&&!rl&&r
000
&Etis620::index($leaf, ".") == -1 and length $leaf <= 8
!ll&&!rl&&r
000
MC/DC0%0/3
&Etis620::index($leaf, ".") == -1 and length $leaf <= 8 and &Etis620::index($pattern, "\\.") != -1
&Etis620::index($leaf, ".") == -1 length $leaf <= 8 &Etis620::index($pattern, "\\.") != -1
Truth table0%0/4
A and B and C
A= &Etis620::index($leaf, ".") == -1B= length $leaf <= 8C= &Etis620::index($pattern, "\\.") != -1
ABCresult
0XX0
10X0
1100
1111
2389 CORE::length($leaf) <= 8 and # name is shorter than or equal to 8 chars *and*
2390 Etis620::index($pattern,'\\.') != -1 # pattern has a dot.
2391 ) {
2392 0 ▶ if (&$matchsub("$leaf.")) {
Branch: 1 branch
BranchTrueFalseTotal
if (&$matchsub("$leaf.")) 0 0 0
2393 0 push @matched, "$head$leaf";
2394 0 next INNER;
2395 }
2396 }
2397 }
2398 0 ▶ if (@matched) {
Branch: 1 branch
BranchTrueFalseTotal
if (@matched) 0 0 0
2399 0 push @glob, @matched;
2400 }
2401 }
2402 0 ▶ if ($fix_drive_relative_paths) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fix_drive_relative_paths) 0 0 0
2403 0 for my $glob (@glob) {
2404 0 $glob =~ s# \A ([A-Za-z]:) \./ #$1#oxms;
2405 }
2406 }
2407 0 return @glob;
2408 }
2409  
2410 #
2411 # TIS-620 parse line
2412 #
2413 0 ▶sub _parse_line {
Subroutine _parse_line: not called CC=3 SCAR=24.8
2414  
2415 0 my($line) = @_;
2416  
2417 0 $line .= ' ';
2418 0 my @piece = ();
2419 0 ▶ while ($line =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ / " ( (?>(?: [^"] )* ) ) " (?>\s+) | ( (?>(?: [^"\s] )* ) ) (?>\s+) /gmosx) 0 0 0
2420 " ( (?>(?: [^"] )* ) ) " (?>\s+) |
2421 ( (?>(?: [^"\s] )* ) ) (?>\s+)
2422 /oxmsg
2423 ) {
2424 0 ▶ push @piece, defined($1) ? $1 : $2;
Branch: 1 branch
BranchTrueFalseTotal
defined $1 ? : 0 0 0
2425 }
2426 0 return @piece;
2427 }
2428  
2429 #
2430 # TIS-620 parse path
2431 #
2432 0 ▶sub _parse_path {
Subroutine _parse_path: not called CC=2 SCAR=17.9
2433  
2434 0 my($path,$pathsep) = @_;
2435  
2436 0 $path .= '/';
2437 0 my @subpath = ();
2438 0 ▶ while ($path =~ /
Branch: 1 branch
BranchTrueFalseTotal
if ($path =~ m( ((?: [^/\\] )+?) [/\\] )gmosx) 0 0 0
2439 ((?: [^\/\\] )+?) [\/\\]
2440 /oxmsg
2441 ) {
2442 0 push @subpath, $1;
2443 }
2444  
2445 0 my $tail = pop @subpath;
2446 0 my $head = join $pathsep, @subpath;
2447 0 return $head, $tail;
2448 }
2449  
2450 #
2451 # via File::HomeDir::Windows 1.00
2452 #
2453 0 ▶sub my_home_MSWin32 {
Subroutine my_home_MSWin32: not called CC=9 SCAR=45.0
Pod undocumented
2454  
2455 # A lot of unix people and unix-derived tools rely on
2456 # the ability to overload HOME. We will support it too
2457 # so that they can replace raw HOME calls with File::HomeDir.
2458 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
2459 0 return $ENV{'HOME'};
2460 }
2461  
2462 # Do we have a user profile?
2463 ▶ 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
2464 0 return $ENV{'USERPROFILE'};
2465 }
2466  
2467 # Some Windows use something like $ENV{'HOME'}
2468 ▶ 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
2469 0 return join '', $ENV{'HOMEDRIVE'}, $ENV{'HOMEPATH'};
2470 }
2471  
2472 0 return undef;
2473 }
2474  
2475 #
2476 # via File::HomeDir::Unix 1.00
2477 #
2478 0 ▶sub my_home {
Subroutine my_home: not called CC=7 SCAR=40.3
Pod undocumented
2479 0 my $home;
2480  
2481 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
2482 0 $home = $ENV{'HOME'};
2483 }
2484  
2485 # This is from the original code, but I'm guessing
2486 # it means "login directory" and exists on some Unixes.
2487 ▶ 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
2488 0 $home = $ENV{'LOGDIR'};
2489 }
2490  
2491 ### More-desperate methods
2492  
2493 # Light desperation on any (Unixish) platform
2494 else {
2495 0 $home = CORE::eval q{ (getpwuid($<))[7] };
2496 }
2497  
2498 # On Unix in general, a non-existant home means "no home"
2499 # For example, "nobody"-like users might use /nonexistant
2500 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
2501 0 $home = undef;
2502 }
2503 0 return $home;
2504 }
2505  
2506 #
2507 # ${^PREMATCH}, $PREMATCH, $` the string preceding what was matched
2508 #
2509 56 ▶sub Etis620::PREMATCH {
Subroutine PREMATCH: called CC=1 SCAR=0.0
Pod undocumented
2510 56 return $`;
2511 }
2512  
2513 #
2514 # ${^MATCH}, $MATCH, $& the string that matched
2515 #
2516 81 ▶sub Etis620::MATCH {
Subroutine MATCH: called CC=1 SCAR=0.0
Pod undocumented
2517 81 return $&;
2518 }
2519  
2520 #
2521 # ${^POSTMATCH}, $POSTMATCH, $' the string following what was matched
2522 #
2523 42 ▶sub Etis620::POSTMATCH {
Subroutine POSTMATCH: called CC=1 SCAR=0.0
Pod undocumented
2524 42 return $';
2525 }
2526  
2527 #
2528 # TIS-620 character to order (with parameter)
2529 #
2530 0 ▶sub TIS620::ord(;$) {
Subroutine ord: not called CC=4 SCAR=30.0
2531  
2532 0 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
2533  
2534 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Etis620::q_char) /mosx) { } 0 0 0
2535 0 my @ord = unpack 'C*', $1;
2536 0 my $ord = 0;
2537 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2538 0 $ord = $ord * 0x100 + $o;
2539 }
2540 0 return $ord;
2541 }
2542 else {
2543 0 return CORE::ord $_;
2544 }
2545 }
2546  
2547 #
2548 # TIS-620 character to order (without parameter)
2549 #
2550 0 ▶sub TIS620::ord_() {
Subroutine ord_: not called CC=3 SCAR=24.8
2551  
2552 0 ▶ if (/\A ($q_char) /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\A ($Etis620::q_char) /mosx) { } 0 0 0
2553 0 my @ord = unpack 'C*', $1;
2554 0 my $ord = 0;
2555 0 ▶ while (my $o = shift @ord) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $o = shift @ord) 0 0 0
2556 0 $ord = $ord * 0x100 + $o;
2557 }
2558 0 return $ord;
2559 }
2560 else {
2561 0 return CORE::ord $_;
2562 }
2563 }
2564  
2565 #
2566 # TIS-620 reverse
2567 #
2568 0 ▶sub TIS620::reverse(@) {
Subroutine reverse: not called CC=2 SCAR=17.9
2569  
2570 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
2571 0 return CORE::reverse @_;
2572 }
2573 else {
2574  
2575 # One of us once cornered Larry in an elevator and asked him what
2576 # problem he was solving with this, but he looked as far off into
2577 # the distance as he could in an elevator and said, "It seemed like
2578 # a good idea at the time."
2579  
2580 0 return join '', CORE::reverse(join('',@_) =~ /\G ($q_char) /oxmsg);
2581 }
2582 }
2583  
2584 #
2585 # TIS-620 getc (with parameter, without parameter)
2586 #
2587 20 ▶sub TIS620::getc(;*@) {
Subroutine getc: called CC=9 SCAR=26.7
2588  
2589 20 my($package) = caller;
2590 20 ▶ my $fh = @_ ? qualify_to_ref(shift,$package) : \*STDIN;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 20 0 20
2591 20 ▶ croak 'Too many arguments for TIS620::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
2592  
2593 0 my @length = sort { $a <=> $b } keys %range_tr;
2594 20 my $getc = '';
2595 20 for my $length ($length[0] .. $length[-1]) {
2596 20 $getc .= CORE::getc($fh);
2597 20 ▶ if (exists $range_tr{CORE::length($getc)}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $range_tr{length $getc}) 20 0 20
2598 20 ▶ if ($getc =~ /\A ${Etis620::dot_s} \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($getc =~ /\A $Etis620::dot_s \z/mosx) 20 0 20
2599 20 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 20 20
2600 }
2601 }
2602 }
2603 0 ▶ return wantarray ? ($getc,@_) : $getc;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
2604 }
2605  
2606 #
2607 # TIS-620 length by character
2608 #
2609 240 ▶sub TIS620::length(;$) {
Subroutine length: called CC=2 SCAR=7.1
2610  
2611 240 ▶ local $_ = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 240 0 240
2612  
2613 240 local @_ = /\G ($q_char) /oxmsg;
2614 240 return scalar @_;
2615 }
2616  
2617 #
2618 # TIS-620 substr by character
2619 #
2620 422 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
2621  
2622 # P.232 The lvalue Attribute
2623 # in Chapter 6: Subroutines
2624 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
2625  
2626 # P.336 The lvalue Attribute
2627 # in Chapter 7: Subroutines
2628 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2629  
2630 # P.144 8.4 Lvalue subroutines
2631 # in Chapter 8: perlsub: Perl subroutines
2632 # of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1)
2633  
2634 0 ▶ CORE::eval sprintf(<<'END', ($] >= 5.014000) ? ':lvalue' : '');
Subroutine substr: called CC=11 SCAR=24.4
Branch: 10 branches
BranchTrueFalseTotal
$] >= 5.014 ? : 422 0 422
if ($offset > scalar @char or $offset < -1 * scalar(@char)) 2 25 27
if (@_ == 4) { } 1 24 25
elsif (@_ == 3) { } 21 3 24
if ($offset == 0) { } 0 21 21
elsif ($offset > 0) { } 20 1 21
if ($length == 0) { } 0 21 21
elsif ($length > 0) { } 20 1 21
if ($offset == 0) { } 0 3 3
elsif ($offset > 0) { } 2 1 3
Condition66%2/3
$offset > scalar @char or $offset < -1 * scalar(@char)
l!l&&r!l&&!r
2025
MC/DC50%1/2
$offset > scalar @char or $offset < -1 * scalar(@char)
$offset > scalar @char $offset < -1 * scalar(@char)
Truth table66%2/3
A or B
A= $offset > scalar @charB= $offset < -1 * scalar(@char)
ABresult
1X1
011
000
2635 # vv----------------------*******
2636 sub TIS620::substr($$;$$) %s {
2637  
2638 my @char = $_[0] =~ /\G (?>$q_char) /oxmsg;
2639  
2640 # If the substring is beyond either end of the string, substr() returns the undefined
2641 # value and produces a warning. When used as an lvalue, specifying a substring that
2642 # is entirely outside the string raises an exception.
2643 # http://perldoc.perl.org/functions/substr.html
2644  
2645 # A return with no argument returns the scalar value undef in scalar context,
2646 # an empty list () in list context, and (naturally) nothing at all in void
2647 # context.
2648  
2649 my $offset = $_[1];
2650 if (($offset > scalar(@char)) or ($offset < (-1 * scalar(@char)))) {
2651 return;
2652 }
2653  
2654 # substr($string,$offset,$length,$replacement)
2655 if (@_ == 4) {
2656 my(undef,undef,$length,$replacement) = @_;
2657 my $substr = join '', splice(@char, $offset, $length, $replacement);
2658 $_[0] = join '', @char;
2659  
2660 # return $substr; this doesn't work, don't say "return"
2661 $substr;
2662 }
2663  
2664 # substr($string,$offset,$length)
2665 elsif (@_ == 3) {
2666 my(undef,undef,$length) = @_;
2667 my $octet_offset = 0;
2668 my $octet_length = 0;
2669 if ($offset == 0) {
2670 $octet_offset = 0;
2671 }
2672 elsif ($offset > 0) {
2673 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2674 }
2675 else {
2676 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2677 }
2678 if ($length == 0) {
2679 $octet_length = 0;
2680 }
2681 elsif ($length > 0) {
2682 $octet_length = CORE::length(join '', @char[$offset..$offset+$length-1]);
2683 }
2684 else {
2685 $octet_length = -1 * CORE::length(join '', @char[$#char+$length+1..$#char]);
2686 }
2687 CORE::substr($_[0], $octet_offset, $octet_length);
2688 }
2689  
2690 # substr($string,$offset)
2691 else {
2692 my $octet_offset = 0;
2693 if ($offset == 0) {
2694 $octet_offset = 0;
2695 }
2696 elsif ($offset > 0) {
2697 $octet_offset = CORE::length(join '', @char[0..$offset-1]);
2698 }
2699 else {
2700 $octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]);
2701 }
2702 CORE::substr($_[0], $octet_offset);
2703 }
2704 }
2705 END
2706 }
2707  
2708 #
2709 # TIS-620 index by character
2710 #
2711 0 ▶sub TIS620::index($$;$) {
Subroutine index: not called CC=3 SCAR=24.8
2712  
2713 0 my $index;
2714 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2715 0 $index = Etis620::index($_[0], $_[1], CORE::length(TIS620::substr($_[0], 0, $_[2])));
2716 }
2717 else {
2718 0 $index = Etis620::index($_[0], $_[1]);
2719 }
2720  
2721 0 ▶ if ($index == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index == -1) { } 0 0 0
2722 0 return -1;
2723 }
2724 else {
2725 0 return TIS620::length(CORE::substr $_[0], 0, $index);
2726 }
2727 }
2728  
2729 #
2730 # TIS-620 rindex by character
2731 #
2732 0 ▶sub TIS620::rindex($$;$) {
Subroutine rindex: not called CC=3 SCAR=24.8
2733  
2734 0 my $rindex;
2735 0 ▶ if (@_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 0 0 0
2736 0 $rindex = Etis620::rindex($_[0], $_[1], CORE::length(TIS620::substr($_[0], 0, $_[2])));
2737 }
2738 else {
2739 0 $rindex = Etis620::rindex($_[0], $_[1]);
2740 }
2741  
2742 0 ▶ if ($rindex == -1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rindex == -1) { } 0 0 0
2743 0 return -1;
2744 }
2745 else {
2746 0 return TIS620::length(CORE::substr $_[0], 0, $rindex);
2747 }
2748 }
2749  
2750 # when 'm//', '/' means regexp match 'm//' and '?' means regexp match '??'
2751 # when 'div', '/' means division operator and '?' means conditional operator (condition ? then : else)
2752 422 ▶use vars qw($slash); $slash = 'm//';
Subroutine BEGIN: called CC=1 SCAR=0.0
2753  
2754 # ord() to ord() or TIS620::ord()
2755 422 my $function_ord = 'ord';
2756  
2757 # ord to ord or TIS620::ord_
2758 422 my $function_ord_ = 'ord';
2759  
2760 # reverse to reverse or TIS620::reverse
2761 422 my $function_reverse = 'reverse';
2762  
2763 # getc to getc or TIS620::getc
2764 422 my $function_getc = 'getc';
2765  
2766 # P.1023 Appendix W.9 Multibyte Anchoring
2767 # of ISBN 1-56592-224-7 CJKV Information Processing
2768  
2769 422 my $anchor = '';
2770  
2771 422 ▶use vars qw($nest);
Subroutine BEGIN: called CC=1 SCAR=0.0
2772  
2773 # regexp of nested parens in qqXX
2774  
2775 # P.340 Matching Nested Constructs with Embedded Code
2776 # in Chapter 7: Perl
2777 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2778  
2779 my $qq_paren = qr{(?{local $nest=0}) (?>(?:
2780 [^\\()] |
2781 \( (?{$nest++}) |
2782 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2783 \\ [^c] |
2784 \\c[\x40-\x5F] |
2785 [\x00-\xFF]
2786 422 }xms;
2787  
2788 my $qq_brace = qr{(?{local $nest=0}) (?>(?:
2789 [^\\{}] |
2790 \{ (?{$nest++}) |
2791 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2792 \\ [^c] |
2793 \\c[\x40-\x5F] |
2794 [\x00-\xFF]
2795 422 }xms;
2796  
2797 my $qq_bracket = qr{(?{local $nest=0}) (?>(?:
2798 [^\\\[\]] |
2799 \[ (?{$nest++}) |
2800 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2801 \\ [^c] |
2802 \\c[\x40-\x5F] |
2803 [\x00-\xFF]
2804 422 }xms;
2805  
2806 my $qq_angle = qr{(?{local $nest=0}) (?>(?:
2807 [^\\<>] |
2808 \< (?{$nest++}) |
2809 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2810 \\ [^c] |
2811 \\c[\x40-\x5F] |
2812 [\x00-\xFF]
2813 422 }xms;
2814  
2815 422 my $qq_scalar = qr{(?: \{ (?:$qq_brace)*? \} |
2816 (?: ::)? (?:
2817 (?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* )
2818 (?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*)
2819 (?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*)
2820 ))
2821 }xms;
2822  
2823 422 my $qq_variable = qr{(?: \{ (?:$qq_brace)*? \} |
2824 (?: ::)? (?:
2825 (?>[0-9]+) |
2826 [^a-zA-Z_0-9\[\]] |
2827 ^[A-Z] |
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 422 my $qq_substr = qr{(?> Char::substr | TIS620::substr | CORE::substr | substr ) (?>\s*) \( $qq_paren \)
2835 }xms;
2836  
2837 # regexp of nested parens in qXX
2838 my $q_paren = qr{(?{local $nest=0}) (?>(?:
2839 [^()] |
2840 \( (?{$nest++}) |
2841 \) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2842 [\x00-\xFF]
2843 422 }xms;
2844  
2845 my $q_brace = qr{(?{local $nest=0}) (?>(?:
2846 [^\{\}] |
2847 \{ (?{$nest++}) |
2848 \} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2849 [\x00-\xFF]
2850 422 }xms;
2851  
2852 my $q_bracket = qr{(?{local $nest=0}) (?>(?:
2853 [^\[\]] |
2854 \[ (?{$nest++}) |
2855 \] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2856 [\x00-\xFF]
2857 422 }xms;
2858  
2859 my $q_angle = qr{(?{local $nest=0}) (?>(?:
2860 [^<>] |
2861 \< (?{$nest++}) |
2862 \> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) |
2863 [\x00-\xFF]
2864 422 }xms;
2865  
2866 422 my $matched = '';
2867 422 my $s_matched = '';
2868  
2869 422 my $tr_variable = ''; # variable of tr///
2870 422 my $sub_variable = ''; # variable of s///
2871 422 my $bind_operator = ''; # =~ or !~
2872  
2873 422 my @heredoc = (); # here document
2874 422 my @heredoc_delimiter = ();
2875 422 my $here_script = ''; # here script
2876  
2877 #
2878 # escape TIS-620 script
2879 #
2880 547 ▶sub TIS620::escape(;$) {
Subroutine escape: called CC=3 SCAR=11.0
2881 547 ▶ local($_) = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 292 255 547
2882  
2883 # P.359 The Study Function
2884 # in Chapter 7: Perl
2885 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2886  
2887 547 study $_; # Yes, I studied study yesterday.
2888  
2889 # while all script
2890  
2891 # 6.14. Matching from Where the Last Pattern Left Off
2892 # in Chapter 6. Pattern Matching
2893 # of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition.
2894 # (and so on)
2895  
2896 # one member of Tag-team
2897 #
2898 # P.128 Start of match (or end of previous match): \G
2899 # P.130 Advanced Use of \G with Perl
2900 # in Chapter 3: Overview of Regular Expression Features and Flavors
2901 # P.255 Use leading anchors
2902 # P.256 Expose ^ and \G at the front expressions
2903 # in Chapter 6: Crafting an Efficient Expression
2904 # P.315 "Tag-team" matching with /gc
2905 # in Chapter 7: Perl
2906 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2907  
2908 547 my $e_script = '';
2909 547 ▶ while (not /\G \z/oxgc) { # member
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 88540 547 89087
2910 88540 $e_script .= TIS620::escape_token();
2911 }
2912  
2913 547 return $e_script;
2914 }
2915  
2916 #
2917 # escape TIS-620 token of script
2918 #
2919 88540 ▶sub TIS620::escape_token {
Subroutine escape_token: called CC=504 SCAR=109.3
2920  
2921 # \n output here document
2922  
2923 88540 my $ignore_modules = join('|', qw(
2924 utf8
2925 bytes
2926 charnames
2927 I18N::Japanese
2928 I18N::Collate
2929 I18N::JExt
2930 File::DosGlob
2931 Wild
2932 Wildcard
2933 Japanese
2934 ));
2935  
2936 # another member of Tag-team
2937 #
2938 # P.315 "Tag-team" matching with /gc
2939 # in Chapter 7: Perl
2940 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
2941  
2942 88540 ▶ if (/\G ( \n ) /oxgc) { # another member (and so on)
Branch: 139 branches
BranchTrueFalseTotal
if (/\G ( \n ) /cgox) { } 12534 76006 88540
elsif (/\G ((?>\s+)|\#.*) /cgox) { } 20565 55441 76006
elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /cgox) { } 1622 53819 55441
elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /cgox) { } 90 53729 53819
elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx) { } 4 53725 53729
elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 28 53697 53725
elsif (/\G ( \$' | \$\{'\} ) /cgmosx) { } 1 53696 53697
elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 3 53693 53696
elsif (/\G ( \$ $qq_scalar | $qq_substr ) /cgox) { } 1749 51944 53693
elsif (/\G ( [,;] ) /cgox) { } 4903 47041 51944
elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 47041 47041
elsif (/\G ( \$ 0 ) /cgmosx) { } 2 47039 47041
elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 47039 47039
elsif (/\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 1 47038 47039
elsif (/\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 4 47034 47038
elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 47034 47034
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 47034 47034
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 47034 47034
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 47034 47034
elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /cgmosx) { } 0 47034 47034
elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 0 47034 47034
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 47002 47034
elsif (m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 63 46939 47002
elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /cgox) { } 0 46939 46939
elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /cgox) { } 0 46939 46939
elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /cgox) { } 0 46939 46939
elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /cgox) { } 0 46939 46939
elsif (/\G \b ( if | unless | while | until | for | when ) \b /cgox) { } 251 46688 46939
elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 19 46669 46688
elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 46669 46669
elsif (/\G \b TIS620::eval (?= (?>\s*) \{ ) /cgox) { } 22 46647 46669
elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /cgox) { } 0 46647 46647
elsif (/\G \b TIS620::eval \b (?! (?>\s*) => ) /cgox) { } 168 46479 46647
elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /cgox) { } 2 46477 46479
elsif (/\G \b chop \b (?! (?>\s*) => ) /cgox) { } 0 46477 46477
elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /cgox) { } 2 46475 46477
elsif (/\G \b Char::index \b (?! (?>\s*) => ) /cgox) { } 0 46475 46475
elsif (/\G \b TIS620::index \b (?! (?>\s*) => ) /cgox) { } 0 46475 46475
elsif (/\G \b index \b (?! (?>\s*) => ) /cgox) { } 0 46475 46475
elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /cgox) { } 2 46473 46475
elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /cgox) { } 0 46473 46473
elsif (/\G \b TIS620::rindex \b (?! (?>\s*) => ) /cgox) { } 0 46473 46473
elsif (/\G \b rindex \b (?! (?>\s*) => ) /cgox) { } 0 46473 46473
elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 46472 46473
elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 46472 46472
elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 1 46471 46472
elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 46471 46471
elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 46469 46471
elsif (/\G -s (?>\s*) (\") ((?:$Etis620::qq_char)+?) (\") /cgox) { } 0 46469 46469
elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Etis620::qq_char)+?) (\#) /cgox) { } 0 46469 46469
elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 46469 46469
elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 46469 46469
elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 46469 46469
elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 46469 46469
elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Etis620::qq_char)+?) (\1) /cgox) { } 0 46469 46469
elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Etis620::q_char)+?) (\') /cgox) { } 0 46469 46469
elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Etis620::q_char)+?) (\#) /cgox) { } 0 46469 46469
elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 46469 46469
elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 46469 46469
elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 46469 46469
elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 46469 46469
elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Etis620::q_char)+?) (\1) /cgox) { } 0 46469 46469
elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /cgox) { } 0 46469 46469
elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 46469 46469
elsif (/\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 46469 46469
elsif (/\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 46469 46469
elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 46467 46469
elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 46465 46467
elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 36 46429 46465
elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 2 46427 46429
elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 8 46419 46427
elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 46419 46419
elsif (/\G \b lc \b (?! (?>\s*) => ) /cgox) { } 0 46419 46419
elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /cgox) { } 0 46419 46419
elsif (/\G \b uc \b (?! (?>\s*) => ) /cgox) { } 0 46419 46419
elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /cgox) { } 0 46419 46419
elsif (/\G \b fc \b (?! (?>\s*) => ) /cgox) { } 0 46419 46419
elsif (/\G -s \b (?! (?>\s*) => ) /cgox) { } 0 46419 46419
elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /cgox) { } 0 46419 46419
elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /cgox) { } 0 46419 46419
elsif (/\G \b chr \b (?! (?>\s*) => ) /cgox) { } 0 46419 46419
elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /cgox) { } 0 46419 46419
elsif (/\G \b ord \b (?! (?>\s*) => ) /cgox) { } 0 46419 46419
elsif (/\G \b glob \b (?! (?>\s*) => ) /cgox) { } 0 46419 46419
elsif (/\G \b reverse \b (?! (?>\s*) => ) /cgox) { } 0 46419 46419
elsif (/\G \b getc \b (?! (?>\s*) => ) /cgox) { } 8 46411 46419
elsif (/\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 87 46324 46411
elsif (/\G \b ( tr | y ) \b /cgox) { } 4 46320 46324
elsif (/\G \b (qq) \b /cgox) { } 2190 44130 46320
elsif (/\G \b (qr) \b /cgox) { } 0 44130 44130
elsif (/\G \b (qw) \b /cgox) { } 14 44116 44130
elsif (/\G \b (qx) \b /cgox) { } 0 44116 44116
elsif (/\G \b (q) \b /cgox) { } 713 43403 44116
elsif (/\G \b (m) \b /cgox) { } 209 43194 43403
elsif (/\G \b (s) \b /cgox) { } 101 43093 43194
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 43093 43093
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 43093 43093
elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 43093 43093
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /cgmosx) { } 37 43056 43093
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 43056 43056
elsif (/\G \b use ((?>\s+) strict) \b /cgmosx) { } 0 43056 43056
elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 2 43054 43056
elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /cgmosx) { } 0 43054 43054
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 2 43052 43054
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 43052 43052
elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 43052 43052
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /cgmosx) { } 0 43052 43052
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /cgmosx) { } 0 43052 43052
elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /cgmosx) { } 0 43052 43052
elsif (/\G \b use \b /cgmosx) { } 0 43052 43052
elsif (/\G \b no \b /cgmosx) { } 2 43050 43052
elsif (/\G (?<![\w\$\@\%\&\*]) (\') /cgox) { } 922 42128 43050
elsif (/\G (\") /cgox) { } 1643 40485 42128
elsif (/\G (\`) /cgox) { } 1 40484 40485
elsif ($Etis620::slash eq 'm//' and m[\G (/) ]cgox) { } 425 40059 40484
elsif ($Etis620::slash eq 'm//' and /\G (\?) /cgox) { } 0 40059 40059
elsif (/\G ( <<>> ) /cgox) { } 0 40059 40059
elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 40059 40059
elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 6 40053 40059
elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 3 40050 40053
elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 6 40044 40050
elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 3 40041 40044
elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 6 40035 40041
elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 72 39963 40035
elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 39963 39963
elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 36 39927 39963
elsif (/\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 42 39885 39927
elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 39885 39885
elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 12 39873 39885
elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 39873 39873
elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /cgox) { } 0 39873 39873
elsif (/\G ^ ( __DATA__ \n .*) \z /cgmosx) { } 0 39873 39873
elsif (/\G ^ ( __END__ \n .*) \z /cgmosx) { } 210 39663 39873
elsif (/\G ( \cD .*) \z /cgmosx) { } 0 39663 39663
elsif (/\G ( \cZ .*) \z /cgmosx) { } 0 39663 39663
elsif (/\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 6001 33662 39663
elsif (/\G ( \.\.\. ) /cgox) { } 7 33655 33662
elsif (m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 10260 23395 33655
elsif (/\G ($Etis620::q_char) /cgox) { } 23395 0 23395
2943 12534 my $heredoc = '';
2944 12534 ▶ if (scalar(@heredoc_delimiter) >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @heredoc_delimiter >= 1) 174 12360 12534
2945 174 $slash = 'm//';
2946  
2947 174 $heredoc = join '', @heredoc;
2948 174 @heredoc = ();
2949  
2950 # skip here document
2951 174 for my $heredoc_delimiter (@heredoc_delimiter) {
2952 174 /\G .*? \n $heredoc_delimiter \n/xmsgc;
2953 }
2954 174 @heredoc_delimiter = ();
2955  
2956 174 $here_script = '';
2957 }
2958 12534 return "\n" . $heredoc;
2959 }
2960  
2961 # ignore space, comment
2962 20565 elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; }
2963  
2964 # if (, elsif (, unless (, while (, until (, given (, and when (
2965  
2966 # given, when
2967  
2968 # P.225 The given Statement
2969 # in Chapter 15: Smart Matching and given-when
2970 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
2971  
2972 # P.133 The given Statement
2973 # in Chapter 4: Statements and Declarations
2974 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2975  
2976 elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /oxgc) {
2977 1622 $slash = 'm//';
2978 1622 return $1;
2979 }
2980  
2981 # scalar variable ($scalar = ...) =~ tr///;
2982 # scalar variable ($scalar = ...) =~ s///;
2983  
2984 # state
2985  
2986 # P.68 Persistent, Private Variables
2987 # in Chapter 4: Subroutines
2988 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
2989  
2990 # P.160 Persistent Lexically Scoped Variables: state
2991 # in Chapter 4: Statements and Declarations
2992 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
2993  
2994 # (and so on)
2995  
2996 elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /oxgc) {
2997 90 my $e_string = e_string($1);
2998  
2999 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
3000 0 $tr_variable = $e_string . e_string($1);
3001 0 $bind_operator = $2;
3002 0 $slash = 'm//';
3003 0 return '';
3004 }
3005 elsif (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3006 0 $sub_variable = $e_string . e_string($1);
3007 0 $bind_operator = $2;
3008 0 $slash = 'm//';
3009 0 return '';
3010 }
3011 else {
3012 90 $slash = 'div';
3013 90 return $e_string;
3014 }
3015 }
3016  
3017 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Etis620::PREMATCH()
3018 elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
3019 4 $slash = 'div';
3020 4 return q{Etis620::PREMATCH()};
3021 }
3022  
3023 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Etis620::MATCH()
3024 elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
3025 28 $slash = 'div';
3026 28 return q{Etis620::MATCH()};
3027 }
3028  
3029 # $', ${'} --> $', ${'}
3030 elsif (/\G ( \$' | \$\{'\} ) /oxmsgc) {
3031 1 $slash = 'div';
3032 1 return $1;
3033 }
3034  
3035 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Etis620::POSTMATCH()
3036 elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
3037 3 $slash = 'div';
3038 3 return q{Etis620::POSTMATCH()};
3039 }
3040  
3041 # scalar variable $scalar =~ tr///;
3042 # scalar variable $scalar =~ s///;
3043 # substr() =~ tr///;
3044 # substr() =~ s///;
3045 elsif (/\G ( \$ $qq_scalar | $qq_substr ) /oxgc) {
3046 1749 my $scalar = e_string($1);
3047  
3048 1749 ▶ if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /oxgc) {
Branch: 2 branches
BranchTrueFalseTotal
if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /cgox) { } 2 1747 1749
elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /cgox) { } 65 1682 1747
3049 2 $tr_variable = $scalar;
3050 2 $bind_operator = $1;
3051 2 $slash = 'm//';
3052 2 return '';
3053 }
3054 elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) {
3055 65 $sub_variable = $scalar;
3056 65 $bind_operator = $1;
3057 65 $slash = 'm//';
3058 65 return '';
3059 }
3060 else {
3061 1682 $slash = 'div';
3062 1682 return $scalar;
3063 }
3064 }
3065  
3066 # end of statement
3067 elsif (/\G ( [,;] ) /oxgc) {
3068 4903 $slash = 'm//';
3069  
3070 # clear tr/// variable
3071 4903 $tr_variable = '';
3072  
3073 # clear s/// variable
3074 4903 $sub_variable = '';
3075  
3076 4903 $bind_operator = '';
3077  
3078 4903 return $1;
3079 }
3080  
3081 # bareword
3082 elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
3083 0 return $1;
3084 }
3085  
3086 # $0 --> $0
3087 elsif (/\G ( \$ 0 ) /oxmsgc) {
3088 2 $slash = 'div';
3089 2 return $1;
3090 }
3091 elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
3092 0 $slash = 'div';
3093 0 return $1;
3094 }
3095  
3096 # $$ --> $$
3097 elsif (/\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
3098 1 $slash = 'div';
3099 1 return $1;
3100 }
3101  
3102 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
3103 # $1, $2, $3 --> $1, $2, $3 otherwise
3104 elsif (/\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
3105 4 $slash = 'div';
3106 4 return e_capture($1);
3107 }
3108 elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
3109 0 $slash = 'div';
3110 0 return e_capture($1);
3111 }
3112  
3113 # $$foo[ ... ] --> $ $foo->[ ... ]
3114 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
3115 0 $slash = 'div';
3116 0 return e_capture($1.'->'.$2);
3117 }
3118  
3119 # $$foo{ ... } --> $ $foo->{ ... }
3120 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
3121 0 $slash = 'div';
3122 0 return e_capture($1.'->'.$2);
3123 }
3124  
3125 # $$foo
3126 elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
3127 0 $slash = 'div';
3128 0 return e_capture($1);
3129 }
3130  
3131 # ${ foo }
3132 elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /oxmsgc) {
3133 0 $slash = 'div';
3134 0 return '${' . $1 . '}';
3135 }
3136  
3137 # ${ ... }
3138 elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
3139 0 $slash = 'div';
3140 0 return e_capture($1);
3141 }
3142  
3143 # variable or function
3144 # $ @ % & * $ #
3145 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) {
3146 32 $slash = 'div';
3147 32 return $1;
3148 }
3149 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
3150 # $ @ # \ ' " / ? ( ) [ ] < >
3151 elsif (/\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
3152 63 $slash = 'div';
3153 63 return $1;
3154 }
3155  
3156 # while (<FILEHANDLE>)
3157 elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /oxgc) {
3158 0 return $1;
3159 }
3160  
3161 # while (<WILDCARD>) --- glob
3162  
3163 # avoid "Error: Runtime exception" of perl version 5.005_03
3164  
3165 elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^>\0\a\e\f\n\r\t])+?) > (?>\s*) \) \b /oxgc) {
3166 0 return 'while ($_ = Etis620::glob("' . $1 . '"))';
3167 }
3168  
3169 # while (glob)
3170 elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /oxgc) {
3171 0 return 'while ($_ = Etis620::glob_)';
3172 }
3173  
3174 # while (glob(WILDCARD))
3175 elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /oxgc) {
3176 0 return 'while ($_ = Etis620::glob';
3177 }
3178  
3179 # doit if, doit unless, doit while, doit until, doit for, doit when
3180 251 elsif (/\G \b ( if | unless | while | until | for | when ) \b /oxgc) { $slash = 'm//'; return $1; }
3181  
3182 # subroutines of package Etis620
3183 19 elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $slash = 'm//'; return $1; }
3184 0 elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3185 22 elsif (/\G \b TIS620::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; }
3186 0 elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Char::escape'; }
3187 168 elsif (/\G \b TIS620::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval TIS620::escape'; }
3188 2 elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'substr'; }
3189 0 elsif (/\G \b chop \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Etis620::chop'; }
3190 2 elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'index'; }
3191 0 elsif (/\G \b Char::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::index'; }
3192 0 elsif (/\G \b TIS620::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'TIS620::index'; }
3193 0 elsif (/\G \b index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Etis620::index'; }
3194 2 elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'rindex'; }
3195 0 elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::rindex'; }
3196 0 elsif (/\G \b TIS620::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'TIS620::rindex'; }
3197 0 elsif (/\G \b rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Etis620::rindex'; }
3198 1 elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Etis620::lc'; }
3199 0 elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Etis620::lcfirst'; }
3200 1 elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Etis620::uc'; }
3201 0 elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Etis620::ucfirst'; }
3202 2 elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Etis620::fc'; }
3203  
3204 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
3205 0 elsif (/\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $slash = 'm//'; return '-s ' . e_qq('', $1,$3,$2); }
3206 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3207 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3208 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3209 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3210 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3211 0 elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); }
3212  
3213 0 elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $slash = 'm//'; return '-s ' . e_q ('', $1,$3,$2); }
3214 0 elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3215 0 elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3216 0 elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3217 0 elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3218 0 elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3219 0 elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); }
3220  
3221 elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /oxgc)
3222 0 { $slash = 'm//'; return "-s $1"; }
3223 0 elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $slash = 'm//'; return "-s ($1)"; }
3224 0 elsif (/\G -s (?= (?>\s+) [a-z]+) /oxgc) { $slash = 'm//'; return '-s'; }
3225 0 elsif (/\G -s (?>\s+) ((?>\w+)) /oxgc) { $slash = 'm//'; return "-s $1"; }
3226  
3227 2 elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'length'; }
3228 2 elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'chr'; }
3229 36 elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Etis620::chr'; }
3230 2 elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return 'ord'; }
3231 8 elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return $function_ord; }
3232 0 elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Etis620::glob'; }
3233 0 elsif (/\G \b lc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Etis620::lc_'; }
3234 0 elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Etis620::lcfirst_'; }
3235 0 elsif (/\G \b uc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Etis620::uc_'; }
3236 0 elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Etis620::ucfirst_'; }
3237 0 elsif (/\G \b fc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Etis620::fc_'; }
3238 0 elsif (/\G -s \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return '-s '; }
3239  
3240 0 elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'length'; }
3241 0 elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'chr'; }
3242 0 elsif (/\G \b chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Etis620::chr_'; }
3243 0 elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return 'ord'; }
3244 0 elsif (/\G \b ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return $function_ord_; }
3245 0 elsif (/\G \b glob \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Etis620::glob_'; }
3246 0 elsif (/\G \b reverse \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_reverse; }
3247 8 elsif (/\G \b getc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_getc; }
3248 # split
3249 elsif (/\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
3250 87 $slash = 'm//';
3251  
3252 87 my $e = '';
3253 87 ▶ while (/\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if (/\G ( (?>\s+) | \( | \#.* ) /cgox) 85 87 172
3254 85 $e .= $1;
3255 }
3256  
3257 # end of split
3258 87 ▶ if (/\G (?= [,;\)\}\]] ) /oxgc) { return 'Etis620::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
3259  
3260 # split scalar value
3261 1 elsif (/\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { return 'Etis620::split' . $e . e_string($1); }
3262  
3263 # split literal space
3264 0 elsif (/\G \b qq (\#) [ ] (\#) /oxgc) { return 'Etis620::split' . $e . qq {qq$1 $2}; }
3265 0 elsif (/\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Etis620::split' . $e . qq{$1qq$2 $3}; }
3266 0 elsif (/\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Etis620::split' . $e . qq{$1qq$2 $3}; }
3267 0 elsif (/\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Etis620::split' . $e . qq{$1qq$2 $3}; }
3268 0 elsif (/\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Etis620::split' . $e . qq{$1qq$2 $3}; }
3269 0 elsif (/\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Etis620::split' . $e . qq{$1qq$2 $3}; }
3270 0 elsif (/\G \b q (\#) [ ] (\#) /oxgc) { return 'Etis620::split' . $e . qq {q$1 $2}; }
3271 0 elsif (/\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Etis620::split' . $e . qq {$1q$2 $3}; }
3272 0 elsif (/\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Etis620::split' . $e . qq {$1q$2 $3}; }
3273 0 elsif (/\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Etis620::split' . $e . qq {$1q$2 $3}; }
3274 0 elsif (/\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Etis620::split' . $e . qq {$1q$2 $3}; }
3275 0 elsif (/\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Etis620::split' . $e . qq {$1q$2 $3}; }
3276 10 elsif (/\G ' [ ] ' /oxgc) { return 'Etis620::split' . $e . qq {' '}; }
3277 0 elsif (/\G " [ ] " /oxgc) { return 'Etis620::split' . $e . qq {" "}; }
3278  
3279 # split qq//
3280 elsif (/\G \b (qq) \b /oxgc) {
3281 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Etis620::qq_char)*?) (\#) /cgox) { } 0 0 0
3282 else {
3283 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3284 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 ([*\-:?\\^|]) ((?:$Etis620::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Etis620::qq_char)*?) (\1) /cgox) { } 0 0 0
3285 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq ( ) --> qr ( )
3286 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq { } --> qr { }
3287 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq [ ] --> qr [ ]
3288 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq < > --> qr < >
3289 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr','{','}',$2,''); } # qq | | --> qr { }
3290 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq * * --> qr * *
3291 }
3292 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3293 }
3294 }
3295  
3296 # split qr//
3297 elsif (/\G \b (qr) \b /oxgc) {
3298 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # qr# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Etis620::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 12 12
3299 else {
3300 12 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 12 0 12
3301 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 (\') ((?:$Etis620::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G ([*\-:?\\^|]) ((?:$Etis620::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 12 12
elsif (/\G (\S) ((?:$Etis620::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 12 0 12
3302 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr ( )
3303 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr { }
3304 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr [ ]
3305 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr < >
3306 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # qr ' '
3307 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # qr | | --> qr { }
3308 12 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr * *
3309 }
3310 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3311 }
3312 }
3313  
3314 # split q//
3315 elsif (/\G \b (q) \b /oxgc) {
3316 0 ▶ if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:\\\#|\\\\|$Etis620::q_char)*?) (\#) /cgox) { } 0 0 0
3317 else {
3318 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3319 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 ([*\-:?\\^|]) ((?:$Etis620::q_char)*?) (\1) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:\\\\|\\\1| $Etis620::q_char)*?) (\1) /cgox) { } 0 0 0
3320 0 elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q ( ) --> qr ( )
3321 0 elsif (/\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q { } --> qr { }
3322 0 elsif (/\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q [ ] --> qr [ ]
3323 0 elsif (/\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q < > --> qr < >
3324 0 elsif (/\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr','{','}',$2,''); } # q | | --> qr { }
3325 0 elsif (/\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q * * --> qr * *
3326 }
3327 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3328 }
3329 }
3330  
3331 # split m//
3332 elsif (/\G \b (m) \b /oxgc) {
3333 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # m# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Etis620::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
3334 else {
3335 18 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 18 0 18
3336 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 (\') ((?:$Etis620::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G ([*\-:?\\^|]) ((?:$Etis620::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 18 18
elsif (/\G (\S) ((?:$Etis620::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 18 0 18
3337 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m ( ) --> qr ( )
3338 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m { } --> qr { }
3339 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m [ ] --> qr [ ]
3340 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m < > --> qr < >
3341 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # m ' ' --> qr ' '
3342 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # m | | --> qr { }
3343 18 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m * * --> qr * *
3344 }
3345 0 die __FILE__, ": Search pattern not terminated\n";
3346 }
3347 }
3348  
3349 # split ''
3350 elsif (/\G (\') /oxgc) {
3351 0 my $q_string = '';
3352 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3353 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 ($Etis620::q_char) /cgox) { } 0 0 0
3354 0 elsif (/\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
3355 0 elsif (/\G \' /oxgc) { return e_split_q($e.q{ qr},"'","'",$q_string,''); } # ' ' --> qr ' '
3356 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3357 }
3358 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3359 }
3360  
3361 # split ""
3362 elsif (/\G (\") /oxgc) {
3363 0 my $qq_string = '';
3364 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3365 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 ($Etis620::q_char) /cgox) { } 0 0 0
3366 0 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
3367 0 elsif (/\G \" /oxgc) { return e_split($e.q{ qr},'"','"',$qq_string,''); } # " " --> qr " "
3368 0 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
3369 }
3370 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3371 }
3372  
3373 # split //
3374 elsif (/\G (\/) /oxgc) {
3375 44 my $regexp = '';
3376 44 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 381 0 381
3377 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 ($Etis620::q_char) /cgox) { } 337 0 337
3378 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
3379 44 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_split($e.q{ qr}, '/','/',$regexp,$1); } # / / --> qr / /
3380 337 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3381 }
3382 0 die __FILE__, ": Search pattern not terminated\n";
3383 }
3384 }
3385  
3386 # tr/// or y///
3387  
3388 # about [cdsrbB]* (/B modifier)
3389 #
3390 # P.559 appendix C
3391 # of ISBN 4-89052-384-7 Programming perl
3392 # (Japanese title is: Perl puroguramingu)
3393  
3394 elsif (/\G \b ( tr | y ) \b /oxgc) {
3395 4 my $ope = $1;
3396  
3397 # $1 $2 $3 $4 $5 $6
3398 4 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cdsrbB]*) /oxgc) { # tr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Etis620::qq_char)*?) (\#) ((?:$Etis620::qq_char)*?) (\#) ([cdsrbB]*) /cgox) { } 0 4 4
3399 0 my @tr = ($tr_variable,$2);
3400 0 return e_tr(@tr,'',$4,$6);
3401 }
3402 else {
3403 4 my $e = '';
3404 4 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 4 0 4
3405 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) ((?:$Etis620::qq_char)*?) (\1) ((?:$Etis620::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 4 0 4
3406 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3407 0 my @tr = ($tr_variable,$2);
3408 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3409 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) ((?:$Etis620::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3410 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) ( )
3411 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) { }
3412 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) [ ]
3413 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) < >
3414 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) * *
3415 }
3416 0 die __FILE__, ": Transliteration replacement not terminated\n";
3417 }
3418 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3419 0 my @tr = ($tr_variable,$2);
3420 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3421 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) ((?:$Etis620::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3422 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } ( )
3423 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } { }
3424 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } [ ]
3425 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } < >
3426 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } * *
3427 }
3428 0 die __FILE__, ": Transliteration replacement not terminated\n";
3429 }
3430 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3431 0 my @tr = ($tr_variable,$2);
3432 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3433 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) ((?:$Etis620::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3434 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] ( )
3435 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] { }
3436 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] [ ]
3437 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] < >
3438 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] * *
3439 }
3440 0 die __FILE__, ": Transliteration replacement not terminated\n";
3441 }
3442 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3443 0 my @tr = ($tr_variable,$2);
3444 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3445 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) ((?:$Etis620::qq_char)*?) (\1) ([cdsrbB]*) /cgox) { } 0 0 0
3446 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > ( )
3447 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > { }
3448 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > [ ]
3449 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > < >
3450 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > * *
3451 }
3452 0 die __FILE__, ": Transliteration replacement not terminated\n";
3453 }
3454 # $1 $2 $3 $4 $5 $6
3455 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { # tr * * *
3456 4 my @tr = ($tr_variable,$2);
3457 4 return e_tr(@tr,'',$4,$6);
3458 }
3459 }
3460 0 die __FILE__, ": Transliteration pattern not terminated\n";
3461 }
3462 }
3463  
3464 # qq//
3465 elsif (/\G \b (qq) \b /oxgc) {
3466 2190 my $ope = $1;
3467  
3468 # if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_qq($ope,$1,$3,$2); } # qq# #
3469 2190 ▶ if (/\G (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 2190 2190
3470 0 my $qq_string = '';
3471 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3472 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 ($Etis620::qq_char) /cgox) { } 0 0 0
3473 0 elsif (/\G (\\\#) /oxgc) { $qq_string .= $1; }
3474 0 elsif (/\G (\#) /oxgc) { return e_qq($ope,'#','#',$qq_string); }
3475 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3476 }
3477 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3478 }
3479  
3480 else {
3481 2190 my $e = '';
3482 2190 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 2190 0 2190
3483 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
3484  
3485 # elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq ( )
3486 elsif (/\G (\() /oxgc) { # qq ( )
3487 0 my $qq_string = '';
3488 0 local $nest = 1;
3489 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3490 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 ($Etis620::qq_char) /cgox) { } 0 0 0
3491 0 elsif (/\G (\\\)) /oxgc) { $qq_string .= $1; }
3492 0 elsif (/\G (\() /oxgc) { $qq_string .= $1; $nest++; }
3493 elsif (/\G (\)) /oxgc) {
3494 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'(',')',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Etis620::nest == 0) { } 0 0 0
3495 0 else { $qq_string .= $1; }
3496 }
3497 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3498 }
3499 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3500 }
3501  
3502 # elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq { }
3503 elsif (/\G (\{) /oxgc) { # qq { }
3504 2160 my $qq_string = '';
3505 2160 local $nest = 1;
3506 2160 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 85352 0 85352
3507 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 ($Etis620::qq_char) /cgox) { } 80128 0 80128
3508 0 elsif (/\G (\\\}) /oxgc) { $qq_string .= $1; }
3509 1227 elsif (/\G (\{) /oxgc) { $qq_string .= $1; $nest++; }
3510 elsif (/\G (\}) /oxgc) {
3511 3387 ▶ if (--$nest == 0) { return $e . e_qq($ope,'{','}',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Etis620::nest == 0) { } 2160 1227 3387
3512 1227 else { $qq_string .= $1; }
3513 }
3514 80128 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3515 }
3516 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3517 }
3518  
3519 # elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq [ ]
3520 elsif (/\G (\[) /oxgc) { # qq [ ]
3521 0 my $qq_string = '';
3522 0 local $nest = 1;
3523 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3524 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 ($Etis620::qq_char) /cgox) { } 0 0 0
3525 0 elsif (/\G (\\\]) /oxgc) { $qq_string .= $1; }
3526 0 elsif (/\G (\[) /oxgc) { $qq_string .= $1; $nest++; }
3527 elsif (/\G (\]) /oxgc) {
3528 0 ▶ if (--$nest == 0) { return $e . e_qq($ope,'[',']',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Etis620::nest == 0) { } 0 0 0
3529 0 else { $qq_string .= $1; }
3530 }
3531 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3532 }
3533 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3534 }
3535  
3536 # elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq < >
3537 elsif (/\G (\<) /oxgc) { # qq < >
3538 30 my $qq_string = '';
3539 30 local $nest = 1;
3540 30 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 1166 0 1166
3541 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 ($Etis620::qq_char) /cgox) { } 1114 0 1114
3542 0 elsif (/\G (\\\>) /oxgc) { $qq_string .= $1; }
3543 0 elsif (/\G (\<) /oxgc) { $qq_string .= $1; $nest++; }
3544 elsif (/\G (\>) /oxgc) {
3545 30 ▶ if (--$nest == 0) { return $e . e_qq($ope,'<','>',$qq_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Etis620::nest == 0) { } 30 0 30
3546 0 else { $qq_string .= $1; }
3547 }
3548 1114 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3549 }
3550 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3551 }
3552  
3553 # elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq * *
3554 elsif (/\G (\S) /oxgc) { # qq * *
3555 0 my $delimiter = $1;
3556 0 my $qq_string = '';
3557 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3558 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 ($Etis620::qq_char) /cgox) { } 0 0 0
3559 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $qq_string .= $1; }
3560 0 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_qq($ope,$delimiter,$delimiter,$qq_string); }
3561 0 elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; }
3562 }
3563 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3564 }
3565 }
3566 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3567 }
3568 }
3569  
3570 # qr//
3571 elsif (/\G \b (qr) \b /oxgc) {
3572 0 my $ope = $1;
3573 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { # qr# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Etis620::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3574 0 return e_qr($ope,$1,$3,$2,$4);
3575 }
3576 else {
3577 0 my $e = '';
3578 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3579 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 (\') ((?:$Etis620::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G ([*\-:?\\^|]) ((?:$Etis620::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Etis620::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
3580 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr ( )
3581 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr { }
3582 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr [ ]
3583 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr < >
3584 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # qr ' '
3585 0 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # qr | | --> qr { }
3586 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr * *
3587 }
3588 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3589 }
3590 }
3591  
3592 # qw//
3593 elsif (/\G \b (qw) \b /oxgc) {
3594 14 my $ope = $1;
3595 14 ▶ if (/\G (\#) (.*?) (\#) /oxmsgc) { # qw# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) (.*?) (\#) /cgmosx) { } 0 14 14
3596 0 return e_qw($ope,$1,$3,$2);
3597 }
3598 else {
3599 14 my $e = '';
3600 14 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 14 0 14
3601 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) ((?:$Etis620::q_char)*?) (\1) /cgmosx) { } 0 0 0
3602  
3603 14 elsif (/\G (\() ([^(]*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3604 0 elsif (/\G (\() ((?:$q_paren)*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( )
3605  
3606 0 elsif (/\G (\{) ([^{]*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3607 0 elsif (/\G (\{) ((?:$q_brace)*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { }
3608  
3609 0 elsif (/\G (\[) ([^[]*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3610 0 elsif (/\G (\[) ((?:$q_bracket)*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ]
3611  
3612 0 elsif (/\G (\<) ([^<]*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3613 0 elsif (/\G (\<) ((?:$q_angle)*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < >
3614  
3615 0 elsif (/\G ([\x21-\x3F]) (.*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3616 0 elsif (/\G (\S) ((?:$q_char)*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * *
3617 }
3618 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3619 }
3620 }
3621  
3622 # qx//
3623 elsif (/\G \b (qx) \b /oxgc) {
3624 0 my $ope = $1;
3625 0 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Etis620::qq_char)*?) (\#) /cgox) { } 0 0 0
3626 0 return e_qq($ope,$1,$3,$2);
3627 }
3628 else {
3629 0 my $e = '';
3630 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3631 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 (\') ((?:$Etis620::qq_char)*?) (\') /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Etis620::qq_char)*?) (\1) /cgox) { } 0 0 0
3632 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx ( )
3633 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx { }
3634 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx [ ]
3635 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx < >
3636 0 elsif (/\G (\') ((?:$qq_char)*?) (\') /oxgc) { return $e . e_q ($ope,$1,$3,$2); } # qx ' '
3637 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx * *
3638 }
3639 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3640 }
3641 }
3642  
3643 # q//
3644 elsif (/\G \b (q) \b /oxgc) {
3645 713 my $ope = $1;
3646  
3647 # if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_q($ope,$1,$3,$2); } # q# #
3648  
3649 # avoid "Error: Runtime exception" of perl version 5.005_03
3650 # (and so on)
3651  
3652 713 ▶ if (/\G (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) /cgox) { } 0 713 713
3653 0 my $q_string = '';
3654 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3655 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 ($Etis620::q_char) /cgox) { } 0 0 0
3656 0 elsif (/\G (\\\#) /oxgc) { $q_string .= $1; }
3657 0 elsif (/\G (\#) /oxgc) { return e_q($ope,'#','#',$q_string); }
3658 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3659 }
3660 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3661 }
3662  
3663 else {
3664 713 my $e = '';
3665 713 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 713 0 713
3666 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
3667  
3668 # elsif (/\G (\() ((?:\\\)|\\\\|$q_paren)*?) (\)) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q ( )
3669 elsif (/\G (\() /oxgc) { # q ( )
3670 0 my $q_string = '';
3671 0 local $nest = 1;
3672 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3673 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 ($Etis620::q_char) /cgox) { } 0 0 0
3674 0 elsif (/\G (\\\)) /oxgc) { $q_string .= $1; }
3675 0 elsif (/\G (\\\() /oxgc) { $q_string .= $1; }
3676 0 elsif (/\G (\() /oxgc) { $q_string .= $1; $nest++; }
3677 elsif (/\G (\)) /oxgc) {
3678 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'(',')',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Etis620::nest == 0) { } 0 0 0
3679 0 else { $q_string .= $1; }
3680 }
3681 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3682 }
3683 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3684 }
3685  
3686 # elsif (/\G (\{) ((?:\\\}|\\\\|$q_brace)*?) (\}) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q { }
3687 elsif (/\G (\{) /oxgc) { # q { }
3688 707 my $q_string = '';
3689 707 local $nest = 1;
3690 707 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 23645 0 23645
3691 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 ($Etis620::q_char) /cgox) { } 22484 0 22484
3692 0 elsif (/\G (\\\}) /oxgc) { $q_string .= $1; }
3693 0 elsif (/\G (\\\{) /oxgc) { $q_string .= $1; }
3694 227 elsif (/\G (\{) /oxgc) { $q_string .= $1; $nest++; }
3695 elsif (/\G (\}) /oxgc) {
3696 934 ▶ if (--$nest == 0) { return $e . e_q($ope,'{','}',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Etis620::nest == 0) { } 707 227 934
3697 227 else { $q_string .= $1; }
3698 }
3699 22484 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3700 }
3701 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3702 }
3703  
3704 # elsif (/\G (\[) ((?:\\\]|\\\\|$q_bracket)*?) (\]) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q [ ]
3705 elsif (/\G (\[) /oxgc) { # q [ ]
3706 0 my $q_string = '';
3707 0 local $nest = 1;
3708 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3709 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 ($Etis620::q_char) /cgox) { } 0 0 0
3710 0 elsif (/\G (\\\]) /oxgc) { $q_string .= $1; }
3711 0 elsif (/\G (\\\[) /oxgc) { $q_string .= $1; }
3712 0 elsif (/\G (\[) /oxgc) { $q_string .= $1; $nest++; }
3713 elsif (/\G (\]) /oxgc) {
3714 0 ▶ if (--$nest == 0) { return $e . e_q($ope,'[',']',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Etis620::nest == 0) { } 0 0 0
3715 0 else { $q_string .= $1; }
3716 }
3717 0 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3718 }
3719 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3720 }
3721  
3722 # elsif (/\G (\<) ((?:\\\>|\\\\|$q_angle)*?) (\>) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q < >
3723 elsif (/\G (\<) /oxgc) { # q < >
3724 5 my $q_string = '';
3725 5 local $nest = 1;
3726 5 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 88 0 88
3727 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 ($Etis620::q_char) /cgox) { } 83 0 83
3728 0 elsif (/\G (\\\>) /oxgc) { $q_string .= $1; }
3729 0 elsif (/\G (\\\<) /oxgc) { $q_string .= $1; }
3730 0 elsif (/\G (\<) /oxgc) { $q_string .= $1; $nest++; }
3731 elsif (/\G (\>) /oxgc) {
3732 5 ▶ if (--$nest == 0) { return $e . e_q($ope,'<','>',$q_string); }
Branch: 1 branch
BranchTrueFalseTotal
if (--$Etis620::nest == 0) { } 5 0 5
3733 0 else { $q_string .= $1; }
3734 }
3735 83 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3736 }
3737 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3738 }
3739  
3740 # elsif (/\G (\S) ((?:\\\1|\\\\|$q_char)*?) (\1) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q * *
3741 elsif (/\G (\S) /oxgc) { # q * *
3742 1 my $delimiter = $1;
3743 1 my $q_string = '';
3744 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 14 0 14
3745 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 ($Etis620::q_char) /cgox) { } 13 0 13
3746 0 elsif (/\G (\\\Q$delimiter\E) /oxgc) { $q_string .= $1; }
3747 1 elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_q($ope,$delimiter,$delimiter,$q_string); }
3748 13 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3749 }
3750 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3751 }
3752 }
3753 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3754 }
3755 }
3756  
3757 # m//
3758 elsif (/\G \b (m) \b /oxgc) {
3759 209 my $ope = $1;
3760 209 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { # m# #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Etis620::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
3761 0 return e_qr($ope,$1,$3,$2,$4);
3762 }
3763 else {
3764 209 my $e = '';
3765 209 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 209 0 209
3766 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 (\?) ((?:$Etis620::qq_char)*?) (\?) ([cgimosxpadlunbB]*) /cgox) { } 0 209 209
elsif (/\G (\') ((?:$Etis620::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 10 199 209
elsif (/\G ([*\-:\\^|]) ((?:$Etis620::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 199 199
elsif (/\G (\S) ((?:$Etis620::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 199 0 199
3767 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ( )
3768 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m { }
3769 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m [ ]
3770 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m < >
3771 0 elsif (/\G (\?) ((?:$qq_char)*?) (\?) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ? ?
3772 10 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # m ' '
3773 0 elsif (/\G ([*\-:\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # m | | --> m { }
3774 199 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m * *
3775 }
3776 0 die __FILE__, ": Search pattern not terminated\n";
3777 }
3778 }
3779  
3780 # s///
3781  
3782 # about [cegimosxpradlunbB]* (/cg modifier)
3783 #
3784 # P.67 Pattern-Matching Operators
3785 # of ISBN 0-596-00241-6 Perl in a Nutshell, Second Edition.
3786  
3787 elsif (/\G \b (s) \b /oxgc) {
3788 101 my $ope = $1;
3789  
3790 # $1 $2 $3 $4 $5 $6
3791 101 ▶ if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cegimosxpradlunbB]*) /oxgc) { # s# # #
Branch: 1 branch
BranchTrueFalseTotal
if (/\G (\#) ((?:$Etis620::qq_char)*?) (\#) ((?:$Etis620::qq_char)*?) (\#) ([cegimosxpradlunbB]*) /cgox) { } 1 100 101
3792 1 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3793 }
3794 else {
3795 100 my $e = '';
3796 100 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 100 0 100
3797 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 (\') ((?:$Etis620::qq_char)*?) (\') ((?:$Etis620::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 21 79 100
elsif (/\G ([*\-:?\\^|]) ((?:$Etis620::qq_char)*?) (\1) ((?:$Etis620::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\$) ((?:$Etis620::qq_char)*?) (\1) ((?:$Etis620::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 79 79
elsif (/\G (\S) ((?:$Etis620::qq_char)*?) (\1) ((?:$Etis620::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 79 0 79
3798 elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) {
3799 0 my @s = ($1,$2,$3);
3800 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3801 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 (\') ((?:$Etis620::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Etis620::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Etis620::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Etis620::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Etis620::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3802 # $1 $2 $3 $4
3803 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3804 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3805 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3806 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3807 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3808 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3809 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3810 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3811 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3812 }
3813 0 die __FILE__, ": Substitution replacement not terminated\n";
3814 }
3815 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) {
3816 0 my @s = ($1,$2,$3);
3817 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3818 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 (\') ((?:$Etis620::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Etis620::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Etis620::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Etis620::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Etis620::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3819 # $1 $2 $3 $4
3820 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3821 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3822 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3823 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3824 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3825 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3826 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3827 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3828 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3829 }
3830 0 die __FILE__, ": Substitution replacement not terminated\n";
3831 }
3832 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) {
3833 0 my @s = ($1,$2,$3);
3834 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3835 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 (\') ((?:$Etis620::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Etis620::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Etis620::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3836 # $1 $2 $3 $4
3837 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3838 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3839 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3840 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3841 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3842 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3843 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3844 }
3845 0 die __FILE__, ": Substitution replacement not terminated\n";
3846 }
3847 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) {
3848 0 my @s = ($1,$2,$3);
3849 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3850 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 (\') ((?:$Etis620::qq_char)*?) (\') ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\$) ((?:$Etis620::qq_char)*?) (\$) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\:) ((?:$Etis620::qq_char)*?) (\:) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\@) ((?:$Etis620::qq_char)*?) (\@) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
elsif (/\G (\S) ((?:$Etis620::qq_char)*?) (\1) ([cegimosxpradlunbB]*) /cgox) { } 0 0 0
3851 # $1 $2 $3 $4
3852 0 elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3853 0 elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3854 0 elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3855 0 elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3856 0 elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3857 0 elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3858 0 elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3859 0 elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3860 0 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); }
3861 }
3862 0 die __FILE__, ": Substitution replacement not terminated\n";
3863 }
3864 # $1 $2 $3 $4 $5 $6
3865 elsif (/\G (\') ((?:$qq_char)*?) (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) {
3866 21 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3867 }
3868 # $1 $2 $3 $4 $5 $6
3869 elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3870 0 return e_sub($sub_variable,'{',$2,'}','{',$4,'}',$6); # s | | | --> s { } { }
3871 }
3872 # $1 $2 $3 $4 $5 $6
3873 elsif (/\G (\$) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3874 0 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3875 }
3876 # $1 $2 $3 $4 $5 $6
3877 elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) {
3878 79 return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6);
3879 }
3880 }
3881 0 die __FILE__, ": Substitution pattern not terminated\n";
3882 }
3883 }
3884  
3885 # require ignore module
3886 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# require$1$2"; }
3887 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# require$1\n$2"; }
3888 0 elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# require$1"; }
3889  
3890 # use strict; --> use strict; no strict qw(refs);
3891 37 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "use$1 no strict qw(refs);$2"; }
3892 0 elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^#]) /oxmsgc) { return "use$1 no strict qw(refs);\n$2"; }
3893 0 elsif (/\G \b use ((?>\s+) strict) \b /oxmsgc) { return "use$1; no strict qw(refs)"; }
3894  
3895 # use 5.12.0; --> use 5.12.0; no strict qw(refs);
3896 elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
3897 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
3898 0 return "use $1; no strict qw(refs);";
3899 }
3900 else {
3901 2 return "use $1;";
3902 }
3903 }
3904 elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) {
3905 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
3906 0 return "use $1; no strict qw(refs);";
3907 }
3908 else {
3909 0 return "use $1;";
3910 }
3911 }
3912  
3913 # ignore use module
3914 2 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# use$1$2"; }
3915 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# use$1\n$2"; }
3916 0 elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# use$1"; }
3917  
3918 # ignore no module
3919 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# no$1$2"; }
3920 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^#]) /oxmsgc) { return "# no$1\n$2"; }
3921 0 elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# no$1"; }
3922  
3923 # use else
3924 0 elsif (/\G \b use \b /oxmsgc) { return "use"; }
3925  
3926 # use else
3927 2 elsif (/\G \b no \b /oxmsgc) { return "no"; }
3928  
3929 # ''
3930 elsif (/\G (?<![\w\$\@\%\&\*]) (\') /oxgc) {
3931 922 my $q_string = '';
3932 922 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 11755 0 11755
3933 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 ($Etis620::q_char) /cgox) { } 10817 0 10817
3934 12 elsif (/\G (\\\') /oxgc) { $q_string .= $1; }
3935 922 elsif (/\G \' /oxgc) { return e_q('', "'","'",$q_string); }
3936 10817 elsif (/\G ($q_char) /oxgc) { $q_string .= $1; }
3937 }
3938 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3939 }
3940  
3941 # ""
3942 elsif (/\G (\") /oxgc) {
3943 1643 my $qq_string = '';
3944 1643 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 39093 0 39093
3945 39093 ▶ if (/\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if (/\G (\\\\) /cgox) { } 67 39026 39093
elsif (/\G (\\\") /cgox) { } 12 39014 39026
elsif (/\G \" /cgox) { } 1643 37371 39014
elsif (/\G ($Etis620::q_char) /cgox) { } 37371 0 37371
3946 12 elsif (/\G (\\\") /oxgc) { $qq_string .= $1; }
3947 1643 elsif (/\G \" /oxgc) { return e_qq('', '"','"',$qq_string); }
3948 37371 elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; }
3949 }
3950 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3951 }
3952  
3953 # ``
3954 elsif (/\G (\`) /oxgc) {
3955 1 my $qx_string = '';
3956 1 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 19 0 19
3957 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 ($Etis620::q_char) /cgox) { } 18 0 18
3958 0 elsif (/\G (\\\`) /oxgc) { $qx_string .= $1; }
3959 1 elsif (/\G \` /oxgc) { return e_qq('', '`','`',$qx_string); }
3960 18 elsif (/\G ($q_char) /oxgc) { $qx_string .= $1; }
3961 }
3962 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
3963 }
3964  
3965 # // --- not divide operator (num / num), not defined-or
3966 ▶ elsif (($slash eq 'm//') and /\G (\/) /oxgc) {
Condition100%3/3
$Etis620::slash eq "m//" and m[\G (/) ]cgox
!ll&&!rl&&r
303699690425
MC/DC100%2/2
$Etis620::slash eq "m//" and m[\G (/) ]cgox
$Etis620::slash eq "m//" m[\G (/) ]cgox
Truth table100%3/3
A and B
A= $Etis620::slash eq "m//"B= m[\G (/) ]cgox
ABresult
0X0
100
111
3967 425 my $regexp = '';
3968 425 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 4222 0 4222
3969 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 ($Etis620::q_char) /cgox) { } 3797 0 3797
3970 0 elsif (/\G (\\\/) /oxgc) { $regexp .= $1; }
3971 425 elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_qr('', '/','/',$regexp,$1); }
3972 3797 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3973 }
3974 0 die __FILE__, ": Search pattern not terminated\n";
3975 }
3976  
3977 # ?? --- not conditional operator (condition ? then : else)
3978 ▶ elsif (($slash eq 'm//') and /\G (\?) /oxgc) {
Condition66%2/3
$Etis620::slash eq "m//" and /\G (\?) /cgox
!ll&&!rl&&r
3036996900
MC/DC0%0/2
$Etis620::slash eq "m//" and /\G (\?) /cgox
$Etis620::slash eq "m//" /\G (\?) /cgox
Truth table66%2/3
A and B
A= $Etis620::slash eq "m//"B= /\G (\?) /cgox
ABresult
0X0
100
111
3979 0 my $regexp = '';
3980 0 ▶ while (not /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/\G \z/cgox) 0 0 0
3981 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 ($Etis620::q_char) /cgox) { } 0 0 0
3982 0 elsif (/\G (\\\?) /oxgc) { $regexp .= $1; }
3983 0 elsif (/\G \? ([cgimosxpadlunbB]*) /oxgc) { return e_qr('m','?','?',$regexp,$1); }
3984 0 elsif (/\G ($q_char) /oxgc) { $regexp .= $1; }
3985 }
3986 0 die __FILE__, ": Search pattern not terminated\n";
3987 }
3988  
3989 # <<>> (a safer ARGV)
3990 0 elsif (/\G ( <<>> ) /oxgc) { $slash = 'm//'; return $1; }
3991  
3992 # << (bit shift) --- not here document
3993 0 elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) { $slash = 'm//'; return $1; }
3994  
3995 # <<~'HEREDOC'
3996 elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
3997 6 $slash = 'm//';
3998 6 my $here_quote = $1;
3999 6 my $delimiter = $2;
4000  
4001 # get here document
4002 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4003 6 $here_script = CORE::substr $_, pos $_;
4004 6 $here_script =~ s/.*?\n//oxm;
4005 }
4006 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
4007 6 my $heredoc = $1;
4008 6 my $indent = $2;
4009 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4010 6 push @heredoc, $heredoc . qq{\n$delimiter\n};
4011 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4012 }
4013 else {
4014 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4015 }
4016 6 return qq{<<'$delimiter'};
4017 }
4018  
4019 # <<~\HEREDOC
4020  
4021 # P.66 2.6.6. "Here" Documents
4022 # in Chapter 2: Bits and Pieces
4023 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4024  
4025 # P.73 "Here" Documents
4026 # in Chapter 2: Bits and Pieces
4027 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4028  
4029 elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4030 3 $slash = 'm//';
4031 3 my $here_quote = $1;
4032 3 my $delimiter = $2;
4033  
4034 # get here document
4035 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4036 3 $here_script = CORE::substr $_, pos $_;
4037 3 $here_script =~ s/.*?\n//oxm;
4038 }
4039 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
4040 3 my $heredoc = $1;
4041 3 my $indent = $2;
4042 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4043 3 push @heredoc, $heredoc . qq{\n$delimiter\n};
4044 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4045 }
4046 else {
4047 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4048 }
4049 3 return qq{<<\\$delimiter};
4050 }
4051  
4052 # <<~"HEREDOC"
4053 elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4054 6 $slash = 'm//';
4055 6 my $here_quote = $1;
4056 6 my $delimiter = $2;
4057  
4058 # get here document
4059 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4060 6 $here_script = CORE::substr $_, pos $_;
4061 6 $here_script =~ s/.*?\n//oxm;
4062 }
4063 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
4064 6 my $heredoc = $1;
4065 6 my $indent = $2;
4066 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4067 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4068 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4069 }
4070 else {
4071 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4072 }
4073 6 return qq{<<"$delimiter"};
4074 }
4075  
4076 # <<~HEREDOC
4077 elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4078 3 $slash = 'm//';
4079 3 my $here_quote = $1;
4080 3 my $delimiter = $2;
4081  
4082 # get here document
4083 3 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 3 0 3
4084 3 $here_script = CORE::substr $_, pos $_;
4085 3 $here_script =~ s/.*?\n//oxm;
4086 }
4087 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
4088 3 my $heredoc = $1;
4089 3 my $indent = $2;
4090 3 $heredoc =~ s{^$indent}{}msg; # no /ox
4091 3 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4092 3 push @heredoc_delimiter, qq{\\s*$delimiter};
4093 }
4094 else {
4095 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4096 }
4097 3 return qq{<<$delimiter};
4098 }
4099  
4100 # <<~`HEREDOC`
4101 elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4102 6 $slash = 'm//';
4103 6 my $here_quote = $1;
4104 6 my $delimiter = $2;
4105  
4106 # get here document
4107 6 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 6 0 6
4108 6 $here_script = CORE::substr $_, pos $_;
4109 6 $here_script =~ s/.*?\n//oxm;
4110 }
4111 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
4112 6 my $heredoc = $1;
4113 6 my $indent = $2;
4114 6 $heredoc =~ s{^$indent}{}msg; # no /ox
4115 6 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4116 6 push @heredoc_delimiter, qq{\\s*$delimiter};
4117 }
4118 else {
4119 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4120 }
4121 6 return qq{<<`$delimiter`};
4122 }
4123  
4124 # <<'HEREDOC'
4125 elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
4126 72 $slash = 'm//';
4127 72 my $here_quote = $1;
4128 72 my $delimiter = $2;
4129  
4130 # get here document
4131 72 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 72 0 72
4132 72 $here_script = CORE::substr $_, pos $_;
4133 72 $here_script =~ s/.*?\n//oxm;
4134 }
4135 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
4136 72 push @heredoc, $1 . qq{\n$delimiter\n};
4137 72 push @heredoc_delimiter, $delimiter;
4138 }
4139 else {
4140 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4141 }
4142 72 return $here_quote;
4143 }
4144  
4145 # <<\HEREDOC
4146  
4147 # P.66 2.6.6. "Here" Documents
4148 # in Chapter 2: Bits and Pieces
4149 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4150  
4151 # P.73 "Here" Documents
4152 # in Chapter 2: Bits and Pieces
4153 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4154  
4155 elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
4156 0 $slash = 'm//';
4157 0 my $here_quote = $1;
4158 0 my $delimiter = $2;
4159  
4160 # get here document
4161 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4162 0 $here_script = CORE::substr $_, pos $_;
4163 0 $here_script =~ s/.*?\n//oxm;
4164 }
4165 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
4166 0 push @heredoc, $1 . qq{\n$delimiter\n};
4167 0 push @heredoc_delimiter, $delimiter;
4168 }
4169 else {
4170 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4171 }
4172 0 return $here_quote;
4173 }
4174  
4175 # <<"HEREDOC"
4176 elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
4177 36 $slash = 'm//';
4178 36 my $here_quote = $1;
4179 36 my $delimiter = $2;
4180  
4181 # get here document
4182 36 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 36 0 36
4183 36 $here_script = CORE::substr $_, pos $_;
4184 36 $here_script =~ s/.*?\n//oxm;
4185 }
4186 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
4187 36 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4188 36 push @heredoc_delimiter, $delimiter;
4189 }
4190 else {
4191 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4192 }
4193 36 return $here_quote;
4194 }
4195  
4196 # <<HEREDOC
4197 elsif (/\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
4198 42 $slash = 'm//';
4199 42 my $here_quote = $1;
4200 42 my $delimiter = $2;
4201  
4202 # get here document
4203 42 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 42 0 42
4204 42 $here_script = CORE::substr $_, pos $_;
4205 42 $here_script =~ s/.*?\n//oxm;
4206 }
4207 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
4208 42 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4209 42 push @heredoc_delimiter, $delimiter;
4210 }
4211 else {
4212 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4213 }
4214 42 return $here_quote;
4215 }
4216  
4217 # <<`HEREDOC`
4218 elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
4219 0 $slash = 'm//';
4220 0 my $here_quote = $1;
4221 0 my $delimiter = $2;
4222  
4223 # get here document
4224 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4225 0 $here_script = CORE::substr $_, pos $_;
4226 0 $here_script =~ s/.*?\n//oxm;
4227 }
4228 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
4229 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4230 0 push @heredoc_delimiter, $delimiter;
4231 }
4232 else {
4233 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4234 }
4235 0 return $here_quote;
4236 }
4237  
4238 # <<= <=> <= < operator
4239 elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) {
4240 12 return $1;
4241 }
4242  
4243 # <FILEHANDLE>
4244 elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) {
4245 0 return $1;
4246 }
4247  
4248 # <WILDCARD> --- glob
4249  
4250 # avoid "Error: Runtime exception" of perl version 5.005_03
4251  
4252 elsif (/\G < ((?:[^>\0\a\e\f\n\r\t])+?) > /oxgc) {
4253 0 return 'Etis620::glob("' . $1 . '")';
4254 }
4255  
4256 # __DATA__
4257 0 elsif (/\G ^ ( __DATA__ \n .*) \z /oxmsgc) { return $1; }
4258  
4259 # __END__
4260 210 elsif (/\G ^ ( __END__ \n .*) \z /oxmsgc) { return $1; }
4261  
4262 # \cD Control-D
4263  
4264 # P.68 2.6.8. Other Literal Tokens
4265 # in Chapter 2: Bits and Pieces
4266 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
4267  
4268 # P.76 Other Literal Tokens
4269 # in Chapter 2: Bits and Pieces
4270 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4271  
4272 0 elsif (/\G ( \cD .*) \z /oxmsgc) { return $1; }
4273  
4274 # \cZ Control-Z
4275 0 elsif (/\G ( \cZ .*) \z /oxmsgc) { return $1; }
4276  
4277 # any operator before div
4278 elsif (/\G (
4279 -- | \+\+ |
4280 [\)\}\]]
4281  
4282 6001 ) /oxgc) { $slash = 'div'; return $1; }
4283  
4284 # yada-yada or triple-dot operator
4285 elsif (/\G (
4286 \.\.\.
4287  
4288 7 ) /oxgc) { $slash = 'm//'; return q{die('Unimplemented')}; }
4289  
4290 # any operator before m//
4291  
4292 # //, //= (defined-or)
4293  
4294 # P.164 Logical Operators
4295 # in Chapter 10: More Control Structures
4296 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4297  
4298 # P.119 C-Style Logical (Short-Circuit) Operators
4299 # in Chapter 3: Unary and Binary Operators
4300 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4301  
4302 # (and so on)
4303  
4304 # ~~
4305  
4306 # P.221 The Smart Match Operator
4307 # in Chapter 15: Smart Matching and given-when
4308 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
4309  
4310 # P.112 Smartmatch Operator
4311 # in Chapter 3: Unary and Binary Operators
4312 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
4313  
4314 # (and so on)
4315  
4316 elsif (/\G ((?>
4317  
4318 !~~ | !~ | != | ! |
4319 %= | % |
4320 &&= | && | &= | &\.= | &\. | & |
4321 -= | -> | - |
4322 :(?>\s*)= |
4323 : |
4324 <<>> |
4325 <<= | <=> | <= | < |
4326 == | => | =~ | = |
4327 >>= | >> | >= | > |
4328 \*\*= | \*\* | \*= | \* |
4329 \+= | \+ |
4330 \.\. | \.= | \. |
4331 \/\/= | \/\/ |
4332 \/= | \/ |
4333 \? |
4334 \\ |
4335 \^= | \^\.= | \^\. | \^ |
4336 \b x= |
4337 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
4338 ~~ | ~\. | ~ |
4339 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
4340 \b(?: print )\b |
4341  
4342 [,;\(\{\[]
4343  
4344 10260 )) /oxgc) { $slash = 'm//'; return $1; }
4345  
4346 # other any character
4347 23395 elsif (/\G ($q_char) /oxgc) { $slash = 'div'; return $1; }
4348  
4349 # system error
4350 else {
4351 0 die __FILE__, ": Oops, this shouldn't happen!\n";
4352 }
4353 }
4354  
4355 # escape TIS-620 string
4356 1852 ▶sub e_string {
Subroutine e_string: called CC=228 SCAR=104.2
Pod documented
4357 1852 my($string) = @_;
4358 1852 my $e_string = '';
4359  
4360 1852 local $slash = 'm//';
4361  
4362 # P.1024 Appendix W.10 Multibyte Processing
4363 # of ISBN 1-56592-224-7 CJKV Information Processing
4364 # (and so on)
4365  
4366 1852 my @char = $string =~ / \G (?>[^\\]|\\$q_char|$q_char) /oxmsg;
4367  
4368 # without { ... }
4369 1852 ▶ 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 16 1852
Condition66%2/3
grep /\A \{ \z/msx, @char and grep /\A \} \z/msx, @char
!ll&&!rl&&r
1836016
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
4370 1836 ▶ if ($string !~ /<</oxms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /<</mosx) 1836 0 1836
4371 1836 return $string;
4372 }
4373 }
4374  
4375 E_STRING_LOOP:
4376 16 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 185 16 201
4377 185 ▶ if (0) {
Branch: 101 branches
BranchTrueFalseTotal
if (do { $string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /cgmosx }) { } 0 185 185
elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /cgmosx) { } 0 185 185
elsif ($string =~ /\G ( \$' | \$\{'\} ) /cgmosx) { } 0 185 185
elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /cgmosx) { } 0 185 185
elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /cgmosx) { } 0 185 185
elsif ($string =~ /\G ( \$ 0 ) /cgmosx) { } 0 185 185
elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /cgmosx) { } 0 185 185
elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /cgmosx) { } 0 185 185
elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /cgmosx) { } 0 185 185
elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /cgmosx) { } 0 185 185
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /cgmosx) { } 0 185 185
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /cgmosx) { } 0 185 185
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /cgmosx) { } 0 185 185
elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /cgmosx) { } 0 185 185
elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /cgmosx) { } 3 182 185
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 176 182
elsif ($string =~ m{\G ( \$[\$\@\#\\\'\"/\?\(\)\[\]\<\>] ) }cgmosx) { } 0 176 176
elsif ($string =~ /\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b Char::eval (?= (?>\s*) \{ ) /cgox) { } 0 176 176
elsif ($string =~ /\G \b TIS620::eval (?= (?>\s*) \{ ) /cgox) { } 0 176 176
elsif ($string =~ /\G \b Char::eval \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b TIS620::eval \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b bytes::substr \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b chop \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b bytes::index \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b Char::index \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b TIS620::index \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b index \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b bytes::rindex \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b Char::rindex \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b TIS620::rindex \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b rindex \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 176 176
elsif ($string =~ /\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 176 176
elsif ($string =~ /\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 176 176
elsif ($string =~ /\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 176 176
elsif ($string =~ /\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 176 176
elsif ($string =~ /\G -s (?>\s*) (\") ((?:$Etis620::qq_char)+?) (\") /cgox) { } 0 176 176
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\#) ((?:$Etis620::qq_char)+?) (\#) /cgox) { } 0 176 176
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /cgox) { } 0 176 176
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /cgox) { } 0 176 176
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /cgox) { } 0 176 176
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /cgox) { } 0 176 176
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\S) ((?:$Etis620::qq_char)+?) (\1) /cgox) { } 0 176 176
elsif ($string =~ /\G -s (?>\s*) (\') ((?:\\\'|\\\\|$Etis620::q_char)+?) (\') /cgox) { } 0 176 176
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$Etis620::q_char)+?) (\#) /cgox) { } 0 176 176
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /cgox) { } 0 176 176
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /cgox) { } 0 176 176
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /cgox) { } 0 176 176
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /cgox) { } 0 176 176
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$Etis620::q_char)+?) (\1) /cgox) { } 0 176 176
elsif ($string =~ /\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)*) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ))*) /cgox) { } 0 176 176
elsif ($string =~ /\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /cgox) { } 0 176 176
elsif ($string =~ /\G -s (?= (?>\s+) [a-z]+) /cgox) { } 0 176 176
elsif ($string =~ /\G -s (?>\s+) ((?>\w+)) /cgox) { } 0 176 176
elsif ($string =~ /\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 176 176
elsif ($string =~ /\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 176 176
elsif ($string =~ /\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 176 176
elsif ($string =~ /\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 176 176
elsif ($string =~ /\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 176 176
elsif ($string =~ /\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /cgox) { } 0 176 176
elsif ($string =~ /\G \b lc \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b lcfirst \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b uc \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b ucfirst \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b fc \b /cgox) { } 0 176 176
elsif ($string =~ /\G -s \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b bytes::length \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b bytes::chr \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b chr \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b bytes::ord \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b ord \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b glob \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b reverse \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b getc \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b (split) \b (?! (?>\s*) => ) /cgox) { } 0 176 176
elsif ($string =~ /\G \b (qq) \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b (qx) \b /cgox) { } 0 176 176
elsif ($string =~ /\G \b (q) \b /cgox) { } 0 176 176
elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$Etis620::q_char)*?) (\') /cgox) { } 0 176 176
elsif ($string =~ /\G (\") ((?:$Etis620::qq_char)*?) (\") /cgox) { } 0 176 176
elsif ($string =~ /\G (\`) ((?:$Etis620::qq_char)*?) (\`) /cgox) { } 0 176 176
elsif ($string =~ /\G ( <<>> ) /cgox) { } 0 176 176
elsif ($string =~ /\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/cgox) { } 0 176 176
elsif ($string =~ /\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /cgox) { } 0 176 176
elsif ($string =~ /\G < ((?:$Etis620::q_char)+?) > /cgox) { } 0 176 176
elsif ($string =~ /\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /cgox) { } 0 176 176
elsif ($string =~ /\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /cgox) { } 0 176 176
elsif ($string =~ /\G ( <<~ \\([a-zA-Z_0-9]+) ) /cgox) { } 0 176 176
elsif ($string =~ /\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /cgox) { } 0 176 176
elsif ($string =~ /\G ( <<~ ([a-zA-Z_0-9]+) ) /cgox) { } 0 176 176
elsif ($string =~ /\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /cgox) { } 0 176 176
elsif ($string =~ /\G ( << '([a-zA-Z_0-9]*)' ) /cgox) { } 0 176 176
elsif ($string =~ /\G ( << \\([a-zA-Z_0-9]+) ) /cgox) { } 0 176 176
elsif ($string =~ /\G ( << "([a-zA-Z_0-9]*)" ) /cgox) { } 0 176 176
elsif ($string =~ /\G ( << ([a-zA-Z_0-9]+) ) /cgox) { } 0 176 176
elsif ($string =~ /\G ( << `([a-zA-Z_0-9]*)` ) /cgox) { } 0 176 176
elsif ($string =~ /\G ( -- | \+\+ | [\)\}\]] ) /cgox) { } 17 159 176
elsif ($string =~ /\G ( \.\.\. ) /cgox) { } 0 159 159
elsif ($string =~ m"\G ((?> !~~ | !~ | != | ! | %= | % | &&= | && | &= | &\.= | &\. | & | -= | -> | - | :(?>\s*)= | : | <<>> | <<= | <=> | <= | < | == | => | =~ | = | >>= | >> | >= | > | \*\*= | \*\* | \*= | \* | \+= | \+ | \.\. | \.= | \. | //= | // | /= | / | \? | \\ | \^= | \^\.= | \^\. | \^ | \b x= | \|\|= | \|\| | \|= | \|\.= | \|\. | \| | ~~ | ~\. | ~ | \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | \b(?: print )\b | [,;\(\{\[] )) "cgox) { } 30 129 159
elsif ($string =~ /\G ($Etis620::q_char) /cgox) { } 129 0 129
4378 }
4379  
4380 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> @{[Etis620::PREMATCH()]}
4381 elsif ($string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) {
4382 0 $e_string .= q{Etis620::PREMATCH()};
4383 0 $slash = 'div';
4384 }
4385  
4386 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> @{[Etis620::MATCH()]}
4387 elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) {
4388 0 $e_string .= q{Etis620::MATCH()};
4389 0 $slash = 'div';
4390 }
4391  
4392 # $', ${'} --> $', ${'}
4393 elsif ($string =~ /\G ( \$' | \$\{'\} ) /oxmsgc) {
4394 0 $e_string .= $1;
4395 0 $slash = 'div';
4396 }
4397  
4398 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> @{[Etis620::POSTMATCH()]}
4399 elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) {
4400 0 $e_string .= q{Etis620::POSTMATCH()};
4401 0 $slash = 'div';
4402 }
4403  
4404 # bareword
4405 elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) {
4406 0 $e_string .= $1;
4407 0 $slash = 'div';
4408 }
4409  
4410 # $0 --> $0
4411 elsif ($string =~ /\G ( \$ 0 ) /oxmsgc) {
4412 0 $e_string .= $1;
4413 0 $slash = 'div';
4414 }
4415 elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) {
4416 0 $e_string .= $1;
4417 0 $slash = 'div';
4418 }
4419  
4420 # $$ --> $$
4421 elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /oxmsgc) {
4422 0 $e_string .= $1;
4423 0 $slash = 'div';
4424 }
4425  
4426 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
4427 # $1, $2, $3 --> $1, $2, $3 otherwise
4428 elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /oxmsgc) {
4429 0 $e_string .= e_capture($1);
4430 0 $slash = 'div';
4431 }
4432 elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) {
4433 0 $e_string .= e_capture($1);
4434 0 $slash = 'div';
4435 }
4436  
4437 # $$foo[ ... ] --> $ $foo->[ ... ]
4438 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) {
4439 0 $e_string .= e_capture($1.'->'.$2);
4440 0 $slash = 'div';
4441 }
4442  
4443 # $$foo{ ... } --> $ $foo->{ ... }
4444 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) {
4445 0 $e_string .= e_capture($1.'->'.$2);
4446 0 $slash = 'div';
4447 }
4448  
4449 # $$foo
4450 elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) {
4451 0 $e_string .= e_capture($1);
4452 0 $slash = 'div';
4453 }
4454  
4455 # ${ foo }
4456 elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /oxmsgc) {
4457 0 $e_string .= '${' . $1 . '}';
4458 0 $slash = 'div';
4459 }
4460  
4461 # ${ ... }
4462 elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) {
4463 3 $e_string .= e_capture($1);
4464 3 $slash = 'div';
4465 }
4466  
4467 # variable or function
4468 # $ @ % & * $ #
4469 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) {
4470 6 $e_string .= $1;
4471 6 $slash = 'div';
4472 }
4473 # $ $ $ $ $ $ $ $ $ $ $ $ $ $
4474 # $ @ # \ ' " / ? ( ) [ ] < >
4475 elsif ($string =~ /\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) {
4476 0 $e_string .= $1;
4477 0 $slash = 'div';
4478 }
4479  
4480 # subroutines of package Etis620
4481 0 elsif ($string =~ /\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $e_string .= $1; $slash = 'm//'; }
4482 0 elsif ($string =~ /\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; }
4483 0 elsif ($string =~ /\G \b TIS620::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; }
4484 0 elsif ($string =~ /\G \b Char::eval \b /oxgc) { $e_string .= 'eval Char::escape'; $slash = 'm//'; }
4485 0 elsif ($string =~ /\G \b TIS620::eval \b /oxgc) { $e_string .= 'eval TIS620::escape'; $slash = 'm//'; }
4486 0 elsif ($string =~ /\G \b bytes::substr \b /oxgc) { $e_string .= 'substr'; $slash = 'm//'; }
4487 0 elsif ($string =~ /\G \b chop \b /oxgc) { $e_string .= 'Etis620::chop'; $slash = 'm//'; }
4488 0 elsif ($string =~ /\G \b bytes::index \b /oxgc) { $e_string .= 'index'; $slash = 'm//'; }
4489 0 elsif ($string =~ /\G \b Char::index \b /oxgc) { $e_string .= 'Char::index'; $slash = 'm//'; }
4490 0 elsif ($string =~ /\G \b TIS620::index \b /oxgc) { $e_string .= 'TIS620::index'; $slash = 'm//'; }
4491 0 elsif ($string =~ /\G \b index \b /oxgc) { $e_string .= 'Etis620::index'; $slash = 'm//'; }
4492 0 elsif ($string =~ /\G \b bytes::rindex \b /oxgc) { $e_string .= 'rindex'; $slash = 'm//'; }
4493 0 elsif ($string =~ /\G \b Char::rindex \b /oxgc) { $e_string .= 'Char::rindex'; $slash = 'm//'; }
4494 0 elsif ($string =~ /\G \b TIS620::rindex \b /oxgc) { $e_string .= 'TIS620::rindex'; $slash = 'm//'; }
4495 0 elsif ($string =~ /\G \b rindex \b /oxgc) { $e_string .= 'Etis620::rindex'; $slash = 'm//'; }
4496 0 elsif ($string =~ /\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Etis620::lc'; $slash = 'm//'; }
4497 0 elsif ($string =~ /\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Etis620::lcfirst'; $slash = 'm//'; }
4498 0 elsif ($string =~ /\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Etis620::uc'; $slash = 'm//'; }
4499 0 elsif ($string =~ /\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Etis620::ucfirst'; $slash = 'm//'; }
4500 0 elsif ($string =~ /\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Etis620::fc'; $slash = 'm//'; }
4501  
4502 # "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...")
4503 0 elsif ($string =~ /\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $e_string .= '-s ' . e_qq('', $1,$3,$2); $slash = 'm//'; }
4504 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4505 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4506 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4507 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4508 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4509 0 elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; }
4510  
4511 0 elsif ($string =~ /\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $e_string .= '-s ' . e_q ('', $1,$3,$2); $slash = 'm//'; }
4512 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4513 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4514 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4515 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4516 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4517 0 elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; }
4518  
4519 elsif ($string =~ /\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)*) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ))*) /oxgc)
4520 0 { $e_string .= "-s $1"; $slash = 'm//'; }
4521 0 elsif ($string =~ /\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $e_string .= "-s ($1)"; $slash = 'm//'; }
4522 0 elsif ($string =~ /\G -s (?= (?>\s+) [a-z]+) /oxgc) { $e_string .= '-s'; $slash = 'm//'; }
4523 0 elsif ($string =~ /\G -s (?>\s+) ((?>\w+)) /oxgc) { $e_string .= "-s $1"; $slash = 'm//'; }
4524  
4525 0 elsif ($string =~ /\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'length'; $slash = 'm//'; }
4526 0 elsif ($string =~ /\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'chr'; $slash = 'm//'; }
4527 0 elsif ($string =~ /\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Etis620::chr'; $slash = 'm//'; }
4528 0 elsif ($string =~ /\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'ord'; $slash = 'div'; }
4529 0 elsif ($string =~ /\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= $function_ord; $slash = 'div'; }
4530 0 elsif ($string =~ /\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Etis620::glob'; $slash = 'm//'; }
4531 0 elsif ($string =~ /\G \b lc \b /oxgc) { $e_string .= 'Etis620::lc_'; $slash = 'm//'; }
4532 0 elsif ($string =~ /\G \b lcfirst \b /oxgc) { $e_string .= 'Etis620::lcfirst_'; $slash = 'm//'; }
4533 0 elsif ($string =~ /\G \b uc \b /oxgc) { $e_string .= 'Etis620::uc_'; $slash = 'm//'; }
4534 0 elsif ($string =~ /\G \b ucfirst \b /oxgc) { $e_string .= 'Etis620::ucfirst_'; $slash = 'm//'; }
4535 0 elsif ($string =~ /\G \b fc \b /oxgc) { $e_string .= 'Etis620::fc_'; $slash = 'm//'; }
4536 0 elsif ($string =~ /\G -s \b /oxgc) { $e_string .= '-s '; $slash = 'm//'; }
4537  
4538 0 elsif ($string =~ /\G \b bytes::length \b /oxgc) { $e_string .= 'length'; $slash = 'm//'; }
4539 0 elsif ($string =~ /\G \b bytes::chr \b /oxgc) { $e_string .= 'chr'; $slash = 'm//'; }
4540 0 elsif ($string =~ /\G \b chr \b /oxgc) { $e_string .= 'Etis620::chr_'; $slash = 'm//'; }
4541 0 elsif ($string =~ /\G \b bytes::ord \b /oxgc) { $e_string .= 'ord'; $slash = 'div'; }
4542 0 elsif ($string =~ /\G \b ord \b /oxgc) { $e_string .= $function_ord_; $slash = 'div'; }
4543 0 elsif ($string =~ /\G \b glob \b /oxgc) { $e_string .= 'Etis620::glob_'; $slash = 'm//'; }
4544 0 elsif ($string =~ /\G \b reverse \b /oxgc) { $e_string .= $function_reverse; $slash = 'm//'; }
4545 0 elsif ($string =~ /\G \b getc \b /oxgc) { $e_string .= $function_getc; $slash = 'm//'; }
4546 # split
4547 elsif ($string =~ /\G \b (split) \b (?! (?>\s*) => ) /oxgc) {
4548 0 $slash = 'm//';
4549  
4550 0 my $e = '';
4551 0 ▶ while ($string =~ /\G ( (?>\s+) | \( | \#.* ) /oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G ( (?>\s+) | \( | \#.* ) /cgox) 0 0 0
4552 0 $e .= $1;
4553 }
4554  
4555 # end of split
4556 0 ▶ if ($string =~ /\G (?= [,;\)\}\]] ) /oxgc) { return 'Etis620::split' . $e; }
Branch: 23 branches
BranchTrueFalseTotal
if ($string =~ /\G (?= [,;\)\}\]] ) /cgox) { } 0 0 0
elsif ($string =~ /\G ( [\$\@\&\*] $qq_scalar ) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq (\#) [ ] (\#) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\() [ ] (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\{) [ ] (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\[) [ ] (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\<) [ ] (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G \b qq ((?>\s*)) (\S) [ ] (\2) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q (\#) [ ] (\#) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\() [ ] (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\{) [ ] (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\[) [ ] (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\<) [ ] (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G \b q ((?>\s*)) (\S) [ ] (\2) /cgox) { } 0 0 0
elsif ($string =~ /\G ' [ ] ' /cgox) { } 0 0 0
elsif ($string =~ /\G " [ ] " /cgox) { } 0 0 0
elsif ($string =~ /\G \b (qq) \b /cgox) { } 0 0 0
elsif ($string =~ /\G \b (qr) \b /cgox) { } 0 0 0
elsif ($string =~ /\G \b (q) \b /cgox) { } 0 0 0
elsif ($string =~ /\G \b (m) \b /cgox) { } 0 0 0
elsif ($string =~ /\G (\') /cgox) { } 0 0 0
elsif ($string =~ /\G (\") /cgox) { } 0 0 0
elsif ($string =~ m[\G (/) ]cgox) { } 0 0 0
4557  
4558 # split scalar value
4559 0 elsif ($string =~ /\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { $e_string .= 'Etis620::split' . $e . e_string($1); next E_STRING_LOOP; }
4560  
4561 # split literal space
4562 0 elsif ($string =~ /\G \b qq (\#) [ ] (\#) /oxgc) { $e_string .= 'Etis620::split' . $e . qq {qq$1 $2}; next E_STRING_LOOP; }
4563 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Etis620::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4564 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Etis620::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4565 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Etis620::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4566 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Etis620::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4567 0 elsif ($string =~ /\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Etis620::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; }
4568 0 elsif ($string =~ /\G \b q (\#) [ ] (\#) /oxgc) { $e_string .= 'Etis620::split' . $e . qq {q$1 $2}; next E_STRING_LOOP; }
4569 0 elsif ($string =~ /\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Etis620::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4570 0 elsif ($string =~ /\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Etis620::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4571 0 elsif ($string =~ /\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Etis620::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4572 0 elsif ($string =~ /\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Etis620::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4573 0 elsif ($string =~ /\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Etis620::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; }
4574 0 elsif ($string =~ /\G ' [ ] ' /oxgc) { $e_string .= 'Etis620::split' . $e . qq {' '}; next E_STRING_LOOP; }
4575 0 elsif ($string =~ /\G " [ ] " /oxgc) { $e_string .= 'Etis620::split' . $e . qq {" "}; next E_STRING_LOOP; }
4576  
4577 # split qq//
4578 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4579 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Etis620::qq_char)*?) (\#) /cgox) { } 0 0 0
4580 else {
4581 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4582 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 7 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Etis620::qq_char)*?) (\1) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Etis620::qq_char)*?) (\1) /cgox) { } 0 0 0
4583 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq ( ) --> qr ( )
4584 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq { } --> qr { }
4585 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq [ ] --> qr [ ]
4586 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq < > --> qr < >
4587 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # qq | | --> qr { }
4588 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq * * --> qr * *
4589 }
4590 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4591 }
4592 }
4593  
4594 # split qr//
4595 elsif ($string =~ /\G \b (qr) \b /oxgc) {
4596 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1,$3,$2,$4); next E_STRING_LOOP; } # qr# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Etis620::qq_char)*?) (\#) ([imosxpadlunbB]*) /cgox) { } 0 0 0
4597 else {
4598 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4599 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 8 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\') ((?:$Etis620::qq_char)*?) (\') ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Etis620::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Etis620::qq_char)*?) (\1) ([imosxpadlunbB]*) /cgox) { } 0 0 0
4600 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ( )
4601 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr { }
4602 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr [ ]
4603 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr < >
4604 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split_q($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ' '
4605 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # qr | | --> qr { }
4606 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr * *
4607 }
4608 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4609 }
4610 }
4611  
4612 # split q//
4613 elsif ($string =~ /\G \b (q) \b /oxgc) {
4614 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Etis620::q_char)*?) (\#) /cgox) { } 0 0 0
4615 else {
4616 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4617 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 7 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Etis620::q_char)*?) (\1) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $Etis620::q_char)*?) (\1) /cgox) { } 0 0 0
4618 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q ( ) --> qr ( )
4619 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q { } --> qr { }
4620 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q [ ] --> qr [ ]
4621 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q < > --> qr < >
4622 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { $e_string .= e_split_q($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # q | | --> qr { }
4623 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q * * --> qr * *
4624 }
4625 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4626 }
4627 }
4628  
4629 # split m//
4630 elsif ($string =~ /\G \b (m) \b /oxgc) {
4631 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1,$3,$2,$4); next E_STRING_LOOP; } # m# # --> qr # #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Etis620::qq_char)*?) (\#) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
4632 else {
4633 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4634 0 ▶ if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; }
Branch: 8 branches
BranchTrueFalseTotal
if ($string =~ /\G ((?>\s+)|\#.*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\') ((?:$Etis620::qq_char)*?) (\') ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$Etis620::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Etis620::qq_char)*?) (\1) ([cgimosxpadlunbB]*) /cgox) { } 0 0 0
4635 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m ( ) --> qr ( )
4636 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m { } --> qr { }
4637 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m [ ] --> qr [ ]
4638 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m < > --> qr < >
4639 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split_q($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m ' ' --> qr ' '
4640 0 elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # m | | --> qr { }
4641 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m * * --> qr * *
4642 }
4643 0 die __FILE__, ": Search pattern not terminated\n";
4644 }
4645 }
4646  
4647 # split ''
4648 elsif ($string =~ /\G (\') /oxgc) {
4649 0 my $q_string = '';
4650 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4651 0 ▶ if ($string =~ /\G (\\\\) /oxgc) { $q_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if ($string =~ /\G (\\\\) /cgox) { } 0 0 0
elsif ($string =~ /\G (\\\') /cgox) { } 0 0 0
elsif ($string =~ /\G \' /cgox) { } 0 0 0
elsif ($string =~ /\G ($Etis620::q_char) /cgox) { } 0 0 0
4652 0 elsif ($string =~ /\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr''
4653 0 elsif ($string =~ /\G \' /oxgc) { $e_string .= e_split_q($e.q{ qr},"'","'",$q_string,''); next E_STRING_LOOP; } # ' ' --> qr ' '
4654 0 elsif ($string =~ /\G ($q_char) /oxgc) { $q_string .= $1; }
4655 }
4656 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4657 }
4658  
4659 # split ""
4660 elsif ($string =~ /\G (\") /oxgc) {
4661 0 my $qq_string = '';
4662 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4663 0 ▶ if ($string =~ /\G (\\\\) /oxgc) { $qq_string .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if ($string =~ /\G (\\\\) /cgox) { } 0 0 0
elsif ($string =~ /\G (\\\") /cgox) { } 0 0 0
elsif ($string =~ /\G \" /cgox) { } 0 0 0
elsif ($string =~ /\G ($Etis620::q_char) /cgox) { } 0 0 0
4664 0 elsif ($string =~ /\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr""
4665 0 elsif ($string =~ /\G \" /oxgc) { $e_string .= e_split($e.q{ qr},'"','"',$qq_string,''); next E_STRING_LOOP; } # " " --> qr " "
4666 0 elsif ($string =~ /\G ($q_char) /oxgc) { $qq_string .= $1; }
4667 }
4668 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4669 }
4670  
4671 # split //
4672 elsif ($string =~ /\G (\/) /oxgc) {
4673 0 my $regexp = '';
4674 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4675 0 ▶ if ($string =~ /\G (\\\\) /oxgc) { $regexp .= $1; }
Branch: 4 branches
BranchTrueFalseTotal
if ($string =~ /\G (\\\\) /cgox) { } 0 0 0
elsif ($string =~ m[\G (\\/) ]cgox) { } 0 0 0
elsif ($string =~ m[\G / ([cgimosxpadlunbB]*) ]cgox) { } 0 0 0
elsif ($string =~ /\G ($Etis620::q_char) /cgox) { } 0 0 0
4676 0 elsif ($string =~ /\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr//
4677 0 elsif ($string =~ /\G \/ ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split($e.q{ qr}, '/','/',$regexp,$1); next E_STRING_LOOP; } # / / --> qr / /
4678 0 elsif ($string =~ /\G ($q_char) /oxgc) { $regexp .= $1; }
4679 }
4680 0 die __FILE__, ": Search pattern not terminated\n";
4681 }
4682 }
4683  
4684 # qq//
4685 elsif ($string =~ /\G \b (qq) \b /oxgc) {
4686 0 my $ope = $1;
4687 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qq# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Etis620::qq_char)*?) (\#) /cgox) { } 0 0 0
4688 0 $e_string .= e_qq($ope,$1,$3,$2);
4689 }
4690 else {
4691 0 my $e = '';
4692 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4693 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) ((?:$Etis620::qq_char)*?) (\1) /cgox) { } 0 0 0
4694 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq ( )
4695 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq { }
4696 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq [ ]
4697 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq < >
4698 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq * *
4699 }
4700 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4701 }
4702 }
4703  
4704 # qx//
4705 elsif ($string =~ /\G \b (qx) \b /oxgc) {
4706 0 my $ope = $1;
4707 0 ▶ if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:$Etis620::qq_char)*?) (\#) /cgox) { } 0 0 0
4708 0 $e_string .= e_qq($ope,$1,$3,$2);
4709 }
4710 else {
4711 0 my $e = '';
4712 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4713 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 (\') ((?:$Etis620::qq_char)*?) (\') /cgox) { } 0 0 0
elsif ($string =~ /\G (\S) ((?:$Etis620::qq_char)*?) (\1) /cgox) { } 0 0 0
4714 0 elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ( )
4715 0 elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx { }
4716 0 elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx [ ]
4717 0 elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx < >
4718 0 elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') /oxgc) { $e_string .= $e . e_q ($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ' '
4719 0 elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx * *
4720 }
4721 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4722 }
4723 }
4724  
4725 # q//
4726 elsif ($string =~ /\G \b (q) \b /oxgc) {
4727 0 my $ope = $1;
4728 0 ▶ if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { # q# #
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$Etis620::q_char)*?) (\#) /cgox) { } 0 0 0
4729 0 $e_string .= e_q($ope,$1,$3,$2);
4730 }
4731 else {
4732 0 my $e = '';
4733 0 ▶ while ($string !~ /\G \z/oxgc) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($string =~ /\G \z/cgox) 0 0 0
4734 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| $Etis620::q_char)*?) (\1) /cgox) { } 0 0 0
4735 0 elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q ( )
4736 0 elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q { }
4737 0 elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q [ ]
4738 0 elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q < >
4739 0 elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q * *
4740 }
4741 0 die __FILE__, ": Can't find string terminator anywhere before EOF\n";
4742 }
4743 }
4744  
4745 # ''
4746 0 elsif ($string =~ /\G (?<![\w\$\@\%\&\*]) (\') ((?:\\\'|\\\\|$q_char)*?) (\') /oxgc) { $e_string .= e_q('',$1,$3,$2); }
4747  
4748 # ""
4749 0 elsif ($string =~ /\G (\") ((?:$qq_char)*?) (\") /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4750  
4751 # ``
4752 0 elsif ($string =~ /\G (\`) ((?:$qq_char)*?) (\`) /oxgc) { $e_string .= e_qq('',$1,$3,$2); }
4753  
4754 # <<>> (a safer ARGV)
4755 0 elsif ($string =~ /\G ( <<>> ) /oxgc) { $e_string .= $1; }
4756  
4757 # <<= <=> <= < operator
4758 0 elsif ($string =~ /\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) { $e_string .= $1; }
4759  
4760 # <FILEHANDLE>
4761 0 elsif ($string =~ /\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) { $e_string .= $1; }
4762  
4763 # <WILDCARD> --- glob
4764 elsif ($string =~ /\G < ((?:$q_char)+?) > /oxgc) {
4765 0 $e_string .= 'Etis620::glob("' . $1 . '")';
4766 }
4767  
4768 # << (bit shift) --- not here document
4769 elsif ($string =~ /\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) {
4770 0 $slash = 'm//';
4771 0 $e_string .= $1;
4772 }
4773  
4774 # <<~'HEREDOC'
4775 elsif ($string =~ /\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) {
4776 0 $slash = 'm//';
4777 0 my $here_quote = $1;
4778 0 my $delimiter = $2;
4779  
4780 # get here document
4781 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4782 0 $here_script = CORE::substr $_, pos $_;
4783 0 $here_script =~ s/.*?\n//oxm;
4784 }
4785 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4786 0 my $heredoc = $1;
4787 0 my $indent = $2;
4788 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4789 0 push @heredoc, $heredoc . qq{\n$delimiter\n};
4790 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4791 }
4792 else {
4793 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4794 }
4795 0 $e_string .= qq{<<'$delimiter'};
4796 }
4797  
4798 # <<~\HEREDOC
4799 elsif ($string =~ /\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) {
4800 0 $slash = 'm//';
4801 0 my $here_quote = $1;
4802 0 my $delimiter = $2;
4803  
4804 # get here document
4805 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4806 0 $here_script = CORE::substr $_, pos $_;
4807 0 $here_script =~ s/.*?\n//oxm;
4808 }
4809 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4810 0 my $heredoc = $1;
4811 0 my $indent = $2;
4812 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4813 0 push @heredoc, $heredoc . qq{\n$delimiter\n};
4814 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4815 }
4816 else {
4817 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4818 }
4819 0 $e_string .= qq{<<\\$delimiter};
4820 }
4821  
4822 # <<~"HEREDOC"
4823 elsif ($string =~ /\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) {
4824 0 $slash = 'm//';
4825 0 my $here_quote = $1;
4826 0 my $delimiter = $2;
4827  
4828 # get here document
4829 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4830 0 $here_script = CORE::substr $_, pos $_;
4831 0 $here_script =~ s/.*?\n//oxm;
4832 }
4833 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4834 0 my $heredoc = $1;
4835 0 my $indent = $2;
4836 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4837 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4838 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4839 }
4840 else {
4841 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4842 }
4843 0 $e_string .= qq{<<"$delimiter"};
4844 }
4845  
4846 # <<~HEREDOC
4847 elsif ($string =~ /\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) {
4848 0 $slash = 'm//';
4849 0 my $here_quote = $1;
4850 0 my $delimiter = $2;
4851  
4852 # get here document
4853 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4854 0 $here_script = CORE::substr $_, pos $_;
4855 0 $here_script =~ s/.*?\n//oxm;
4856 }
4857 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4858 0 my $heredoc = $1;
4859 0 my $indent = $2;
4860 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4861 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4862 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4863 }
4864 else {
4865 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4866 }
4867 0 $e_string .= qq{<<$delimiter};
4868 }
4869  
4870 # <<~`HEREDOC`
4871 elsif ($string =~ /\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) {
4872 0 $slash = 'm//';
4873 0 my $here_quote = $1;
4874 0 my $delimiter = $2;
4875  
4876 # get here document
4877 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4878 0 $here_script = CORE::substr $_, pos $_;
4879 0 $here_script =~ s/.*?\n//oxm;
4880 }
4881 0 ▶ if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //msx) { } 0 0 0
4882 0 my $heredoc = $1;
4883 0 my $indent = $2;
4884 0 $heredoc =~ s{^$indent}{}msg; # no /ox
4885 0 push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n};
4886 0 push @heredoc_delimiter, qq{\\s*$delimiter};
4887 }
4888 else {
4889 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4890 }
4891 0 $e_string .= qq{<<`$delimiter`};
4892 }
4893  
4894 # <<'HEREDOC'
4895 elsif ($string =~ /\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) {
4896 0 $slash = 'm//';
4897 0 my $here_quote = $1;
4898 0 my $delimiter = $2;
4899  
4900 # get here document
4901 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4902 0 $here_script = CORE::substr $_, pos $_;
4903 0 $here_script =~ s/.*?\n//oxm;
4904 }
4905 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
4906 0 push @heredoc, $1 . qq{\n$delimiter\n};
4907 0 push @heredoc_delimiter, $delimiter;
4908 }
4909 else {
4910 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4911 }
4912 0 $e_string .= $here_quote;
4913 }
4914  
4915 # <<\HEREDOC
4916 elsif ($string =~ /\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) {
4917 0 $slash = 'm//';
4918 0 my $here_quote = $1;
4919 0 my $delimiter = $2;
4920  
4921 # get here document
4922 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4923 0 $here_script = CORE::substr $_, pos $_;
4924 0 $here_script =~ s/.*?\n//oxm;
4925 }
4926 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
4927 0 push @heredoc, $1 . qq{\n$delimiter\n};
4928 0 push @heredoc_delimiter, $delimiter;
4929 }
4930 else {
4931 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4932 }
4933 0 $e_string .= $here_quote;
4934 }
4935  
4936 # <<"HEREDOC"
4937 elsif ($string =~ /\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) {
4938 0 $slash = 'm//';
4939 0 my $here_quote = $1;
4940 0 my $delimiter = $2;
4941  
4942 # get here document
4943 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4944 0 $here_script = CORE::substr $_, pos $_;
4945 0 $here_script =~ s/.*?\n//oxm;
4946 }
4947 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
4948 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4949 0 push @heredoc_delimiter, $delimiter;
4950 }
4951 else {
4952 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4953 }
4954 0 $e_string .= $here_quote;
4955 }
4956  
4957 # <<HEREDOC
4958 elsif ($string =~ /\G ( << ([a-zA-Z_0-9]+) ) /oxgc) {
4959 0 $slash = 'm//';
4960 0 my $here_quote = $1;
4961 0 my $delimiter = $2;
4962  
4963 # get here document
4964 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4965 0 $here_script = CORE::substr $_, pos $_;
4966 0 $here_script =~ s/.*?\n//oxm;
4967 }
4968 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
4969 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4970 0 push @heredoc_delimiter, $delimiter;
4971 }
4972 else {
4973 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4974 }
4975 0 $e_string .= $here_quote;
4976 }
4977  
4978 # <<`HEREDOC`
4979 elsif ($string =~ /\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) {
4980 0 $slash = 'm//';
4981 0 my $here_quote = $1;
4982 0 my $delimiter = $2;
4983  
4984 # get here document
4985 0 ▶ if ($here_script eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($here_script eq "") 0 0 0
4986 0 $here_script = CORE::substr $_, pos $_;
4987 0 $here_script =~ s/.*?\n//oxm;
4988 }
4989 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
4990 0 push @heredoc, e_heredoc($1) . qq{\n$delimiter\n};
4991 0 push @heredoc_delimiter, $delimiter;
4992 }
4993 else {
4994 0 die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n";
4995 }
4996 0 $e_string .= $here_quote;
4997 }
4998  
4999 # any operator before div
5000 elsif ($string =~ /\G (
5001 -- | \+\+ |
5002 [\)\}\]]
5003  
5004 17 ) /oxgc) { $slash = 'div'; $e_string .= $1; }
5005  
5006 # yada-yada or triple-dot operator
5007 elsif ($string =~ /\G (
5008 \.\.\.
5009  
5010 0 ) /oxgc) { $slash = 'm//'; $e_string .= q{die('Unimplemented')}; }
5011  
5012 # any operator before m//
5013 elsif ($string =~ /\G ((?>
5014  
5015 !~~ | !~ | != | ! |
5016 %= | % |
5017 &&= | && | &= | &\.= | &\. | & |
5018 -= | -> | - |
5019 :(?>\s*)= |
5020 : |
5021 <<>> |
5022 <<= | <=> | <= | < |
5023 == | => | =~ | = |
5024 >>= | >> | >= | > |
5025 \*\*= | \*\* | \*= | \* |
5026 \+= | \+ |
5027 \.\. | \.= | \. |
5028 \/\/= | \/\/ |
5029 \/= | \/ |
5030 \? |
5031 \\ |
5032 \^= | \^\.= | \^\. | \^ |
5033 \b x= |
5034 \|\|= | \|\| | \|= | \|\.= | \|\. | \| |
5035 ~~ | ~\. | ~ |
5036 \b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b |
5037 \b(?: print )\b |
5038  
5039 [,;\(\{\[]
5040  
5041 30 )) /oxgc) { $slash = 'm//'; $e_string .= $1; }
5042  
5043 # other any character
5044 129 elsif ($string =~ /\G ($q_char) /oxgc) { $e_string .= $1; }
5045  
5046 # system error
5047 else {
5048 0 die __FILE__, ": Oops, this shouldn't happen!\n";
5049 }
5050 }
5051  
5052 16 return $e_string;
5053 }
5054  
5055 #
5056 # character class
5057 #
5058 1880 ▶sub character_class {
Subroutine character_class: called CC=3 SCAR=11.0
Pod undocumented
5059 1880 my($char,$modifier) = @_;
5060  
5061 1880 ▶ if ($char eq '.') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char eq '.') { } 52 1828 1880
5062 52 ▶ if ($modifier =~ /s/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /s/) { } 17 35 52
5063 17 return '${Etis620::dot_s}';
5064 }
5065 else {
5066 35 return '${Etis620::dot}';
5067 }
5068 }
5069 else {
5070 1828 return Etis620::classic_character_class($char);
5071 }
5072 }
5073  
5074 #
5075 # escape capture ($1, $2, $3, ...)
5076 #
5077 212 ▶sub e_capture {
Subroutine e_capture: called CC=1 SCAR=0.0
Pod undocumented
5078  
5079 212 return join '', '${', $_[0], '}';
5080 }
5081  
5082 #
5083 # escape transliteration (tr/// or y///)
5084 #
5085 4 ▶sub e_tr {
Subroutine e_tr: called CC=5 SCAR=16.8
Pod undocumented
5086 4 my($variable,$charclass,$e,$charclass2,$modifier) = @_;
5087 4 my $e_tr = '';
5088 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
5089  
5090 4 $slash = 'div';
5091  
5092 # quote character class 1
5093 4 $charclass = q_tr($charclass);
5094  
5095 # quote character class 2
5096 4 $charclass2 = q_tr($charclass2);
5097  
5098 # /b /B modifier
5099 4 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) { } 0 4 4
5100 0 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 0 0 0
5101 0 $e_tr = qq{tr$charclass$e$charclass2$modifier};
5102 }
5103 else {
5104 0 $e_tr = qq{$variable${bind_operator}tr$charclass$e$charclass2$modifier};
5105 }
5106 }
5107 else {
5108 4 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq '') { } 2 2 4
5109 2 $e_tr = qq{Etis620::tr(\$_,' =~ ',$charclass,$e$charclass2,'$modifier')};
5110 }
5111 else {
5112 2 $e_tr = qq{Etis620::tr($variable,'$bind_operator',$charclass,$e$charclass2,'$modifier')};
5113 }
5114 }
5115  
5116 # clear tr/// variable
5117 4 $tr_variable = '';
5118 4 $bind_operator = '';
5119  
5120 4 return $e_tr;
5121 }
5122  
5123 #
5124 # quote for escape transliteration (tr/// or y///)
5125 #
5126 8 ▶sub q_tr {
Subroutine q_tr: called CC=9 SCAR=40.6
Pod undocumented
5127 8 my($charclass) = @_;
5128  
5129 # quote character class
5130 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
5131 8 return e_q('', "'", "'", $charclass); # --> q' '
5132 }
5133 elsif ($charclass !~ /\//oxms) {
5134 0 return e_q('q', '/', '/', $charclass); # --> q/ /
5135 }
5136 elsif ($charclass !~ /\#/oxms) {
5137 0 return e_q('q', '#', '#', $charclass); # --> q# #
5138 }
5139 elsif ($charclass !~ /[\<\>]/oxms) {
5140 0 return e_q('q', '<', '>', $charclass); # --> q< >
5141 }
5142 elsif ($charclass !~ /[\(\)]/oxms) {
5143 0 return e_q('q', '(', ')', $charclass); # --> q( )
5144 }
5145 elsif ($charclass !~ /[\{\}]/oxms) {
5146 0 return e_q('q', '{', '}', $charclass); # --> q{ }
5147 }
5148 else {
5149 0 for my $char (qw( ! " $ % & * + . : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5150 0 ▶ if ($charclass !~ /\Q$char\E/xms) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($charclass =~ /\Q$char\E/msx) 0 0 0
5151 0 return e_q('q', $char, $char, $charclass);
5152 }
5153 }
5154 }
5155  
5156 0 return e_q('q', '{', '}', $charclass);
5157 }
5158  
5159 #
5160 # escape q string (q//, '')
5161 #
5162 1643 ▶sub e_q {
Subroutine e_q: called CC=1 SCAR=0.0
Pod undocumented
5163 1643 my($ope,$delimiter,$end_delimiter,$string) = @_;
5164  
5165 1643 $slash = 'div';
5166  
5167 1643 return join '', $ope, $delimiter, $string, $end_delimiter;
5168 }
5169  
5170 #
5171 # escape qq string (qq//, "", qx//, ``)
5172 #
5173 3919 ▶sub e_qq {
Subroutine e_qq: called CC=37 SCAR=50.9
Pod undocumented
5174 3919 my($ope,$delimiter,$end_delimiter,$string) = @_;
5175  
5176 3919 $slash = 'div';
5177  
5178 3919 my $left_e = 0;
5179 3919 my $right_e = 0;
5180  
5181 # split regexp
5182 3919 my @char = $string =~ /\G((?>
5183 [^\\\$] |
5184 \\x\{ (?>[0-9A-Fa-f]+) \} |
5185 \\o\{ (?>[0-7]+) \} |
5186 \\N\{ (?>[^0-9\}][^\}]*) \} |
5187 \\ $q_char |
5188 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5189 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5190 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5191 \$ (?>\s* [0-9]+) |
5192 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5193 \$ \$ (?![\w\{]) |
5194 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5195 $q_char
5196 ))/oxmsg;
5197  
5198 3919 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 119469 3919 123388
5199  
5200 # "\L\u" --> "\u\L"
5201 119469 ▶ 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 119469 119469
elsif ($char[$i] eq '\\U' and $char[$i + 1] eq '\\l') { } 0 119469 119469
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/mosx) { } 1 119468 119469
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/mosx) { } 1 119467 119468
elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/mosx) { } 0 119467 119467
Condition33%1/3
$char[$i] eq "\\L" and $char[$i + 1] eq "\\u"
!ll&&!rl&&r
11946900
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
5202 0 @char[$i,$i+1] = @char[$i+1,$i];
5203 }
5204  
5205 # "\U\l" --> "\l\U"
5206 ▶ 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
11946900
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
5207 0 @char[$i,$i+1] = @char[$i+1,$i];
5208 }
5209  
5210 # octal escape sequence
5211 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5212 1 $char[$i] = Etis620::octchr($1);
5213 }
5214  
5215 # hexadecimal escape sequence
5216 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5217 1 $char[$i] = Etis620::hexchr($1);
5218 }
5219  
5220 # \N{CHARNAME} --> N{CHARNAME}
5221 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5222 0 $char[$i] = $1;
5223 }
5224  
5225 119469 ▶ if (0) {
Branch: 23 branches
BranchTrueFalseTotal
if (do { $char[$i] =~ /\A ([<>]) \z/mosx }) { } 484 118985 119469
elsif ($char[$i] eq '\\u') { } 0 118985 118985
elsif ($char[$i] eq '\\l') { } 0 118985 118985
elsif ($char[$i] eq '\\U') { } 0 118985 118985
elsif ($char[$i] eq '\\L') { } 0 118985 118985
elsif ($char[$i] eq '\\F') { } 8 118977 118985
elsif ($char[$i] eq '\\Q') { } 0 118977 118977
elsif ($char[$i] eq '\\E') { } 8 118969 118977
elsif ($char[$i] eq '\\Q') { } 0 118969 118969
elsif ($char[$i] eq '\\E') { } 0 118969 118969
elsif ($char[$i] =~ /\A \$ 0 \z/mosx) { } 4 118965 118969
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/mosx) { } 0 118965 118965
elsif ($char[$i] =~ /\A \$\$ \z/mosx) { } 0 118965 118965
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/mosx) { } 205 118760 118965
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/mosx) { } 0 118760 118760
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/mosx) { } 0 118760 118760
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/mosx) { } 0 118760 118760
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/mosx) { } 0 118760 118760
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/cgmosx) { } 44 118716 118760
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/cgmosx) { } 45 118671 118716
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/cgmosx) { } 33 118638 118671
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/mosx) { } 0 118638 118638
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/mosx) { } 0 118638 118638
5226 }
5227  
5228 # \F
5229 #
5230 # P.69 Table 2-6. Translation escapes
5231 # in Chapter 2: Bits and Pieces
5232 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
5233 # (and so on)
5234  
5235 # \u \l \U \L \F \Q \E
5236 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5237 484 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 484 484
5238 0 $char[$i] = '\\' . $char[$i];
5239 }
5240 }
5241 elsif ($char[$i] eq '\u') {
5242  
5243 # "STRING @{[ LIST EXPR ]} MORE STRING"
5244  
5245 # P.257 Other Tricks You Can Do with Hard References
5246 # in Chapter 8: References
5247 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
5248  
5249 # P.353 Other Tricks You Can Do with Hard References
5250 # in Chapter 8: References
5251 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
5252  
5253 # (and so on)
5254  
5255 0 $char[$i] = '@{[Etis620::ucfirst qq<';
5256 0 $left_e++;
5257 }
5258 elsif ($char[$i] eq '\l') {
5259 0 $char[$i] = '@{[Etis620::lcfirst qq<';
5260 0 $left_e++;
5261 }
5262 elsif ($char[$i] eq '\U') {
5263 0 $char[$i] = '@{[Etis620::uc qq<';
5264 0 $left_e++;
5265 }
5266 elsif ($char[$i] eq '\L') {
5267 0 $char[$i] = '@{[Etis620::lc qq<';
5268 0 $left_e++;
5269 }
5270 elsif ($char[$i] eq '\F') {
5271 8 $char[$i] = '@{[Etis620::fc qq<';
5272 8 $left_e++;
5273 }
5274 elsif ($char[$i] eq '\Q') {
5275 0 $char[$i] = '@{[CORE::quotemeta qq<';
5276 0 $left_e++;
5277 }
5278 elsif ($char[$i] eq '\E') {
5279 8 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 8 0 8
5280 8 $char[$i] = '>]}';
5281 8 $right_e++;
5282 }
5283 else {
5284 0 $char[$i] = '';
5285 }
5286 }
5287 elsif ($char[$i] eq '\Q') {
5288 0 while (1) {
5289 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5290 0 last;
5291 }
5292 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5293 0 last;
5294 }
5295 }
5296 }
5297 elsif ($char[$i] eq '\E') {
5298 }
5299  
5300 # $0 --> $0
5301 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5302 }
5303 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5304 }
5305  
5306 # $$ --> $$
5307 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5308 }
5309  
5310 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5311 # $1, $2, $3 --> $1, $2, $3 otherwise
5312 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5313 205 $char[$i] = e_capture($1);
5314 }
5315 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5316 0 $char[$i] = e_capture($1);
5317 }
5318  
5319 # $$foo[ ... ] --> $ $foo->[ ... ]
5320 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5321 0 $char[$i] = e_capture($1.'->'.$2);
5322 }
5323  
5324 # $$foo{ ... } --> $ $foo->{ ... }
5325 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5326 0 $char[$i] = e_capture($1.'->'.$2);
5327 }
5328  
5329 # $$foo
5330 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5331 0 $char[$i] = e_capture($1);
5332 }
5333  
5334 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Etis620::PREMATCH()
5335 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5336 44 $char[$i] = '@{[Etis620::PREMATCH()]}';
5337 }
5338  
5339 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Etis620::MATCH()
5340 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5341 45 $char[$i] = '@{[Etis620::MATCH()]}';
5342 }
5343  
5344 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Etis620::POSTMATCH()
5345 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5346 33 $char[$i] = '@{[Etis620::POSTMATCH()]}';
5347 }
5348  
5349 # ${ foo } --> ${ foo }
5350 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5351 }
5352  
5353 # ${ ... }
5354 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5355 0 $char[$i] = e_capture($1);
5356 }
5357 }
5358  
5359 # return string
5360 3919 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 3919 3919
5361 0 return join '', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter;
5362 }
5363 3919 return join '', $ope, $delimiter, @char, $end_delimiter;
5364 }
5365  
5366 #
5367 # escape qw string (qw//)
5368 #
5369 14 ▶sub e_qw {
Subroutine e_qw: called CC=11 SCAR=43.1
Pod undocumented
5370 14 my($ope,$delimiter,$end_delimiter,$string) = @_;
5371  
5372 14 $slash = 'div';
5373  
5374 # choice again delimiter
5375 14 my %octet = map {$_ => 1} ($string =~ /\G ([\x00-\xFF]) /oxmsg);
5376 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
5377 14 return join '', $ope, $delimiter, $string, $end_delimiter;
5378 }
5379 elsif (not $octet{')'}) {
5380 0 return join '', $ope, '(', $string, ')';
5381 }
5382 elsif (not $octet{'}'}) {
5383 0 return join '', $ope, '{', $string, '}';
5384 }
5385 elsif (not $octet{']'}) {
5386 0 return join '', $ope, '[', $string, ']';
5387 }
5388 elsif (not $octet{'>'}) {
5389 0 return join '', $ope, '<', $string, '>';
5390 }
5391 else {
5392 0 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5393 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5394 0 return join '', $ope, $char, $string, $char;
5395 }
5396 }
5397 }
5398  
5399 # qw/AAA BBB C'CC/ --> ('AAA', 'BBB', 'C\'CC')
5400 0 my @string = CORE::split(/\s+/, $string);
5401 0 for my $string (@string) {
5402 0 my @octet = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5403 0 for my $octet (@octet) {
5404 0 ▶ if ($octet =~ /\A (['\\]) \z/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($octet =~ /\A (['\\]) \z/mosx) 0 0 0
5405 0 $octet = '\\' . $1;
5406 }
5407 }
5408 0 $string = join '', @octet;
5409 }
5410 0 return join '', '(', (join ', ', map { "'$_'" } @string), ')';
5411 }
5412  
5413 #
5414 # escape here document (<<"HEREDOC", <<HEREDOC, <<`HEREDOC`, <<~"HEREDOC", <<~HEREDOC, <<~`HEREDOC`)
5415 #
5416 93 ▶sub e_heredoc {
Subroutine e_heredoc: called CC=37 SCAR=56.3
Pod undocumented
5417 93 my($string) = @_;
5418  
5419 93 $slash = 'm//';
5420  
5421 93 my $metachar = qr/[\@\\|]/oxms; # '|' is for <<`HEREDOC`
5422  
5423 93 my $left_e = 0;
5424 93 my $right_e = 0;
5425  
5426 # split regexp
5427 93 my @char = $string =~ /\G((?>
5428 [^\\\$] |
5429 \\x\{ (?>[0-9A-Fa-f]+) \} |
5430 \\o\{ (?>[0-7]+) \} |
5431 \\N\{ (?>[^0-9\}][^\}]*) \} |
5432 \\ $q_char |
5433 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5434 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5435 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5436 \$ (?>\s* [0-9]+) |
5437 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5438 \$ \$ (?![\w\{]) |
5439 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5440 $q_char
5441 ))/oxmsg;
5442  
5443 93 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 5449 93 5542
5444  
5445 # "\L\u" --> "\u\L"
5446 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
5447 0 @char[$i,$i+1] = @char[$i+1,$i];
5448 }
5449  
5450 # "\U\l" --> "\l\U"
5451 ▶ 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
5452 0 @char[$i,$i+1] = @char[$i+1,$i];
5453 }
5454  
5455 # octal escape sequence
5456 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5457 1 $char[$i] = Etis620::octchr($1);
5458 }
5459  
5460 # hexadecimal escape sequence
5461 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5462 1 $char[$i] = Etis620::hexchr($1);
5463 }
5464  
5465 # \N{CHARNAME} --> N{CHARNAME}
5466 elsif ($char[$i] =~ /\A \\ ( N\{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5467 0 $char[$i] = $1;
5468 }
5469  
5470 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
5471 }
5472  
5473 # \u \l \U \L \F \Q \E
5474 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
5475 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
5476 0 $char[$i] = '\\' . $char[$i];
5477 }
5478 }
5479 elsif ($char[$i] eq '\u') {
5480 0 $char[$i] = '@{[Etis620::ucfirst qq<';
5481 0 $left_e++;
5482 }
5483 elsif ($char[$i] eq '\l') {
5484 0 $char[$i] = '@{[Etis620::lcfirst qq<';
5485 0 $left_e++;
5486 }
5487 elsif ($char[$i] eq '\U') {
5488 0 $char[$i] = '@{[Etis620::uc qq<';
5489 0 $left_e++;
5490 }
5491 elsif ($char[$i] eq '\L') {
5492 0 $char[$i] = '@{[Etis620::lc qq<';
5493 0 $left_e++;
5494 }
5495 elsif ($char[$i] eq '\F') {
5496 0 $char[$i] = '@{[Etis620::fc qq<';
5497 0 $left_e++;
5498 }
5499 elsif ($char[$i] eq '\Q') {
5500 0 $char[$i] = '@{[CORE::quotemeta qq<';
5501 0 $left_e++;
5502 }
5503 elsif ($char[$i] eq '\E') {
5504 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
5505 0 $char[$i] = '>]}';
5506 0 $right_e++;
5507 }
5508 else {
5509 0 $char[$i] = '';
5510 }
5511 }
5512 elsif ($char[$i] eq '\Q') {
5513 0 while (1) {
5514 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5515 0 last;
5516 }
5517 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5518 0 last;
5519 }
5520 }
5521 }
5522 elsif ($char[$i] eq '\E') {
5523 }
5524  
5525 # $0 --> $0
5526 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5527 }
5528 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5529 }
5530  
5531 # $$ --> $$
5532 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5533 }
5534  
5535 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5536 # $1, $2, $3 --> $1, $2, $3 otherwise
5537 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5538 0 $char[$i] = e_capture($1);
5539 }
5540 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5541 0 $char[$i] = e_capture($1);
5542 }
5543  
5544 # $$foo[ ... ] --> $ $foo->[ ... ]
5545 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5546 0 $char[$i] = e_capture($1.'->'.$2);
5547 }
5548  
5549 # $$foo{ ... } --> $ $foo->{ ... }
5550 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5551 0 $char[$i] = e_capture($1.'->'.$2);
5552 }
5553  
5554 # $$foo
5555 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5556 0 $char[$i] = e_capture($1);
5557 }
5558  
5559 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Etis620::PREMATCH()
5560 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5561 8 $char[$i] = '@{[Etis620::PREMATCH()]}';
5562 }
5563  
5564 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Etis620::MATCH()
5565 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5566 8 $char[$i] = '@{[Etis620::MATCH()]}';
5567 }
5568  
5569 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Etis620::POSTMATCH()
5570 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5571 6 $char[$i] = '@{[Etis620::POSTMATCH()]}';
5572 }
5573  
5574 # ${ foo } --> ${ foo }
5575 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) {
5576 }
5577  
5578 # ${ ... }
5579 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5580 0 $char[$i] = e_capture($1);
5581 }
5582 }
5583  
5584 # return string
5585 93 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 93 93
5586 0 return join '', @char, '>]}' x ($left_e - $right_e);
5587 }
5588 93 return join '', @char;
5589 }
5590  
5591 #
5592 # escape regexp (m//, qr//)
5593 #
5594 624 ▶sub e_qr {
Subroutine e_qr: called CC=110 SCAR=73.6
Pod undocumented
5595 624 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
5596 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
5597  
5598 624 $modifier =~ tr/p//d;
5599 624 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 624 624
5600 0 my $line = 0;
5601 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
5602 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
5603 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
5604 0 last;
5605 }
5606 }
5607 0 die qq{Unsupported modifier "$1" used at line $line.\n};
5608 }
5609  
5610 624 $slash = 'div';
5611  
5612 # literal null string pattern
5613 624 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 616 624
elsif ($modifier =~ tr/Bb//d) { } 2 614 616
5614 8 $modifier =~ tr/bB//d;
5615 8 $modifier =~ tr/i//d;
5616 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
5617 }
5618  
5619 # /b /B modifier
5620 elsif ($modifier =~ tr/bB//d) {
5621  
5622 # choice again delimiter
5623 2 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 2 2
5624 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
5625 0 my %octet = map {$_ => 1} @char;
5626 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
5627 0 $delimiter = '(';
5628 0 $end_delimiter = ')';
5629 }
5630 elsif (not $octet{'}'}) {
5631 0 $delimiter = '{';
5632 0 $end_delimiter = '}';
5633 }
5634 elsif (not $octet{']'}) {
5635 0 $delimiter = '[';
5636 0 $end_delimiter = ']';
5637 }
5638 elsif (not $octet{'>'}) {
5639 0 $delimiter = '<';
5640 0 $end_delimiter = '>';
5641 }
5642 else {
5643 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5644 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5645 0 $delimiter = $char;
5646 0 $end_delimiter = $char;
5647 0 last;
5648 }
5649 }
5650 }
5651 }
5652  
5653 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
5654 0 return join '', $ope, $delimiter, $string, $matched, $end_delimiter, $modifier;
5655 }
5656 else {
5657 2 return join '', $ope, $delimiter, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
5658 }
5659 }
5660  
5661 614 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 64 550 614
5662 614 my $metachar = qr/[\@\\|[\]{^]/oxms;
5663  
5664 # split regexp
5665 614 my @char = $string =~ /\G((?>
5666 [^\\\$\@\[\(] |
5667 \\x (?>[0-9A-Fa-f]{1,2}) |
5668 \\ (?>[0-7]{2,3}) |
5669 \\c [\x40-\x5F] |
5670 \\x\{ (?>[0-9A-Fa-f]+) \} |
5671 \\o\{ (?>[0-7]+) \} |
5672 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
5673 \\ $q_char |
5674 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
5675 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
5676 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
5677 [\$\@] $qq_variable |
5678 \$ (?>\s* [0-9]+) |
5679 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
5680 \$ \$ (?![\w\{]) |
5681 \$ (?>\s*) \$ (?>\s*) $qq_variable |
5682 \[\^ |
5683 \[\: (?>[a-z]+) :\] |
5684 \[\:\^ (?>[a-z]+) :\] |
5685 \(\? |
5686 $q_char
5687 ))/oxmsg;
5688  
5689 # choice again delimiter
5690 614 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 614 614
5691 0 my %octet = map {$_ => 1} @char;
5692 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
5693 0 $delimiter = '(';
5694 0 $end_delimiter = ')';
5695 }
5696 elsif (not $octet{'}'}) {
5697 0 $delimiter = '{';
5698 0 $end_delimiter = '}';
5699 }
5700 elsif (not $octet{']'}) {
5701 0 $delimiter = '[';
5702 0 $end_delimiter = ']';
5703 }
5704 elsif (not $octet{'>'}) {
5705 0 $delimiter = '<';
5706 0 $end_delimiter = '>';
5707 }
5708 else {
5709 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
5710 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
5711 0 $delimiter = $char;
5712 0 $end_delimiter = $char;
5713 0 last;
5714 }
5715 }
5716 }
5717 }
5718  
5719 614 my $left_e = 0;
5720 614 my $right_e = 0;
5721 614 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 1820 614 2434
5722  
5723 # "\L\u" --> "\u\L"
5724 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
5725 0 @char[$i,$i+1] = @char[$i+1,$i];
5726 }
5727  
5728 # "\U\l" --> "\l\U"
5729 ▶ 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
5730 0 @char[$i,$i+1] = @char[$i+1,$i];
5731 }
5732  
5733 # octal escape sequence
5734 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
5735 1 $char[$i] = Etis620::octchr($1);
5736 }
5737  
5738 # hexadecimal escape sequence
5739 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
5740 1 $char[$i] = Etis620::hexchr($1);
5741 }
5742  
5743 # \b{...} --> b\{...}
5744 # \B{...} --> B\{...}
5745 # \N{CHARNAME} --> N\{CHARNAME}
5746 # \p{PROPERTY} --> p\{PROPERTY}
5747 # \P{PROPERTY} --> P\{PROPERTY}
5748 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
5749 6 $char[$i] = $1 . '\\' . $2;
5750 }
5751  
5752 # \p, \P, \X --> p, P, X
5753 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
5754 4 $char[$i] = $1;
5755 }
5756  
5757 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 &Etis620::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
5758 }
5759  
5760 # join separated multiple-octet
5761 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
5762 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 $Etis620::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 $Etis620::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 $Etis620::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 $Etis620::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 $Etis620::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 $Etis620::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 $Etis620::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5763 0 $char[$i] .= join '', splice @char, $i+1, 3;
5764 }
5765 ▶ 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 $Etis620::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 $Etis620::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 $Etis620::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 $Etis620::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5766 0 $char[$i] .= join '', splice @char, $i+1, 2;
5767 }
5768 ▶ 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 $Etis620::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 $Etis620::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 $Etis620::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 $Etis620::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
5769 0 $char[$i] .= join '', splice @char, $i+1, 1;
5770 }
5771 }
5772  
5773 # open character class [...]
5774 elsif ($char[$i] eq '[') {
5775 316 my $left = $i;
5776  
5777 # [] make die "Unmatched [] in regexp ...\n"
5778 # (and so on)
5779  
5780 316 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 3 313 316
5781 3 $i++;
5782 }
5783  
5784 316 while (1) {
5785 1343 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 1343 1343
5786 0 die __FILE__, ": Unmatched [] in regexp\n";
5787 }
5788 1343 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 316 1027 1343
5789 316 my $right = $i;
5790  
5791 # [...]
5792 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
5793 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Etis620::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5794 }
5795 else {
5796 286 splice @char, $left, $right-$left+1, Etis620::charlist_qr(@char[$left+1..$right-1], $modifier);
5797 }
5798  
5799 316 $i = $left;
5800 316 last;
5801 }
5802 }
5803 }
5804  
5805 # open character class [^...]
5806 elsif ($char[$i] eq '[^') {
5807 74 my $left = $i;
5808  
5809 # [^] make die "Unmatched [] in regexp ...\n"
5810 # (and so on)
5811  
5812 74 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 4 70 74
5813 4 $i++;
5814 }
5815  
5816 74 while (1) {
5817 272 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 272 272
5818 0 die __FILE__, ": Unmatched [] in regexp\n";
5819 }
5820 272 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 74 198 272
5821 74 my $right = $i;
5822  
5823 # [^...]
5824 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
5825 30 splice @char, $left, $right-$left+1, sprintf(q{@{[Etis620::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
5826 }
5827 else {
5828 44 splice @char, $left, $right-$left+1, Etis620::charlist_not_qr(@char[$left+1..$right-1], $modifier);
5829 }
5830  
5831 74 $i = $left;
5832 74 last;
5833 }
5834 }
5835 }
5836  
5837 # rewrite character class or escape character
5838 elsif (my $char = character_class($char[$i],$modifier)) {
5839 139 $char[$i] = $char;
5840 }
5841  
5842 # /i modifier
5843 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Etis620::uc($char[$i]) ne Etis620::fc($char[$i]))) {
Condition100%6/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Etis620::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 &Etis620::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Etis620::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= &Etis620::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
5844 20 ▶ if (CORE::length(Etis620::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 20 0 20
5845 20 $char[$i] = '[' . Etis620::uc($char[$i]) . Etis620::fc($char[$i]) . ']';
5846 }
5847 else {
5848 0 $char[$i] = '(?:' . Etis620::uc($char[$i]) . '|' . Etis620::fc($char[$i]) . ')';
5849 }
5850 }
5851  
5852 # \u \l \U \L \F \Q \E
5853 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
5854 1 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 1 1
5855 0 $char[$i] = '\\' . $char[$i];
5856 }
5857 }
5858 elsif ($char[$i] eq '\u') {
5859 0 $char[$i] = '@{[Etis620::ucfirst qq<';
5860 0 $left_e++;
5861 }
5862 elsif ($char[$i] eq '\l') {
5863 0 $char[$i] = '@{[Etis620::lcfirst qq<';
5864 0 $left_e++;
5865 }
5866 elsif ($char[$i] eq '\U') {
5867 1 $char[$i] = '@{[Etis620::uc qq<';
5868 1 $left_e++;
5869 }
5870 elsif ($char[$i] eq '\L') {
5871 1 $char[$i] = '@{[Etis620::lc qq<';
5872 1 $left_e++;
5873 }
5874 elsif ($char[$i] eq '\F') {
5875 6 $char[$i] = '@{[Etis620::fc qq<';
5876 6 $left_e++;
5877 }
5878 elsif ($char[$i] eq '\Q') {
5879 1 $char[$i] = '@{[CORE::quotemeta qq<';
5880 1 $left_e++;
5881 }
5882 elsif ($char[$i] eq '\E') {
5883 9 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 9 0 9
5884 9 $char[$i] = '>]}';
5885 9 $right_e++;
5886 }
5887 else {
5888 0 $char[$i] = '';
5889 }
5890 }
5891 elsif ($char[$i] eq '\Q') {
5892 0 while (1) {
5893 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
5894 0 last;
5895 }
5896 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
5897 0 last;
5898 }
5899 }
5900 }
5901 elsif ($char[$i] eq '\E') {
5902 }
5903  
5904 # $0 --> $0
5905 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
5906 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5907 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
5908 }
5909 }
5910 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
5911 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5912 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
5913 }
5914 }
5915  
5916 # $$ --> $$
5917 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
5918 }
5919  
5920 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
5921 # $1, $2, $3 --> $1, $2, $3 otherwise
5922 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
5923 0 $char[$i] = e_capture($1);
5924 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5925 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
5926 }
5927 }
5928 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
5929 0 $char[$i] = e_capture($1);
5930 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5931 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
5932 }
5933 }
5934  
5935 # $$foo[ ... ] --> $ $foo->[ ... ]
5936 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
5937 0 $char[$i] = e_capture($1.'->'.$2);
5938 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5939 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
5940 }
5941 }
5942  
5943 # $$foo{ ... } --> $ $foo->{ ... }
5944 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
5945 0 $char[$i] = e_capture($1.'->'.$2);
5946 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5947 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
5948 }
5949 }
5950  
5951 # $$foo
5952 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
5953 0 $char[$i] = e_capture($1);
5954 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5955 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
5956 }
5957 }
5958  
5959 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Etis620::PREMATCH()
5960 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
5961 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
5962 0 $char[$i] = '@{[Etis620::ignorecase(Etis620::PREMATCH())]}';
5963 }
5964 else {
5965 8 $char[$i] = '@{[Etis620::PREMATCH()]}';
5966 }
5967 }
5968  
5969 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Etis620::MATCH()
5970 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
5971 8 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 8 8
5972 0 $char[$i] = '@{[Etis620::ignorecase(Etis620::MATCH())]}';
5973 }
5974 else {
5975 8 $char[$i] = '@{[Etis620::MATCH()]}';
5976 }
5977 }
5978  
5979 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Etis620::POSTMATCH()
5980 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
5981 6 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 6 6
5982 0 $char[$i] = '@{[Etis620::ignorecase(Etis620::POSTMATCH())]}';
5983 }
5984 else {
5985 6 $char[$i] = '@{[Etis620::POSTMATCH()]}';
5986 }
5987 }
5988  
5989 # ${ foo }
5990 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
5991 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
5992 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
5993 }
5994 }
5995  
5996 # ${ ... }
5997 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
5998 0 $char[$i] = e_capture($1);
5999 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6000 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
6001 }
6002 }
6003  
6004 # $scalar or @array
6005 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6006 5 $char[$i] = e_string($char[$i]);
6007 5 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 3 2 5
6008 3 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
6009 }
6010 }
6011  
6012 # quote character before ? + * {
6013 ▶ 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
6014 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
6015 }
6016 ▶ 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
6017 0 my $char = $char[$i-1];
6018 0 ▶ if ($char[$i] eq '{') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq '{') { } 0 0 0
6019 0 die __FILE__, qq{: "MULTIBYTE{n}" should be "(MULTIBYTE){n}" in m?? (and shift \$1,\$2,\$3,...) ($char){n}\n};
6020 }
6021 else {
6022 0 die __FILE__, qq{: "MULTIBYTE$char[$i]" should be "(MULTIBYTE)$char[$i]" in m?? (and shift \$1,\$2,\$3,...) ($char)$char[$i]\n};
6023 }
6024 }
6025 else {
6026 127 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6027 }
6028 }
6029 }
6030  
6031 # make regexp string
6032 614 $modifier =~ tr/i//d;
6033 614 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 614 614
6034 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
6035 0 return join '', $ope, $delimiter, $anchor, @char, '>]}' x ($left_e - $right_e), $matched, $end_delimiter, $modifier;
6036 }
6037 else {
6038 0 return join '', $ope, $delimiter, $anchor, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6039 }
6040 }
6041 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
6042 0 return join '', $ope, $delimiter, $anchor, @char, $matched, $end_delimiter, $modifier;
6043 }
6044 else {
6045 614 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6046 }
6047 }
6048  
6049 #
6050 # double quote stuff
6051 #
6052 180 ▶sub qq_stuff {
Subroutine qq_stuff: called CC=6 SCAR=18.5
Pod undocumented
6053 180 my($delimiter,$end_delimiter,$stuff) = @_;
6054  
6055 # scalar variable or array variable
6056 180 ▶ if ($stuff =~ /\A [\$\@] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($stuff =~ /\A [\$\@] /mosx) 100 80 180
6057 100 return $stuff;
6058 }
6059  
6060 # quote by delimiter
6061 80 my %octet = map {$_ => 1} ($stuff =~ /\G ([\x00-\xFF]) /oxmsg);
6062 80 for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6063 80 ▶ next if $char eq $delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $delimiter 0 80 80
6064 80 ▶ next if $char eq $end_delimiter;
Branch: 1 branch
BranchTrueFalseTotal
if $char eq $end_delimiter 0 80 80
6065 80 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 80 0 80
6066 80 return join '', 'qq', $char, $stuff, $char;
6067 }
6068 }
6069 0 return join '', 'qq', '<', $stuff, '>';
6070 }
6071  
6072 #
6073 # escape regexp (m'', qr'', and m''b, qr''b)
6074 #
6075 10 ▶sub e_qr_q {
Subroutine e_qr_q: called CC=7 SCAR=25.3
Pod undocumented
6076 10 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6077 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
6078  
6079 10 $modifier =~ tr/p//d;
6080 10 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 10 10
6081 0 my $line = 0;
6082 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6083 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6084 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6085 0 last;
6086 }
6087 }
6088 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6089 }
6090  
6091 10 $slash = 'div';
6092  
6093 # literal null string pattern
6094 10 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 2 10
elsif ($modifier =~ tr/Bb//d) { } 0 2 2
6095 8 $modifier =~ tr/bB//d;
6096 8 $modifier =~ tr/i//d;
6097 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6098 }
6099  
6100 # with /b /B modifier
6101 elsif ($modifier =~ tr/bB//d) {
6102 0 return e_qr_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6103 }
6104  
6105 # without /b /B modifier
6106 else {
6107 2 return e_qr_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6108 }
6109 }
6110  
6111 #
6112 # escape regexp (m'', qr'')
6113 #
6114 2 ▶sub e_qr_qt {
Subroutine e_qr_qt: called CC=20 SCAR=51.8
Pod undocumented
6115 2 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6116  
6117 2 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 2 2
6118  
6119 # split regexp
6120 2 my @char = $string =~ /\G((?>
6121 [^\\\[\$\@\/] |
6122 [\x00-\xFF] |
6123 \[\^ |
6124 \[\: (?>[a-z]+) \:\] |
6125 \[\:\^ (?>[a-z]+) \:\] |
6126 [\$\@\/] |
6127 \\ (?:$q_char) |
6128 (?:$q_char)
6129 ))/oxmsg;
6130  
6131 # unescape character
6132 2 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 2 2 4
6133 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 &Etis620::uc($char[$i]) ne &fc($char[$i])) { } 0 2 2
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 4 4
6134 }
6135  
6136 # open character class [...]
6137 elsif ($char[$i] eq '[') {
6138 0 my $left = $i;
6139 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6140 0 $i++;
6141 }
6142 0 while (1) {
6143 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6144 0 die __FILE__, ": Unmatched [] in regexp\n";
6145 }
6146 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6147 0 my $right = $i;
6148  
6149 # [...]
6150 0 splice @char, $left, $right-$left+1, Etis620::charlist_qr(@char[$left+1..$right-1], $modifier);
6151  
6152 0 $i = $left;
6153 0 last;
6154 }
6155 }
6156 }
6157  
6158 # open character class [^...]
6159 elsif ($char[$i] eq '[^') {
6160 0 my $left = $i;
6161 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6162 0 $i++;
6163 }
6164 0 while (1) {
6165 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6166 0 die __FILE__, ": Unmatched [] in regexp\n";
6167 }
6168 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6169 0 my $right = $i;
6170  
6171 # [^...]
6172 0 splice @char, $left, $right-$left+1, Etis620::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6173  
6174 0 $i = $left;
6175 0 last;
6176 }
6177 }
6178 }
6179  
6180 # escape $ @ / and \
6181 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6182 0 $char[$i] = '\\' . $char[$i];
6183 }
6184  
6185 # rewrite character class or escape character
6186 elsif (my $char = character_class($char[$i],$modifier)) {
6187 0 $char[$i] = $char;
6188 }
6189  
6190 # /i modifier
6191 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Etis620::uc($char[$i]) ne Etis620::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Etis620::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 &Etis620::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Etis620::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= &Etis620::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6192 0 ▶ if (CORE::length(Etis620::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6193 0 $char[$i] = '[' . Etis620::uc($char[$i]) . Etis620::fc($char[$i]) . ']';
6194 }
6195 else {
6196 0 $char[$i] = '(?:' . Etis620::uc($char[$i]) . '|' . Etis620::fc($char[$i]) . ')';
6197 }
6198 }
6199  
6200 # quote character before ? + * {
6201 ▶ 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
6202 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
6203 }
6204 else {
6205 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6206 }
6207 }
6208 }
6209  
6210 2 $delimiter = '/';
6211 2 $end_delimiter = '/';
6212  
6213 2 $modifier =~ tr/i//d;
6214 2 return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6215 }
6216  
6217 #
6218 # escape regexp (m''b, qr''b)
6219 #
6220 0 ▶sub e_qr_qb {
Subroutine e_qr_qb: not called CC=4 SCAR=30.0
Pod undocumented
6221 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6222  
6223 # split regexp
6224 0 my @char = $string =~ /\G ((?>[^\\]|\\\\)) /oxmsg;
6225  
6226 # unescape character
6227 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6228 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
6229 }
6230  
6231 # remain \\
6232 elsif ($char[$i] eq '\\\\') {
6233 }
6234  
6235 # escape $ @ / and \
6236 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6237 0 $char[$i] = '\\' . $char[$i];
6238 }
6239 }
6240  
6241 0 $delimiter = '/';
6242 0 $end_delimiter = '/';
6243 0 return join '', $ope, $delimiter, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6244 }
6245  
6246 #
6247 # escape regexp (s/here//)
6248 #
6249 80 ▶sub e_s1 {
Subroutine e_s1: called CC=106 SCAR=81.1
Pod undocumented
6250 80 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6251 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
6252  
6253 80 $modifier =~ tr/p//d;
6254 80 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 80 80
6255 0 my $line = 0;
6256 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6257 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6258 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6259 0 last;
6260 }
6261 }
6262 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6263 }
6264  
6265 80 $slash = 'div';
6266  
6267 # literal null string pattern
6268 80 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 72 80
elsif ($modifier =~ tr/Bb//d) { } 0 72 72
6269 8 $modifier =~ tr/bB//d;
6270 8 $modifier =~ tr/i//d;
6271 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6272 }
6273  
6274 # /b /B modifier
6275 elsif ($modifier =~ tr/bB//d) {
6276  
6277 # choice again delimiter
6278 0 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 0 0
6279 0 my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg;
6280 0 my %octet = map {$_ => 1} @char;
6281 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
6282 0 $delimiter = '(';
6283 0 $end_delimiter = ')';
6284 }
6285 elsif (not $octet{'}'}) {
6286 0 $delimiter = '{';
6287 0 $end_delimiter = '}';
6288 }
6289 elsif (not $octet{']'}) {
6290 0 $delimiter = '[';
6291 0 $end_delimiter = ']';
6292 }
6293 elsif (not $octet{'>'}) {
6294 0 $delimiter = '<';
6295 0 $end_delimiter = '>';
6296 }
6297 else {
6298 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6299 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6300 0 $delimiter = $char;
6301 0 $end_delimiter = $char;
6302 0 last;
6303 }
6304 }
6305 }
6306 }
6307  
6308 0 my $prematch = '';
6309 0 return join '', $ope, $delimiter, $prematch, '(?:', $string, ')', $matched, $end_delimiter, $modifier;
6310 }
6311  
6312 72 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 1 71 72
6313 72 my $metachar = qr/[\@\\|[\]{^]/oxms;
6314  
6315 # split regexp
6316 72 my @char = $string =~ /\G((?>
6317 [^\\\$\@\[\(] |
6318 \\ (?>[1-9][0-9]*) |
6319 \\g (?>\s*) (?>[1-9][0-9]*) |
6320 \\g (?>\s*) \{ (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
6321 \\g (?>\s*) \{ (?>\s*) - (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} |
6322 \\x (?>[0-9A-Fa-f]{1,2}) |
6323 \\ (?>[0-7]{2,3}) |
6324 \\c [\x40-\x5F] |
6325 \\x\{ (?>[0-9A-Fa-f]+) \} |
6326 \\o\{ (?>[0-7]+) \} |
6327 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
6328 \\ $q_char |
6329 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
6330 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
6331 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
6332 [\$\@] $qq_variable |
6333 \$ (?>\s* [0-9]+) |
6334 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
6335 \$ \$ (?![\w\{]) |
6336 \$ (?>\s*) \$ (?>\s*) $qq_variable |
6337 \[\^ |
6338 \[\: (?>[a-z]+) :\] |
6339 \[\:\^ (?>[a-z]+) :\] |
6340 \(\? |
6341 $q_char
6342 ))/oxmsg;
6343  
6344 # choice again delimiter
6345 72 ▶ if ($delimiter =~ / [\@:] /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter =~ / [\@:] /mosx) 0 72 72
6346 0 my %octet = map {$_ => 1} @char;
6347 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
6348 0 $delimiter = '(';
6349 0 $end_delimiter = ')';
6350 }
6351 elsif (not $octet{'}'}) {
6352 0 $delimiter = '{';
6353 0 $end_delimiter = '}';
6354 }
6355 elsif (not $octet{']'}) {
6356 0 $delimiter = '[';
6357 0 $end_delimiter = ']';
6358 }
6359 elsif (not $octet{'>'}) {
6360 0 $delimiter = '<';
6361 0 $end_delimiter = '>';
6362 }
6363 else {
6364 0 for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") {
6365 0 ▶ if (not $octet{$char}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($octet{$char}) 0 0 0
6366 0 $delimiter = $char;
6367 0 $end_delimiter = $char;
6368 0 last;
6369 }
6370 }
6371 }
6372 }
6373  
6374 # count '('
6375 72 my $parens = grep { $_ eq '(' } @char;
6376  
6377 72 my $left_e = 0;
6378 72 my $right_e = 0;
6379 72 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 200 72 272
6380  
6381 # "\L\u" --> "\u\L"
6382 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
6383 0 @char[$i,$i+1] = @char[$i+1,$i];
6384 }
6385  
6386 # "\U\l" --> "\l\U"
6387 ▶ 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
6388 0 @char[$i,$i+1] = @char[$i+1,$i];
6389 }
6390  
6391 # octal escape sequence
6392 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
6393 1 $char[$i] = Etis620::octchr($1);
6394 }
6395  
6396 # hexadecimal escape sequence
6397 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
6398 1 $char[$i] = Etis620::hexchr($1);
6399 }
6400  
6401 # \b{...} --> b\{...}
6402 # \B{...} --> B\{...}
6403 # \N{CHARNAME} --> N\{CHARNAME}
6404 # \p{PROPERTY} --> p\{PROPERTY}
6405 # \P{PROPERTY} --> P\{PROPERTY}
6406 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
6407 0 $char[$i] = $1 . '\\' . $2;
6408 }
6409  
6410 # \p, \P, \X --> p, P, X
6411 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
6412 0 $char[$i] = $1;
6413 }
6414  
6415 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 &Etis620::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
6416 }
6417  
6418 # join separated multiple-octet
6419 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
6420 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 $Etis620::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 $Etis620::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 $Etis620::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 $Etis620::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 $Etis620::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 $Etis620::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 $Etis620::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6421 0 $char[$i] .= join '', splice @char, $i+1, 3;
6422 }
6423 ▶ 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 $Etis620::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 $Etis620::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 $Etis620::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 $Etis620::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6424 0 $char[$i] .= join '', splice @char, $i+1, 2;
6425 }
6426 ▶ 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 $Etis620::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 $Etis620::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 $Etis620::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 $Etis620::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
6427 0 $char[$i] .= join '', splice @char, $i+1, 1;
6428 }
6429 }
6430  
6431 # open character class [...]
6432 elsif ($char[$i] eq '[') {
6433 17 my $left = $i;
6434 17 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 17 17
6435 0 $i++;
6436 }
6437 17 while (1) {
6438 74 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 74 74
6439 0 die __FILE__, ": Unmatched [] in regexp\n";
6440 }
6441 74 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 17 57 74
6442 17 my $right = $i;
6443  
6444 # [...]
6445 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
6446 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Etis620::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6447 }
6448 else {
6449 17 splice @char, $left, $right-$left+1, Etis620::charlist_qr(@char[$left+1..$right-1], $modifier);
6450 }
6451  
6452 17 $i = $left;
6453 17 last;
6454 }
6455 }
6456 }
6457  
6458 # open character class [^...]
6459 elsif ($char[$i] eq '[^') {
6460 0 my $left = $i;
6461 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6462 0 $i++;
6463 }
6464 0 while (1) {
6465 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6466 0 die __FILE__, ": Unmatched [] in regexp\n";
6467 }
6468 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6469 0 my $right = $i;
6470  
6471 # [^...]
6472 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
6473 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Etis620::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
6474 }
6475 else {
6476 0 splice @char, $left, $right-$left+1, Etis620::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6477 }
6478  
6479 0 $i = $left;
6480 0 last;
6481 }
6482 }
6483 }
6484  
6485 # rewrite character class or escape character
6486 elsif (my $char = character_class($char[$i],$modifier)) {
6487 7 $char[$i] = $char;
6488 }
6489  
6490 # /i modifier
6491 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Etis620::uc($char[$i]) ne Etis620::fc($char[$i]))) {
Condition66%4/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Etis620::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 &Etis620::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Etis620::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= &Etis620::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6492 3 ▶ if (CORE::length(Etis620::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 3 0 3
6493 3 $char[$i] = '[' . Etis620::uc($char[$i]) . Etis620::fc($char[$i]) . ']';
6494 }
6495 else {
6496 0 $char[$i] = '(?:' . Etis620::uc($char[$i]) . '|' . Etis620::fc($char[$i]) . ')';
6497 }
6498 }
6499  
6500 # \u \l \U \L \F \Q \E
6501 elsif ($char[$i] =~ /\A [<>] \z/oxms) {
6502 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
6503 0 $char[$i] = '\\' . $char[$i];
6504 }
6505 }
6506 elsif ($char[$i] eq '\u') {
6507 0 $char[$i] = '@{[Etis620::ucfirst qq<';
6508 0 $left_e++;
6509 }
6510 elsif ($char[$i] eq '\l') {
6511 0 $char[$i] = '@{[Etis620::lcfirst qq<';
6512 0 $left_e++;
6513 }
6514 elsif ($char[$i] eq '\U') {
6515 0 $char[$i] = '@{[Etis620::uc qq<';
6516 0 $left_e++;
6517 }
6518 elsif ($char[$i] eq '\L') {
6519 0 $char[$i] = '@{[Etis620::lc qq<';
6520 0 $left_e++;
6521 }
6522 elsif ($char[$i] eq '\F') {
6523 0 $char[$i] = '@{[Etis620::fc qq<';
6524 0 $left_e++;
6525 }
6526 elsif ($char[$i] eq '\Q') {
6527 0 $char[$i] = '@{[CORE::quotemeta qq<';
6528 0 $left_e++;
6529 }
6530 elsif ($char[$i] eq '\E') {
6531 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
6532 0 $char[$i] = '>]}';
6533 0 $right_e++;
6534 }
6535 else {
6536 0 $char[$i] = '';
6537 }
6538 }
6539 elsif ($char[$i] eq '\Q') {
6540 0 while (1) {
6541 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6542 0 last;
6543 }
6544 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
6545 0 last;
6546 }
6547 }
6548 }
6549 elsif ($char[$i] eq '\E') {
6550 }
6551  
6552 # \0 --> \0
6553 elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/oxms) {
6554 }
6555  
6556 # \g{N}, \g{-N}
6557  
6558 # P.108 Using Simple Patterns
6559 # in Chapter 7: In the World of Regular Expressions
6560 # of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition
6561  
6562 # P.221 Capturing
6563 # in Chapter 5: Pattern Matching
6564 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6565  
6566 # \g{-1}, \g{-2}, \g{-3} --> \g{-1}, \g{-2}, \g{-3}
6567 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6568 }
6569  
6570 # \g{1}, \g{2}, \g{3} --> \g{2}, \g{3}, \g{4} (only when multibyte anchoring is enable)
6571 elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6572 }
6573  
6574 # \g1, \g2, \g3 --> \g2, \g3, \g4 (only when multibyte anchoring is enable)
6575 elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6576 }
6577  
6578 # \1, \2, \3 --> \2, \3, \4 (only when multibyte anchoring is enable)
6579 elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) {
6580 }
6581  
6582 # $0 --> $0
6583 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
6584 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6585 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
6586 }
6587 }
6588 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
6589 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6590 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
6591 }
6592 }
6593  
6594 # $$ --> $$
6595 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
6596 }
6597  
6598 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
6599 # $1, $2, $3 --> $1, $2, $3 otherwise
6600 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
6601 0 $char[$i] = e_capture($1);
6602 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6603 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
6604 }
6605 }
6606 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
6607 0 $char[$i] = e_capture($1);
6608 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6609 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
6610 }
6611 }
6612  
6613 # $$foo[ ... ] --> $ $foo->[ ... ]
6614 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
6615 0 $char[$i] = e_capture($1.'->'.$2);
6616 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6617 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
6618 }
6619 }
6620  
6621 # $$foo{ ... } --> $ $foo->{ ... }
6622 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
6623 0 $char[$i] = e_capture($1.'->'.$2);
6624 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6625 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
6626 }
6627 }
6628  
6629 # $$foo
6630 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
6631 0 $char[$i] = e_capture($1);
6632 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6633 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
6634 }
6635 }
6636  
6637 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Etis620::PREMATCH()
6638 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
6639 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6640 0 $char[$i] = '@{[Etis620::ignorecase(Etis620::PREMATCH())]}';
6641 }
6642 else {
6643 4 $char[$i] = '@{[Etis620::PREMATCH()]}';
6644 }
6645 }
6646  
6647 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Etis620::MATCH()
6648 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
6649 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 4 4
6650 0 $char[$i] = '@{[Etis620::ignorecase(Etis620::MATCH())]}';
6651 }
6652 else {
6653 4 $char[$i] = '@{[Etis620::MATCH()]}';
6654 }
6655 }
6656  
6657 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Etis620::POSTMATCH()
6658 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
6659 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 3 3
6660 0 $char[$i] = '@{[Etis620::ignorecase(Etis620::POSTMATCH())]}';
6661 }
6662 else {
6663 3 $char[$i] = '@{[Etis620::POSTMATCH()]}';
6664 }
6665 }
6666  
6667 # ${ foo }
6668 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
6669 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6670 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
6671 }
6672 }
6673  
6674 # ${ ... }
6675 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
6676 0 $char[$i] = e_capture($1);
6677 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
6678 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
6679 }
6680 }
6681  
6682 # $scalar or @array
6683 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
6684 4 $char[$i] = e_string($char[$i]);
6685 4 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 4 4
6686 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
6687 }
6688 }
6689  
6690 # quote character before ? + * {
6691 ▶ 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
6692 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
6693 }
6694 else {
6695 14 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6696 }
6697 }
6698 }
6699  
6700 # make regexp string
6701 72 my $prematch = '';
6702 72 $modifier =~ tr/i//d;
6703 72 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 72 72
6704 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier;
6705 }
6706 72 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6707 }
6708  
6709 #
6710 # escape regexp (s'here'' or s'here''b)
6711 #
6712 21 ▶sub e_s1_q {
Subroutine e_s1_q: called CC=7 SCAR=24.3
Pod undocumented
6713 21 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6714 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
6715  
6716 21 $modifier =~ tr/p//d;
6717 21 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 21 21
6718 0 my $line = 0;
6719 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6720 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6721 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6722 0 last;
6723 }
6724 }
6725 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6726 }
6727  
6728 21 $slash = 'div';
6729  
6730 # literal null string pattern
6731 21 ▶ if ($string eq '') {
Branch: 2 branches
BranchTrueFalseTotal
if ($string eq '') { } 8 13 21
elsif ($modifier =~ tr/Bb//d) { } 0 13 13
6732 8 $modifier =~ tr/bB//d;
6733 8 $modifier =~ tr/i//d;
6734 8 return join '', $ope, $delimiter, $end_delimiter, $modifier;
6735 }
6736  
6737 # with /b /B modifier
6738 elsif ($modifier =~ tr/bB//d) {
6739 0 return e_s1_qb($ope,$delimiter,$end_delimiter,$string,$modifier);
6740 }
6741  
6742 # without /b /B modifier
6743 else {
6744 13 return e_s1_qt($ope,$delimiter,$end_delimiter,$string,$modifier);
6745 }
6746 }
6747  
6748 #
6749 # escape regexp (s'here'')
6750 #
6751 13 ▶sub e_s1_qt {
Subroutine e_s1_qt: called CC=20 SCAR=50.1
Pod undocumented
6752 13 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6753  
6754 13 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 13 13
6755  
6756 # split regexp
6757 13 my @char = $string =~ /\G((?>
6758 [^\\\[\$\@\/] |
6759 [\x00-\xFF] |
6760 \[\^ |
6761 \[\: (?>[a-z]+) \:\] |
6762 \[\:\^ (?>[a-z]+) \:\] |
6763 [\$\@\/] |
6764 \\ (?:$q_char) |
6765 (?:$q_char)
6766 ))/oxmsg;
6767  
6768 # unescape character
6769 13 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 25 13 38
6770 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 &Etis620::uc($char[$i]) ne &fc($char[$i])) { } 0 19 19
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 32 32
6771 }
6772  
6773 # open character class [...]
6774 elsif ($char[$i] eq '[') {
6775 0 my $left = $i;
6776 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6777 0 $i++;
6778 }
6779 0 while (1) {
6780 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6781 0 die __FILE__, ": Unmatched [] in regexp\n";
6782 }
6783 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6784 0 my $right = $i;
6785  
6786 # [...]
6787 0 splice @char, $left, $right-$left+1, Etis620::charlist_qr(@char[$left+1..$right-1], $modifier);
6788  
6789 0 $i = $left;
6790 0 last;
6791 }
6792 }
6793 }
6794  
6795 # open character class [^...]
6796 elsif ($char[$i] eq '[^') {
6797 0 my $left = $i;
6798 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
6799 0 $i++;
6800 }
6801 0 while (1) {
6802 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
6803 0 die __FILE__, ": Unmatched [] in regexp\n";
6804 }
6805 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
6806 0 my $right = $i;
6807  
6808 # [^...]
6809 0 splice @char, $left, $right-$left+1, Etis620::charlist_not_qr(@char[$left+1..$right-1], $modifier);
6810  
6811 0 $i = $left;
6812 0 last;
6813 }
6814 }
6815 }
6816  
6817 # escape $ @ / and \
6818 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6819 0 $char[$i] = '\\' . $char[$i];
6820 }
6821  
6822 # rewrite character class or escape character
6823 elsif (my $char = character_class($char[$i],$modifier)) {
6824 6 $char[$i] = $char;
6825 }
6826  
6827 # /i modifier
6828 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Etis620::uc($char[$i]) ne Etis620::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Etis620::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 &Etis620::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Etis620::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= &Etis620::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
6829 0 ▶ if (CORE::length(Etis620::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
6830 0 $char[$i] = '[' . Etis620::uc($char[$i]) . Etis620::fc($char[$i]) . ']';
6831 }
6832 else {
6833 0 $char[$i] = '(?:' . Etis620::uc($char[$i]) . '|' . Etis620::fc($char[$i]) . ')';
6834 }
6835 }
6836  
6837 # quote character before ? + * {
6838 ▶ 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
6839 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
6840 }
6841 else {
6842 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
6843 }
6844 }
6845 }
6846  
6847 13 $modifier =~ tr/i//d;
6848 13 $delimiter = '/';
6849 13 $end_delimiter = '/';
6850 13 my $prematch = '';
6851 13 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6852 }
6853  
6854 #
6855 # escape regexp (s'here''b)
6856 #
6857 0 ▶sub e_s1_qb {
Subroutine e_s1_qb: not called CC=4 SCAR=30.0
Pod undocumented
6858 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
6859  
6860 # split regexp
6861 0 my @char = $string =~ /\G (?>[^\\]|\\\\) /oxmsg;
6862  
6863 # unescape character
6864 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
6865 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
6866 }
6867  
6868 # remain \\
6869 elsif ($char[$i] eq '\\\\') {
6870 }
6871  
6872 # escape $ @ / and \
6873 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6874 0 $char[$i] = '\\' . $char[$i];
6875 }
6876 }
6877  
6878 0 $delimiter = '/';
6879 0 $end_delimiter = '/';
6880 0 my $prematch = '';
6881 0 return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier;
6882 }
6883  
6884 #
6885 # escape regexp (s''here')
6886 #
6887 16 ▶sub e_s2_q {
Subroutine e_s2_q: called CC=4 SCAR=13.9
Pod undocumented
6888 16 my($ope,$delimiter,$end_delimiter,$string) = @_;
6889  
6890 16 $slash = 'div';
6891  
6892 16 my @char = $string =~ / \G (?>[^\\]|\\\\|$q_char) /oxmsg;
6893 16 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 9 16 25
6894 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
6895 }
6896  
6897 # not escape \\
6898 elsif ($char[$i] =~ /\A \\\\ \z/oxms) {
6899 }
6900  
6901 # escape $ @ / and \
6902 elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) {
6903 5 $char[$i] = '\\' . $char[$i];
6904 }
6905 }
6906  
6907 16 return join '', $ope, $delimiter, @char, $end_delimiter;
6908 }
6909  
6910 #
6911 # escape regexp (s/here/and here/modifier)
6912 #
6913 101 ▶sub e_sub {
Subroutine e_sub: called CC=20 SCAR=32.6
Pod undocumented
6914 101 my($variable,$delimiter1,$pattern,$end_delimiter1,$delimiter2,$replacement,$end_delimiter2,$modifier) = @_;
6915 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
6916  
6917 101 $modifier =~ tr/p//d;
6918 101 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 101 101
6919 0 my $line = 0;
6920 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
6921 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
6922 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
6923 0 last;
6924 }
6925 }
6926 0 die qq{Unsupported modifier "$1" used at line $line.\n};
6927 }
6928  
6929 101 ▶ if ($variable eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($variable eq "") 36 65 101
6930 36 $variable = '$_';
6931 36 $bind_operator = ' =~ ';
6932 }
6933  
6934 101 $slash = 'div';
6935  
6936 # P.128 Start of match (or end of previous match): \G
6937 # P.130 Advanced Use of \G with Perl
6938 # in Chapter 3: Overview of Regular Expression Features and Flavors
6939 # P.312 Iterative Matching: Scalar Context, with /g
6940 # in Chapter 7: Perl
6941 # of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition
6942  
6943 # P.181 Where You Left Off: The \G Assertion
6944 # in Chapter 5: Pattern Matching
6945 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
6946  
6947 # P.220 Where You Left Off: The \G Assertion
6948 # in Chapter 5: Pattern Matching
6949 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
6950  
6951 101 my $e_modifier = $modifier =~ tr/e//d;
6952 101 my $r_modifier = $modifier =~ tr/r//d;
6953  
6954 101 my $my = '';
6955 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
6956 0 $my = $variable;
6957 0 $variable =~ s/ (?: local \b | my \b | our \b | state \b ) (?>\s*) //oxms;
6958 0 $variable =~ s/ = .+ \z//oxms;
6959 }
6960  
6961 101 (my $variable_basename = $variable) =~ s/ [\[\{].* \z//oxms;
6962 101 $variable_basename =~ s/ \s+ \z//oxms;
6963  
6964 # quote replacement string
6965 101 my $e_replacement = '';
6966 101 ▶ if ($e_modifier >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($e_modifier >= 1) { } 17 84 101
6967 17 $e_replacement = e_qq('', '', '', $replacement);
6968 17 $e_modifier--;
6969 }
6970 else {
6971 84 ▶ if ($delimiter2 eq "'") {
Branch: 1 branch
BranchTrueFalseTotal
if ($delimiter2 eq q[']) { } 16 68 84
6972 16 $e_replacement = e_s2_q('qq', '/', '/', $replacement);
6973 }
6974 else {
6975 68 $e_replacement = e_qq ('qq', $delimiter2, $end_delimiter2, $replacement);
6976 }
6977 }
6978  
6979 101 my $sub = '';
6980  
6981 # with /r
6982 101 ▶ if ($r_modifier) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r_modifier) { } 10 91 101
6983 10 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 5 5 10
6984 }
6985  
6986 # s///gr without multibyte anchoring
6987 elsif ($modifier =~ /g/oxms) {
6988 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
6989 # 1 2 3 4 5
6990 q<CORE::eval{local $Etis620::re_t=%s; while($Etis620::re_t =~ %s){%s local $^W=0; local $Etis620::re_r=%s; %s$Etis620::re_t="$`$Etis620::re_r$'"; pos($Etis620::re_t)=length "$`$Etis620::re_r"; } return $Etis620::re_t}>,
6991  
6992 $variable, # 1
6993 ($delimiter1 eq "'") ? # 2
6994 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
6995 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
6996 $s_matched, # 3
6997 $e_replacement, # 4
6998 '$Etis620::re_r=CORE::eval $Etis620::re_r; ' x $e_modifier, # 5
6999 );
7000 }
7001  
7002 # s///r
7003 else {
7004  
7005 5 my $prematch = q{$`};
7006  
7007 5 ▶ $sub = sprintf(
Branch: 1 branch
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 0 5 5
7008 # 1 2 3 4 5 6 7
7009 q<(%s =~ %s) ? CORE::eval{%s local $^W=0; local $Etis620::re_r=%s; %s"%s$Etis620::re_r$'" } : %s>,
7010  
7011 $variable, # 1
7012 ($delimiter1 eq "'") ? # 2
7013 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7014 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7015 $s_matched, # 3
7016 $e_replacement, # 4
7017 '$Etis620::re_r=CORE::eval $Etis620::re_r; ' x $e_modifier, # 5
7018 $prematch, # 6
7019 $variable, # 7
7020 );
7021 }
7022  
7023 # $var !~ s///r doesn't make sense
7024 10 ▶ if ($bind_operator =~ / !~ /oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bind_operator =~ / !~ /mosx) 0 10 10
7025 0 $sub = q{die("$0: Using !~ with s///r doesn't make sense"), } . $sub;
7026 }
7027 }
7028  
7029 # without /r
7030 else {
7031 91 ▶ if (0) {
Branch: 1 branch
BranchTrueFalseTotal
if (do { $modifier =~ /g/mosx }) { } 23 68 91
7032 }
7033  
7034 # s///g without multibyte anchoring
7035 elsif ($modifier =~ /g/oxms) {
7036 23 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$delimiter1 eq q['] ? : 3 20 23
$bind_operator =~ / !~ /mosx ? : 3 20 23
7037 # 1 2 3 4 5 6 7 8
7038 q<CORE::eval{local $Etis620::re_n=0; while(%s =~ %s){%s local $^W=0; local $Etis620::re_r=%s; %s%s="$`$Etis620::re_r$'"; pos(%s)=length "$`$Etis620::re_r"; $Etis620::re_n++} return %s$Etis620::re_n}>,
7039  
7040 $variable, # 1
7041 ($delimiter1 eq "'") ? # 2
7042 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7043 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7044 $s_matched, # 3
7045 $e_replacement, # 4
7046 '$Etis620::re_r=CORE::eval $Etis620::re_r; ' x $e_modifier, # 5
7047 $variable, # 6
7048 $variable, # 7
7049 ($bind_operator =~ / !~ /oxms) ? '!' : '', # 8
7050 );
7051 }
7052  
7053 # s///
7054 else {
7055  
7056 68 my $prematch = q{$`};
7057  
7058 68 ▶ $sub = sprintf(
Branch: 2 branches
BranchTrueFalseTotal
$bind_operator =~ / =~ /mosx ? : 65 3 68
$delimiter1 eq q['] ? : 18 50 68
7059  
7060 ($bind_operator =~ / =~ /oxms) ?
7061  
7062 # 1 2 3 4 5 6 7 8
7063 q<(%s%s%s) ? CORE::eval{%s local $^W=0; local $Etis620::re_r=%s; %s%s="%s$Etis620::re_r$'"; 1 } : undef> :
7064  
7065 # 1 2 3 4 5 6 7 8
7066 q<(%s%s%s) ? 1 : CORE::eval{%s local $^W=0; local $Etis620::re_r=%s; %s%s="%s$Etis620::re_r$'"; undef }>,
7067  
7068 $variable, # 1
7069 $bind_operator, # 2
7070 ($delimiter1 eq "'") ? # 3
7071 e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # :
7072 e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # :
7073 $s_matched, # 4
7074 $e_replacement, # 5
7075 '$Etis620::re_r=CORE::eval $Etis620::re_r; ' x $e_modifier, # 6
7076 $variable, # 7
7077 $prematch, # 8
7078 );
7079 }
7080 }
7081  
7082 # (my $foo = $bar) =~ s/// --> (my $foo = $bar, CORE::eval { ... })[1]
7083 101 ▶ if ($my ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($my ne "") 0 101 101
7084 0 $sub = "($my, $sub)[1]";
7085 }
7086  
7087 # clear s/// variable
7088 101 $sub_variable = '';
7089 101 $bind_operator = '';
7090  
7091 101 return $sub;
7092 }
7093  
7094 #
7095 # escape regexp of split qr//
7096 #
7097 74 ▶sub e_split {
Subroutine e_split: called CC=88 SCAR=76.4
Pod undocumented
7098 74 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7099 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
7100  
7101 74 $modifier =~ tr/p//d;
7102 74 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 74 74
7103 0 my $line = 0;
7104 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7105 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7106 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7107 0 last;
7108 }
7109 }
7110 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7111 }
7112  
7113 74 $slash = 'div';
7114  
7115 # /b /B modifier
7116 74 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 74 74
7117 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7118 }
7119  
7120 74 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 74 74
7121 74 my $metachar = qr/[\@\\|[\]{^]/oxms;
7122  
7123 # split regexp
7124 74 my @char = $string =~ /\G((?>
7125 [^\\\$\@\[\(] |
7126 \\x (?>[0-9A-Fa-f]{1,2}) |
7127 \\ (?>[0-7]{2,3}) |
7128 \\c [\x40-\x5F] |
7129 \\x\{ (?>[0-9A-Fa-f]+) \} |
7130 \\o\{ (?>[0-7]+) \} |
7131 \\[bBNpP]\{ (?>[^0-9\}][^\}]*) \} |
7132 \\ $q_char |
7133 \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} |
7134 \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} |
7135 \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} |
7136 [\$\@] $qq_variable |
7137 \$ (?>\s* [0-9]+) |
7138 \$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} |
7139 \$ \$ (?![\w\{]) |
7140 \$ (?>\s*) \$ (?>\s*) $qq_variable |
7141 \[\^ |
7142 \[\: (?>[a-z]+) :\] |
7143 \[\:\^ (?>[a-z]+) :\] |
7144 \(\? |
7145 $q_char
7146 ))/oxmsg;
7147  
7148 74 my $left_e = 0;
7149 74 my $right_e = 0;
7150 74 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 249 74 323
7151  
7152 # "\L\u" --> "\u\L"
7153 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
7154 0 @char[$i,$i+1] = @char[$i+1,$i];
7155 }
7156  
7157 # "\U\l" --> "\l\U"
7158 ▶ 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
7159 0 @char[$i,$i+1] = @char[$i+1,$i];
7160 }
7161  
7162 # octal escape sequence
7163 elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) {
7164 1 $char[$i] = Etis620::octchr($1);
7165 }
7166  
7167 # hexadecimal escape sequence
7168 elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) {
7169 1 $char[$i] = Etis620::hexchr($1);
7170 }
7171  
7172 # \b{...} --> b\{...}
7173 # \B{...} --> B\{...}
7174 # \N{CHARNAME} --> N\{CHARNAME}
7175 # \p{PROPERTY} --> p\{PROPERTY}
7176 # \P{PROPERTY} --> P\{PROPERTY}
7177 elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^0-9\}][^\}]*) \} ) \z/oxms) {
7178 0 $char[$i] = $1 . '\\' . $2;
7179 }
7180  
7181 # \p, \P, \X --> p, P, X
7182 elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) {
7183 0 $char[$i] = $1;
7184 }
7185  
7186 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 &Etis620::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
7187 }
7188  
7189 # join separated multiple-octet
7190 elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) {
7191 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 $Etis620::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 $Etis620::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 $Etis620::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 $Etis620::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 $Etis620::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 $Etis620::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 $Etis620::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
7192 0 $char[$i] .= join '', splice @char, $i+1, 3;
7193 }
7194 ▶ 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 $Etis620::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 $Etis620::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 $Etis620::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 $Etis620::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
7195 0 $char[$i] .= join '', splice @char, $i+1, 2;
7196 }
7197 ▶ 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 $Etis620::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 $Etis620::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 $Etis620::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 $Etis620::q_char \z/mosx
ABCresult
0XX0
10X0
1100
1111
7198 0 $char[$i] .= join '', splice @char, $i+1, 1;
7199 }
7200 }
7201  
7202 # open character class [...]
7203 elsif ($char[$i] eq '[') {
7204 3 my $left = $i;
7205 3 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 3 3
7206 0 $i++;
7207 }
7208 3 while (1) {
7209 7 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 7 7
7210 0 die __FILE__, ": Unmatched [] in regexp\n";
7211 }
7212 7 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 3 4 7
7213 3 my $right = $i;
7214  
7215 # [...]
7216 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
7217 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Etis620::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
7218 }
7219 else {
7220 3 splice @char, $left, $right-$left+1, Etis620::charlist_qr(@char[$left+1..$right-1], $modifier);
7221 }
7222  
7223 3 $i = $left;
7224 3 last;
7225 }
7226 }
7227 }
7228  
7229 # open character class [^...]
7230 elsif ($char[$i] eq '[^') {
7231 0 my $left = $i;
7232 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7233 0 $i++;
7234 }
7235 0 while (1) {
7236 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7237 0 die __FILE__, ": Unmatched [] in regexp\n";
7238 }
7239 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7240 0 my $right = $i;
7241  
7242 # [^...]
7243 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
7244 0 splice @char, $left, $right-$left+1, sprintf(q{@{[Etis620::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier);
7245 }
7246 else {
7247 0 splice @char, $left, $right-$left+1, Etis620::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7248 }
7249  
7250 0 $i = $left;
7251 0 last;
7252 }
7253 }
7254 }
7255  
7256 # rewrite character class or escape character
7257 elsif (my $char = character_class($char[$i],$modifier)) {
7258 1 $char[$i] = $char;
7259 }
7260  
7261 # P.794 29.2.161. split
7262 # in Chapter 29: Functions
7263 # of ISBN 0-596-00027-8 Programming Perl Third Edition.
7264  
7265 # P.951 split
7266 # in Chapter 27: Functions
7267 # of ISBN 978-0-596-00492-7 Programming Perl 4th Edition.
7268  
7269 # said "The //m modifier is assumed when you split on the pattern /^/",
7270 # but perl5.008 is not so. Therefore, this software adds //m.
7271 # (and so on)
7272  
7273 # split(m/^/) --> split(m/^/m)
7274 ▶ 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
7275 7 $modifier .= 'm';
7276 }
7277  
7278 # /i modifier
7279 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Etis620::uc($char[$i]) ne Etis620::fc($char[$i]))) {
Condition33%2/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Etis620::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 &Etis620::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Etis620::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= &Etis620::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7280 0 ▶ if (CORE::length(Etis620::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7281 0 $char[$i] = '[' . Etis620::uc($char[$i]) . Etis620::fc($char[$i]) . ']';
7282 }
7283 else {
7284 0 $char[$i] = '(?:' . Etis620::uc($char[$i]) . '|' . Etis620::fc($char[$i]) . ')';
7285 }
7286 }
7287  
7288 # \u \l \U \L \F \Q \E
7289 elsif ($char[$i] =~ /\A ([<>]) \z/oxms) {
7290 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) 0 0 0
7291 0 $char[$i] = '\\' . $char[$i];
7292 }
7293 }
7294 elsif ($char[$i] eq '\u') {
7295 0 $char[$i] = '@{[Etis620::ucfirst qq<';
7296 0 $left_e++;
7297 }
7298 elsif ($char[$i] eq '\l') {
7299 0 $char[$i] = '@{[Etis620::lcfirst qq<';
7300 0 $left_e++;
7301 }
7302 elsif ($char[$i] eq '\U') {
7303 0 $char[$i] = '@{[Etis620::uc qq<';
7304 0 $left_e++;
7305 }
7306 elsif ($char[$i] eq '\L') {
7307 0 $char[$i] = '@{[Etis620::lc qq<';
7308 0 $left_e++;
7309 }
7310 elsif ($char[$i] eq '\F') {
7311 0 $char[$i] = '@{[Etis620::fc qq<';
7312 0 $left_e++;
7313 }
7314 elsif ($char[$i] eq '\Q') {
7315 0 $char[$i] = '@{[CORE::quotemeta qq<';
7316 0 $left_e++;
7317 }
7318 elsif ($char[$i] eq '\E') {
7319 0 ▶ if ($right_e < $left_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($right_e < $left_e) { } 0 0 0
7320 0 $char[$i] = '>]}';
7321 0 $right_e++;
7322 }
7323 else {
7324 0 $char[$i] = '';
7325 }
7326 }
7327 elsif ($char[$i] eq '\Q') {
7328 0 while (1) {
7329 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7330 0 last;
7331 }
7332 0 ▶ if ($char[$i] eq '\E') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "\\E") 0 0 0
7333 0 last;
7334 }
7335 }
7336 }
7337 elsif ($char[$i] eq '\E') {
7338 }
7339  
7340 # $0 --> $0
7341 elsif ($char[$i] =~ /\A \$ 0 \z/oxms) {
7342 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7343 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
7344 }
7345 }
7346 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) {
7347 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7348 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
7349 }
7350 }
7351  
7352 # $$ --> $$
7353 elsif ($char[$i] =~ /\A \$\$ \z/oxms) {
7354 }
7355  
7356 # $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring
7357 # $1, $2, $3 --> $1, $2, $3 otherwise
7358 elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) {
7359 0 $char[$i] = e_capture($1);
7360 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7361 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
7362 }
7363 }
7364 elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) {
7365 0 $char[$i] = e_capture($1);
7366 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7367 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
7368 }
7369 }
7370  
7371 # $$foo[ ... ] --> $ $foo->[ ... ]
7372 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) {
7373 0 $char[$i] = e_capture($1.'->'.$2);
7374 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7375 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
7376 }
7377 }
7378  
7379 # $$foo{ ... } --> $ $foo->{ ... }
7380 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) {
7381 0 $char[$i] = e_capture($1.'->'.$2);
7382 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7383 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
7384 }
7385 }
7386  
7387 # $$foo
7388 elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) {
7389 0 $char[$i] = e_capture($1);
7390 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7391 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
7392 }
7393 }
7394  
7395 # $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Etis620::PREMATCH()
7396 elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) {
7397 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7398 0 $char[$i] = '@{[Etis620::ignorecase(Etis620::PREMATCH())]}';
7399 }
7400 else {
7401 12 $char[$i] = '@{[Etis620::PREMATCH()]}';
7402 }
7403 }
7404  
7405 # $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Etis620::MATCH()
7406 elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) {
7407 12 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 12 12
7408 0 $char[$i] = '@{[Etis620::ignorecase(Etis620::MATCH())]}';
7409 }
7410 else {
7411 12 $char[$i] = '@{[Etis620::MATCH()]}';
7412 }
7413 }
7414  
7415 # $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Etis620::POSTMATCH()
7416 elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) {
7417 9 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) { } 0 9 9
7418 0 $char[$i] = '@{[Etis620::ignorecase(Etis620::POSTMATCH())]}';
7419 }
7420 else {
7421 9 $char[$i] = '@{[Etis620::POSTMATCH()]}';
7422 }
7423 }
7424  
7425 # ${ foo }
7426 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) {
7427 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7428 0 $char[$i] = '@{[Etis620::ignorecase(' . $1 . ')]}';
7429 }
7430 }
7431  
7432 # ${ ... }
7433 elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) {
7434 0 $char[$i] = e_capture($1);
7435 0 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 0 0
7436 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
7437 }
7438 }
7439  
7440 # $scalar or @array
7441 elsif ($char[$i] =~ /\A [\$\@].+ /oxms) {
7442 3 $char[$i] = e_string($char[$i]);
7443 3 ▶ if ($ignorecase) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ignorecase) 0 3 3
7444 0 $char[$i] = '@{[Etis620::ignorecase(' . $char[$i] . ')]}';
7445 }
7446 }
7447  
7448 # quote character before ? + * {
7449 ▶ 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
7450 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
7451 }
7452 else {
7453 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7454 }
7455 }
7456 }
7457  
7458 # make regexp string
7459 74 $modifier =~ tr/i//d;
7460 74 ▶ if ($left_e > $right_e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left_e > $right_e) 0 74 74
7461 0 return join '', 'Etis620::split', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter, $modifier;
7462 }
7463 74 return join '', 'Etis620::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7464 }
7465  
7466 #
7467 # escape regexp of split qr''
7468 #
7469 0 ▶sub e_split_q {
Subroutine e_split_q: not called CC=26 SCAR=65.5
Pod undocumented
7470 0 my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_;
7471 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
7472  
7473 0 $modifier =~ tr/p//d;
7474 0 ▶ if ($modifier =~ /([adlu])/oxms) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ /([adlu])/mosx) 0 0 0
7475 0 my $line = 0;
7476 0 ▶ for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7477 0 ▶ if ($filename ne __FILE__) {
Branch: 1 branch
BranchTrueFalseTotal
if ($filename ne __FILE__) 0 0 0
7478 0 $line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1;
7479 0 last;
7480 }
7481 }
7482 0 die qq{Unsupported modifier "$1" used at line $line.\n};
7483 }
7484  
7485 0 $slash = 'div';
7486  
7487 # /b /B modifier
7488 0 ▶ if ($modifier =~ tr/bB//d) {
Branch: 1 branch
BranchTrueFalseTotal
if ($modifier =~ tr/Bb//d) 0 0 0
7489 0 return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier;
7490 }
7491  
7492 0 ▶ my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$modifier =~ /i/mosx ? : 0 0 0
7493  
7494 # split regexp
7495 0 my @char = $string =~ /\G((?>
7496 [^\\\[] |
7497 [\x00-\xFF] |
7498 \[\^ |
7499 \[\: (?>[a-z]+) \:\] |
7500 \[\:\^ (?>[a-z]+) \:\] |
7501 \\ (?:$q_char) |
7502 (?:$q_char)
7503 ))/oxmsg;
7504  
7505 # unescape character
7506 0 ▶ for (my $i=0; $i <= $#char; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#char) 0 0 0
7507 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 &Etis620::uc($char[$i]) ne &fc($char[$i])) { } 0 0 0
elsif ($i >= 1 and $char[$i] =~ /\A [\?\+\*\{] \z/mosx) { } 0 0 0
7508 }
7509  
7510 # open character class [...]
7511 elsif ($char[$i] eq '[') {
7512 0 my $left = $i;
7513 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7514 0 $i++;
7515 }
7516 0 while (1) {
7517 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7518 0 die __FILE__, ": Unmatched [] in regexp\n";
7519 }
7520 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7521 0 my $right = $i;
7522  
7523 # [...]
7524 0 splice @char, $left, $right-$left+1, Etis620::charlist_qr(@char[$left+1..$right-1], $modifier);
7525  
7526 0 $i = $left;
7527 0 last;
7528 }
7529 }
7530 }
7531  
7532 # open character class [^...]
7533 elsif ($char[$i] eq '[^') {
7534 0 my $left = $i;
7535 0 ▶ if ($char[$i+1] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i + 1] eq "]") 0 0 0
7536 0 $i++;
7537 }
7538 0 while (1) {
7539 0 ▶ if (++$i > $#char) {
Branch: 1 branch
BranchTrueFalseTotal
if (++$i > $#char) 0 0 0
7540 0 die __FILE__, ": Unmatched [] in regexp\n";
7541 }
7542 0 ▶ if ($char[$i] eq ']') {
Branch: 1 branch
BranchTrueFalseTotal
if ($char[$i] eq "]") 0 0 0
7543 0 my $right = $i;
7544  
7545 # [^...]
7546 0 splice @char, $left, $right-$left+1, Etis620::charlist_not_qr(@char[$left+1..$right-1], $modifier);
7547  
7548 0 $i = $left;
7549 0 last;
7550 }
7551 }
7552 }
7553  
7554 # rewrite character class or escape character
7555 elsif (my $char = character_class($char[$i],$modifier)) {
7556 0 $char[$i] = $char;
7557 }
7558  
7559 # split(m/^/) --> split(m/^/m)
7560 ▶ 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
7561 0 $modifier .= 'm';
7562 }
7563  
7564 # /i modifier
7565 ▶ elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Etis620::uc($char[$i]) ne Etis620::fc($char[$i]))) {
Condition0%0/6
$ignorecase and $char[$i] =~ /\A [\x00-\xFF] \z/mosx and &Etis620::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 &Etis620::uc($char[$i]) ne &fc($char[$i])
$ignorecase $char[$i] =~ /\A [\x00-\xFF] \z/mosx &Etis620::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= &Etis620::uc($char[$i]) ne &fc($char[$i])
ABCresult
0XX0
10X0
1100
1111
7566 0 ▶ if (CORE::length(Etis620::fc($char[$i])) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (length &fc($char[$i]) == 1) { } 0 0 0
7567 0 $char[$i] = '[' . Etis620::uc($char[$i]) . Etis620::fc($char[$i]) . ']';
7568 }
7569 else {
7570 0 $char[$i] = '(?:' . Etis620::uc($char[$i]) . '|' . Etis620::fc($char[$i]) . ')';
7571 }
7572 }
7573  
7574 # quote character before ? + * {
7575 ▶ 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
7576 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
7577 }
7578 else {
7579 0 $char[$i-1] = '(?:' . $char[$i-1] . ')';
7580 }
7581 }
7582 }
7583  
7584 0 $modifier =~ tr/i//d;
7585 0 return join '', 'Etis620::split', $ope, $delimiter, @char, $end_delimiter, $modifier;
7586 }
7587  
7588 #
7589 # instead of Carp::carp
7590 #
7591 0 ▶sub carp {
Subroutine carp: not called CC=1 SCAR=6.9
Pod undocumented
7592 0 my($package,$filename,$line) = caller(1);
7593 0 print STDERR "@_ at $filename line $line.\n";
7594 }
7595  
7596 #
7597 # instead of Carp::croak
7598 #
7599 0 ▶sub croak {
Subroutine croak: not called CC=1 SCAR=6.9
Pod undocumented
7600 0 my($package,$filename,$line) = caller(1);
7601 0 print STDERR "@_ at $filename line $line.\n";
7602 0 die "\n";
7603 }
7604  
7605 #
7606 # instead of Carp::cluck
7607 #
7608 0 ▶sub cluck {
Subroutine cluck: not called CC=2 SCAR=17.9
Pod undocumented
7609 0 my $i = 0;
7610 0 my @cluck = ();
7611 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7612 0 push @cluck, "[$i] $filename($line) $package::$subroutine\n";
7613 0 $i++;
7614 }
7615 0 print STDERR CORE::reverse @cluck;
7616 0 print STDERR "\n";
7617 0 print STDERR @_;
7618 }
7619  
7620 #
7621 # instead of Carp::confess
7622 #
7623 0 ▶sub confess {
Subroutine confess: not called CC=2 SCAR=17.9
Pod undocumented
7624 0 my $i = 0;
7625 0 my @confess = ();
7626 0 ▶ while (my($package,$filename,$line,$subroutine) = caller($i)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = caller $i) 0 0 0
7627 0 push @confess, "[$i] $filename($line) $package::$subroutine\n";
7628 0 $i++;
7629 }
7630 0 print STDERR CORE::reverse @confess;
7631 0 print STDERR "\n";
7632 0 print STDERR @_;
7633 0 die "\n";
7634 }
7635  
7636 422 1;
7637  
7638 __END__
↑ Summary blib/lib/TIS620.pm »