line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Eeucjp; |
2
|
329
|
|
|
329
|
|
2047
|
use strict; |
|
329
|
|
|
|
|
527
|
|
|
329
|
|
|
|
|
9692
|
|
3
|
|
|
|
|
|
|
###################################################################### |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# Eeucjp - Run-time routines for EUCJP.pm |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
# http://search.cpan.org/dist/Char-EUCJP/ |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2018, 2019 INABA Hitoshi |
10
|
|
|
|
|
|
|
###################################################################### |
11
|
|
|
|
|
|
|
|
12
|
329
|
|
|
329
|
|
4582
|
use 5.00503; # Galapagos Consensus 1998 for primetools |
|
329
|
|
|
|
|
1161
|
|
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
|
329
|
|
|
329
|
|
1570
|
use vars qw($VERSION); |
|
329
|
|
|
|
|
573
|
|
|
329
|
|
|
|
|
62634
|
|
28
|
|
|
|
|
|
|
$VERSION = '1.15'; |
29
|
|
|
|
|
|
|
$VERSION = $VERSION; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
BEGIN { |
32
|
329
|
50
|
|
329
|
|
2598
|
if ($^X =~ / jperl /oxmsi) { |
33
|
0
|
|
|
|
|
0
|
die __FILE__, ": needs perl(not jperl) 5.00503 or later. (\$^X==$^X)\n"; |
34
|
|
|
|
|
|
|
} |
35
|
329
|
|
|
|
|
1248
|
if (CORE::ord('A') == 193) { |
36
|
|
|
|
|
|
|
die __FILE__, ": is not US-ASCII script (may be EBCDIC or EBCDIK script).\n"; |
37
|
|
|
|
|
|
|
} |
38
|
329
|
|
|
|
|
47319
|
if (CORE::ord('A') != 0x41) { |
39
|
|
|
|
|
|
|
die __FILE__, ": is not US-ASCII script (must be US-ASCII script).\n"; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
BEGIN { |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# instead of utf8.pm |
46
|
329
|
|
|
329
|
|
25749
|
CORE::eval q{ |
|
329
|
|
|
329
|
|
1963
|
|
|
329
|
|
|
130
|
|
615
|
|
|
329
|
|
|
|
|
57891
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
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
|
329
|
50
|
|
|
|
166446
|
if ($@) { |
56
|
0
|
|
|
|
|
0
|
*utf8::upgrade = sub { CORE::length $_[0] }; |
|
0
|
|
|
|
|
0
|
|
57
|
0
|
|
|
|
|
0
|
*utf8::downgrade = sub { 1 }; |
|
0
|
|
|
|
|
0
|
|
58
|
0
|
|
|
|
|
0
|
*utf8::encode = sub { }; |
59
|
0
|
|
|
|
|
0
|
*utf8::decode = sub { 1 }; |
|
0
|
|
|
|
|
0
|
|
60
|
0
|
|
|
|
|
0
|
*utf8::is_utf8 = sub { }; |
61
|
0
|
|
|
|
|
0
|
*utf8::valid = sub { 1 }; |
|
0
|
|
|
|
|
0
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# instead of Symbol.pm |
66
|
0
|
|
|
|
|
0
|
BEGIN { |
67
|
|
|
|
|
|
|
sub gensym () { |
68
|
0
|
0
|
|
0
|
0
|
0
|
if ($] < 5.006) { |
69
|
0
|
|
|
|
|
0
|
return \do { local *_ }; |
|
0
|
|
|
|
|
0
|
|
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
else { |
72
|
0
|
|
|
|
|
0
|
return undef; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub qualify ($$) { |
77
|
0
|
|
|
0
|
0
|
0
|
my($name) = @_; |
78
|
|
|
|
|
|
|
|
79
|
0
|
0
|
|
|
|
0
|
if (ref $name) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
80
|
0
|
|
|
|
|
0
|
return $name; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
elsif (Eeucjp::index($name,'::') >= 0) { |
83
|
0
|
|
|
|
|
0
|
return $name; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
elsif (Eeucjp::index($name,"'") >= 0) { |
86
|
0
|
|
|
|
|
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
|
|
|
|
|
0
|
$name =~ s{\A \^ ([ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]) }{'qq(\c'.$1.')'}xee; |
|
0
|
|
|
|
|
0
|
|
94
|
0
|
|
|
|
|
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
|
|
|
|
|
0
|
return 'main::' . $name; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
# or other |
103
|
|
|
|
|
|
|
elsif ($name =~ /\A [^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz] \z/x) { |
104
|
0
|
|
|
|
|
0
|
return 'main::' . $name; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
elsif (defined $_[1]) { |
108
|
0
|
|
|
|
|
0
|
return $_[1] . '::' . $name; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
else { |
111
|
0
|
|
|
|
|
0
|
return (caller)[0] . '::' . $name; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub qualify_to_ref ($;$) { |
116
|
0
|
0
|
|
0
|
0
|
0
|
if (defined $_[1]) { |
117
|
329
|
|
|
329
|
|
3454
|
no strict qw(refs); |
|
329
|
|
|
|
|
627
|
|
|
329
|
|
|
|
|
24486
|
|
118
|
0
|
|
|
|
|
0
|
return \*{ qualify $_[0], $_[1] }; |
|
0
|
|
|
|
|
0
|
|
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
else { |
121
|
329
|
|
|
329
|
|
2939
|
no strict qw(refs); |
|
329
|
|
|
0
|
|
668
|
|
|
329
|
|
|
|
|
71225
|
|
122
|
0
|
|
|
|
|
0
|
return \*{ qualify $_[0], (caller)[0] }; |
|
0
|
|
|
|
|
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
|
|
|
|
|
|
|
my $your_char = q{[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF]|[\x00-\xFF]}; |
153
|
329
|
|
|
329
|
|
2296
|
use vars qw($qq_char); $qq_char = qr/\\c[\x40-\x5F]|\\?(?:$your_char)/oxms; |
|
329
|
|
|
|
|
678
|
|
|
329
|
|
|
|
|
21321
|
|
154
|
329
|
|
|
329
|
|
1950
|
use vars qw($q_char); $q_char = qr/$your_char/oxms; |
|
329
|
|
|
|
|
556
|
|
|
329
|
|
|
|
|
391159
|
|
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
# |
157
|
|
|
|
|
|
|
# EUC-JP character range per length |
158
|
|
|
|
|
|
|
# |
159
|
|
|
|
|
|
|
my %range_tr = (); |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
# |
162
|
|
|
|
|
|
|
# EUC-JP case conversion |
163
|
|
|
|
|
|
|
# |
164
|
|
|
|
|
|
|
my %lc = (); |
165
|
|
|
|
|
|
|
@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
|
|
|
|
|
|
|
my %uc = (); |
168
|
|
|
|
|
|
|
@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
|
|
|
|
|
|
|
my %fc = (); |
171
|
|
|
|
|
|
|
@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
|
|
|
|
|
|
|
if (0) { |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
elsif (__PACKAGE__ =~ / \b Eeucjp \z/oxms) { |
178
|
|
|
|
|
|
|
%range_tr = ( |
179
|
|
|
|
|
|
|
1 => [ [0x00..0x8D], |
180
|
|
|
|
|
|
|
[0x90..0xA0], |
181
|
|
|
|
|
|
|
[0xFF..0xFF], |
182
|
|
|
|
|
|
|
], |
183
|
|
|
|
|
|
|
2 => [ [0x8E..0x8E],[0xA1..0xFE], |
184
|
|
|
|
|
|
|
[0xA1..0xFE],[0xA1..0xFE], |
185
|
|
|
|
|
|
|
], |
186
|
|
|
|
|
|
|
3 => [ [0x8F..0x8F],[0xA1..0xFE],[0xA1..0xFE], |
187
|
|
|
|
|
|
|
], |
188
|
|
|
|
|
|
|
); |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
else { |
192
|
|
|
|
|
|
|
croak "Don't know my package name '@{[__PACKAGE__]}'"; |
193
|
|
|
|
|
|
|
} |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
# |
196
|
|
|
|
|
|
|
# @ARGV wildcard globbing |
197
|
|
|
|
|
|
|
# |
198
|
|
|
|
|
|
|
sub import { |
199
|
|
|
|
|
|
|
|
200
|
0
|
0
|
|
0
|
|
0
|
if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/oxms) { |
201
|
0
|
|
|
|
|
0
|
my @argv = (); |
202
|
0
|
|
|
|
|
0
|
for (@ARGV) { |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
# has space |
205
|
0
|
0
|
|
|
|
0
|
if (/\A (?:$q_char)*? [ ] /oxms) { |
|
|
0
|
|
|
|
|
|
206
|
0
|
0
|
|
|
|
0
|
if (my @glob = Eeucjp::glob(qq{"$_"})) { |
207
|
0
|
|
|
|
|
0
|
push @argv, @glob; |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
else { |
210
|
0
|
|
|
|
|
0
|
push @argv, $_; |
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
} |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
# has wildcard metachar |
215
|
|
|
|
|
|
|
elsif (/\A (?:$q_char)*? [*?] /oxms) { |
216
|
0
|
0
|
|
|
|
0
|
if (my @glob = Eeucjp::glob($_)) { |
217
|
0
|
|
|
|
|
0
|
push @argv, @glob; |
218
|
|
|
|
|
|
|
} |
219
|
|
|
|
|
|
|
else { |
220
|
0
|
|
|
|
|
0
|
push @argv, $_; |
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
} |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
# no wildcard globbing |
225
|
|
|
|
|
|
|
else { |
226
|
0
|
|
|
|
|
0
|
push @argv, $_; |
227
|
|
|
|
|
|
|
} |
228
|
|
|
|
|
|
|
} |
229
|
0
|
|
|
|
|
0
|
@ARGV = @argv; |
230
|
|
|
|
|
|
|
} |
231
|
|
|
|
|
|
|
|
232
|
0
|
|
|
|
|
0
|
*Char::ord = \&EUCJP::ord; |
233
|
0
|
|
|
|
|
0
|
*Char::ord_ = \&EUCJP::ord_; |
234
|
0
|
|
|
|
|
0
|
*Char::reverse = \&EUCJP::reverse; |
235
|
0
|
|
|
|
|
0
|
*Char::getc = \&EUCJP::getc; |
236
|
0
|
|
|
|
|
0
|
*Char::length = \&EUCJP::length; |
237
|
0
|
|
|
|
|
0
|
*Char::substr = \&EUCJP::substr; |
238
|
0
|
|
|
|
|
0
|
*Char::index = \&EUCJP::index; |
239
|
0
|
|
|
|
|
0
|
*Char::rindex = \&EUCJP::rindex; |
240
|
0
|
|
|
|
|
0
|
*Char::eval = \&EUCJP::eval; |
241
|
0
|
|
|
|
|
0
|
*Char::escape = \&EUCJP::escape; |
242
|
0
|
|
|
|
|
0
|
*Char::escape_token = \&EUCJP::escape_token; |
243
|
0
|
|
|
|
|
0
|
*Char::escape_script = \&EUCJP::escape_script; |
244
|
|
|
|
|
|
|
} |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
# P.230 Care with Prototypes |
247
|
|
|
|
|
|
|
# in Chapter 6: Subroutines |
248
|
|
|
|
|
|
|
# of ISBN 0-596-00027-8 Programming Perl Third Edition. |
249
|
|
|
|
|
|
|
# |
250
|
|
|
|
|
|
|
# If you aren't careful, you can get yourself into trouble with prototypes. |
251
|
|
|
|
|
|
|
# But if you are careful, you can do a lot of neat things with them. This is |
252
|
|
|
|
|
|
|
# all very powerful, of course, and should only be used in moderation to make |
253
|
|
|
|
|
|
|
# the world a better place. |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
# P.332 Care with Prototypes |
256
|
|
|
|
|
|
|
# in Chapter 7: Subroutines |
257
|
|
|
|
|
|
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
258
|
|
|
|
|
|
|
# |
259
|
|
|
|
|
|
|
# If you aren't careful, you can get yourself into trouble with prototypes. |
260
|
|
|
|
|
|
|
# But if you are careful, you can do a lot of neat things with them. This is |
261
|
|
|
|
|
|
|
# all very powerful, of course, and should only be used in moderation to make |
262
|
|
|
|
|
|
|
# the world a better place. |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
# |
265
|
|
|
|
|
|
|
# Prototypes of subroutines |
266
|
|
|
|
|
|
|
# |
267
|
|
|
|
0
|
|
|
sub unimport {} |
268
|
|
|
|
|
|
|
sub Eeucjp::split(;$$$); |
269
|
|
|
|
|
|
|
sub Eeucjp::tr($$$$;$); |
270
|
|
|
|
|
|
|
sub Eeucjp::chop(@); |
271
|
|
|
|
|
|
|
sub Eeucjp::index($$;$); |
272
|
|
|
|
|
|
|
sub Eeucjp::rindex($$;$); |
273
|
|
|
|
|
|
|
sub Eeucjp::lcfirst(@); |
274
|
|
|
|
|
|
|
sub Eeucjp::lcfirst_(); |
275
|
|
|
|
|
|
|
sub Eeucjp::lc(@); |
276
|
|
|
|
|
|
|
sub Eeucjp::lc_(); |
277
|
|
|
|
|
|
|
sub Eeucjp::ucfirst(@); |
278
|
|
|
|
|
|
|
sub Eeucjp::ucfirst_(); |
279
|
|
|
|
|
|
|
sub Eeucjp::uc(@); |
280
|
|
|
|
|
|
|
sub Eeucjp::uc_(); |
281
|
|
|
|
|
|
|
sub Eeucjp::fc(@); |
282
|
|
|
|
|
|
|
sub Eeucjp::fc_(); |
283
|
|
|
|
|
|
|
sub Eeucjp::ignorecase; |
284
|
|
|
|
|
|
|
sub Eeucjp::classic_character_class; |
285
|
|
|
|
|
|
|
sub Eeucjp::capture; |
286
|
|
|
|
|
|
|
sub Eeucjp::chr(;$); |
287
|
|
|
|
|
|
|
sub Eeucjp::chr_(); |
288
|
|
|
|
|
|
|
sub Eeucjp::glob($); |
289
|
|
|
|
|
|
|
sub Eeucjp::glob_(); |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
sub EUCJP::ord(;$); |
292
|
|
|
|
|
|
|
sub EUCJP::ord_(); |
293
|
|
|
|
|
|
|
sub EUCJP::reverse(@); |
294
|
|
|
|
|
|
|
sub EUCJP::getc(;*@); |
295
|
|
|
|
|
|
|
sub EUCJP::length(;$); |
296
|
|
|
|
|
|
|
sub EUCJP::substr($$;$$); |
297
|
|
|
|
|
|
|
sub EUCJP::index($$;$); |
298
|
|
|
|
|
|
|
sub EUCJP::rindex($$;$); |
299
|
|
|
|
|
|
|
sub EUCJP::escape(;$); |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
# |
302
|
|
|
|
|
|
|
# Regexp work |
303
|
|
|
|
|
|
|
# |
304
|
329
|
|
|
|
|
38526
|
use vars qw( |
305
|
|
|
|
|
|
|
$re_a |
306
|
|
|
|
|
|
|
$re_t |
307
|
|
|
|
|
|
|
$re_n |
308
|
|
|
|
|
|
|
$re_r |
309
|
329
|
|
|
329
|
|
2561
|
); |
|
329
|
|
|
|
|
5004
|
|
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
# |
312
|
|
|
|
|
|
|
# Character class |
313
|
|
|
|
|
|
|
# |
314
|
329
|
|
|
|
|
99041
|
use vars qw( |
315
|
|
|
|
|
|
|
$dot |
316
|
|
|
|
|
|
|
$dot_s |
317
|
|
|
|
|
|
|
$eD |
318
|
|
|
|
|
|
|
$eS |
319
|
|
|
|
|
|
|
$eW |
320
|
|
|
|
|
|
|
$eH |
321
|
|
|
|
|
|
|
$eV |
322
|
|
|
|
|
|
|
$eR |
323
|
|
|
|
|
|
|
$eN |
324
|
|
|
|
|
|
|
$not_alnum |
325
|
|
|
|
|
|
|
$not_alpha |
326
|
|
|
|
|
|
|
$not_ascii |
327
|
|
|
|
|
|
|
$not_blank |
328
|
|
|
|
|
|
|
$not_cntrl |
329
|
|
|
|
|
|
|
$not_digit |
330
|
|
|
|
|
|
|
$not_graph |
331
|
|
|
|
|
|
|
$not_lower |
332
|
|
|
|
|
|
|
$not_lower_i |
333
|
|
|
|
|
|
|
$not_print |
334
|
|
|
|
|
|
|
$not_punct |
335
|
|
|
|
|
|
|
$not_space |
336
|
|
|
|
|
|
|
$not_upper |
337
|
|
|
|
|
|
|
$not_upper_i |
338
|
|
|
|
|
|
|
$not_word |
339
|
|
|
|
|
|
|
$not_xdigit |
340
|
|
|
|
|
|
|
$eb |
341
|
|
|
|
|
|
|
$eB |
342
|
329
|
|
|
329
|
|
4489
|
); |
|
329
|
|
|
|
|
2403
|
|
343
|
|
|
|
|
|
|
|
344
|
329
|
|
|
|
|
4344258
|
use vars qw( |
345
|
|
|
|
|
|
|
$anchor |
346
|
|
|
|
|
|
|
$matched |
347
|
329
|
|
|
329
|
|
4049
|
); |
|
329
|
|
|
|
|
719
|
|
348
|
|
|
|
|
|
|
${Eeucjp::anchor} = qr{\G(?>[^\x8E\x8F\xA1-\xFE]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])*?}oxms; |
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
# unless LONG_STRING_FOR_RE |
351
|
|
|
|
|
|
|
if (1) { |
352
|
|
|
|
|
|
|
} |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
my $q_char_SADAHIRO_Tomoyuki_2002_01_17 = ''; |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
# Quantifiers |
357
|
|
|
|
|
|
|
# {n,m} --- Match at least n but not more than m times |
358
|
|
|
|
|
|
|
# |
359
|
|
|
|
|
|
|
# n and m are limited to non-negative integral values less than a |
360
|
|
|
|
|
|
|
# preset limit defined when perl is built. This is usually 32766 on |
361
|
|
|
|
|
|
|
# the most common platforms. |
362
|
|
|
|
|
|
|
# |
363
|
|
|
|
|
|
|
# The following code is an attempt to solve the above limitations |
364
|
|
|
|
|
|
|
# in a multi-byte anchoring. |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
# avoid "Segmentation fault" and "Error: Parse exception" |
367
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
# perl5101delta |
369
|
|
|
|
|
|
|
# http://perldoc.perl.org/perl5101delta.html |
370
|
|
|
|
|
|
|
# In 5.10.0, the * quantifier in patterns was sometimes treated as {0,32767} |
371
|
|
|
|
|
|
|
# [RT #60034, #60464]. For example, this match would fail: |
372
|
|
|
|
|
|
|
# ("ab" x 32768) =~ /^(ab)*$/ |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
# SEE ALSO |
375
|
|
|
|
|
|
|
# |
376
|
|
|
|
|
|
|
# Complex regular subexpression recursion limit |
377
|
|
|
|
|
|
|
# http://www.perlmonks.org/?node_id=810857 |
378
|
|
|
|
|
|
|
# |
379
|
|
|
|
|
|
|
# regexp iteration limits |
380
|
|
|
|
|
|
|
# http://www.nntp.perl.org/group/perl.perl5.porters/2009/02/msg144065.html |
381
|
|
|
|
|
|
|
# |
382
|
|
|
|
|
|
|
# latest Perl won't match certain regexes more than 32768 characters long |
383
|
|
|
|
|
|
|
# http://stackoverflow.com/questions/26226630/latest-perl-wont-match-certain-regexes-more-than-32768-characters-long |
384
|
|
|
|
|
|
|
# |
385
|
|
|
|
|
|
|
# Break through the limitations of regular expressions of Perl |
386
|
|
|
|
|
|
|
# http://d.hatena.ne.jp/gfx/20110212/1297512479 |
387
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
if (($] >= 5.010001) or |
389
|
|
|
|
|
|
|
# ActivePerl 5.6 or later (include 5.10.0) |
390
|
|
|
|
|
|
|
(defined($ActivePerl::VERSION) and ($ActivePerl::VERSION > 800)) or |
391
|
|
|
|
|
|
|
(($^O eq 'MSWin32') and ($] =~ /\A 5\.006/oxms)) |
392
|
|
|
|
|
|
|
) { |
393
|
|
|
|
|
|
|
my $sbcs = ''; # Single Byte Character Set |
394
|
|
|
|
|
|
|
for my $range (@{ $range_tr{1} }) { |
395
|
|
|
|
|
|
|
$sbcs .= sprintf('\\x%02X-\\x%02X', $range->[0], $range->[-1]); |
396
|
|
|
|
|
|
|
} |
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
if (0) { |
399
|
|
|
|
|
|
|
} |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
# EUC-JP encoding |
402
|
|
|
|
|
|
|
elsif (__PACKAGE__ =~ / \b Eeucjp \z/oxms) { |
403
|
|
|
|
|
|
|
${Eeucjp::q_char_SADAHIRO_Tomoyuki_2002_01_17} = qr{.*?[^\x8E\x8F\xA1-\xFE] (?> [\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\xA1-\xFE] )*?}oxms; |
404
|
|
|
|
|
|
|
# ******************** octets not in multiple octet char (always char boundary) |
405
|
|
|
|
|
|
|
# ************************** 2 octet chars |
406
|
|
|
|
|
|
|
# ************************** 3 octet chars |
407
|
|
|
|
|
|
|
} |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
# other encoding |
410
|
|
|
|
|
|
|
else { |
411
|
|
|
|
|
|
|
${Eeucjp::q_char_SADAHIRO_Tomoyuki_2002_01_17} = qr{.*?[$sbcs](?:[^$sbcs][^$sbcs])*?}oxms; |
412
|
|
|
|
|
|
|
# ******* octets not in multiple octet char (always char boundary) |
413
|
|
|
|
|
|
|
# **************** 2 octet chars |
414
|
|
|
|
|
|
|
} |
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
${Eeucjp::anchor_SADAHIRO_Tomoyuki_2002_01_17} = |
417
|
|
|
|
|
|
|
qr{\G(?(?=.{0,32766}\z)(?:[^\x8E\x8F\xA1-\xFE]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])*?|(?(?=[$sbcs]+\z).*?|(?:${Eeucjp::q_char_SADAHIRO_Tomoyuki_2002_01_17})))}oxms; |
418
|
|
|
|
|
|
|
# qr{ |
419
|
|
|
|
|
|
|
# \G # (1), (2) |
420
|
|
|
|
|
|
|
# (? # (3) |
421
|
|
|
|
|
|
|
# (?=.{0,32766}\z) # (4) |
422
|
|
|
|
|
|
|
# (?:[^\x8E\x8F\xA1-\xFE]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])*?| # (5) |
423
|
|
|
|
|
|
|
# (?(?=[$sbcs]+\z) # (6) |
424
|
|
|
|
|
|
|
# .*?| #(7) |
425
|
|
|
|
|
|
|
# (?:${Eeucjp::q_char_SADAHIRO_Tomoyuki_2002_01_17}) # (8) |
426
|
|
|
|
|
|
|
# ))}oxms; |
427
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
# avoid: Complex regular subexpression recursion limit (32766) exceeded at here. |
429
|
|
|
|
|
|
|
local $^W = 0; |
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
if (((('A' x 32768).'B') !~ / ${Eeucjp::anchor} B /oxms) and |
432
|
|
|
|
|
|
|
((('A' x 32768).'B') =~ / ${Eeucjp::anchor_SADAHIRO_Tomoyuki_2002_01_17} B /oxms) |
433
|
|
|
|
|
|
|
) { |
434
|
|
|
|
|
|
|
${Eeucjp::anchor} = ${Eeucjp::anchor_SADAHIRO_Tomoyuki_2002_01_17}; |
435
|
|
|
|
|
|
|
} |
436
|
|
|
|
|
|
|
else { |
437
|
|
|
|
|
|
|
undef ${Eeucjp::q_char_SADAHIRO_Tomoyuki_2002_01_17}; |
438
|
|
|
|
|
|
|
} |
439
|
|
|
|
|
|
|
} |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
# (1) |
442
|
|
|
|
|
|
|
# P.128 Start of match (or end of previous match): \G |
443
|
|
|
|
|
|
|
# P.130 Advanced Use of \G with Perl |
444
|
|
|
|
|
|
|
# in Chapter3: Over view of Regular Expression Features and Flavors |
445
|
|
|
|
|
|
|
# of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
# (2) |
448
|
|
|
|
|
|
|
# P.255 Use leading anchors |
449
|
|
|
|
|
|
|
# P.256 Expose ^ and \G at the front of expressions |
450
|
|
|
|
|
|
|
# in Chapter6: Crafting an Efficient Expression |
451
|
|
|
|
|
|
|
# of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
# (3) |
454
|
|
|
|
|
|
|
# P.138 Conditional: (? if then| else) |
455
|
|
|
|
|
|
|
# in Chapter3: Over view of Regular Expression Features and Flavors |
456
|
|
|
|
|
|
|
# of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition |
457
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
# (4) |
459
|
|
|
|
|
|
|
# perlre |
460
|
|
|
|
|
|
|
# http://perldoc.perl.org/perlre.html |
461
|
|
|
|
|
|
|
# The "*" quantifier is equivalent to {0,} , the "+" quantifier to {1,} , |
462
|
|
|
|
|
|
|
# and the "?" quantifier to {0,1}, ., n, and m are limited to non-negative |
463
|
|
|
|
|
|
|
# integral values less than a preset limit defined when perl is built. |
464
|
|
|
|
|
|
|
# This is usually 32766 on the most common platforms. The actual limit |
465
|
|
|
|
|
|
|
# can be seen in the error message generated by code such as this: |
466
|
|
|
|
|
|
|
# $_ **= $_ , / {$_} / for 2 .. 42; |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
# (5) |
469
|
|
|
|
|
|
|
# P.1023 Multiple-Byte Anchoring |
470
|
|
|
|
|
|
|
# in Appendix W Perl Code Examples |
471
|
|
|
|
|
|
|
# of ISBN 1-56592-224-7 CJKV Information Processing |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
# (6) |
474
|
|
|
|
|
|
|
# if string has only SBCS (Single Byte Character Set) |
475
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
# (7) |
477
|
|
|
|
|
|
|
# then .*? (isn't limited to 32766) |
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
# (8) |
480
|
|
|
|
|
|
|
# else EUC-JP::Regexp::Const (SADAHIRO Tomoyuki) |
481
|
|
|
|
|
|
|
# http://homepage1.nifty.com/nomenclator/perl/shiftjis.htm#long |
482
|
|
|
|
|
|
|
# http://search.cpan.org/~sadahiro/EUC-JP-Regexp/ |
483
|
|
|
|
|
|
|
# $PadA = ' (?:\A| [\x00-\x80\xA0-\xDF])(?:[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE]{2})*?'; |
484
|
|
|
|
|
|
|
# $PadG = '\G(?: |[\x00-\xFF]*?[\x00-\x80\xA0-\xDF])(?:[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE]{2})*?'; |
485
|
|
|
|
|
|
|
# $PadGA = '\G(?:\A|(?:[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE]{2})+?|[\x00-\xFF]*?[\x00-\x80\xA0-\xDF] (?:[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE]{2})*?)'; |
486
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
${Eeucjp::dot} = qr{(?>[^\x8E\x8F\xA1-\xFE\x0A]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
488
|
|
|
|
|
|
|
${Eeucjp::dot_s} = qr{(?>[^\x8E\x8F\xA1-\xFE]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
489
|
|
|
|
|
|
|
${Eeucjp::eD} = qr{(?>[^\x8E\x8F\xA1-\xFE0-9]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
# Vertical tabs are now whitespace |
492
|
|
|
|
|
|
|
# \s in a regex now matches a vertical tab in all circumstances. |
493
|
|
|
|
|
|
|
# http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace |
494
|
|
|
|
|
|
|
# ${Eeucjp::eS} = qr{(?>[^\x8E\x8F\xA1-\xFE\x09\x0A \x0C\x0D\x20]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
495
|
|
|
|
|
|
|
# ${Eeucjp::eS} = qr{(?>[^\x8E\x8F\xA1-\xFE\x09\x0A\x0B\x0C\x0D\x20]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
496
|
|
|
|
|
|
|
${Eeucjp::eS} = qr{(?>[^\x8E\x8F\xA1-\xFE\s]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
497
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
${Eeucjp::eW} = qr{(?>[^\x8E\x8F\xA1-\xFE0-9A-Z_a-z]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
499
|
|
|
|
|
|
|
${Eeucjp::eH} = qr{(?>[^\x8E\x8F\xA1-\xFE\x09\x20]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
500
|
|
|
|
|
|
|
${Eeucjp::eV} = qr{(?>[^\x8E\x8F\xA1-\xFE\x0A\x0B\x0C\x0D]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
501
|
|
|
|
|
|
|
${Eeucjp::eR} = qr{(?>\x0D\x0A|[\x0A\x0D])}; |
502
|
|
|
|
|
|
|
${Eeucjp::eN} = qr{(?>[^\x8E\x8F\xA1-\xFE\x0A]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
503
|
|
|
|
|
|
|
${Eeucjp::not_alnum} = qr{(?>[^\x8E\x8F\xA1-\xFE\x30-\x39\x41-\x5A\x61-\x7A]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
504
|
|
|
|
|
|
|
${Eeucjp::not_alpha} = qr{(?>[^\x8E\x8F\xA1-\xFE\x41-\x5A\x61-\x7A]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
505
|
|
|
|
|
|
|
${Eeucjp::not_ascii} = qr{(?>[^\x8E\x8F\xA1-\xFE\x00-\x7F]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
506
|
|
|
|
|
|
|
${Eeucjp::not_blank} = qr{(?>[^\x8E\x8F\xA1-\xFE\x09\x20]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
507
|
|
|
|
|
|
|
${Eeucjp::not_cntrl} = qr{(?>[^\x8E\x8F\xA1-\xFE\x00-\x1F\x7F]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
508
|
|
|
|
|
|
|
${Eeucjp::not_digit} = qr{(?>[^\x8E\x8F\xA1-\xFE\x30-\x39]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
509
|
|
|
|
|
|
|
${Eeucjp::not_graph} = qr{(?>[^\x8E\x8F\xA1-\xFE\x21-\x7F]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
510
|
|
|
|
|
|
|
${Eeucjp::not_lower} = qr{(?>[^\x8E\x8F\xA1-\xFE\x61-\x7A]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
511
|
|
|
|
|
|
|
${Eeucjp::not_lower_i} = qr{(?>[^\x8E\x8F\xA1-\xFE\x41-\x5A\x61-\x7A]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; # Perl 5.16 compatible |
512
|
|
|
|
|
|
|
# ${Eeucjp::not_lower_i} = qr{(?>[^\x8E\x8F\xA1-\xFE]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; # older Perl compatible |
513
|
|
|
|
|
|
|
${Eeucjp::not_print} = qr{(?>[^\x8E\x8F\xA1-\xFE\x20-\x7F]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
514
|
|
|
|
|
|
|
${Eeucjp::not_punct} = qr{(?>[^\x8E\x8F\xA1-\xFE\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
515
|
|
|
|
|
|
|
${Eeucjp::not_space} = qr{(?>[^\x8E\x8F\xA1-\xFE\s\x0B]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
516
|
|
|
|
|
|
|
${Eeucjp::not_upper} = qr{(?>[^\x8E\x8F\xA1-\xFE\x41-\x5A]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
517
|
|
|
|
|
|
|
${Eeucjp::not_upper_i} = qr{(?>[^\x8E\x8F\xA1-\xFE\x41-\x5A\x61-\x7A]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; # Perl 5.16 compatible |
518
|
|
|
|
|
|
|
# ${Eeucjp::not_upper_i} = qr{(?>[^\x8E\x8F\xA1-\xFE]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; # older Perl compatible |
519
|
|
|
|
|
|
|
${Eeucjp::not_word} = qr{(?>[^\x8E\x8F\xA1-\xFE\x30-\x39\x41-\x5A\x5F\x61-\x7A]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
520
|
|
|
|
|
|
|
${Eeucjp::not_xdigit} = qr{(?>[^\x8E\x8F\xA1-\xFE\x30-\x39\x41-\x46\x61-\x66]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])}; |
521
|
|
|
|
|
|
|
${Eeucjp::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))}; |
522
|
|
|
|
|
|
|
${Eeucjp::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]))}; |
523
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
# avoid: Name "Eeucjp::foo" used only once: possible typo at here. |
525
|
|
|
|
|
|
|
${Eeucjp::dot} = ${Eeucjp::dot}; |
526
|
|
|
|
|
|
|
${Eeucjp::dot_s} = ${Eeucjp::dot_s}; |
527
|
|
|
|
|
|
|
${Eeucjp::eD} = ${Eeucjp::eD}; |
528
|
|
|
|
|
|
|
${Eeucjp::eS} = ${Eeucjp::eS}; |
529
|
|
|
|
|
|
|
${Eeucjp::eW} = ${Eeucjp::eW}; |
530
|
|
|
|
|
|
|
${Eeucjp::eH} = ${Eeucjp::eH}; |
531
|
|
|
|
|
|
|
${Eeucjp::eV} = ${Eeucjp::eV}; |
532
|
|
|
|
|
|
|
${Eeucjp::eR} = ${Eeucjp::eR}; |
533
|
|
|
|
|
|
|
${Eeucjp::eN} = ${Eeucjp::eN}; |
534
|
|
|
|
|
|
|
${Eeucjp::not_alnum} = ${Eeucjp::not_alnum}; |
535
|
|
|
|
|
|
|
${Eeucjp::not_alpha} = ${Eeucjp::not_alpha}; |
536
|
|
|
|
|
|
|
${Eeucjp::not_ascii} = ${Eeucjp::not_ascii}; |
537
|
|
|
|
|
|
|
${Eeucjp::not_blank} = ${Eeucjp::not_blank}; |
538
|
|
|
|
|
|
|
${Eeucjp::not_cntrl} = ${Eeucjp::not_cntrl}; |
539
|
|
|
|
|
|
|
${Eeucjp::not_digit} = ${Eeucjp::not_digit}; |
540
|
|
|
|
|
|
|
${Eeucjp::not_graph} = ${Eeucjp::not_graph}; |
541
|
|
|
|
|
|
|
${Eeucjp::not_lower} = ${Eeucjp::not_lower}; |
542
|
|
|
|
|
|
|
${Eeucjp::not_lower_i} = ${Eeucjp::not_lower_i}; |
543
|
|
|
|
|
|
|
${Eeucjp::not_print} = ${Eeucjp::not_print}; |
544
|
|
|
|
|
|
|
${Eeucjp::not_punct} = ${Eeucjp::not_punct}; |
545
|
|
|
|
|
|
|
${Eeucjp::not_space} = ${Eeucjp::not_space}; |
546
|
|
|
|
|
|
|
${Eeucjp::not_upper} = ${Eeucjp::not_upper}; |
547
|
|
|
|
|
|
|
${Eeucjp::not_upper_i} = ${Eeucjp::not_upper_i}; |
548
|
|
|
|
|
|
|
${Eeucjp::not_word} = ${Eeucjp::not_word}; |
549
|
|
|
|
|
|
|
${Eeucjp::not_xdigit} = ${Eeucjp::not_xdigit}; |
550
|
|
|
|
|
|
|
${Eeucjp::eb} = ${Eeucjp::eb}; |
551
|
|
|
|
|
|
|
${Eeucjp::eB} = ${Eeucjp::eB}; |
552
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
# |
554
|
|
|
|
|
|
|
# EUC-JP split |
555
|
|
|
|
|
|
|
# |
556
|
|
|
|
|
|
|
sub Eeucjp::split(;$$$) { |
557
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
# P.794 29.2.161. split |
559
|
|
|
|
|
|
|
# in Chapter 29: Functions |
560
|
|
|
|
|
|
|
# of ISBN 0-596-00027-8 Programming Perl Third Edition. |
561
|
|
|
|
|
|
|
|
562
|
|
|
|
|
|
|
# P.951 split |
563
|
|
|
|
|
|
|
# in Chapter 27: Functions |
564
|
|
|
|
|
|
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
565
|
|
|
|
|
|
|
|
566
|
0
|
|
|
0
|
0
|
0
|
my $pattern = $_[0]; |
567
|
0
|
|
|
|
|
0
|
my $string = $_[1]; |
568
|
0
|
|
|
|
|
0
|
my $limit = $_[2]; |
569
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
# if $pattern is also omitted or is the literal space, " " |
571
|
0
|
0
|
|
|
|
0
|
if (not defined $pattern) { |
572
|
0
|
|
|
|
|
0
|
$pattern = ' '; |
573
|
|
|
|
|
|
|
} |
574
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
# if $string is omitted, the function splits the $_ string |
576
|
0
|
0
|
|
|
|
0
|
if (not defined $string) { |
577
|
0
|
0
|
|
|
|
0
|
if (defined $_) { |
578
|
0
|
|
|
|
|
0
|
$string = $_; |
579
|
|
|
|
|
|
|
} |
580
|
|
|
|
|
|
|
else { |
581
|
0
|
|
|
|
|
0
|
$string = ''; |
582
|
|
|
|
|
|
|
} |
583
|
|
|
|
|
|
|
} |
584
|
|
|
|
|
|
|
|
585
|
0
|
|
|
|
|
0
|
my @split = (); |
586
|
|
|
|
|
|
|
|
587
|
|
|
|
|
|
|
# when string is empty |
588
|
0
|
0
|
|
|
|
0
|
if ($string eq '') { |
|
|
0
|
|
|
|
|
|
589
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
# resulting list value in list context |
591
|
0
|
0
|
|
|
|
0
|
if (wantarray) { |
592
|
0
|
|
|
|
|
0
|
return @split; |
593
|
|
|
|
|
|
|
} |
594
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
# count of substrings in scalar context |
596
|
|
|
|
|
|
|
else { |
597
|
0
|
0
|
|
|
|
0
|
carp "Use of implicit split to \@_ is deprecated" if $^W; |
598
|
0
|
|
|
|
|
0
|
@_ = @split; |
599
|
0
|
|
|
|
|
0
|
return scalar @_; |
600
|
|
|
|
|
|
|
} |
601
|
|
|
|
|
|
|
} |
602
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
# split's first argument is more consistently interpreted |
604
|
|
|
|
|
|
|
# |
605
|
|
|
|
|
|
|
# After some changes earlier in v5.17, split's behavior has been simplified: |
606
|
|
|
|
|
|
|
# if the PATTERN argument evaluates to a string containing one space, it is |
607
|
|
|
|
|
|
|
# treated the way that a literal string containing one space once was. |
608
|
|
|
|
|
|
|
# http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#split's_first_argument_is_more_consistently_interpreted |
609
|
|
|
|
|
|
|
|
610
|
|
|
|
|
|
|
# if $pattern is also omitted or is the literal space, " ", the function splits |
611
|
|
|
|
|
|
|
# on whitespace, /\s+/, after skipping any leading whitespace |
612
|
|
|
|
|
|
|
# (and so on) |
613
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
elsif ($pattern eq ' ') { |
615
|
0
|
0
|
|
|
|
0
|
if (not defined $limit) { |
616
|
0
|
|
|
|
|
0
|
return CORE::split(' ', $string); |
617
|
|
|
|
|
|
|
} |
618
|
|
|
|
|
|
|
else { |
619
|
0
|
|
|
|
|
0
|
return CORE::split(' ', $string, $limit); |
620
|
|
|
|
|
|
|
} |
621
|
|
|
|
|
|
|
} |
622
|
|
|
|
|
|
|
|
623
|
0
|
|
|
|
|
0
|
local $q_char = $q_char; |
624
|
0
|
0
|
|
|
|
0
|
if (CORE::length($string) > 32766) { |
625
|
0
|
0
|
|
|
|
0
|
if ($string =~ /\A [\x00-\x7F]+ \z/oxms) { |
|
|
0
|
|
|
|
|
|
626
|
0
|
|
|
|
|
0
|
$q_char = qr{.}s; |
627
|
|
|
|
|
|
|
} |
628
|
|
|
|
|
|
|
elsif (defined ${Eeucjp::q_char_SADAHIRO_Tomoyuki_2002_01_17}) { |
629
|
0
|
|
|
|
|
0
|
$q_char = ${Eeucjp::q_char_SADAHIRO_Tomoyuki_2002_01_17}; |
630
|
|
|
|
|
|
|
} |
631
|
|
|
|
|
|
|
} |
632
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
# if $limit is negative, it is treated as if an arbitrarily large $limit has been specified |
634
|
0
|
0
|
0
|
|
|
0
|
if ((not defined $limit) or ($limit <= 0)) { |
|
|
0
|
|
|
|
|
|
635
|
|
|
|
|
|
|
|
636
|
|
|
|
|
|
|
# a pattern capable of matching either the null string or something longer than the |
637
|
|
|
|
|
|
|
# null string will split the value of $string into separate characters wherever it |
638
|
|
|
|
|
|
|
# matches the null string between characters |
639
|
|
|
|
|
|
|
# (and so on) |
640
|
|
|
|
|
|
|
|
641
|
0
|
0
|
|
|
|
0
|
if ('' =~ / \A $pattern \z /xms) { |
642
|
0
|
|
|
|
|
0
|
my $last_subexpression_offsets = _last_subexpression_offsets($pattern); |
643
|
0
|
|
|
|
|
0
|
my $limit = scalar(() = $string =~ /($pattern)/oxmsg); |
644
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
# P.1024 Appendix W.10 Multibyte Processing |
646
|
|
|
|
|
|
|
# of ISBN 1-56592-224-7 CJKV Information Processing |
647
|
|
|
|
|
|
|
# (and so on) |
648
|
|
|
|
|
|
|
|
649
|
|
|
|
|
|
|
# the //m modifier is assumed when you split on the pattern /^/ |
650
|
|
|
|
|
|
|
# (and so on) |
651
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
# V |
653
|
0
|
|
0
|
|
|
0
|
while ((--$limit > 0) and ($string =~ s/\A((?:$q_char)+?)$pattern//m)) { |
654
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
# if the $pattern contains parentheses, then the substring matched by each pair of parentheses |
656
|
|
|
|
|
|
|
# is included in the resulting list, interspersed with the fields that are ordinarily returned |
657
|
|
|
|
|
|
|
# (and so on) |
658
|
|
|
|
|
|
|
|
659
|
0
|
|
|
|
|
0
|
local $@; |
660
|
0
|
|
|
|
|
0
|
for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) { |
661
|
0
|
|
|
|
|
0
|
push @split, CORE::eval('$' . $digit); |
662
|
|
|
|
|
|
|
} |
663
|
|
|
|
|
|
|
} |
664
|
|
|
|
|
|
|
} |
665
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
else { |
667
|
0
|
|
|
|
|
0
|
my $last_subexpression_offsets = _last_subexpression_offsets($pattern); |
668
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
# V |
670
|
0
|
|
|
|
|
0
|
while ($string =~ s/\A((?:$q_char)*?)$pattern//m) { |
671
|
0
|
|
|
|
|
0
|
local $@; |
672
|
0
|
|
|
|
|
0
|
for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) { |
673
|
0
|
|
|
|
|
0
|
push @split, CORE::eval('$' . $digit); |
674
|
|
|
|
|
|
|
} |
675
|
|
|
|
|
|
|
} |
676
|
|
|
|
|
|
|
} |
677
|
|
|
|
|
|
|
} |
678
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
elsif ($limit > 0) { |
680
|
0
|
0
|
|
|
|
0
|
if ('' =~ / \A $pattern \z /xms) { |
681
|
0
|
|
|
|
|
0
|
my $last_subexpression_offsets = _last_subexpression_offsets($pattern); |
682
|
0
|
|
0
|
|
|
0
|
while ((--$limit > 0) and (CORE::length($string) > 0)) { |
683
|
|
|
|
|
|
|
|
684
|
|
|
|
|
|
|
# V |
685
|
0
|
0
|
|
|
|
0
|
if ($string =~ s/\A((?:$q_char)+?)$pattern//m) { |
686
|
0
|
|
|
|
|
0
|
local $@; |
687
|
0
|
|
|
|
|
0
|
for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) { |
688
|
0
|
|
|
|
|
0
|
push @split, CORE::eval('$' . $digit); |
689
|
|
|
|
|
|
|
} |
690
|
|
|
|
|
|
|
} |
691
|
|
|
|
|
|
|
} |
692
|
|
|
|
|
|
|
} |
693
|
|
|
|
|
|
|
else { |
694
|
0
|
|
|
|
|
0
|
my $last_subexpression_offsets = _last_subexpression_offsets($pattern); |
695
|
0
|
|
0
|
|
|
0
|
while ((--$limit > 0) and (CORE::length($string) > 0)) { |
696
|
|
|
|
|
|
|
|
697
|
|
|
|
|
|
|
# V |
698
|
0
|
0
|
|
|
|
0
|
if ($string =~ s/\A((?:$q_char)*?)$pattern//m) { |
699
|
0
|
|
|
|
|
0
|
local $@; |
700
|
0
|
|
|
|
|
0
|
for (my $digit=1; $digit <= ($last_subexpression_offsets + 1); $digit++) { |
701
|
0
|
|
|
|
|
0
|
push @split, CORE::eval('$' . $digit); |
702
|
|
|
|
|
|
|
} |
703
|
|
|
|
|
|
|
} |
704
|
|
|
|
|
|
|
} |
705
|
|
|
|
|
|
|
} |
706
|
|
|
|
|
|
|
} |
707
|
|
|
|
|
|
|
|
708
|
0
|
0
|
|
|
|
0
|
if (CORE::length($string) > 0) { |
709
|
0
|
|
|
|
|
0
|
push @split, $string; |
710
|
|
|
|
|
|
|
} |
711
|
|
|
|
|
|
|
|
712
|
|
|
|
|
|
|
# if $_[2] (NOT "$limit") is omitted or zero, trailing null fields are stripped from the result |
713
|
0
|
0
|
0
|
|
|
0
|
if ((not defined $_[2]) or ($_[2] == 0)) { |
714
|
0
|
|
0
|
|
|
0
|
while ((scalar(@split) >= 1) and ($split[-1] eq '')) { |
715
|
0
|
|
|
|
|
0
|
pop @split; |
716
|
|
|
|
|
|
|
} |
717
|
|
|
|
|
|
|
} |
718
|
|
|
|
|
|
|
|
719
|
|
|
|
|
|
|
# resulting list value in list context |
720
|
0
|
0
|
|
|
|
0
|
if (wantarray) { |
721
|
0
|
|
|
|
|
0
|
return @split; |
722
|
|
|
|
|
|
|
} |
723
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
# count of substrings in scalar context |
725
|
|
|
|
|
|
|
else { |
726
|
0
|
0
|
|
|
|
0
|
carp "Use of implicit split to \@_ is deprecated" if $^W; |
727
|
0
|
|
|
|
|
0
|
@_ = @split; |
728
|
0
|
|
|
|
|
0
|
return scalar @_; |
729
|
|
|
|
|
|
|
} |
730
|
|
|
|
|
|
|
} |
731
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
# |
733
|
|
|
|
|
|
|
# get last subexpression offsets |
734
|
|
|
|
|
|
|
# |
735
|
|
|
|
|
|
|
sub _last_subexpression_offsets { |
736
|
0
|
|
|
0
|
|
0
|
my $pattern = $_[0]; |
737
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
# remove comment |
739
|
0
|
|
|
|
|
0
|
$pattern =~ s/\(\?\# .*? \)//oxmsg; |
740
|
|
|
|
|
|
|
|
741
|
0
|
|
|
|
|
0
|
my $modifier = ''; |
742
|
0
|
0
|
|
|
|
0
|
if ($pattern =~ /\(\?\^? ([\-A-Za-z]+) :/oxms) { |
743
|
0
|
|
|
|
|
0
|
$modifier = $1; |
744
|
0
|
|
|
|
|
0
|
$modifier =~ s/-[A-Za-z]*//; |
745
|
|
|
|
|
|
|
} |
746
|
|
|
|
|
|
|
|
747
|
|
|
|
|
|
|
# with /x modifier |
748
|
0
|
|
|
|
|
0
|
my @char = (); |
749
|
0
|
0
|
|
|
|
0
|
if ($modifier =~ /x/oxms) { |
750
|
0
|
|
|
|
|
0
|
@char = $pattern =~ /\G((?> |
751
|
|
|
|
|
|
|
[^\x8E\x8F\xA1-\xFE\\\#\[\(]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
752
|
|
|
|
|
|
|
\\ $q_char | |
753
|
|
|
|
|
|
|
\# (?>[^\n]*) $ | |
754
|
|
|
|
|
|
|
\[ (?>(?:[^\x8E\x8F\xA1-\xFE\\\]]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF]|\\\\|\\\]|$q_char)+) \] | |
755
|
|
|
|
|
|
|
\(\? | |
756
|
|
|
|
|
|
|
$q_char |
757
|
|
|
|
|
|
|
))/oxmsg; |
758
|
|
|
|
|
|
|
} |
759
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
# without /x modifier |
761
|
|
|
|
|
|
|
else { |
762
|
0
|
|
|
|
|
0
|
@char = $pattern =~ /\G((?> |
763
|
|
|
|
|
|
|
[^\x8E\x8F\xA1-\xFE\\\[\(]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
764
|
|
|
|
|
|
|
\\ $q_char | |
765
|
|
|
|
|
|
|
\[ (?>(?:[^\x8E\x8F\xA1-\xFE\\\]]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF]|\\\\|\\\]|$q_char)+) \] | |
766
|
|
|
|
|
|
|
\(\? | |
767
|
|
|
|
|
|
|
$q_char |
768
|
|
|
|
|
|
|
))/oxmsg; |
769
|
|
|
|
|
|
|
} |
770
|
|
|
|
|
|
|
|
771
|
0
|
|
|
|
|
0
|
return scalar grep { $_ eq '(' } @char; |
|
0
|
|
|
|
|
0
|
|
772
|
|
|
|
|
|
|
} |
773
|
|
|
|
|
|
|
|
774
|
|
|
|
|
|
|
# |
775
|
|
|
|
|
|
|
# EUC-JP transliteration (tr///) |
776
|
|
|
|
|
|
|
# |
777
|
|
|
|
|
|
|
sub Eeucjp::tr($$$$;$) { |
778
|
|
|
|
|
|
|
|
779
|
0
|
|
|
0
|
0
|
0
|
my $bind_operator = $_[1]; |
780
|
0
|
|
|
|
|
0
|
my $searchlist = $_[2]; |
781
|
0
|
|
|
|
|
0
|
my $replacementlist = $_[3]; |
782
|
0
|
|
0
|
|
|
0
|
my $modifier = $_[4] || ''; |
783
|
|
|
|
|
|
|
|
784
|
0
|
0
|
|
|
|
0
|
if ($modifier =~ /r/oxms) { |
785
|
0
|
0
|
|
|
|
0
|
if ($bind_operator =~ / !~ /oxms) { |
786
|
0
|
|
|
|
|
0
|
croak "Using !~ with tr///r doesn't make sense"; |
787
|
|
|
|
|
|
|
} |
788
|
|
|
|
|
|
|
} |
789
|
|
|
|
|
|
|
|
790
|
0
|
|
|
|
|
0
|
my @char = $_[0] =~ /\G (?>$q_char) /oxmsg; |
791
|
0
|
|
|
|
|
0
|
my @searchlist = _charlist_tr($searchlist); |
792
|
0
|
|
|
|
|
0
|
my @replacementlist = _charlist_tr($replacementlist); |
793
|
|
|
|
|
|
|
|
794
|
0
|
|
|
|
|
0
|
my %tr = (); |
795
|
0
|
|
|
|
|
0
|
for (my $i=0; $i <= $#searchlist; $i++) { |
796
|
0
|
0
|
|
|
|
0
|
if (not exists $tr{$searchlist[$i]}) { |
797
|
0
|
0
|
0
|
|
|
0
|
if (defined $replacementlist[$i] and ($replacementlist[$i] ne '')) { |
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
798
|
0
|
|
|
|
|
0
|
$tr{$searchlist[$i]} = $replacementlist[$i]; |
799
|
|
|
|
|
|
|
} |
800
|
|
|
|
|
|
|
elsif ($modifier =~ /d/oxms) { |
801
|
0
|
|
|
|
|
0
|
$tr{$searchlist[$i]} = ''; |
802
|
|
|
|
|
|
|
} |
803
|
|
|
|
|
|
|
elsif (defined $replacementlist[-1] and ($replacementlist[-1] ne '')) { |
804
|
0
|
|
|
|
|
0
|
$tr{$searchlist[$i]} = $replacementlist[-1]; |
805
|
|
|
|
|
|
|
} |
806
|
|
|
|
|
|
|
else { |
807
|
0
|
|
|
|
|
0
|
$tr{$searchlist[$i]} = $searchlist[$i]; |
808
|
|
|
|
|
|
|
} |
809
|
|
|
|
|
|
|
} |
810
|
|
|
|
|
|
|
} |
811
|
|
|
|
|
|
|
|
812
|
0
|
|
|
|
|
0
|
my $tr = 0; |
813
|
0
|
|
|
|
|
0
|
my $replaced = ''; |
814
|
0
|
0
|
|
|
|
0
|
if ($modifier =~ /c/oxms) { |
815
|
0
|
|
|
|
|
0
|
while (defined(my $char = shift @char)) { |
816
|
0
|
0
|
|
|
|
0
|
if (not exists $tr{$char}) { |
817
|
0
|
0
|
|
|
|
0
|
if (defined $replacementlist[0]) { |
818
|
0
|
|
|
|
|
0
|
$replaced .= $replacementlist[0]; |
819
|
|
|
|
|
|
|
} |
820
|
0
|
|
|
|
|
0
|
$tr++; |
821
|
0
|
0
|
|
|
|
0
|
if ($modifier =~ /s/oxms) { |
822
|
0
|
|
0
|
|
|
0
|
while (@char and (not exists $tr{$char[0]})) { |
823
|
0
|
|
|
|
|
0
|
shift @char; |
824
|
0
|
|
|
|
|
0
|
$tr++; |
825
|
|
|
|
|
|
|
} |
826
|
|
|
|
|
|
|
} |
827
|
|
|
|
|
|
|
} |
828
|
|
|
|
|
|
|
else { |
829
|
0
|
|
|
|
|
0
|
$replaced .= $char; |
830
|
|
|
|
|
|
|
} |
831
|
|
|
|
|
|
|
} |
832
|
|
|
|
|
|
|
} |
833
|
|
|
|
|
|
|
else { |
834
|
0
|
|
|
|
|
0
|
while (defined(my $char = shift @char)) { |
835
|
0
|
0
|
|
|
|
0
|
if (exists $tr{$char}) { |
836
|
0
|
|
|
|
|
0
|
$replaced .= $tr{$char}; |
837
|
0
|
|
|
|
|
0
|
$tr++; |
838
|
0
|
0
|
|
|
|
0
|
if ($modifier =~ /s/oxms) { |
839
|
0
|
|
0
|
|
|
0
|
while (@char and (exists $tr{$char[0]}) and ($tr{$char[0]} eq $tr{$char})) { |
|
|
|
0
|
|
|
|
|
840
|
0
|
|
|
|
|
0
|
shift @char; |
841
|
0
|
|
|
|
|
0
|
$tr++; |
842
|
|
|
|
|
|
|
} |
843
|
|
|
|
|
|
|
} |
844
|
|
|
|
|
|
|
} |
845
|
|
|
|
|
|
|
else { |
846
|
0
|
|
|
|
|
0
|
$replaced .= $char; |
847
|
|
|
|
|
|
|
} |
848
|
|
|
|
|
|
|
} |
849
|
|
|
|
|
|
|
} |
850
|
|
|
|
|
|
|
|
851
|
0
|
0
|
|
|
|
0
|
if ($modifier =~ /r/oxms) { |
852
|
0
|
|
|
|
|
0
|
return $replaced; |
853
|
|
|
|
|
|
|
} |
854
|
|
|
|
|
|
|
else { |
855
|
0
|
|
|
|
|
0
|
$_[0] = $replaced; |
856
|
0
|
0
|
|
|
|
0
|
if ($bind_operator =~ / !~ /oxms) { |
857
|
0
|
|
|
|
|
0
|
return not $tr; |
858
|
|
|
|
|
|
|
} |
859
|
|
|
|
|
|
|
else { |
860
|
0
|
|
|
|
|
0
|
return $tr; |
861
|
|
|
|
|
|
|
} |
862
|
|
|
|
|
|
|
} |
863
|
|
|
|
|
|
|
} |
864
|
|
|
|
|
|
|
|
865
|
|
|
|
|
|
|
# |
866
|
|
|
|
|
|
|
# EUC-JP chop |
867
|
|
|
|
|
|
|
# |
868
|
|
|
|
|
|
|
sub Eeucjp::chop(@) { |
869
|
|
|
|
|
|
|
|
870
|
0
|
|
|
0
|
0
|
0
|
my $chop; |
871
|
0
|
0
|
|
|
|
0
|
if (@_ == 0) { |
872
|
0
|
|
|
|
|
0
|
my @char = /\G (?>$q_char) /oxmsg; |
873
|
0
|
|
|
|
|
0
|
$chop = pop @char; |
874
|
0
|
|
|
|
|
0
|
$_ = join '', @char; |
875
|
|
|
|
|
|
|
} |
876
|
|
|
|
|
|
|
else { |
877
|
0
|
|
|
|
|
0
|
for (@_) { |
878
|
0
|
|
|
|
|
0
|
my @char = /\G (?>$q_char) /oxmsg; |
879
|
0
|
|
|
|
|
0
|
$chop = pop @char; |
880
|
0
|
|
|
|
|
0
|
$_ = join '', @char; |
881
|
|
|
|
|
|
|
} |
882
|
|
|
|
|
|
|
} |
883
|
0
|
|
|
|
|
0
|
return $chop; |
884
|
|
|
|
|
|
|
} |
885
|
|
|
|
|
|
|
|
886
|
|
|
|
|
|
|
# |
887
|
|
|
|
|
|
|
# EUC-JP index by octet |
888
|
|
|
|
|
|
|
# |
889
|
|
|
|
|
|
|
sub Eeucjp::index($$;$) { |
890
|
|
|
|
|
|
|
|
891
|
0
|
|
|
0
|
1
|
0
|
my($str,$substr,$position) = @_; |
892
|
0
|
|
0
|
|
|
0
|
$position ||= 0; |
893
|
0
|
|
|
|
|
0
|
my $pos = 0; |
894
|
|
|
|
|
|
|
|
895
|
0
|
|
|
|
|
0
|
while ($pos < CORE::length($str)) { |
896
|
0
|
0
|
|
|
|
0
|
if (CORE::substr($str,$pos,CORE::length($substr)) eq $substr) { |
897
|
0
|
0
|
|
|
|
0
|
if ($pos >= $position) { |
898
|
0
|
|
|
|
|
0
|
return $pos; |
899
|
|
|
|
|
|
|
} |
900
|
|
|
|
|
|
|
} |
901
|
0
|
0
|
|
|
|
0
|
if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) { |
902
|
0
|
|
|
|
|
0
|
$pos += CORE::length($1); |
903
|
|
|
|
|
|
|
} |
904
|
|
|
|
|
|
|
else { |
905
|
0
|
|
|
|
|
0
|
$pos += 1; |
906
|
|
|
|
|
|
|
} |
907
|
|
|
|
|
|
|
} |
908
|
0
|
|
|
|
|
0
|
return -1; |
909
|
|
|
|
|
|
|
} |
910
|
|
|
|
|
|
|
|
911
|
|
|
|
|
|
|
# |
912
|
|
|
|
|
|
|
# EUC-JP reverse index |
913
|
|
|
|
|
|
|
# |
914
|
|
|
|
|
|
|
sub Eeucjp::rindex($$;$) { |
915
|
|
|
|
|
|
|
|
916
|
0
|
|
|
0
|
0
|
0
|
my($str,$substr,$position) = @_; |
917
|
0
|
|
0
|
|
|
0
|
$position ||= CORE::length($str) - 1; |
918
|
0
|
|
|
|
|
0
|
my $pos = 0; |
919
|
0
|
|
|
|
|
0
|
my $rindex = -1; |
920
|
|
|
|
|
|
|
|
921
|
0
|
|
0
|
|
|
0
|
while (($pos < CORE::length($str)) and ($pos <= $position)) { |
922
|
0
|
0
|
|
|
|
0
|
if (CORE::substr($str,$pos,CORE::length($substr)) eq $substr) { |
923
|
0
|
|
|
|
|
0
|
$rindex = $pos; |
924
|
|
|
|
|
|
|
} |
925
|
0
|
0
|
|
|
|
0
|
if (CORE::substr($str,$pos) =~ /\A ($q_char) /oxms) { |
926
|
0
|
|
|
|
|
0
|
$pos += CORE::length($1); |
927
|
|
|
|
|
|
|
} |
928
|
|
|
|
|
|
|
else { |
929
|
0
|
|
|
|
|
0
|
$pos += 1; |
930
|
|
|
|
|
|
|
} |
931
|
|
|
|
|
|
|
} |
932
|
0
|
|
|
|
|
0
|
return $rindex; |
933
|
|
|
|
|
|
|
} |
934
|
|
|
|
|
|
|
|
935
|
|
|
|
|
|
|
# |
936
|
|
|
|
|
|
|
# EUC-JP lower case first with parameter |
937
|
|
|
|
|
|
|
# |
938
|
|
|
|
|
|
|
sub Eeucjp::lcfirst(@) { |
939
|
0
|
0
|
|
0
|
0
|
0
|
if (@_) { |
940
|
0
|
|
|
|
|
0
|
my $s = shift @_; |
941
|
0
|
0
|
0
|
|
|
0
|
if (@_ and wantarray) { |
942
|
0
|
|
|
|
|
0
|
return Eeucjp::lc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_; |
943
|
|
|
|
|
|
|
} |
944
|
|
|
|
|
|
|
else { |
945
|
0
|
|
|
|
|
0
|
return Eeucjp::lc(CORE::substr($s,0,1)) . CORE::substr($s,1); |
946
|
|
|
|
|
|
|
} |
947
|
|
|
|
|
|
|
} |
948
|
|
|
|
|
|
|
else { |
949
|
0
|
|
|
|
|
0
|
return Eeucjp::lc(CORE::substr($_,0,1)) . CORE::substr($_,1); |
950
|
|
|
|
|
|
|
} |
951
|
|
|
|
|
|
|
} |
952
|
|
|
|
|
|
|
|
953
|
|
|
|
|
|
|
# |
954
|
|
|
|
|
|
|
# EUC-JP lower case first without parameter |
955
|
|
|
|
|
|
|
# |
956
|
|
|
|
|
|
|
sub Eeucjp::lcfirst_() { |
957
|
0
|
|
|
0
|
0
|
0
|
return Eeucjp::lc(CORE::substr($_,0,1)) . CORE::substr($_,1); |
958
|
|
|
|
|
|
|
} |
959
|
|
|
|
|
|
|
|
960
|
|
|
|
|
|
|
# |
961
|
|
|
|
|
|
|
# EUC-JP lower case with parameter |
962
|
|
|
|
|
|
|
# |
963
|
|
|
|
|
|
|
sub Eeucjp::lc(@) { |
964
|
0
|
0
|
|
0
|
0
|
0
|
if (@_) { |
965
|
0
|
|
|
|
|
0
|
my $s = shift @_; |
966
|
0
|
0
|
0
|
|
|
0
|
if (@_ and wantarray) { |
967
|
0
|
0
|
|
|
|
0
|
return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_; |
|
0
|
|
|
|
|
0
|
|
968
|
|
|
|
|
|
|
} |
969
|
|
|
|
|
|
|
else { |
970
|
0
|
0
|
|
|
|
0
|
return join('', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)); |
|
0
|
|
|
|
|
0
|
|
971
|
|
|
|
|
|
|
} |
972
|
|
|
|
|
|
|
} |
973
|
|
|
|
|
|
|
else { |
974
|
0
|
|
|
|
|
0
|
return Eeucjp::lc_(); |
975
|
|
|
|
|
|
|
} |
976
|
|
|
|
|
|
|
} |
977
|
|
|
|
|
|
|
|
978
|
|
|
|
|
|
|
# |
979
|
|
|
|
|
|
|
# EUC-JP lower case without parameter |
980
|
|
|
|
|
|
|
# |
981
|
|
|
|
|
|
|
sub Eeucjp::lc_() { |
982
|
0
|
|
|
0
|
0
|
0
|
my $s = $_; |
983
|
0
|
0
|
|
|
|
0
|
return join '', map {defined($lc{$_}) ? $lc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg); |
|
0
|
|
|
|
|
0
|
|
984
|
|
|
|
|
|
|
} |
985
|
|
|
|
|
|
|
|
986
|
|
|
|
|
|
|
# |
987
|
|
|
|
|
|
|
# EUC-JP upper case first with parameter |
988
|
|
|
|
|
|
|
# |
989
|
|
|
|
|
|
|
sub Eeucjp::ucfirst(@) { |
990
|
0
|
0
|
|
0
|
0
|
0
|
if (@_) { |
991
|
0
|
|
|
|
|
0
|
my $s = shift @_; |
992
|
0
|
0
|
0
|
|
|
0
|
if (@_ and wantarray) { |
993
|
0
|
|
|
|
|
0
|
return Eeucjp::uc(CORE::substr($s,0,1)) . CORE::substr($s,1), @_; |
994
|
|
|
|
|
|
|
} |
995
|
|
|
|
|
|
|
else { |
996
|
0
|
|
|
|
|
0
|
return Eeucjp::uc(CORE::substr($s,0,1)) . CORE::substr($s,1); |
997
|
|
|
|
|
|
|
} |
998
|
|
|
|
|
|
|
} |
999
|
|
|
|
|
|
|
else { |
1000
|
0
|
|
|
|
|
0
|
return Eeucjp::uc(CORE::substr($_,0,1)) . CORE::substr($_,1); |
1001
|
|
|
|
|
|
|
} |
1002
|
|
|
|
|
|
|
} |
1003
|
|
|
|
|
|
|
|
1004
|
|
|
|
|
|
|
# |
1005
|
|
|
|
|
|
|
# EUC-JP upper case first without parameter |
1006
|
|
|
|
|
|
|
# |
1007
|
|
|
|
|
|
|
sub Eeucjp::ucfirst_() { |
1008
|
0
|
|
|
0
|
0
|
0
|
return Eeucjp::uc(CORE::substr($_,0,1)) . CORE::substr($_,1); |
1009
|
|
|
|
|
|
|
} |
1010
|
|
|
|
|
|
|
|
1011
|
|
|
|
|
|
|
# |
1012
|
|
|
|
|
|
|
# EUC-JP upper case with parameter |
1013
|
|
|
|
|
|
|
# |
1014
|
|
|
|
|
|
|
sub Eeucjp::uc(@) { |
1015
|
0
|
50
|
|
2780
|
0
|
0
|
if (@_) { |
1016
|
2780
|
|
|
|
|
3965
|
my $s = shift @_; |
1017
|
2780
|
50
|
33
|
|
|
3362
|
if (@_ and wantarray) { |
1018
|
2780
|
0
|
|
|
|
4753
|
return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_; |
|
0
|
|
|
|
|
0
|
|
1019
|
|
|
|
|
|
|
} |
1020
|
|
|
|
|
|
|
else { |
1021
|
0
|
100
|
|
|
|
0
|
return join('', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)); |
|
2780
|
|
|
|
|
7446
|
|
1022
|
|
|
|
|
|
|
} |
1023
|
|
|
|
|
|
|
} |
1024
|
|
|
|
|
|
|
else { |
1025
|
2780
|
|
|
|
|
8405
|
return Eeucjp::uc_(); |
1026
|
|
|
|
|
|
|
} |
1027
|
|
|
|
|
|
|
} |
1028
|
|
|
|
|
|
|
|
1029
|
|
|
|
|
|
|
# |
1030
|
|
|
|
|
|
|
# EUC-JP upper case without parameter |
1031
|
|
|
|
|
|
|
# |
1032
|
|
|
|
|
|
|
sub Eeucjp::uc_() { |
1033
|
0
|
|
|
0
|
0
|
0
|
my $s = $_; |
1034
|
0
|
0
|
|
|
|
0
|
return join '', map {defined($uc{$_}) ? $uc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg); |
|
0
|
|
|
|
|
0
|
|
1035
|
|
|
|
|
|
|
} |
1036
|
|
|
|
|
|
|
|
1037
|
|
|
|
|
|
|
# |
1038
|
|
|
|
|
|
|
# EUC-JP fold case with parameter |
1039
|
|
|
|
|
|
|
# |
1040
|
|
|
|
|
|
|
sub Eeucjp::fc(@) { |
1041
|
0
|
50
|
|
2855
|
0
|
0
|
if (@_) { |
1042
|
2855
|
|
|
|
|
4348
|
my $s = shift @_; |
1043
|
2855
|
50
|
33
|
|
|
3220
|
if (@_ and wantarray) { |
1044
|
2855
|
0
|
|
|
|
4348
|
return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)), @_; |
|
0
|
|
|
|
|
0
|
|
1045
|
|
|
|
|
|
|
} |
1046
|
|
|
|
|
|
|
else { |
1047
|
0
|
100
|
|
|
|
0
|
return join('', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg)); |
|
2855
|
|
|
|
|
6826
|
|
1048
|
|
|
|
|
|
|
} |
1049
|
|
|
|
|
|
|
} |
1050
|
|
|
|
|
|
|
else { |
1051
|
2855
|
|
|
|
|
9132
|
return Eeucjp::fc_(); |
1052
|
|
|
|
|
|
|
} |
1053
|
|
|
|
|
|
|
} |
1054
|
|
|
|
|
|
|
|
1055
|
|
|
|
|
|
|
# |
1056
|
|
|
|
|
|
|
# EUC-JP fold case without parameter |
1057
|
|
|
|
|
|
|
# |
1058
|
|
|
|
|
|
|
sub Eeucjp::fc_() { |
1059
|
0
|
|
|
0
|
0
|
0
|
my $s = $_; |
1060
|
0
|
0
|
|
|
|
0
|
return join '', map {defined($fc{$_}) ? $fc{$_} : $_} ($s =~ /\G ($q_char) /oxmsg); |
|
0
|
|
|
|
|
0
|
|
1061
|
|
|
|
|
|
|
} |
1062
|
|
|
|
|
|
|
|
1063
|
|
|
|
|
|
|
# |
1064
|
|
|
|
|
|
|
# EUC-JP regexp capture |
1065
|
|
|
|
|
|
|
# |
1066
|
|
|
|
|
|
|
{ |
1067
|
|
|
|
|
|
|
# 10.3. Creating Persistent Private Variables |
1068
|
|
|
|
|
|
|
# in Chapter 10. Subroutines |
1069
|
|
|
|
|
|
|
# of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition. |
1070
|
|
|
|
|
|
|
|
1071
|
|
|
|
|
|
|
my $last_s_matched = 0; |
1072
|
|
|
|
|
|
|
|
1073
|
|
|
|
|
|
|
sub Eeucjp::capture { |
1074
|
0
|
0
|
0
|
0
|
1
|
0
|
if ($last_s_matched and ($_[0] =~ /\A (?>[1-9][0-9]*) \z/oxms)) { |
1075
|
0
|
|
|
|
|
0
|
return $_[0] + 1; |
1076
|
|
|
|
|
|
|
} |
1077
|
0
|
|
|
|
|
0
|
return $_[0]; |
1078
|
|
|
|
|
|
|
} |
1079
|
|
|
|
|
|
|
|
1080
|
|
|
|
|
|
|
# EUC-JP mark last regexp matched |
1081
|
|
|
|
|
|
|
sub Eeucjp::matched() { |
1082
|
0
|
|
|
0
|
0
|
0
|
$last_s_matched = 0; |
1083
|
|
|
|
|
|
|
} |
1084
|
|
|
|
|
|
|
|
1085
|
|
|
|
|
|
|
# EUC-JP mark last s/// matched |
1086
|
|
|
|
|
|
|
sub Eeucjp::s_matched() { |
1087
|
0
|
|
|
0
|
0
|
0
|
$last_s_matched = 1; |
1088
|
|
|
|
|
|
|
} |
1089
|
|
|
|
|
|
|
|
1090
|
|
|
|
|
|
|
# P.854 31.17. use re |
1091
|
|
|
|
|
|
|
# in Chapter 31. Pragmatic Modules |
1092
|
|
|
|
|
|
|
# of ISBN 0-596-00027-8 Programming Perl Third Edition. |
1093
|
|
|
|
|
|
|
|
1094
|
|
|
|
|
|
|
# P.1026 re |
1095
|
|
|
|
|
|
|
# in Chapter 29. Pragmatic Modules |
1096
|
|
|
|
|
|
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
1097
|
|
|
|
|
|
|
|
1098
|
|
|
|
|
|
|
$Eeucjp::matched = qr/(?{Eeucjp::matched})/; |
1099
|
|
|
|
|
|
|
} |
1100
|
|
|
|
|
|
|
|
1101
|
|
|
|
|
|
|
# |
1102
|
|
|
|
|
|
|
# EUC-JP regexp ignore case modifier |
1103
|
|
|
|
|
|
|
# |
1104
|
|
|
|
|
|
|
sub Eeucjp::ignorecase { |
1105
|
|
|
|
|
|
|
|
1106
|
0
|
|
|
0
|
0
|
0
|
my @string = @_; |
1107
|
0
|
|
|
|
|
0
|
my $metachar = qr/[\@\\|[\]{]/oxms; |
1108
|
|
|
|
|
|
|
|
1109
|
|
|
|
|
|
|
# ignore case of $scalar or @array |
1110
|
0
|
|
|
|
|
0
|
for my $string (@string) { |
1111
|
|
|
|
|
|
|
|
1112
|
|
|
|
|
|
|
# split regexp |
1113
|
0
|
|
|
|
|
0
|
my @char = $string =~ /\G (?>\[\^|\\$q_char|$q_char) /oxmsg; |
1114
|
|
|
|
|
|
|
|
1115
|
|
|
|
|
|
|
# unescape character |
1116
|
0
|
|
|
|
|
0
|
for (my $i=0; $i <= $#char; $i++) { |
1117
|
0
|
0
|
|
|
|
0
|
next if not defined $char[$i]; |
1118
|
|
|
|
|
|
|
|
1119
|
|
|
|
|
|
|
# open character class [...] |
1120
|
0
|
0
|
|
|
|
0
|
if ($char[$i] eq '[') { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1121
|
0
|
|
|
|
|
0
|
my $left = $i; |
1122
|
|
|
|
|
|
|
|
1123
|
|
|
|
|
|
|
# [] make die "unmatched [] in regexp ...\n" |
1124
|
|
|
|
|
|
|
|
1125
|
0
|
0
|
|
|
|
0
|
if ($char[$i+1] eq ']') { |
1126
|
0
|
|
|
|
|
0
|
$i++; |
1127
|
|
|
|
|
|
|
} |
1128
|
|
|
|
|
|
|
|
1129
|
0
|
|
|
|
|
0
|
while (1) { |
1130
|
0
|
0
|
|
|
|
0
|
if (++$i > $#char) { |
1131
|
0
|
|
|
|
|
0
|
croak "Unmatched [] in regexp"; |
1132
|
|
|
|
|
|
|
} |
1133
|
0
|
0
|
|
|
|
0
|
if ($char[$i] eq ']') { |
1134
|
0
|
|
|
|
|
0
|
my $right = $i; |
1135
|
0
|
|
|
|
|
0
|
my @charlist = charlist_qr(@char[$left+1..$right-1], 'i'); |
1136
|
|
|
|
|
|
|
|
1137
|
|
|
|
|
|
|
# escape character |
1138
|
0
|
|
|
|
|
0
|
for my $char (@charlist) { |
1139
|
0
|
0
|
|
|
|
0
|
if (0) { |
1140
|
|
|
|
|
|
|
} |
1141
|
|
|
|
|
|
|
|
1142
|
0
|
|
|
|
|
0
|
elsif ($char =~ /\A [.|)] \z/oxms) { |
1143
|
0
|
|
|
|
|
0
|
$char = '\\' . $char; |
1144
|
|
|
|
|
|
|
} |
1145
|
|
|
|
|
|
|
} |
1146
|
|
|
|
|
|
|
|
1147
|
|
|
|
|
|
|
# [...] |
1148
|
0
|
|
|
|
|
0
|
splice @char, $left, $right-$left+1, '(?:' . join('|', @charlist) . ')'; |
1149
|
|
|
|
|
|
|
|
1150
|
0
|
|
|
|
|
0
|
$i = $left; |
1151
|
0
|
|
|
|
|
0
|
last; |
1152
|
|
|
|
|
|
|
} |
1153
|
|
|
|
|
|
|
} |
1154
|
|
|
|
|
|
|
} |
1155
|
|
|
|
|
|
|
|
1156
|
|
|
|
|
|
|
# open character class [^...] |
1157
|
|
|
|
|
|
|
elsif ($char[$i] eq '[^') { |
1158
|
0
|
|
|
|
|
0
|
my $left = $i; |
1159
|
|
|
|
|
|
|
|
1160
|
|
|
|
|
|
|
# [^] make die "unmatched [] in regexp ...\n" |
1161
|
|
|
|
|
|
|
|
1162
|
0
|
0
|
|
|
|
0
|
if ($char[$i+1] eq ']') { |
1163
|
0
|
|
|
|
|
0
|
$i++; |
1164
|
|
|
|
|
|
|
} |
1165
|
|
|
|
|
|
|
|
1166
|
0
|
|
|
|
|
0
|
while (1) { |
1167
|
0
|
0
|
|
|
|
0
|
if (++$i > $#char) { |
1168
|
0
|
|
|
|
|
0
|
croak "Unmatched [] in regexp"; |
1169
|
|
|
|
|
|
|
} |
1170
|
0
|
0
|
|
|
|
0
|
if ($char[$i] eq ']') { |
1171
|
0
|
|
|
|
|
0
|
my $right = $i; |
1172
|
0
|
|
|
|
|
0
|
my @charlist = charlist_not_qr(@char[$left+1..$right-1], 'i'); |
1173
|
|
|
|
|
|
|
|
1174
|
|
|
|
|
|
|
# escape character |
1175
|
0
|
|
|
|
|
0
|
for my $char (@charlist) { |
1176
|
0
|
0
|
|
|
|
0
|
if (0) { |
1177
|
|
|
|
|
|
|
} |
1178
|
|
|
|
|
|
|
|
1179
|
0
|
|
|
|
|
0
|
elsif ($char =~ /\A [.|)] \z/oxms) { |
1180
|
0
|
|
|
|
|
0
|
$char = '\\' . $char; |
1181
|
|
|
|
|
|
|
} |
1182
|
|
|
|
|
|
|
} |
1183
|
|
|
|
|
|
|
|
1184
|
|
|
|
|
|
|
# [^...] |
1185
|
0
|
|
|
|
|
0
|
splice @char, $left, $right-$left+1, '(?!' . join('|', @charlist) . ")(?:$your_char)"; |
1186
|
|
|
|
|
|
|
|
1187
|
0
|
|
|
|
|
0
|
$i = $left; |
1188
|
0
|
|
|
|
|
0
|
last; |
1189
|
|
|
|
|
|
|
} |
1190
|
|
|
|
|
|
|
} |
1191
|
|
|
|
|
|
|
} |
1192
|
|
|
|
|
|
|
|
1193
|
|
|
|
|
|
|
# rewrite classic character class or escape character |
1194
|
|
|
|
|
|
|
elsif (my $char = classic_character_class($char[$i])) { |
1195
|
0
|
|
|
|
|
0
|
$char[$i] = $char; |
1196
|
|
|
|
|
|
|
} |
1197
|
|
|
|
|
|
|
|
1198
|
|
|
|
|
|
|
# with /i modifier |
1199
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) { |
1200
|
0
|
|
|
|
|
0
|
my $uc = Eeucjp::uc($char[$i]); |
1201
|
0
|
|
|
|
|
0
|
my $fc = Eeucjp::fc($char[$i]); |
1202
|
0
|
0
|
|
|
|
0
|
if ($uc ne $fc) { |
1203
|
0
|
0
|
|
|
|
0
|
if (CORE::length($fc) == 1) { |
1204
|
0
|
|
|
|
|
0
|
$char[$i] = '[' . $uc . $fc . ']'; |
1205
|
|
|
|
|
|
|
} |
1206
|
|
|
|
|
|
|
else { |
1207
|
0
|
|
|
|
|
0
|
$char[$i] = '(?:' . $uc . '|' . $fc . ')'; |
1208
|
|
|
|
|
|
|
} |
1209
|
|
|
|
|
|
|
} |
1210
|
|
|
|
|
|
|
} |
1211
|
|
|
|
|
|
|
} |
1212
|
|
|
|
|
|
|
|
1213
|
|
|
|
|
|
|
# characterize |
1214
|
0
|
|
|
|
|
0
|
for (my $i=0; $i <= $#char; $i++) { |
1215
|
0
|
0
|
|
|
|
0
|
next if not defined $char[$i]; |
1216
|
|
|
|
|
|
|
|
1217
|
0
|
0
|
|
|
|
0
|
if (0) { |
1218
|
|
|
|
|
|
|
} |
1219
|
|
|
|
|
|
|
|
1220
|
|
|
|
|
|
|
# quote character before ? + * { |
1221
|
0
|
0
|
|
|
|
0
|
elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) { |
1222
|
0
|
0
|
|
|
|
0
|
if ($char[$i-1] !~ /\A [\x00-\xFF] \z/oxms) { |
1223
|
0
|
|
|
|
|
0
|
$char[$i-1] = '(?:' . $char[$i-1] . ')'; |
1224
|
|
|
|
|
|
|
} |
1225
|
|
|
|
|
|
|
} |
1226
|
|
|
|
|
|
|
} |
1227
|
|
|
|
|
|
|
|
1228
|
0
|
|
|
|
|
0
|
$string = join '', @char; |
1229
|
|
|
|
|
|
|
} |
1230
|
|
|
|
|
|
|
|
1231
|
|
|
|
|
|
|
# make regexp string |
1232
|
0
|
|
|
|
|
0
|
return @string; |
1233
|
|
|
|
|
|
|
} |
1234
|
|
|
|
|
|
|
|
1235
|
|
|
|
|
|
|
# |
1236
|
|
|
|
|
|
|
# classic character class ( \D \S \W \d \s \w \C \X \H \V \h \v \R \N \b \B ) |
1237
|
|
|
|
|
|
|
# |
1238
|
|
|
|
|
|
|
sub Eeucjp::classic_character_class { |
1239
|
0
|
|
|
2944
|
0
|
0
|
my($char) = @_; |
1240
|
|
|
|
|
|
|
|
1241
|
|
|
|
|
|
|
return { |
1242
|
|
|
|
|
|
|
'\D' => '${Eeucjp::eD}', |
1243
|
|
|
|
|
|
|
'\S' => '${Eeucjp::eS}', |
1244
|
|
|
|
|
|
|
'\W' => '${Eeucjp::eW}', |
1245
|
|
|
|
|
|
|
'\d' => '[0-9]', |
1246
|
|
|
|
|
|
|
|
1247
|
|
|
|
|
|
|
# Before Perl 5.6, \s only matched the five whitespace characters |
1248
|
|
|
|
|
|
|
# tab, newline, form-feed, carriage return, and the space character |
1249
|
|
|
|
|
|
|
# itself, which, taken together, is the character class [\t\n\f\r ]. |
1250
|
|
|
|
|
|
|
|
1251
|
|
|
|
|
|
|
# Vertical tabs are now whitespace |
1252
|
|
|
|
|
|
|
# \s in a regex now matches a vertical tab in all circumstances. |
1253
|
|
|
|
|
|
|
# http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace |
1254
|
|
|
|
|
|
|
# \t \n \v \f \r space |
1255
|
|
|
|
|
|
|
# '\s' => '[\x09\x0A \x0C\x0D\x20]', |
1256
|
|
|
|
|
|
|
# '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]', |
1257
|
|
|
|
|
|
|
'\s' => '\s', |
1258
|
|
|
|
|
|
|
|
1259
|
|
|
|
|
|
|
'\w' => '[0-9A-Z_a-z]', |
1260
|
|
|
|
|
|
|
'\C' => '[\x00-\xFF]', |
1261
|
|
|
|
|
|
|
'\X' => 'X', |
1262
|
|
|
|
|
|
|
|
1263
|
|
|
|
|
|
|
# \h \v \H \V |
1264
|
|
|
|
|
|
|
|
1265
|
|
|
|
|
|
|
# P.114 Character Class Shortcuts |
1266
|
|
|
|
|
|
|
# in Chapter 7: In the World of Regular Expressions |
1267
|
|
|
|
|
|
|
# of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition |
1268
|
|
|
|
|
|
|
|
1269
|
|
|
|
|
|
|
# P.357 13.2.3 Whitespace |
1270
|
|
|
|
|
|
|
# in Chapter 13: perlrecharclass: Perl Regular Expression Character Classes |
1271
|
|
|
|
|
|
|
# of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1) |
1272
|
|
|
|
|
|
|
# |
1273
|
|
|
|
|
|
|
# 0x00009 CHARACTER TABULATION h s |
1274
|
|
|
|
|
|
|
# 0x0000a LINE FEED (LF) vs |
1275
|
|
|
|
|
|
|
# 0x0000b LINE TABULATION v |
1276
|
|
|
|
|
|
|
# 0x0000c FORM FEED (FF) vs |
1277
|
|
|
|
|
|
|
# 0x0000d CARRIAGE RETURN (CR) vs |
1278
|
|
|
|
|
|
|
# 0x00020 SPACE h s |
1279
|
|
|
|
|
|
|
|
1280
|
|
|
|
|
|
|
# P.196 Table 5-9. Alphanumeric regex metasymbols |
1281
|
|
|
|
|
|
|
# in Chapter 5. Pattern Matching |
1282
|
|
|
|
|
|
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
1283
|
|
|
|
|
|
|
|
1284
|
|
|
|
|
|
|
# (and so on) |
1285
|
|
|
|
|
|
|
|
1286
|
|
|
|
|
|
|
'\H' => '${Eeucjp::eH}', |
1287
|
|
|
|
|
|
|
'\V' => '${Eeucjp::eV}', |
1288
|
|
|
|
|
|
|
'\h' => '[\x09\x20]', |
1289
|
|
|
|
|
|
|
'\v' => '[\x0A\x0B\x0C\x0D]', |
1290
|
|
|
|
|
|
|
'\R' => '${Eeucjp::eR}', |
1291
|
|
|
|
|
|
|
|
1292
|
|
|
|
|
|
|
# \N |
1293
|
|
|
|
|
|
|
# |
1294
|
|
|
|
|
|
|
# http://perldoc.perl.org/perlre.html |
1295
|
|
|
|
|
|
|
# Character Classes and other Special Escapes |
1296
|
|
|
|
|
|
|
# Any character but \n (experimental). Not affected by /s modifier |
1297
|
|
|
|
|
|
|
|
1298
|
|
|
|
|
|
|
'\N' => '${Eeucjp::eN}', |
1299
|
|
|
|
|
|
|
|
1300
|
|
|
|
|
|
|
# \b \B |
1301
|
|
|
|
|
|
|
|
1302
|
|
|
|
|
|
|
# P.180 Boundaries: The \b and \B Assertions |
1303
|
|
|
|
|
|
|
# in Chapter 5: Pattern Matching |
1304
|
|
|
|
|
|
|
# of ISBN 0-596-00027-8 Programming Perl Third Edition. |
1305
|
|
|
|
|
|
|
|
1306
|
|
|
|
|
|
|
# P.219 Boundaries: The \b and \B Assertions |
1307
|
|
|
|
|
|
|
# in Chapter 5: Pattern Matching |
1308
|
|
|
|
|
|
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
1309
|
|
|
|
|
|
|
|
1310
|
|
|
|
|
|
|
# \b really means (?:(?<=\w)(?!\w)|(?
|
1311
|
|
|
|
|
|
|
# or (?:(?<=\A|\W)(?=\w)|(?<=\w)(?=\W|\z)) |
1312
|
|
|
|
|
|
|
'\b' => '${Eeucjp::eb}', |
1313
|
|
|
|
|
|
|
|
1314
|
|
|
|
|
|
|
# \B really means (?:(?<=\w)(?=\w)|(?
|
1315
|
|
|
|
|
|
|
# or (?:(?<=\w)(?=\w)|(?<=\W)(?=\W)) |
1316
|
|
|
|
|
|
|
'\B' => '${Eeucjp::eB}', |
1317
|
|
|
|
|
|
|
|
1318
|
2944
|
|
100
|
|
|
4410
|
}->{$char} || ''; |
1319
|
|
|
|
|
|
|
} |
1320
|
|
|
|
|
|
|
|
1321
|
|
|
|
|
|
|
# |
1322
|
|
|
|
|
|
|
# prepare EUC-JP characters per length |
1323
|
|
|
|
|
|
|
# |
1324
|
|
|
|
|
|
|
|
1325
|
|
|
|
|
|
|
# 1 octet characters |
1326
|
|
|
|
|
|
|
my @chars1 = (); |
1327
|
|
|
|
|
|
|
sub chars1 { |
1328
|
2944
|
0
|
|
0
|
0
|
136850
|
if (@chars1) { |
1329
|
0
|
|
|
|
|
0
|
return @chars1; |
1330
|
|
|
|
|
|
|
} |
1331
|
0
|
0
|
|
|
|
0
|
if (exists $range_tr{1}) { |
1332
|
0
|
|
|
|
|
0
|
my @ranges = @{ $range_tr{1} }; |
|
0
|
|
|
|
|
0
|
|
1333
|
0
|
|
|
|
|
0
|
while (my @range = splice(@ranges,0,1)) { |
1334
|
0
|
|
|
|
|
0
|
for my $oct0 (@{$range[0]}) { |
|
0
|
|
|
|
|
0
|
|
1335
|
0
|
|
|
|
|
0
|
push @chars1, pack 'C', $oct0; |
1336
|
|
|
|
|
|
|
} |
1337
|
|
|
|
|
|
|
} |
1338
|
|
|
|
|
|
|
} |
1339
|
0
|
|
|
|
|
0
|
return @chars1; |
1340
|
|
|
|
|
|
|
} |
1341
|
|
|
|
|
|
|
|
1342
|
|
|
|
|
|
|
# 2 octets characters |
1343
|
|
|
|
|
|
|
my @chars2 = (); |
1344
|
|
|
|
|
|
|
sub chars2 { |
1345
|
0
|
0
|
|
0
|
0
|
0
|
if (@chars2) { |
1346
|
0
|
|
|
|
|
0
|
return @chars2; |
1347
|
|
|
|
|
|
|
} |
1348
|
0
|
0
|
|
|
|
0
|
if (exists $range_tr{2}) { |
1349
|
0
|
|
|
|
|
0
|
my @ranges = @{ $range_tr{2} }; |
|
0
|
|
|
|
|
0
|
|
1350
|
0
|
|
|
|
|
0
|
while (my @range = splice(@ranges,0,2)) { |
1351
|
0
|
|
|
|
|
0
|
for my $oct0 (@{$range[0]}) { |
|
0
|
|
|
|
|
0
|
|
1352
|
0
|
|
|
|
|
0
|
for my $oct1 (@{$range[1]}) { |
|
0
|
|
|
|
|
0
|
|
1353
|
0
|
|
|
|
|
0
|
push @chars2, pack 'CC', $oct0,$oct1; |
1354
|
|
|
|
|
|
|
} |
1355
|
|
|
|
|
|
|
} |
1356
|
|
|
|
|
|
|
} |
1357
|
|
|
|
|
|
|
} |
1358
|
0
|
|
|
|
|
0
|
return @chars2; |
1359
|
|
|
|
|
|
|
} |
1360
|
|
|
|
|
|
|
|
1361
|
|
|
|
|
|
|
# 3 octets characters |
1362
|
|
|
|
|
|
|
my @chars3 = (); |
1363
|
|
|
|
|
|
|
sub chars3 { |
1364
|
0
|
0
|
|
0
|
0
|
0
|
if (@chars3) { |
1365
|
0
|
|
|
|
|
0
|
return @chars3; |
1366
|
|
|
|
|
|
|
} |
1367
|
0
|
0
|
|
|
|
0
|
if (exists $range_tr{3}) { |
1368
|
0
|
|
|
|
|
0
|
my @ranges = @{ $range_tr{3} }; |
|
0
|
|
|
|
|
0
|
|
1369
|
0
|
|
|
|
|
0
|
while (my @range = splice(@ranges,0,3)) { |
1370
|
0
|
|
|
|
|
0
|
for my $oct0 (@{$range[0]}) { |
|
0
|
|
|
|
|
0
|
|
1371
|
0
|
|
|
|
|
0
|
for my $oct1 (@{$range[1]}) { |
|
0
|
|
|
|
|
0
|
|
1372
|
0
|
|
|
|
|
0
|
for my $oct2 (@{$range[2]}) { |
|
0
|
|
|
|
|
0
|
|
1373
|
0
|
|
|
|
|
0
|
push @chars3, pack 'CCC', $oct0,$oct1,$oct2; |
1374
|
|
|
|
|
|
|
} |
1375
|
|
|
|
|
|
|
} |
1376
|
|
|
|
|
|
|
} |
1377
|
|
|
|
|
|
|
} |
1378
|
|
|
|
|
|
|
} |
1379
|
0
|
|
|
|
|
0
|
return @chars3; |
1380
|
|
|
|
|
|
|
} |
1381
|
|
|
|
|
|
|
|
1382
|
|
|
|
|
|
|
# 4 octets characters |
1383
|
|
|
|
|
|
|
my @chars4 = (); |
1384
|
|
|
|
|
|
|
sub chars4 { |
1385
|
0
|
0
|
|
0
|
0
|
0
|
if (@chars4) { |
1386
|
0
|
|
|
|
|
0
|
return @chars4; |
1387
|
|
|
|
|
|
|
} |
1388
|
0
|
0
|
|
|
|
0
|
if (exists $range_tr{4}) { |
1389
|
0
|
|
|
|
|
0
|
my @ranges = @{ $range_tr{4} }; |
|
0
|
|
|
|
|
0
|
|
1390
|
0
|
|
|
|
|
0
|
while (my @range = splice(@ranges,0,4)) { |
1391
|
0
|
|
|
|
|
0
|
for my $oct0 (@{$range[0]}) { |
|
0
|
|
|
|
|
0
|
|
1392
|
0
|
|
|
|
|
0
|
for my $oct1 (@{$range[1]}) { |
|
0
|
|
|
|
|
0
|
|
1393
|
0
|
|
|
|
|
0
|
for my $oct2 (@{$range[2]}) { |
|
0
|
|
|
|
|
0
|
|
1394
|
0
|
|
|
|
|
0
|
for my $oct3 (@{$range[3]}) { |
|
0
|
|
|
|
|
0
|
|
1395
|
0
|
|
|
|
|
0
|
push @chars4, pack 'CCCC', $oct0,$oct1,$oct2,$oct3; |
1396
|
|
|
|
|
|
|
} |
1397
|
|
|
|
|
|
|
} |
1398
|
|
|
|
|
|
|
} |
1399
|
|
|
|
|
|
|
} |
1400
|
|
|
|
|
|
|
} |
1401
|
|
|
|
|
|
|
} |
1402
|
0
|
|
|
|
|
0
|
return @chars4; |
1403
|
|
|
|
|
|
|
} |
1404
|
|
|
|
|
|
|
|
1405
|
|
|
|
|
|
|
# |
1406
|
|
|
|
|
|
|
# EUC-JP open character list for tr |
1407
|
|
|
|
|
|
|
# |
1408
|
|
|
|
|
|
|
sub _charlist_tr { |
1409
|
|
|
|
|
|
|
|
1410
|
0
|
|
|
0
|
|
0
|
local $_ = shift @_; |
1411
|
|
|
|
|
|
|
|
1412
|
|
|
|
|
|
|
# unescape character |
1413
|
0
|
|
|
|
|
0
|
my @char = (); |
1414
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxmsgc) { |
1415
|
0
|
0
|
|
|
|
0
|
if (/\G (\\0?55|\\x2[Dd]|\\-) /oxmsgc) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1416
|
0
|
|
|
|
|
0
|
push @char, '\-'; |
1417
|
|
|
|
|
|
|
} |
1418
|
|
|
|
|
|
|
elsif (/\G \\ ([0-7]{2,3}) /oxmsgc) { |
1419
|
0
|
|
|
|
|
0
|
push @char, CORE::chr(oct $1); |
1420
|
|
|
|
|
|
|
} |
1421
|
|
|
|
|
|
|
elsif (/\G \\x ([0-9A-Fa-f]{1,2}) /oxmsgc) { |
1422
|
0
|
|
|
|
|
0
|
push @char, CORE::chr(hex $1); |
1423
|
|
|
|
|
|
|
} |
1424
|
|
|
|
|
|
|
elsif (/\G \\c ([\x40-\x5F]) /oxmsgc) { |
1425
|
0
|
|
|
|
|
0
|
push @char, CORE::chr(CORE::ord($1) & 0x1F); |
1426
|
|
|
|
|
|
|
} |
1427
|
|
|
|
|
|
|
elsif (/\G (\\ [0nrtfbae]) /oxmsgc) { |
1428
|
|
|
|
|
|
|
push @char, { |
1429
|
|
|
|
|
|
|
'\0' => "\0", |
1430
|
|
|
|
|
|
|
'\n' => "\n", |
1431
|
|
|
|
|
|
|
'\r' => "\r", |
1432
|
|
|
|
|
|
|
'\t' => "\t", |
1433
|
|
|
|
|
|
|
'\f' => "\f", |
1434
|
|
|
|
|
|
|
'\b' => "\x08", # \b means backspace in character class |
1435
|
|
|
|
|
|
|
'\a' => "\a", |
1436
|
|
|
|
|
|
|
'\e' => "\e", |
1437
|
0
|
|
|
|
|
0
|
}->{$1}; |
1438
|
|
|
|
|
|
|
} |
1439
|
|
|
|
|
|
|
elsif (/\G \\ ($q_char) /oxmsgc) { |
1440
|
0
|
|
|
|
|
0
|
push @char, $1; |
1441
|
|
|
|
|
|
|
} |
1442
|
|
|
|
|
|
|
elsif (/\G ($q_char) /oxmsgc) { |
1443
|
0
|
|
|
|
|
0
|
push @char, $1; |
1444
|
|
|
|
|
|
|
} |
1445
|
|
|
|
|
|
|
} |
1446
|
|
|
|
|
|
|
|
1447
|
|
|
|
|
|
|
# join separated multiple-octet |
1448
|
0
|
|
|
|
|
0
|
@char = join('',@char) =~ /\G (?>\\-|$q_char) /oxmsg; |
1449
|
|
|
|
|
|
|
|
1450
|
|
|
|
|
|
|
# unescape '-' |
1451
|
0
|
|
|
|
|
0
|
my @i = (); |
1452
|
0
|
|
|
|
|
0
|
for my $i (0 .. $#char) { |
1453
|
0
|
0
|
|
|
|
0
|
if ($char[$i] eq '\-') { |
|
|
0
|
|
|
|
|
|
1454
|
0
|
|
|
|
|
0
|
$char[$i] = '-'; |
1455
|
|
|
|
|
|
|
} |
1456
|
|
|
|
|
|
|
elsif ($char[$i] eq '-') { |
1457
|
0
|
0
|
0
|
|
|
0
|
if ((0 < $i) and ($i < $#char)) { |
1458
|
0
|
|
|
|
|
0
|
push @i, $i; |
1459
|
|
|
|
|
|
|
} |
1460
|
|
|
|
|
|
|
} |
1461
|
|
|
|
|
|
|
} |
1462
|
|
|
|
|
|
|
|
1463
|
|
|
|
|
|
|
# open character list (reverse for splice) |
1464
|
0
|
|
|
|
|
0
|
for my $i (CORE::reverse @i) { |
1465
|
0
|
|
|
|
|
0
|
my @range = (); |
1466
|
|
|
|
|
|
|
|
1467
|
|
|
|
|
|
|
# range error |
1468
|
0
|
0
|
0
|
|
|
0
|
if ((CORE::length($char[$i-1]) > CORE::length($char[$i+1])) or ($char[$i-1] gt $char[$i+1])) { |
1469
|
0
|
|
|
|
|
0
|
croak "Invalid tr/// range \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"'; |
1470
|
|
|
|
|
|
|
} |
1471
|
|
|
|
|
|
|
|
1472
|
|
|
|
|
|
|
# range of multiple-octet code |
1473
|
0
|
0
|
|
|
|
0
|
if (CORE::length($char[$i-1]) == 1) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1474
|
0
|
0
|
|
|
|
0
|
if (CORE::length($char[$i+1]) == 1) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1475
|
0
|
0
|
|
|
|
0
|
push @range, grep {($char[$i-1] le $_) and ($_ le $char[$i+1])} chars1(); |
|
0
|
|
|
|
|
0
|
|
1476
|
|
|
|
|
|
|
} |
1477
|
|
|
|
|
|
|
elsif (CORE::length($char[$i+1]) == 2) { |
1478
|
0
|
|
|
|
|
0
|
push @range, grep {$char[$i-1] le $_} chars1(); |
|
0
|
|
|
|
|
0
|
|
1479
|
0
|
|
|
|
|
0
|
push @range, grep {$_ le $char[$i+1]} chars2(); |
|
0
|
|
|
|
|
0
|
|
1480
|
|
|
|
|
|
|
} |
1481
|
|
|
|
|
|
|
elsif (CORE::length($char[$i+1]) == 3) { |
1482
|
0
|
|
|
|
|
0
|
push @range, grep {$char[$i-1] le $_} chars1(); |
|
0
|
|
|
|
|
0
|
|
1483
|
0
|
|
|
|
|
0
|
push @range, chars2(); |
1484
|
0
|
|
|
|
|
0
|
push @range, grep {$_ le $char[$i+1]} chars3(); |
|
0
|
|
|
|
|
0
|
|
1485
|
|
|
|
|
|
|
} |
1486
|
|
|
|
|
|
|
elsif (CORE::length($char[$i+1]) == 4) { |
1487
|
0
|
|
|
|
|
0
|
push @range, grep {$char[$i-1] le $_} chars1(); |
|
0
|
|
|
|
|
0
|
|
1488
|
0
|
|
|
|
|
0
|
push @range, chars2(); |
1489
|
0
|
|
|
|
|
0
|
push @range, chars3(); |
1490
|
0
|
|
|
|
|
0
|
push @range, grep {$_ le $char[$i+1]} chars4(); |
|
0
|
|
|
|
|
0
|
|
1491
|
|
|
|
|
|
|
} |
1492
|
|
|
|
|
|
|
else { |
1493
|
0
|
|
|
|
|
0
|
croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"'; |
1494
|
|
|
|
|
|
|
} |
1495
|
|
|
|
|
|
|
} |
1496
|
|
|
|
|
|
|
elsif (CORE::length($char[$i-1]) == 2) { |
1497
|
0
|
0
|
|
|
|
0
|
if (CORE::length($char[$i+1]) == 2) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1498
|
0
|
0
|
|
|
|
0
|
push @range, grep {($char[$i-1] le $_) and ($_ le $char[$i+1])} chars2(); |
|
0
|
|
|
|
|
0
|
|
1499
|
|
|
|
|
|
|
} |
1500
|
|
|
|
|
|
|
elsif (CORE::length($char[$i+1]) == 3) { |
1501
|
0
|
|
|
|
|
0
|
push @range, grep {$char[$i-1] le $_} chars2(); |
|
0
|
|
|
|
|
0
|
|
1502
|
0
|
|
|
|
|
0
|
push @range, grep {$_ le $char[$i+1]} chars3(); |
|
0
|
|
|
|
|
0
|
|
1503
|
|
|
|
|
|
|
} |
1504
|
|
|
|
|
|
|
elsif (CORE::length($char[$i+1]) == 4) { |
1505
|
0
|
|
|
|
|
0
|
push @range, grep {$char[$i-1] le $_} chars2(); |
|
0
|
|
|
|
|
0
|
|
1506
|
0
|
|
|
|
|
0
|
push @range, chars3(); |
1507
|
0
|
|
|
|
|
0
|
push @range, grep {$_ le $char[$i+1]} chars4(); |
|
0
|
|
|
|
|
0
|
|
1508
|
|
|
|
|
|
|
} |
1509
|
|
|
|
|
|
|
else { |
1510
|
0
|
|
|
|
|
0
|
croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"'; |
1511
|
|
|
|
|
|
|
} |
1512
|
|
|
|
|
|
|
} |
1513
|
|
|
|
|
|
|
elsif (CORE::length($char[$i-1]) == 3) { |
1514
|
0
|
0
|
|
|
|
0
|
if (CORE::length($char[$i+1]) == 3) { |
|
|
0
|
|
|
|
|
|
1515
|
0
|
0
|
|
|
|
0
|
push @range, grep {($char[$i-1] le $_) and ($_ le $char[$i+1])} chars3(); |
|
0
|
|
|
|
|
0
|
|
1516
|
|
|
|
|
|
|
} |
1517
|
|
|
|
|
|
|
elsif (CORE::length($char[$i+1]) == 4) { |
1518
|
0
|
|
|
|
|
0
|
push @range, grep {$char[$i-1] le $_} chars3(); |
|
0
|
|
|
|
|
0
|
|
1519
|
0
|
|
|
|
|
0
|
push @range, grep {$_ le $char[$i+1]} chars4(); |
|
0
|
|
|
|
|
0
|
|
1520
|
|
|
|
|
|
|
} |
1521
|
|
|
|
|
|
|
else { |
1522
|
0
|
|
|
|
|
0
|
croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"'; |
1523
|
|
|
|
|
|
|
} |
1524
|
|
|
|
|
|
|
} |
1525
|
|
|
|
|
|
|
elsif (CORE::length($char[$i-1]) == 4) { |
1526
|
0
|
0
|
|
|
|
0
|
if (CORE::length($char[$i+1]) == 4) { |
1527
|
0
|
0
|
|
|
|
0
|
push @range, grep {($char[$i-1] le $_) and ($_ le $char[$i+1])} chars4(); |
|
0
|
|
|
|
|
0
|
|
1528
|
|
|
|
|
|
|
} |
1529
|
|
|
|
|
|
|
else { |
1530
|
0
|
|
|
|
|
0
|
croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"'; |
1531
|
|
|
|
|
|
|
} |
1532
|
|
|
|
|
|
|
} |
1533
|
|
|
|
|
|
|
else { |
1534
|
0
|
|
|
|
|
0
|
croak "Invalid tr/// range (over 4octets) \"\\x" . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]) . '"'; |
1535
|
|
|
|
|
|
|
} |
1536
|
|
|
|
|
|
|
|
1537
|
0
|
|
|
|
|
0
|
splice @char, $i-1, 3, @range; |
1538
|
|
|
|
|
|
|
} |
1539
|
|
|
|
|
|
|
|
1540
|
0
|
|
|
|
|
0
|
return @char; |
1541
|
|
|
|
|
|
|
} |
1542
|
|
|
|
|
|
|
|
1543
|
|
|
|
|
|
|
# |
1544
|
|
|
|
|
|
|
# EUC-JP open character class |
1545
|
|
|
|
|
|
|
# |
1546
|
|
|
|
|
|
|
sub _cc { |
1547
|
0
|
50
|
|
382
|
|
0
|
if (scalar(@_) == 0) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1548
|
382
|
|
|
|
|
932
|
die __FILE__, ": subroutine cc got no parameter.\n"; |
1549
|
|
|
|
|
|
|
} |
1550
|
|
|
|
|
|
|
elsif (scalar(@_) == 1) { |
1551
|
0
|
|
|
|
|
0
|
return sprintf('\x%02X',$_[0]); |
1552
|
|
|
|
|
|
|
} |
1553
|
|
|
|
|
|
|
elsif (scalar(@_) == 2) { |
1554
|
171
|
50
|
|
|
|
636
|
if ($_[0] > $_[1]) { |
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
1555
|
211
|
|
|
|
|
557
|
die __FILE__, ": subroutine cc got \$_[0] > \$_[1] parameters).\n"; |
1556
|
|
|
|
|
|
|
} |
1557
|
|
|
|
|
|
|
elsif ($_[0] == $_[1]) { |
1558
|
0
|
|
|
|
|
0
|
return sprintf('\x%02X',$_[0]); |
1559
|
|
|
|
|
|
|
} |
1560
|
|
|
|
|
|
|
elsif (($_[0]+1) == $_[1]) { |
1561
|
0
|
|
|
|
|
0
|
return sprintf('[\\x%02X\\x%02X]',$_[0],$_[1]); |
1562
|
|
|
|
|
|
|
} |
1563
|
|
|
|
|
|
|
else { |
1564
|
20
|
|
|
|
|
55
|
return sprintf('[\\x%02X-\\x%02X]',$_[0],$_[1]); |
1565
|
|
|
|
|
|
|
} |
1566
|
|
|
|
|
|
|
} |
1567
|
|
|
|
|
|
|
else { |
1568
|
191
|
|
|
|
|
1032
|
die __FILE__, ": subroutine cc got 3 or more parameters (@{[scalar(@_)]} parameters).\n"; |
|
0
|
|
|
|
|
0
|
|
1569
|
|
|
|
|
|
|
} |
1570
|
|
|
|
|
|
|
} |
1571
|
|
|
|
|
|
|
|
1572
|
|
|
|
|
|
|
# |
1573
|
|
|
|
|
|
|
# EUC-JP octet range |
1574
|
|
|
|
|
|
|
# |
1575
|
|
|
|
|
|
|
sub _octets { |
1576
|
0
|
|
|
577
|
|
0
|
my $length = shift @_; |
1577
|
|
|
|
|
|
|
|
1578
|
577
|
100
|
|
|
|
907
|
if ($length == 1) { |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
1579
|
577
|
|
|
|
|
1302
|
my($a1) = unpack 'C', $_[0]; |
1580
|
426
|
|
|
|
|
1066
|
my($z1) = unpack 'C', $_[1]; |
1581
|
|
|
|
|
|
|
|
1582
|
426
|
50
|
|
|
|
693
|
if ($a1 > $z1) { |
1583
|
426
|
|
|
|
|
894
|
croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$a1) . '-\x' . unpack('H*',$z1); |
1584
|
|
|
|
|
|
|
} |
1585
|
|
|
|
|
|
|
|
1586
|
0
|
100
|
|
|
|
0
|
if ($a1 == $z1) { |
|
|
50
|
|
|
|
|
|
1587
|
426
|
|
|
|
|
1023
|
return sprintf('\x%02X',$a1); |
1588
|
|
|
|
|
|
|
} |
1589
|
|
|
|
|
|
|
elsif (($a1+1) == $z1) { |
1590
|
20
|
|
|
|
|
80
|
return sprintf('\x%02X\x%02X',$a1,$z1); |
1591
|
|
|
|
|
|
|
} |
1592
|
|
|
|
|
|
|
else { |
1593
|
0
|
|
|
|
|
0
|
return sprintf('\x%02X-\x%02X',$a1,$z1); |
1594
|
|
|
|
|
|
|
} |
1595
|
|
|
|
|
|
|
} |
1596
|
|
|
|
|
|
|
elsif ($length == 2) { |
1597
|
406
|
|
|
|
|
2355
|
my($a1,$a2) = unpack 'CC', $_[0]; |
1598
|
151
|
|
|
|
|
393
|
my($z1,$z2) = unpack 'CC', $_[1]; |
1599
|
151
|
|
|
|
|
299
|
my($A1,$A2) = unpack 'CC', $_[2]; |
1600
|
151
|
|
|
|
|
222
|
my($Z1,$Z2) = unpack 'CC', $_[3]; |
1601
|
|
|
|
|
|
|
|
1602
|
151
|
100
|
|
|
|
241
|
if ($a1 == $z1) { |
|
|
50
|
|
|
|
|
|
1603
|
|
|
|
|
|
|
return ( |
1604
|
|
|
|
|
|
|
# 11111111 222222222222 |
1605
|
|
|
|
|
|
|
# A A Z |
1606
|
151
|
|
|
|
|
322
|
_cc($a1) . _cc($a2,$z2), # a2-z2 |
1607
|
|
|
|
|
|
|
); |
1608
|
|
|
|
|
|
|
} |
1609
|
|
|
|
|
|
|
elsif (($a1+1) == $z1) { |
1610
|
|
|
|
|
|
|
return ( |
1611
|
|
|
|
|
|
|
# 11111111111 222222222222 |
1612
|
|
|
|
|
|
|
# A Z A Z |
1613
|
131
|
|
|
|
|
255
|
_cc($a1) . _cc($a2,$Z2), # a2- |
1614
|
|
|
|
|
|
|
_cc( $z1) . _cc($A2,$z2), # -z2 |
1615
|
|
|
|
|
|
|
); |
1616
|
|
|
|
|
|
|
} |
1617
|
|
|
|
|
|
|
else { |
1618
|
|
|
|
|
|
|
return ( |
1619
|
|
|
|
|
|
|
# 1111111111111111 222222222222 |
1620
|
|
|
|
|
|
|
# A Z A Z |
1621
|
0
|
|
|
|
|
0
|
_cc($a1) . _cc($a2,$Z2), # a2- |
1622
|
|
|
|
|
|
|
_cc($a1+1,$z1-1) . _cc($A2,$Z2), # - |
1623
|
|
|
|
|
|
|
_cc( $z1) . _cc($A2,$z2), # -z2 |
1624
|
|
|
|
|
|
|
); |
1625
|
|
|
|
|
|
|
} |
1626
|
|
|
|
|
|
|
} |
1627
|
|
|
|
|
|
|
elsif ($length == 3) { |
1628
|
20
|
|
|
|
|
33
|
my($a1,$a2,$a3) = unpack 'CCC', $_[0]; |
1629
|
0
|
|
|
|
|
0
|
my($z1,$z2,$z3) = unpack 'CCC', $_[1]; |
1630
|
0
|
|
|
|
|
0
|
my($A1,$A2,$A3) = unpack 'CCC', $_[2]; |
1631
|
0
|
|
|
|
|
0
|
my($Z1,$Z2,$Z3) = unpack 'CCC', $_[3]; |
1632
|
|
|
|
|
|
|
|
1633
|
0
|
0
|
|
|
|
0
|
if ($a1 == $z1) { |
|
|
0
|
|
|
|
|
|
1634
|
0
|
0
|
|
|
|
0
|
if ($a2 == $z2) { |
|
|
0
|
|
|
|
|
|
1635
|
|
|
|
|
|
|
return ( |
1636
|
|
|
|
|
|
|
# 11111111 22222222 333333333333 |
1637
|
|
|
|
|
|
|
# A A A Z |
1638
|
0
|
|
|
|
|
0
|
_cc($a1) . _cc($a2) . _cc($a3,$z3), # a3-z3 |
1639
|
|
|
|
|
|
|
); |
1640
|
|
|
|
|
|
|
} |
1641
|
|
|
|
|
|
|
elsif (($a2+1) == $z2) { |
1642
|
|
|
|
|
|
|
return ( |
1643
|
|
|
|
|
|
|
# 11111111 22222222222 333333333333 |
1644
|
|
|
|
|
|
|
# A A Z A Z |
1645
|
0
|
|
|
|
|
0
|
_cc($a1) . _cc($a2) . _cc($a3,$Z3), # a3- |
1646
|
|
|
|
|
|
|
_cc($a1) . _cc( $z2) . _cc($A3,$z3), # -z3 |
1647
|
|
|
|
|
|
|
); |
1648
|
|
|
|
|
|
|
} |
1649
|
|
|
|
|
|
|
else { |
1650
|
|
|
|
|
|
|
return ( |
1651
|
|
|
|
|
|
|
# 11111111 2222222222222222 333333333333 |
1652
|
|
|
|
|
|
|
# A A Z A Z |
1653
|
0
|
|
|
|
|
0
|
_cc($a1) . _cc($a2) . _cc($a3,$Z3), # a3- |
1654
|
|
|
|
|
|
|
_cc($a1) . _cc($a2+1,$z2-1) . _cc($A3,$Z3), # - |
1655
|
|
|
|
|
|
|
_cc($a1) . _cc( $z2) . _cc($A3,$z3), # -z3 |
1656
|
|
|
|
|
|
|
); |
1657
|
|
|
|
|
|
|
} |
1658
|
|
|
|
|
|
|
} |
1659
|
|
|
|
|
|
|
elsif (($a1+1) == $z1) { |
1660
|
|
|
|
|
|
|
return ( |
1661
|
|
|
|
|
|
|
# 11111111111 22222222222222 333333333333 |
1662
|
|
|
|
|
|
|
# A Z A Z A Z |
1663
|
0
|
|
|
|
|
0
|
_cc($a1) . _cc($a2) . _cc($a3,$Z3), # a3- |
1664
|
|
|
|
|
|
|
_cc($a1) . _cc($a2+1,$Z2) . _cc($A3,$Z3), # - |
1665
|
|
|
|
|
|
|
_cc( $z1) . _cc($A2,$z2-1) . _cc($A3,$Z3), # - |
1666
|
|
|
|
|
|
|
_cc( $z1) . _cc( $z2) . _cc($A3,$z3), # -z3 |
1667
|
|
|
|
|
|
|
); |
1668
|
|
|
|
|
|
|
} |
1669
|
|
|
|
|
|
|
else { |
1670
|
|
|
|
|
|
|
return ( |
1671
|
|
|
|
|
|
|
# 1111111111111111 22222222222222 333333333333 |
1672
|
|
|
|
|
|
|
# A Z A Z A Z |
1673
|
0
|
|
|
|
|
0
|
_cc($a1) . _cc($a2) . _cc($a3,$Z3), # a3- |
1674
|
|
|
|
|
|
|
_cc($a1) . _cc($a2+1,$Z2) . _cc($A3,$Z3), # - |
1675
|
|
|
|
|
|
|
_cc($a1+1,$z1-1) . _cc($A2,$Z2) . _cc($A3,$Z3), # - |
1676
|
|
|
|
|
|
|
_cc( $z1) . _cc($A2,$z2-1) . _cc($A3,$Z3), # - |
1677
|
|
|
|
|
|
|
_cc( $z1) . _cc( $z2) . _cc($A3,$z3), # -z3 |
1678
|
|
|
|
|
|
|
); |
1679
|
|
|
|
|
|
|
} |
1680
|
|
|
|
|
|
|
} |
1681
|
|
|
|
|
|
|
elsif ($length == 4) { |
1682
|
0
|
|
|
|
|
0
|
my($a1,$a2,$a3,$a4) = unpack 'CCCC', $_[0]; |
1683
|
0
|
|
|
|
|
0
|
my($z1,$z2,$z3,$z4) = unpack 'CCCC', $_[1]; |
1684
|
0
|
|
|
|
|
0
|
my($A1,$A2,$A3,$A4) = unpack 'CCCC', $_[0]; |
1685
|
0
|
|
|
|
|
0
|
my($Z1,$Z2,$Z3,$Z4) = unpack 'CCCC', $_[1]; |
1686
|
|
|
|
|
|
|
|
1687
|
0
|
0
|
|
|
|
0
|
if ($a1 == $z1) { |
|
|
0
|
|
|
|
|
|
1688
|
0
|
0
|
|
|
|
0
|
if ($a2 == $z2) { |
|
|
0
|
|
|
|
|
|
1689
|
0
|
0
|
|
|
|
0
|
if ($a3 == $z3) { |
|
|
0
|
|
|
|
|
|
1690
|
|
|
|
|
|
|
return ( |
1691
|
|
|
|
|
|
|
# 11111111 22222222 33333333 444444444444 |
1692
|
|
|
|
|
|
|
# A A A A Z |
1693
|
0
|
|
|
|
|
0
|
_cc($a1) . _cc($a2) . _cc($a3) . _cc($a4,$z4), # a4-z4 |
1694
|
|
|
|
|
|
|
); |
1695
|
|
|
|
|
|
|
} |
1696
|
|
|
|
|
|
|
elsif (($a3+1) == $z3) { |
1697
|
|
|
|
|
|
|
return ( |
1698
|
|
|
|
|
|
|
# 11111111 22222222 33333333333 444444444444 |
1699
|
|
|
|
|
|
|
# A A A Z A Z |
1700
|
0
|
|
|
|
|
0
|
_cc($a1) . _cc($a2) . _cc($a3) . _cc($a4,$Z4), # a4- |
1701
|
|
|
|
|
|
|
_cc($a1) . _cc($a2) . _cc( $z3) . _cc($A4,$z4), # -z4 |
1702
|
|
|
|
|
|
|
); |
1703
|
|
|
|
|
|
|
} |
1704
|
|
|
|
|
|
|
else { |
1705
|
|
|
|
|
|
|
return ( |
1706
|
|
|
|
|
|
|
# 11111111 22222222 3333333333333333 444444444444 |
1707
|
|
|
|
|
|
|
# A A A Z A Z |
1708
|
0
|
|
|
|
|
0
|
_cc($a1) . _cc($a2) . _cc($a3) . _cc($a4,$Z4), # a4- |
1709
|
|
|
|
|
|
|
_cc($a1) . _cc($a2) . _cc($a3+1,$z3-1) . _cc($A4,$Z4), # - |
1710
|
|
|
|
|
|
|
_cc($a1) . _cc($a2) . _cc( $z3) . _cc($A4,$z4), # -z4 |
1711
|
|
|
|
|
|
|
); |
1712
|
|
|
|
|
|
|
} |
1713
|
|
|
|
|
|
|
} |
1714
|
|
|
|
|
|
|
elsif (($a2+1) == $z2) { |
1715
|
|
|
|
|
|
|
return ( |
1716
|
|
|
|
|
|
|
# 11111111 22222222222 33333333333333 444444444444 |
1717
|
|
|
|
|
|
|
# A A Z A Z A Z |
1718
|
0
|
|
|
|
|
0
|
_cc($a1) . _cc($a2) . _cc($a3) . _cc($a4,$Z4), # a4- |
1719
|
|
|
|
|
|
|
_cc($a1) . _cc($a2) . _cc($a3+1,$Z3) . _cc($A4,$Z4), # - |
1720
|
|
|
|
|
|
|
_cc($a1) . _cc( $z2) . _cc($A3,$z3-1) . _cc($A4,$Z4), # - |
1721
|
|
|
|
|
|
|
_cc($a1) . _cc( $z2) . _cc( $z3) . _cc($A4,$z4), # -z4 |
1722
|
|
|
|
|
|
|
); |
1723
|
|
|
|
|
|
|
} |
1724
|
|
|
|
|
|
|
else { |
1725
|
|
|
|
|
|
|
return ( |
1726
|
|
|
|
|
|
|
# 11111111 2222222222222222 33333333333333 444444444444 |
1727
|
|
|
|
|
|
|
# A A Z A Z A Z |
1728
|
0
|
|
|
|
|
0
|
_cc($a1) . _cc($a2) . _cc($a3) . _cc($a4,$Z4), # a4- |
1729
|
|
|
|
|
|
|
_cc($a1) . _cc($a2) . _cc($a3+1,$Z3) . _cc($A4,$Z4), # - |
1730
|
|
|
|
|
|
|
_cc($a1) . _cc($a2+1,$z2-1) . _cc($A3,$Z3) . _cc($A4,$Z4), # - |
1731
|
|
|
|
|
|
|
_cc($a1) . _cc( $z2) . _cc($A3,$z3-1) . _cc($A4,$Z4), # - |
1732
|
|
|
|
|
|
|
_cc($a1) . _cc( $z2) . _cc( $z3) . _cc($A4,$z4), # -z4 |
1733
|
|
|
|
|
|
|
); |
1734
|
|
|
|
|
|
|
} |
1735
|
|
|
|
|
|
|
} |
1736
|
|
|
|
|
|
|
elsif (($a1+1) == $z1) { |
1737
|
|
|
|
|
|
|
return ( |
1738
|
|
|
|
|
|
|
# 11111111111 22222222222222 33333333333333 444444444444 |
1739
|
|
|
|
|
|
|
# A Z A Z A Z A Z |
1740
|
0
|
|
|
|
|
0
|
_cc($a1) . _cc($a2) . _cc($a3) . _cc($a4,$Z4), # a4- |
1741
|
|
|
|
|
|
|
_cc($a1) . _cc($a2) . _cc($a3+1,$Z3) . _cc($A4,$Z4), # - |
1742
|
|
|
|
|
|
|
_cc($a1) . _cc($a2+1,$Z2) . _cc($A3,$Z3) . _cc($A4,$Z4), # - |
1743
|
|
|
|
|
|
|
_cc( $z1) . _cc($A2,$z2-1) . _cc($A3,$Z3) . _cc($A4,$Z4), # - |
1744
|
|
|
|
|
|
|
_cc( $z1) . _cc( $z2) . _cc($A3,$z3-1) . _cc($A4,$Z4), # - |
1745
|
|
|
|
|
|
|
_cc( $z1) . _cc( $z2) . _cc( $z3) . _cc($A4,$z4), # -z4 |
1746
|
|
|
|
|
|
|
); |
1747
|
|
|
|
|
|
|
} |
1748
|
|
|
|
|
|
|
else { |
1749
|
|
|
|
|
|
|
return ( |
1750
|
|
|
|
|
|
|
# 1111111111111111 22222222222222 33333333333333 444444444444 |
1751
|
|
|
|
|
|
|
# A Z A Z A Z A Z |
1752
|
0
|
|
|
|
|
0
|
_cc($a1) . _cc($a2) . _cc($a3) . _cc($a4,$Z4), # a4- |
1753
|
|
|
|
|
|
|
_cc($a1) . _cc($a2) . _cc($a3+1,$Z3) . _cc($A4,$Z4), # - |
1754
|
|
|
|
|
|
|
_cc($a1) . _cc($a2+1,$Z2) . _cc($A3,$Z3) . _cc($A4,$Z4), # - |
1755
|
|
|
|
|
|
|
_cc($a1+1,$z1-1) . _cc($A2,$Z2) . _cc($A3,$Z3) . _cc($A4,$Z4), # - |
1756
|
|
|
|
|
|
|
_cc( $z1) . _cc($A2,$z2-1) . _cc($A3,$Z3) . _cc($A4,$Z4), # - |
1757
|
|
|
|
|
|
|
_cc( $z1) . _cc( $z2) . _cc($A3,$z3-1) . _cc($A4,$Z4), # - |
1758
|
|
|
|
|
|
|
_cc( $z1) . _cc( $z2) . _cc( $z3) . _cc($A4,$z4), # -z4 |
1759
|
|
|
|
|
|
|
); |
1760
|
|
|
|
|
|
|
} |
1761
|
|
|
|
|
|
|
} |
1762
|
|
|
|
|
|
|
else { |
1763
|
0
|
|
|
|
|
0
|
die __FILE__, ": subroutine _octets got invalid length ($length).\n"; |
1764
|
|
|
|
|
|
|
} |
1765
|
|
|
|
|
|
|
} |
1766
|
|
|
|
|
|
|
|
1767
|
|
|
|
|
|
|
# |
1768
|
|
|
|
|
|
|
# EUC-JP range regexp |
1769
|
|
|
|
|
|
|
# |
1770
|
|
|
|
|
|
|
sub _range_regexp { |
1771
|
0
|
|
|
517
|
|
0
|
my($length,$first,$last) = @_; |
1772
|
|
|
|
|
|
|
|
1773
|
517
|
|
|
|
|
1056
|
my @range_regexp = (); |
1774
|
517
|
50
|
|
|
|
739
|
if (not exists $range_tr{$length}) { |
1775
|
517
|
|
|
|
|
1210
|
return @range_regexp; |
1776
|
|
|
|
|
|
|
} |
1777
|
|
|
|
|
|
|
|
1778
|
0
|
|
|
|
|
0
|
my @ranges = @{ $range_tr{$length} }; |
|
517
|
|
|
|
|
659
|
|
1779
|
517
|
|
|
|
|
1135
|
while (my @range = splice(@ranges,0,$length)) { |
1780
|
517
|
|
|
|
|
1572
|
my $min = ''; |
1781
|
1420
|
|
|
|
|
1936
|
my $max = ''; |
1782
|
1420
|
|
|
|
|
1500
|
for (my $i=0; $i < $length; $i++) { |
1783
|
1420
|
|
|
|
|
2434
|
$min .= pack 'C', $range[$i][0]; |
1784
|
1682
|
|
|
|
|
3204
|
$max .= pack 'C', $range[$i][-1]; |
1785
|
|
|
|
|
|
|
} |
1786
|
|
|
|
|
|
|
|
1787
|
|
|
|
|
|
|
# min___max |
1788
|
|
|
|
|
|
|
# FIRST_____________LAST |
1789
|
|
|
|
|
|
|
# (nothing) |
1790
|
|
|
|
|
|
|
|
1791
|
1682
|
100
|
66
|
|
|
3043
|
if ($max lt $first) { |
|
|
100
|
100
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
|
|
100
|
100
|
|
|
|
|
|
|
100
|
66
|
|
|
|
|
|
|
100
|
66
|
|
|
|
|
|
|
50
|
66
|
|
|
|
|
1792
|
|
|
|
|
|
|
} |
1793
|
|
|
|
|
|
|
|
1794
|
|
|
|
|
|
|
# ********** |
1795
|
|
|
|
|
|
|
# min_________max |
1796
|
|
|
|
|
|
|
# FIRST_____________LAST |
1797
|
|
|
|
|
|
|
# ********** |
1798
|
|
|
|
|
|
|
|
1799
|
|
|
|
|
|
|
elsif (($min le $first) and ($first le $max) and ($max le $last)) { |
1800
|
1420
|
|
|
|
|
11386
|
push @range_regexp, _octets($length,$first,$max,$min,$max); |
1801
|
|
|
|
|
|
|
} |
1802
|
|
|
|
|
|
|
|
1803
|
|
|
|
|
|
|
# ********************** |
1804
|
|
|
|
|
|
|
# min________________max |
1805
|
|
|
|
|
|
|
# FIRST_____________LAST |
1806
|
|
|
|
|
|
|
# ********************** |
1807
|
|
|
|
|
|
|
|
1808
|
|
|
|
|
|
|
elsif (($min eq $first) and ($max eq $last)) { |
1809
|
20
|
|
|
|
|
52
|
push @range_regexp, _octets($length,$first,$last,$min,$max); |
1810
|
|
|
|
|
|
|
} |
1811
|
|
|
|
|
|
|
|
1812
|
|
|
|
|
|
|
# ********* |
1813
|
|
|
|
|
|
|
# min___max |
1814
|
|
|
|
|
|
|
# FIRST_____________LAST |
1815
|
|
|
|
|
|
|
# ********* |
1816
|
|
|
|
|
|
|
|
1817
|
|
|
|
|
|
|
elsif (($first le $min) and ($max le $last)) { |
1818
|
0
|
|
|
|
|
0
|
push @range_regexp, _octets($length,$min,$max,$min,$max); |
1819
|
|
|
|
|
|
|
} |
1820
|
|
|
|
|
|
|
|
1821
|
|
|
|
|
|
|
# ********************** |
1822
|
|
|
|
|
|
|
# min__________________________max |
1823
|
|
|
|
|
|
|
# FIRST_____________LAST |
1824
|
|
|
|
|
|
|
# ********************** |
1825
|
|
|
|
|
|
|
|
1826
|
|
|
|
|
|
|
elsif (($min le $first) and ($last le $max)) { |
1827
|
60
|
|
|
|
|
96
|
push @range_regexp, _octets($length,$first,$last,$min,$max); |
1828
|
|
|
|
|
|
|
} |
1829
|
|
|
|
|
|
|
|
1830
|
|
|
|
|
|
|
# ********* |
1831
|
|
|
|
|
|
|
# min________max |
1832
|
|
|
|
|
|
|
# FIRST_____________LAST |
1833
|
|
|
|
|
|
|
# ********* |
1834
|
|
|
|
|
|
|
|
1835
|
|
|
|
|
|
|
elsif (($first le $min) and ($min le $last) and ($last le $max)) { |
1836
|
477
|
|
|
|
|
1113
|
push @range_regexp, _octets($length,$min,$last,$min,$max); |
1837
|
|
|
|
|
|
|
} |
1838
|
|
|
|
|
|
|
|
1839
|
|
|
|
|
|
|
# min___max |
1840
|
|
|
|
|
|
|
# FIRST_____________LAST |
1841
|
|
|
|
|
|
|
# (nothing) |
1842
|
|
|
|
|
|
|
|
1843
|
|
|
|
|
|
|
elsif ($last lt $min) { |
1844
|
|
|
|
|
|
|
} |
1845
|
|
|
|
|
|
|
|
1846
|
|
|
|
|
|
|
else { |
1847
|
20
|
|
|
|
|
35
|
die __FILE__, ": subroutine _range_regexp panic.\n"; |
1848
|
|
|
|
|
|
|
} |
1849
|
|
|
|
|
|
|
} |
1850
|
|
|
|
|
|
|
|
1851
|
0
|
|
|
|
|
0
|
return @range_regexp; |
1852
|
|
|
|
|
|
|
} |
1853
|
|
|
|
|
|
|
|
1854
|
|
|
|
|
|
|
# |
1855
|
|
|
|
|
|
|
# EUC-JP open character list for qr and not qr |
1856
|
|
|
|
|
|
|
# |
1857
|
|
|
|
|
|
|
sub _charlist { |
1858
|
|
|
|
|
|
|
|
1859
|
517
|
|
|
758
|
|
1130
|
my $modifier = pop @_; |
1860
|
758
|
|
|
|
|
1150
|
my @char = @_; |
1861
|
|
|
|
|
|
|
|
1862
|
758
|
100
|
|
|
|
1598
|
my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0; |
1863
|
|
|
|
|
|
|
|
1864
|
|
|
|
|
|
|
# unescape character |
1865
|
758
|
|
|
|
|
1675
|
for (my $i=0; $i <= $#char; $i++) { |
1866
|
|
|
|
|
|
|
|
1867
|
|
|
|
|
|
|
# escape - to ... |
1868
|
758
|
100
|
100
|
|
|
2179
|
if ($char[$i] eq '-') { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
1869
|
2648
|
100
|
100
|
|
|
18427
|
if ((0 < $i) and ($i < $#char)) { |
1870
|
522
|
|
|
|
|
1765
|
$char[$i] = '...'; |
1871
|
|
|
|
|
|
|
} |
1872
|
|
|
|
|
|
|
} |
1873
|
|
|
|
|
|
|
|
1874
|
|
|
|
|
|
|
# octal escape sequence |
1875
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) { |
1876
|
497
|
|
|
|
|
1000
|
$char[$i] = octchr($1); |
1877
|
|
|
|
|
|
|
} |
1878
|
|
|
|
|
|
|
|
1879
|
|
|
|
|
|
|
# hexadecimal escape sequence |
1880
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) { |
1881
|
0
|
|
|
|
|
0
|
$char[$i] = hexchr($1); |
1882
|
|
|
|
|
|
|
} |
1883
|
|
|
|
|
|
|
|
1884
|
|
|
|
|
|
|
# \b{...} --> b\{...} |
1885
|
|
|
|
|
|
|
# \B{...} --> B\{...} |
1886
|
|
|
|
|
|
|
# \N{CHARNAME} --> N\{CHARNAME} |
1887
|
|
|
|
|
|
|
# \p{PROPERTY} --> p\{PROPERTY} |
1888
|
|
|
|
|
|
|
# \P{PROPERTY} --> P\{PROPERTY} |
1889
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^\x8E\x8F\xA1-\xFE0-9\}][^\x8E\x8F\xA1-\xFE\}]*) \} ) \z/oxms) { |
1890
|
0
|
|
|
|
|
0
|
$char[$i] = $1 . '\\' . $2; |
1891
|
|
|
|
|
|
|
} |
1892
|
|
|
|
|
|
|
|
1893
|
|
|
|
|
|
|
# \p, \P, \X --> p, P, X |
1894
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) { |
1895
|
0
|
|
|
|
|
0
|
$char[$i] = $1; |
1896
|
|
|
|
|
|
|
} |
1897
|
|
|
|
|
|
|
|
1898
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\ ([0-7]{2,3}) \z/oxms) { |
1899
|
0
|
|
|
|
|
0
|
$char[$i] = CORE::chr oct $1; |
1900
|
|
|
|
|
|
|
} |
1901
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\x ([0-9A-Fa-f]{1,2}) \z/oxms) { |
1902
|
0
|
|
|
|
|
0
|
$char[$i] = CORE::chr hex $1; |
1903
|
|
|
|
|
|
|
} |
1904
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\c ([\x40-\x5F]) \z/oxms) { |
1905
|
206
|
|
|
|
|
735
|
$char[$i] = CORE::chr(CORE::ord($1) & 0x1F); |
1906
|
|
|
|
|
|
|
} |
1907
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A (\\ [0nrtfbaedswDSWHVhvR]) \z/oxms) { |
1908
|
|
|
|
|
|
|
$char[$i] = { |
1909
|
|
|
|
|
|
|
'\0' => "\0", |
1910
|
|
|
|
|
|
|
'\n' => "\n", |
1911
|
|
|
|
|
|
|
'\r' => "\r", |
1912
|
|
|
|
|
|
|
'\t' => "\t", |
1913
|
|
|
|
|
|
|
'\f' => "\f", |
1914
|
|
|
|
|
|
|
'\b' => "\x08", # \b means backspace in character class |
1915
|
|
|
|
|
|
|
'\a' => "\a", |
1916
|
|
|
|
|
|
|
'\e' => "\e", |
1917
|
|
|
|
|
|
|
'\d' => '[0-9]', |
1918
|
|
|
|
|
|
|
|
1919
|
|
|
|
|
|
|
# Vertical tabs are now whitespace |
1920
|
|
|
|
|
|
|
# \s in a regex now matches a vertical tab in all circumstances. |
1921
|
|
|
|
|
|
|
# http://search.cpan.org/dist/perl-5.18.0/pod/perldelta.pod#Vertical_tabs_are_now_whitespace |
1922
|
|
|
|
|
|
|
# \t \n \v \f \r space |
1923
|
|
|
|
|
|
|
# '\s' => '[\x09\x0A \x0C\x0D\x20]', |
1924
|
|
|
|
|
|
|
# '\s' => '[\x09\x0A\x0B\x0C\x0D\x20]', |
1925
|
|
|
|
|
|
|
'\s' => '\s', |
1926
|
|
|
|
|
|
|
|
1927
|
|
|
|
|
|
|
'\w' => '[0-9A-Z_a-z]', |
1928
|
|
|
|
|
|
|
'\D' => '${Eeucjp::eD}', |
1929
|
|
|
|
|
|
|
'\S' => '${Eeucjp::eS}', |
1930
|
|
|
|
|
|
|
'\W' => '${Eeucjp::eW}', |
1931
|
|
|
|
|
|
|
|
1932
|
|
|
|
|
|
|
'\H' => '${Eeucjp::eH}', |
1933
|
|
|
|
|
|
|
'\V' => '${Eeucjp::eV}', |
1934
|
|
|
|
|
|
|
'\h' => '[\x09\x20]', |
1935
|
|
|
|
|
|
|
'\v' => '[\x0A\x0B\x0C\x0D]', |
1936
|
|
|
|
|
|
|
'\R' => '${Eeucjp::eR}', |
1937
|
|
|
|
|
|
|
|
1938
|
0
|
|
|
|
|
0
|
}->{$1}; |
1939
|
|
|
|
|
|
|
} |
1940
|
|
|
|
|
|
|
|
1941
|
|
|
|
|
|
|
# POSIX-style character classes |
1942
|
|
|
|
|
|
|
elsif ($ignorecase and ($char[$i] =~ /\A ( \[\: \^? (?:lower|upper) :\] ) \z/oxms)) { |
1943
|
|
|
|
|
|
|
$char[$i] = { |
1944
|
|
|
|
|
|
|
|
1945
|
|
|
|
|
|
|
'[:lower:]' => '[\x41-\x5A\x61-\x7A]', |
1946
|
|
|
|
|
|
|
'[:upper:]' => '[\x41-\x5A\x61-\x7A]', |
1947
|
|
|
|
|
|
|
'[:^lower:]' => '${Eeucjp::not_lower_i}', |
1948
|
|
|
|
|
|
|
'[:^upper:]' => '${Eeucjp::not_upper_i}', |
1949
|
|
|
|
|
|
|
|
1950
|
33
|
|
|
|
|
636
|
}->{$1}; |
1951
|
|
|
|
|
|
|
} |
1952
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A ( \[\: \^? (?:alnum|alpha|ascii|blank|cntrl|digit|graph|lower|print|punct|space|upper|word|xdigit) :\] ) \z/oxms) { |
1953
|
|
|
|
|
|
|
$char[$i] = { |
1954
|
|
|
|
|
|
|
|
1955
|
|
|
|
|
|
|
'[:alnum:]' => '[\x30-\x39\x41-\x5A\x61-\x7A]', |
1956
|
|
|
|
|
|
|
'[:alpha:]' => '[\x41-\x5A\x61-\x7A]', |
1957
|
|
|
|
|
|
|
'[:ascii:]' => '[\x00-\x7F]', |
1958
|
|
|
|
|
|
|
'[:blank:]' => '[\x09\x20]', |
1959
|
|
|
|
|
|
|
'[:cntrl:]' => '[\x00-\x1F\x7F]', |
1960
|
|
|
|
|
|
|
'[:digit:]' => '[\x30-\x39]', |
1961
|
|
|
|
|
|
|
'[:graph:]' => '[\x21-\x7F]', |
1962
|
|
|
|
|
|
|
'[:lower:]' => '[\x61-\x7A]', |
1963
|
|
|
|
|
|
|
'[:print:]' => '[\x20-\x7F]', |
1964
|
|
|
|
|
|
|
'[:punct:]' => '[\x21-\x2F\x3A-\x3F\x40\x5B-\x5F\x60\x7B-\x7E]', |
1965
|
|
|
|
|
|
|
|
1966
|
|
|
|
|
|
|
# P.174 POSIX-Style Character Classes |
1967
|
|
|
|
|
|
|
# in Chapter 5: Pattern Matching |
1968
|
|
|
|
|
|
|
# of ISBN 0-596-00027-8 Programming Perl Third Edition. |
1969
|
|
|
|
|
|
|
|
1970
|
|
|
|
|
|
|
# P.311 11.2.4 Character Classes and other Special Escapes |
1971
|
|
|
|
|
|
|
# in Chapter 11: perlre: Perl regular expressions |
1972
|
|
|
|
|
|
|
# of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1) |
1973
|
|
|
|
|
|
|
|
1974
|
|
|
|
|
|
|
# P.210 POSIX-Style Character Classes |
1975
|
|
|
|
|
|
|
# in Chapter 5: Pattern Matching |
1976
|
|
|
|
|
|
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
1977
|
|
|
|
|
|
|
|
1978
|
|
|
|
|
|
|
'[:space:]' => '[\s\x0B]', # "\s" plus vertical tab ("\cK") |
1979
|
|
|
|
|
|
|
|
1980
|
|
|
|
|
|
|
'[:upper:]' => '[\x41-\x5A]', |
1981
|
|
|
|
|
|
|
'[:word:]' => '[\x30-\x39\x41-\x5A\x5F\x61-\x7A]', |
1982
|
|
|
|
|
|
|
'[:xdigit:]' => '[\x30-\x39\x41-\x46\x61-\x66]', |
1983
|
|
|
|
|
|
|
'[:^alnum:]' => '${Eeucjp::not_alnum}', |
1984
|
|
|
|
|
|
|
'[:^alpha:]' => '${Eeucjp::not_alpha}', |
1985
|
|
|
|
|
|
|
'[:^ascii:]' => '${Eeucjp::not_ascii}', |
1986
|
|
|
|
|
|
|
'[:^blank:]' => '${Eeucjp::not_blank}', |
1987
|
|
|
|
|
|
|
'[:^cntrl:]' => '${Eeucjp::not_cntrl}', |
1988
|
|
|
|
|
|
|
'[:^digit:]' => '${Eeucjp::not_digit}', |
1989
|
|
|
|
|
|
|
'[:^graph:]' => '${Eeucjp::not_graph}', |
1990
|
|
|
|
|
|
|
'[:^lower:]' => '${Eeucjp::not_lower}', |
1991
|
|
|
|
|
|
|
'[:^print:]' => '${Eeucjp::not_print}', |
1992
|
|
|
|
|
|
|
'[:^punct:]' => '${Eeucjp::not_punct}', |
1993
|
|
|
|
|
|
|
'[:^space:]' => '${Eeucjp::not_space}', |
1994
|
|
|
|
|
|
|
'[:^upper:]' => '${Eeucjp::not_upper}', |
1995
|
|
|
|
|
|
|
'[:^word:]' => '${Eeucjp::not_word}', |
1996
|
|
|
|
|
|
|
'[:^xdigit:]' => '${Eeucjp::not_xdigit}', |
1997
|
|
|
|
|
|
|
|
1998
|
8
|
|
|
|
|
49
|
}->{$1}; |
1999
|
|
|
|
|
|
|
} |
2000
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\ ($q_char) \z/oxms) { |
2001
|
70
|
|
|
|
|
1136
|
$char[$i] = $1; |
2002
|
|
|
|
|
|
|
} |
2003
|
|
|
|
|
|
|
} |
2004
|
|
|
|
|
|
|
|
2005
|
|
|
|
|
|
|
# open character list |
2006
|
7
|
|
|
|
|
33
|
my @singleoctet = (); |
2007
|
758
|
|
|
|
|
1321
|
my @multipleoctet = (); |
2008
|
758
|
|
|
|
|
1006
|
for (my $i=0; $i <= $#char; ) { |
2009
|
|
|
|
|
|
|
|
2010
|
|
|
|
|
|
|
# escaped - |
2011
|
758
|
100
|
100
|
|
|
1671
|
if (defined($char[$i+1]) and ($char[$i+1] eq '...')) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
2012
|
2151
|
|
|
|
|
8511
|
$i += 1; |
2013
|
497
|
|
|
|
|
636
|
next; |
2014
|
|
|
|
|
|
|
} |
2015
|
|
|
|
|
|
|
|
2016
|
|
|
|
|
|
|
# make range regexp |
2017
|
|
|
|
|
|
|
elsif ($char[$i] eq '...') { |
2018
|
|
|
|
|
|
|
|
2019
|
|
|
|
|
|
|
# range error |
2020
|
497
|
50
|
|
|
|
880
|
if (CORE::length($char[$i-1]) > CORE::length($char[$i+1])) { |
|
|
100
|
|
|
|
|
|
2021
|
497
|
|
|
|
|
1909
|
croak 'Invalid [] range in regexp (length(A) > length(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]); |
2022
|
|
|
|
|
|
|
} |
2023
|
|
|
|
|
|
|
elsif (CORE::length($char[$i-1]) == CORE::length($char[$i+1])) { |
2024
|
0
|
50
|
|
|
|
0
|
if ($char[$i-1] gt $char[$i+1]) { |
2025
|
477
|
|
|
|
|
1139
|
croak 'Invalid [] range in regexp (CORE::ord(A) > CORE::ord(B)) ' . '\x' . unpack('H*',$char[$i-1]) . '-\x' . unpack('H*',$char[$i+1]); |
2026
|
|
|
|
|
|
|
} |
2027
|
|
|
|
|
|
|
} |
2028
|
|
|
|
|
|
|
|
2029
|
|
|
|
|
|
|
# make range regexp per length |
2030
|
0
|
|
|
|
|
0
|
for my $length (CORE::length($char[$i-1]) .. CORE::length($char[$i+1])) { |
2031
|
497
|
|
|
|
|
1407
|
my @regexp = (); |
2032
|
|
|
|
|
|
|
|
2033
|
|
|
|
|
|
|
# is first and last |
2034
|
517
|
100
|
100
|
|
|
723
|
if (($length == CORE::length($char[$i-1])) and ($length == CORE::length($char[$i+1]))) { |
|
|
100
|
33
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
2035
|
517
|
|
|
|
|
1900
|
push @regexp, _range_regexp($length, $char[$i-1], $char[$i+1]); |
2036
|
|
|
|
|
|
|
} |
2037
|
|
|
|
|
|
|
|
2038
|
|
|
|
|
|
|
# is first |
2039
|
|
|
|
|
|
|
elsif ($length == CORE::length($char[$i-1])) { |
2040
|
477
|
|
|
|
|
1355
|
push @regexp, _range_regexp($length, $char[$i-1], "\xFF" x $length); |
2041
|
|
|
|
|
|
|
} |
2042
|
|
|
|
|
|
|
|
2043
|
|
|
|
|
|
|
# is inside in first and last |
2044
|
|
|
|
|
|
|
elsif ((CORE::length($char[$i-1]) < $length) and ($length < CORE::length($char[$i+1]))) { |
2045
|
20
|
|
|
|
|
67
|
push @regexp, _range_regexp($length, "\x00" x $length, "\xFF" x $length); |
2046
|
|
|
|
|
|
|
} |
2047
|
|
|
|
|
|
|
|
2048
|
|
|
|
|
|
|
# is last |
2049
|
|
|
|
|
|
|
elsif ($length == CORE::length($char[$i+1])) { |
2050
|
0
|
|
|
|
|
0
|
push @regexp, _range_regexp($length, "\x00" x $length, $char[$i+1]); |
2051
|
|
|
|
|
|
|
} |
2052
|
|
|
|
|
|
|
|
2053
|
|
|
|
|
|
|
else { |
2054
|
20
|
|
|
|
|
71
|
die __FILE__, ": subroutine make_regexp panic.\n"; |
2055
|
|
|
|
|
|
|
} |
2056
|
|
|
|
|
|
|
|
2057
|
0
|
100
|
|
|
|
0
|
if ($length == 1) { |
2058
|
517
|
|
|
|
|
948
|
push @singleoctet, @regexp; |
2059
|
|
|
|
|
|
|
} |
2060
|
|
|
|
|
|
|
else { |
2061
|
386
|
|
|
|
|
1154
|
push @multipleoctet, @regexp; |
2062
|
|
|
|
|
|
|
} |
2063
|
|
|
|
|
|
|
} |
2064
|
|
|
|
|
|
|
|
2065
|
131
|
|
|
|
|
279
|
$i += 2; |
2066
|
|
|
|
|
|
|
} |
2067
|
|
|
|
|
|
|
|
2068
|
|
|
|
|
|
|
# with /i modifier |
2069
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) { |
2070
|
497
|
100
|
|
|
|
1028
|
if ($modifier =~ /i/oxms) { |
2071
|
764
|
|
|
|
|
1184
|
my $uc = Eeucjp::uc($char[$i]); |
2072
|
192
|
|
|
|
|
293
|
my $fc = Eeucjp::fc($char[$i]); |
2073
|
192
|
50
|
|
|
|
308
|
if ($uc ne $fc) { |
2074
|
192
|
50
|
|
|
|
291
|
if (CORE::length($fc) == 1) { |
2075
|
192
|
|
|
|
|
261
|
push @singleoctet, $uc, $fc; |
2076
|
|
|
|
|
|
|
} |
2077
|
|
|
|
|
|
|
else { |
2078
|
192
|
|
|
|
|
324
|
push @singleoctet, $uc; |
2079
|
0
|
|
|
|
|
0
|
push @multipleoctet, $fc; |
2080
|
|
|
|
|
|
|
} |
2081
|
|
|
|
|
|
|
} |
2082
|
|
|
|
|
|
|
else { |
2083
|
0
|
|
|
|
|
0
|
push @singleoctet, $char[$i]; |
2084
|
|
|
|
|
|
|
} |
2085
|
|
|
|
|
|
|
} |
2086
|
|
|
|
|
|
|
else { |
2087
|
0
|
|
|
|
|
0
|
push @singleoctet, $char[$i]; |
2088
|
|
|
|
|
|
|
} |
2089
|
572
|
|
|
|
|
825
|
$i += 1; |
2090
|
|
|
|
|
|
|
} |
2091
|
|
|
|
|
|
|
|
2092
|
|
|
|
|
|
|
# single character of single octet code |
2093
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A (?: \\h ) \z/oxms) { |
2094
|
764
|
|
|
|
|
1216
|
push @singleoctet, "\t", "\x20"; |
2095
|
0
|
|
|
|
|
0
|
$i += 1; |
2096
|
|
|
|
|
|
|
} |
2097
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A (?: \\v ) \z/oxms) { |
2098
|
0
|
|
|
|
|
0
|
push @singleoctet, "\x0A", "\x0B", "\x0C", "\x0D"; |
2099
|
0
|
|
|
|
|
0
|
$i += 1; |
2100
|
|
|
|
|
|
|
} |
2101
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A (?: \\d | \\s | \\w ) \z/oxms) { |
2102
|
0
|
|
|
|
|
0
|
push @singleoctet, $char[$i]; |
2103
|
2
|
|
|
|
|
5
|
$i += 1; |
2104
|
|
|
|
|
|
|
} |
2105
|
|
|
|
|
|
|
|
2106
|
|
|
|
|
|
|
# single character of multiple-octet code |
2107
|
|
|
|
|
|
|
else { |
2108
|
2
|
|
|
|
|
11
|
push @multipleoctet, $char[$i]; |
2109
|
391
|
|
|
|
|
663
|
$i += 1; |
2110
|
|
|
|
|
|
|
} |
2111
|
|
|
|
|
|
|
} |
2112
|
|
|
|
|
|
|
|
2113
|
|
|
|
|
|
|
# quote metachar |
2114
|
391
|
|
|
|
|
608
|
for (@singleoctet) { |
2115
|
758
|
50
|
|
|
|
1435
|
if ($_ eq '...') { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
2116
|
1384
|
|
|
|
|
5628
|
$_ = '-'; |
2117
|
|
|
|
|
|
|
} |
2118
|
|
|
|
|
|
|
elsif (/\A \n \z/oxms) { |
2119
|
0
|
|
|
|
|
0
|
$_ = '\n'; |
2120
|
|
|
|
|
|
|
} |
2121
|
|
|
|
|
|
|
elsif (/\A \r \z/oxms) { |
2122
|
8
|
|
|
|
|
15
|
$_ = '\r'; |
2123
|
|
|
|
|
|
|
} |
2124
|
|
|
|
|
|
|
elsif (/\A ([\x00-\x20\x7F-\xFF]) \z/oxms) { |
2125
|
8
|
|
|
|
|
19
|
$_ = sprintf('\x%02X', CORE::ord $1); |
2126
|
|
|
|
|
|
|
} |
2127
|
|
|
|
|
|
|
elsif (/\A [\x00-\xFF] \z/oxms) { |
2128
|
1
|
|
|
|
|
6
|
$_ = quotemeta $_; |
2129
|
|
|
|
|
|
|
} |
2130
|
|
|
|
|
|
|
} |
2131
|
|
|
|
|
|
|
|
2132
|
|
|
|
|
|
|
# return character list |
2133
|
939
|
|
|
|
|
1346
|
return \@singleoctet, \@multipleoctet; |
2134
|
|
|
|
|
|
|
} |
2135
|
|
|
|
|
|
|
|
2136
|
|
|
|
|
|
|
# |
2137
|
|
|
|
|
|
|
# EUC-JP octal escape sequence |
2138
|
|
|
|
|
|
|
# |
2139
|
|
|
|
|
|
|
sub octchr { |
2140
|
758
|
|
|
5
|
0
|
2508
|
my($octdigit) = @_; |
2141
|
|
|
|
|
|
|
|
2142
|
5
|
|
|
|
|
15
|
my @binary = (); |
2143
|
5
|
|
|
|
|
7
|
for my $octal (split(//,$octdigit)) { |
2144
|
|
|
|
|
|
|
push @binary, { |
2145
|
|
|
|
|
|
|
'0' => '000', |
2146
|
|
|
|
|
|
|
'1' => '001', |
2147
|
|
|
|
|
|
|
'2' => '010', |
2148
|
|
|
|
|
|
|
'3' => '011', |
2149
|
|
|
|
|
|
|
'4' => '100', |
2150
|
|
|
|
|
|
|
'5' => '101', |
2151
|
|
|
|
|
|
|
'6' => '110', |
2152
|
|
|
|
|
|
|
'7' => '111', |
2153
|
5
|
|
|
|
|
32
|
}->{$octal}; |
2154
|
|
|
|
|
|
|
} |
2155
|
50
|
|
|
|
|
181
|
my $binary = join '', @binary; |
2156
|
|
|
|
|
|
|
|
2157
|
|
|
|
|
|
|
my $octchr = { |
2158
|
|
|
|
|
|
|
# 1234567 |
2159
|
|
|
|
|
|
|
1 => pack('B*', "0000000$binary"), |
2160
|
|
|
|
|
|
|
2 => pack('B*', "000000$binary"), |
2161
|
|
|
|
|
|
|
3 => pack('B*', "00000$binary"), |
2162
|
|
|
|
|
|
|
4 => pack('B*', "0000$binary"), |
2163
|
|
|
|
|
|
|
5 => pack('B*', "000$binary"), |
2164
|
|
|
|
|
|
|
6 => pack('B*', "00$binary"), |
2165
|
|
|
|
|
|
|
7 => pack('B*', "0$binary"), |
2166
|
|
|
|
|
|
|
0 => pack('B*', "$binary"), |
2167
|
|
|
|
|
|
|
|
2168
|
5
|
|
|
|
|
16
|
}->{CORE::length($binary) % 8}; |
2169
|
|
|
|
|
|
|
|
2170
|
5
|
|
|
|
|
66
|
return $octchr; |
2171
|
|
|
|
|
|
|
} |
2172
|
|
|
|
|
|
|
|
2173
|
|
|
|
|
|
|
# |
2174
|
|
|
|
|
|
|
# EUC-JP hexadecimal escape sequence |
2175
|
|
|
|
|
|
|
# |
2176
|
|
|
|
|
|
|
sub hexchr { |
2177
|
5
|
|
|
5
|
0
|
22
|
my($hexdigit) = @_; |
2178
|
|
|
|
|
|
|
|
2179
|
|
|
|
|
|
|
my $hexchr = { |
2180
|
|
|
|
|
|
|
1 => pack('H*', "0$hexdigit"), |
2181
|
|
|
|
|
|
|
0 => pack('H*', "$hexdigit"), |
2182
|
|
|
|
|
|
|
|
2183
|
5
|
|
|
|
|
17
|
}->{CORE::length($_[0]) % 2}; |
2184
|
|
|
|
|
|
|
|
2185
|
5
|
|
|
|
|
50
|
return $hexchr; |
2186
|
|
|
|
|
|
|
} |
2187
|
|
|
|
|
|
|
|
2188
|
|
|
|
|
|
|
# |
2189
|
|
|
|
|
|
|
# EUC-JP open character list for qr |
2190
|
|
|
|
|
|
|
# |
2191
|
|
|
|
|
|
|
sub charlist_qr { |
2192
|
|
|
|
|
|
|
|
2193
|
5
|
|
|
519
|
0
|
18
|
my $modifier = pop @_; |
2194
|
519
|
|
|
|
|
986
|
my @char = @_; |
2195
|
|
|
|
|
|
|
|
2196
|
519
|
|
|
|
|
1263
|
my($singleoctet, $multipleoctet) = _charlist(@char, $modifier); |
2197
|
519
|
|
|
|
|
1432
|
my @singleoctet = @$singleoctet; |
2198
|
519
|
|
|
|
|
1036
|
my @multipleoctet = @$multipleoctet; |
2199
|
|
|
|
|
|
|
|
2200
|
|
|
|
|
|
|
# return character list |
2201
|
519
|
100
|
|
|
|
1872
|
if (scalar(@singleoctet) >= 1) { |
2202
|
|
|
|
|
|
|
|
2203
|
|
|
|
|
|
|
# with /i modifier |
2204
|
519
|
100
|
|
|
|
1181
|
if ($modifier =~ m/i/oxms) { |
2205
|
384
|
|
|
|
|
1140
|
my %singleoctet_ignorecase = (); |
2206
|
107
|
|
|
|
|
147
|
for (@singleoctet) { |
2207
|
107
|
|
100
|
|
|
206
|
while (s/ \A \\x(..) - \\x(..) //oxms or s/ \A \\x((..)) //oxms) { |
2208
|
277
|
|
|
|
|
842
|
for my $ord (hex($1) .. hex($2)) { |
2209
|
85
|
|
|
|
|
301
|
my $char = CORE::chr($ord); |
2210
|
1196
|
|
|
|
|
1688
|
my $uc = Eeucjp::uc($char); |
2211
|
1196
|
|
|
|
|
1632
|
my $fc = Eeucjp::fc($char); |
2212
|
1196
|
100
|
|
|
|
1967
|
if ($uc eq $fc) { |
2213
|
1196
|
|
|
|
|
1959
|
$singleoctet_ignorecase{unpack 'C*', $char} = 1; |
2214
|
|
|
|
|
|
|
} |
2215
|
|
|
|
|
|
|
else { |
2216
|
607
|
50
|
|
|
|
1390
|
if (CORE::length($fc) == 1) { |
2217
|
589
|
|
|
|
|
877
|
$singleoctet_ignorecase{unpack 'C*', $uc} = 1; |
2218
|
589
|
|
|
|
|
1597
|
$singleoctet_ignorecase{unpack 'C*', $fc} = 1; |
2219
|
|
|
|
|
|
|
} |
2220
|
|
|
|
|
|
|
else { |
2221
|
589
|
|
|
|
|
1445
|
$singleoctet_ignorecase{unpack 'C*', $uc} = 1; |
2222
|
0
|
|
|
|
|
0
|
push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc; |
|
0
|
|
|
|
|
0
|
|
2223
|
|
|
|
|
|
|
} |
2224
|
|
|
|
|
|
|
} |
2225
|
|
|
|
|
|
|
} |
2226
|
|
|
|
|
|
|
} |
2227
|
0
|
100
|
|
|
|
0
|
if ($_ ne '') { |
2228
|
277
|
|
|
|
|
491
|
$singleoctet_ignorecase{unpack 'C*', $_} = 1; |
2229
|
|
|
|
|
|
|
} |
2230
|
|
|
|
|
|
|
} |
2231
|
192
|
|
|
|
|
419
|
my $i = 0; |
2232
|
107
|
|
|
|
|
130
|
my @singleoctet_ignorecase = (); |
2233
|
107
|
|
|
|
|
139
|
for my $ord (0 .. 255) { |
2234
|
107
|
100
|
|
|
|
165
|
if (exists $singleoctet_ignorecase{$ord}) { |
2235
|
27392
|
|
|
|
|
31360
|
push @{$singleoctet_ignorecase[$i]}, $ord; |
|
1727
|
|
|
|
|
1613
|
|
2236
|
|
|
|
|
|
|
} |
2237
|
|
|
|
|
|
|
else { |
2238
|
1727
|
|
|
|
|
2939
|
$i++; |
2239
|
|
|
|
|
|
|
} |
2240
|
|
|
|
|
|
|
} |
2241
|
25665
|
|
|
|
|
25337
|
@singleoctet = (); |
2242
|
107
|
|
|
|
|
154
|
for my $range (@singleoctet_ignorecase) { |
2243
|
107
|
100
|
|
|
|
235
|
if (ref $range) { |
2244
|
11262
|
100
|
|
|
|
17012
|
if (scalar(@{$range}) == 1) { |
|
219
|
50
|
|
|
|
218
|
|
2245
|
219
|
|
|
|
|
330
|
push @singleoctet, sprintf('\x%02X', @{$range}[0]); |
|
5
|
|
|
|
|
7
|
|
2246
|
|
|
|
|
|
|
} |
2247
|
5
|
|
|
|
|
195
|
elsif (scalar(@{$range}) == 2) { |
2248
|
214
|
|
|
|
|
294
|
push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]); |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
2249
|
|
|
|
|
|
|
} |
2250
|
|
|
|
|
|
|
else { |
2251
|
0
|
|
|
|
|
0
|
push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]); |
|
214
|
|
|
|
|
254
|
|
|
214
|
|
|
|
|
239
|
|
2252
|
|
|
|
|
|
|
} |
2253
|
|
|
|
|
|
|
} |
2254
|
|
|
|
|
|
|
} |
2255
|
|
|
|
|
|
|
} |
2256
|
|
|
|
|
|
|
|
2257
|
214
|
|
|
|
|
879
|
my $not_anchor = ''; |
2258
|
384
|
|
|
|
|
597
|
$not_anchor = '(?![\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE])'; |
2259
|
|
|
|
|
|
|
|
2260
|
384
|
|
|
|
|
522
|
push @multipleoctet, join('', $not_anchor, '[', @singleoctet, ']' ); |
2261
|
|
|
|
|
|
|
} |
2262
|
384
|
100
|
|
|
|
1021
|
if (scalar(@multipleoctet) >= 2) { |
2263
|
519
|
|
|
|
|
1165
|
return '(?:' . join('|', @multipleoctet) . ')'; |
2264
|
|
|
|
|
|
|
} |
2265
|
|
|
|
|
|
|
else { |
2266
|
102
|
|
|
|
|
605
|
return $multipleoctet[0]; |
2267
|
|
|
|
|
|
|
} |
2268
|
|
|
|
|
|
|
} |
2269
|
|
|
|
|
|
|
|
2270
|
|
|
|
|
|
|
# |
2271
|
|
|
|
|
|
|
# EUC-JP open character list for not qr |
2272
|
|
|
|
|
|
|
# |
2273
|
|
|
|
|
|
|
sub charlist_not_qr { |
2274
|
|
|
|
|
|
|
|
2275
|
417
|
|
|
239
|
0
|
1808
|
my $modifier = pop @_; |
2276
|
239
|
|
|
|
|
384
|
my @char = @_; |
2277
|
|
|
|
|
|
|
|
2278
|
239
|
|
|
|
|
504
|
my($singleoctet, $multipleoctet) = _charlist(@char, $modifier); |
2279
|
239
|
|
|
|
|
484
|
my @singleoctet = @$singleoctet; |
2280
|
239
|
|
|
|
|
489
|
my @multipleoctet = @$multipleoctet; |
2281
|
|
|
|
|
|
|
|
2282
|
|
|
|
|
|
|
# with /i modifier |
2283
|
239
|
100
|
|
|
|
339
|
if ($modifier =~ m/i/oxms) { |
2284
|
239
|
|
|
|
|
502
|
my %singleoctet_ignorecase = (); |
2285
|
128
|
|
|
|
|
174
|
for (@singleoctet) { |
2286
|
128
|
|
100
|
|
|
172
|
while (s/ \A \\x(..) - \\x(..) //oxms or s/ \A \\x((..)) //oxms) { |
2287
|
277
|
|
|
|
|
889
|
for my $ord (hex($1) .. hex($2)) { |
2288
|
85
|
|
|
|
|
248
|
my $char = CORE::chr($ord); |
2289
|
1196
|
|
|
|
|
1519
|
my $uc = Eeucjp::uc($char); |
2290
|
1196
|
|
|
|
|
1405
|
my $fc = Eeucjp::fc($char); |
2291
|
1196
|
100
|
|
|
|
1673
|
if ($uc eq $fc) { |
2292
|
1196
|
|
|
|
|
1641
|
$singleoctet_ignorecase{unpack 'C*', $char} = 1; |
2293
|
|
|
|
|
|
|
} |
2294
|
|
|
|
|
|
|
else { |
2295
|
607
|
50
|
|
|
|
1332
|
if (CORE::length($fc) == 1) { |
2296
|
589
|
|
|
|
|
694
|
$singleoctet_ignorecase{unpack 'C*', $uc} = 1; |
2297
|
589
|
|
|
|
|
1056
|
$singleoctet_ignorecase{unpack 'C*', $fc} = 1; |
2298
|
|
|
|
|
|
|
} |
2299
|
|
|
|
|
|
|
else { |
2300
|
589
|
|
|
|
|
1337
|
$singleoctet_ignorecase{unpack 'C*', $uc} = 1; |
2301
|
0
|
|
|
|
|
0
|
push @multipleoctet, join '', map {sprintf('\x%02X',$_)} unpack 'C*', $fc; |
|
0
|
|
|
|
|
0
|
|
2302
|
|
|
|
|
|
|
} |
2303
|
|
|
|
|
|
|
} |
2304
|
|
|
|
|
|
|
} |
2305
|
|
|
|
|
|
|
} |
2306
|
0
|
100
|
|
|
|
0
|
if ($_ ne '') { |
2307
|
277
|
|
|
|
|
418
|
$singleoctet_ignorecase{unpack 'C*', $_} = 1; |
2308
|
|
|
|
|
|
|
} |
2309
|
|
|
|
|
|
|
} |
2310
|
192
|
|
|
|
|
406
|
my $i = 0; |
2311
|
128
|
|
|
|
|
153
|
my @singleoctet_ignorecase = (); |
2312
|
128
|
|
|
|
|
157
|
for my $ord (0 .. 255) { |
2313
|
128
|
100
|
|
|
|
188
|
if (exists $singleoctet_ignorecase{$ord}) { |
2314
|
32768
|
|
|
|
|
36375
|
push @{$singleoctet_ignorecase[$i]}, $ord; |
|
1727
|
|
|
|
|
1548
|
|
2315
|
|
|
|
|
|
|
} |
2316
|
|
|
|
|
|
|
else { |
2317
|
1727
|
|
|
|
|
2602
|
$i++; |
2318
|
|
|
|
|
|
|
} |
2319
|
|
|
|
|
|
|
} |
2320
|
31041
|
|
|
|
|
30206
|
@singleoctet = (); |
2321
|
128
|
|
|
|
|
180
|
for my $range (@singleoctet_ignorecase) { |
2322
|
128
|
100
|
|
|
|
248
|
if (ref $range) { |
2323
|
11262
|
100
|
|
|
|
16714
|
if (scalar(@{$range}) == 1) { |
|
219
|
50
|
|
|
|
220
|
|
2324
|
219
|
|
|
|
|
346
|
push @singleoctet, sprintf('\x%02X', @{$range}[0]); |
|
5
|
|
|
|
|
5
|
|
2325
|
|
|
|
|
|
|
} |
2326
|
5
|
|
|
|
|
70
|
elsif (scalar(@{$range}) == 2) { |
2327
|
214
|
|
|
|
|
273
|
push @singleoctet, sprintf('\x%02X\x%02X', @{$range}[0], @{$range}[-1]); |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
2328
|
|
|
|
|
|
|
} |
2329
|
|
|
|
|
|
|
else { |
2330
|
0
|
|
|
|
|
0
|
push @singleoctet, sprintf('\x%02X-\x%02X', @{$range}[0], @{$range}[-1]); |
|
214
|
|
|
|
|
239
|
|
|
214
|
|
|
|
|
235
|
|
2331
|
|
|
|
|
|
|
} |
2332
|
|
|
|
|
|
|
} |
2333
|
|
|
|
|
|
|
} |
2334
|
|
|
|
|
|
|
} |
2335
|
|
|
|
|
|
|
|
2336
|
|
|
|
|
|
|
# return character list |
2337
|
214
|
100
|
|
|
|
861
|
if (scalar(@multipleoctet) >= 1) { |
2338
|
239
|
100
|
|
|
|
522
|
if (scalar(@singleoctet) >= 1) { |
2339
|
|
|
|
|
|
|
|
2340
|
|
|
|
|
|
|
# any character other than multiple-octet and single octet character class |
2341
|
114
|
|
|
|
|
200
|
return '(?!' . join('|', @multipleoctet) . ')(?:[^\x8E\x8F\xA1-\xFE' . join('', @singleoctet) . ']|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])'; |
2342
|
|
|
|
|
|
|
} |
2343
|
|
|
|
|
|
|
else { |
2344
|
|
|
|
|
|
|
|
2345
|
|
|
|
|
|
|
# any character other than multiple-octet character class |
2346
|
70
|
|
|
|
|
442
|
return '(?!' . join('|', @multipleoctet) . ")(?:$your_char)"; |
2347
|
|
|
|
|
|
|
} |
2348
|
|
|
|
|
|
|
} |
2349
|
|
|
|
|
|
|
else { |
2350
|
44
|
50
|
|
|
|
242
|
if (scalar(@singleoctet) >= 1) { |
2351
|
|
|
|
|
|
|
|
2352
|
|
|
|
|
|
|
# any character other than single octet character class |
2353
|
125
|
|
|
|
|
206
|
return '(?:[^\x8E\x8F\xA1-\xFE' . join('', @singleoctet) . ']|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])'; |
2354
|
|
|
|
|
|
|
} |
2355
|
|
|
|
|
|
|
else { |
2356
|
|
|
|
|
|
|
|
2357
|
|
|
|
|
|
|
# any character |
2358
|
125
|
|
|
|
|
684
|
return "(?:$your_char)"; |
2359
|
|
|
|
|
|
|
} |
2360
|
|
|
|
|
|
|
} |
2361
|
|
|
|
|
|
|
} |
2362
|
|
|
|
|
|
|
|
2363
|
|
|
|
|
|
|
# |
2364
|
|
|
|
|
|
|
# open file in read mode |
2365
|
|
|
|
|
|
|
# |
2366
|
|
|
|
|
|
|
sub _open_r { |
2367
|
0
|
|
|
658
|
|
0
|
my(undef,$file) = @_; |
2368
|
329
|
|
|
329
|
|
3910
|
use Fcntl qw(O_RDONLY); |
|
329
|
|
|
|
|
930
|
|
|
329
|
|
|
|
|
77074
|
|
2369
|
658
|
|
|
|
|
2117
|
return CORE::sysopen($_[0], $file, &O_RDONLY); |
2370
|
|
|
|
|
|
|
} |
2371
|
|
|
|
|
|
|
|
2372
|
|
|
|
|
|
|
# |
2373
|
|
|
|
|
|
|
# open file in append mode |
2374
|
|
|
|
|
|
|
# |
2375
|
|
|
|
|
|
|
sub _open_a { |
2376
|
658
|
|
|
329
|
|
28793
|
my(undef,$file) = @_; |
2377
|
329
|
|
|
329
|
|
3901
|
use Fcntl qw(O_WRONLY O_APPEND O_CREAT); |
|
329
|
|
|
|
|
740
|
|
|
329
|
|
|
|
|
1221382
|
|
2378
|
329
|
|
|
|
|
1210
|
return CORE::sysopen($_[0], $file, &O_WRONLY|&O_APPEND|&O_CREAT); |
2379
|
|
|
|
|
|
|
} |
2380
|
|
|
|
|
|
|
|
2381
|
|
|
|
|
|
|
# |
2382
|
|
|
|
|
|
|
# safe system |
2383
|
|
|
|
|
|
|
# |
2384
|
|
|
|
|
|
|
sub _systemx { |
2385
|
|
|
|
|
|
|
|
2386
|
|
|
|
|
|
|
# P.707 29.2.33. exec |
2387
|
|
|
|
|
|
|
# in Chapter 29: Functions |
2388
|
|
|
|
|
|
|
# of ISBN 0-596-00027-8 Programming Perl Third Edition. |
2389
|
|
|
|
|
|
|
# |
2390
|
|
|
|
|
|
|
# Be aware that in older releases of Perl, exec (and system) did not flush |
2391
|
|
|
|
|
|
|
# your output buffer, so you needed to enable command buffering by setting $| |
2392
|
|
|
|
|
|
|
# on one or more filehandles to avoid lost output in the case of exec, or |
2393
|
|
|
|
|
|
|
# misordererd output in the case of system. This situation was largely remedied |
2394
|
|
|
|
|
|
|
# in the 5.6 release of Perl. (So, 5.005 release not yet.) |
2395
|
|
|
|
|
|
|
|
2396
|
|
|
|
|
|
|
# P.855 exec |
2397
|
|
|
|
|
|
|
# in Chapter 27: Functions |
2398
|
|
|
|
|
|
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
2399
|
|
|
|
|
|
|
# |
2400
|
|
|
|
|
|
|
# In very old release of Perl (before v5.6), exec (and system) did not flush |
2401
|
|
|
|
|
|
|
# your output buffer, so you needed to enable command buffering by setting $| |
2402
|
|
|
|
|
|
|
# on one or more filehandles to avoid lost output with exec or misordered |
2403
|
|
|
|
|
|
|
# output with system. |
2404
|
|
|
|
|
|
|
|
2405
|
329
|
|
|
329
|
|
128267
|
$| = 1; |
2406
|
|
|
|
|
|
|
|
2407
|
|
|
|
|
|
|
# P.565 23.1.2. Cleaning Up Your Environment |
2408
|
|
|
|
|
|
|
# in Chapter 23: Security |
2409
|
|
|
|
|
|
|
# of ISBN 0-596-00027-8 Programming Perl Third Edition. |
2410
|
|
|
|
|
|
|
|
2411
|
|
|
|
|
|
|
# P.656 Cleaning Up Your Environment |
2412
|
|
|
|
|
|
|
# in Chapter 20: Security |
2413
|
|
|
|
|
|
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
2414
|
|
|
|
|
|
|
|
2415
|
|
|
|
|
|
|
# local $ENV{'PATH'} = '.'; |
2416
|
329
|
|
|
|
|
1170
|
local @ENV{qw(IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer |
2417
|
|
|
|
|
|
|
|
2418
|
|
|
|
|
|
|
# P.707 29.2.33. exec |
2419
|
|
|
|
|
|
|
# in Chapter 29: Functions |
2420
|
|
|
|
|
|
|
# of ISBN 0-596-00027-8 Programming Perl Third Edition. |
2421
|
|
|
|
|
|
|
# |
2422
|
|
|
|
|
|
|
# As we mentioned earlier, exec treats a discrete list of arguments as an |
2423
|
|
|
|
|
|
|
# indication that it should bypass shell processing. However, there is one |
2424
|
|
|
|
|
|
|
# place where you might still get tripped up. The exec call (and system, too) |
2425
|
|
|
|
|
|
|
# will not distinguish between a single scalar argument and an array containing |
2426
|
|
|
|
|
|
|
# only one element. |
2427
|
|
|
|
|
|
|
# |
2428
|
|
|
|
|
|
|
# @args = ("echo surprise"); # just one element in list |
2429
|
|
|
|
|
|
|
# exec @args # still subject to shell escapes |
2430
|
|
|
|
|
|
|
# or die "exec: $!"; # because @args == 1 |
2431
|
|
|
|
|
|
|
# |
2432
|
|
|
|
|
|
|
# To avoid this, you can use the PATHNAME syntax, explicitly duplicating the |
2433
|
|
|
|
|
|
|
# first argument as the pathname, which forces the rest of the arguments to be |
2434
|
|
|
|
|
|
|
# interpreted as a list, even if there is only one of them: |
2435
|
|
|
|
|
|
|
# |
2436
|
|
|
|
|
|
|
# exec { $args[0] } @args # safe even with one-argument list |
2437
|
|
|
|
|
|
|
# or die "can't exec @args: $!"; |
2438
|
|
|
|
|
|
|
|
2439
|
|
|
|
|
|
|
# P.855 exec |
2440
|
|
|
|
|
|
|
# in Chapter 27: Functions |
2441
|
|
|
|
|
|
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
2442
|
|
|
|
|
|
|
# |
2443
|
|
|
|
|
|
|
# As we mentioned earlier, exec treats a discrete list of arguments as a |
2444
|
|
|
|
|
|
|
# directive to bypass shell processing. However, there is one place where |
2445
|
|
|
|
|
|
|
# you might still get tripped up. The exec call (and system, too) cannot |
2446
|
|
|
|
|
|
|
# distinguish between a single scalar argument and an array containing |
2447
|
|
|
|
|
|
|
# only one element. |
2448
|
|
|
|
|
|
|
# |
2449
|
|
|
|
|
|
|
# @args = ("echo surprise"); # just one element in list |
2450
|
|
|
|
|
|
|
# exec @args # still subject to shell escapes |
2451
|
|
|
|
|
|
|
# || die "exec: $!"; # because @args == 1 |
2452
|
|
|
|
|
|
|
# |
2453
|
|
|
|
|
|
|
# To avoid this, use the PATHNAME syntax, explicitly duplicating the first |
2454
|
|
|
|
|
|
|
# argument as the pathname, which forces the rest of the arguments to be |
2455
|
|
|
|
|
|
|
# interpreted as a list, even if there is only one of them: |
2456
|
|
|
|
|
|
|
# |
2457
|
|
|
|
|
|
|
# exec { $args[0] } @args # safe even with one-argument list |
2458
|
|
|
|
|
|
|
# || die "can't exec @args: $!"; |
2459
|
|
|
|
|
|
|
|
2460
|
329
|
|
|
|
|
3193
|
return CORE::system { $_[0] } @_; # safe even with one-argument list |
|
329
|
|
|
|
|
740
|
|
2461
|
|
|
|
|
|
|
} |
2462
|
|
|
|
|
|
|
|
2463
|
|
|
|
|
|
|
# |
2464
|
|
|
|
|
|
|
# EUC-JP order to character (with parameter) |
2465
|
|
|
|
|
|
|
# |
2466
|
|
|
|
|
|
|
sub Eeucjp::chr(;$) { |
2467
|
|
|
|
|
|
|
|
2468
|
329
|
0
|
|
0
|
0
|
37221406
|
my $c = @_ ? $_[0] : $_; |
2469
|
|
|
|
|
|
|
|
2470
|
0
|
0
|
|
|
|
0
|
if ($c == 0x00) { |
2471
|
0
|
|
|
|
|
0
|
return "\x00"; |
2472
|
|
|
|
|
|
|
} |
2473
|
|
|
|
|
|
|
else { |
2474
|
0
|
|
|
|
|
0
|
my @chr = (); |
2475
|
0
|
|
|
|
|
0
|
while ($c > 0) { |
2476
|
0
|
|
|
|
|
0
|
unshift @chr, ($c % 0x100); |
2477
|
0
|
|
|
|
|
0
|
$c = int($c / 0x100); |
2478
|
|
|
|
|
|
|
} |
2479
|
0
|
|
|
|
|
0
|
return pack 'C*', @chr; |
2480
|
|
|
|
|
|
|
} |
2481
|
|
|
|
|
|
|
} |
2482
|
|
|
|
|
|
|
|
2483
|
|
|
|
|
|
|
# |
2484
|
|
|
|
|
|
|
# EUC-JP order to character (without parameter) |
2485
|
|
|
|
|
|
|
# |
2486
|
|
|
|
|
|
|
sub Eeucjp::chr_() { |
2487
|
|
|
|
|
|
|
|
2488
|
0
|
|
|
0
|
0
|
0
|
my $c = $_; |
2489
|
|
|
|
|
|
|
|
2490
|
0
|
0
|
|
|
|
0
|
if ($c == 0x00) { |
2491
|
0
|
|
|
|
|
0
|
return "\x00"; |
2492
|
|
|
|
|
|
|
} |
2493
|
|
|
|
|
|
|
else { |
2494
|
0
|
|
|
|
|
0
|
my @chr = (); |
2495
|
0
|
|
|
|
|
0
|
while ($c > 0) { |
2496
|
0
|
|
|
|
|
0
|
unshift @chr, ($c % 0x100); |
2497
|
0
|
|
|
|
|
0
|
$c = int($c / 0x100); |
2498
|
|
|
|
|
|
|
} |
2499
|
0
|
|
|
|
|
0
|
return pack 'C*', @chr; |
2500
|
|
|
|
|
|
|
} |
2501
|
|
|
|
|
|
|
} |
2502
|
|
|
|
|
|
|
|
2503
|
|
|
|
|
|
|
# |
2504
|
|
|
|
|
|
|
# EUC-JP path globbing (with parameter) |
2505
|
|
|
|
|
|
|
# |
2506
|
|
|
|
|
|
|
sub Eeucjp::glob($) { |
2507
|
|
|
|
|
|
|
|
2508
|
0
|
0
|
|
0
|
0
|
0
|
if (wantarray) { |
2509
|
0
|
|
|
|
|
0
|
my @glob = _DOS_like_glob(@_); |
2510
|
0
|
|
|
|
|
0
|
for my $glob (@glob) { |
2511
|
0
|
|
|
|
|
0
|
$glob =~ s{ \A (?:\./)+ }{}oxms; |
2512
|
|
|
|
|
|
|
} |
2513
|
0
|
|
|
|
|
0
|
return @glob; |
2514
|
|
|
|
|
|
|
} |
2515
|
|
|
|
|
|
|
else { |
2516
|
0
|
|
|
|
|
0
|
my $glob = _DOS_like_glob(@_); |
2517
|
0
|
|
|
|
|
0
|
$glob =~ s{ \A (?:\./)+ }{}oxms; |
2518
|
0
|
|
|
|
|
0
|
return $glob; |
2519
|
|
|
|
|
|
|
} |
2520
|
|
|
|
|
|
|
} |
2521
|
|
|
|
|
|
|
|
2522
|
|
|
|
|
|
|
# |
2523
|
|
|
|
|
|
|
# EUC-JP path globbing (without parameter) |
2524
|
|
|
|
|
|
|
# |
2525
|
|
|
|
|
|
|
sub Eeucjp::glob_() { |
2526
|
|
|
|
|
|
|
|
2527
|
0
|
0
|
|
0
|
0
|
0
|
if (wantarray) { |
2528
|
0
|
|
|
|
|
0
|
my @glob = _DOS_like_glob(); |
2529
|
0
|
|
|
|
|
0
|
for my $glob (@glob) { |
2530
|
0
|
|
|
|
|
0
|
$glob =~ s{ \A (?:\./)+ }{}oxms; |
2531
|
|
|
|
|
|
|
} |
2532
|
0
|
|
|
|
|
0
|
return @glob; |
2533
|
|
|
|
|
|
|
} |
2534
|
|
|
|
|
|
|
else { |
2535
|
0
|
|
|
|
|
0
|
my $glob = _DOS_like_glob(); |
2536
|
0
|
|
|
|
|
0
|
$glob =~ s{ \A (?:\./)+ }{}oxms; |
2537
|
0
|
|
|
|
|
0
|
return $glob; |
2538
|
|
|
|
|
|
|
} |
2539
|
|
|
|
|
|
|
} |
2540
|
|
|
|
|
|
|
|
2541
|
|
|
|
|
|
|
# |
2542
|
|
|
|
|
|
|
# EUC-JP path globbing via File::DosGlob 1.10 |
2543
|
|
|
|
|
|
|
# |
2544
|
|
|
|
|
|
|
# Often I confuse "_dosglob" and "_doglob". |
2545
|
|
|
|
|
|
|
# So, I renamed "_dosglob" to "_DOS_like_glob". |
2546
|
|
|
|
|
|
|
# |
2547
|
|
|
|
|
|
|
my %iter; |
2548
|
|
|
|
|
|
|
my %entries; |
2549
|
|
|
|
|
|
|
sub _DOS_like_glob { |
2550
|
|
|
|
|
|
|
|
2551
|
|
|
|
|
|
|
# context (keyed by second cxix argument provided by core) |
2552
|
0
|
|
|
0
|
|
0
|
my($expr,$cxix) = @_; |
2553
|
|
|
|
|
|
|
|
2554
|
|
|
|
|
|
|
# glob without args defaults to $_ |
2555
|
0
|
0
|
|
|
|
0
|
$expr = $_ if not defined $expr; |
2556
|
|
|
|
|
|
|
|
2557
|
|
|
|
|
|
|
# represents the current user's home directory |
2558
|
|
|
|
|
|
|
# |
2559
|
|
|
|
|
|
|
# 7.3. Expanding Tildes in Filenames |
2560
|
|
|
|
|
|
|
# in Chapter 7. File Access |
2561
|
|
|
|
|
|
|
# of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition. |
2562
|
|
|
|
|
|
|
# |
2563
|
|
|
|
|
|
|
# and File::HomeDir, File::HomeDir::Windows module |
2564
|
|
|
|
|
|
|
|
2565
|
|
|
|
|
|
|
# DOS-like system |
2566
|
0
|
0
|
|
|
|
0
|
if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/oxms) { |
2567
|
0
|
|
|
|
|
0
|
$expr =~ s{ \A ~ (?= [^/\\] ) } |
|
0
|
|
|
|
|
0
|
|
2568
|
|
|
|
|
|
|
{ my_home_MSWin32() }oxmse; |
2569
|
|
|
|
|
|
|
} |
2570
|
|
|
|
|
|
|
|
2571
|
|
|
|
|
|
|
# UNIX-like system |
2572
|
0
|
0
|
0
|
|
|
0
|
else { |
|
0
|
|
|
|
|
0
|
|
2573
|
|
|
|
|
|
|
$expr =~ s{ \A ~ ( (?:[^\x8E\x8F\xA1-\xFE/]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])* ) } |
2574
|
|
|
|
|
|
|
{ $1 ? (CORE::eval(q{(getpwnam($1))[7]})||my_home()) : my_home() }oxmse; |
2575
|
|
|
|
|
|
|
} |
2576
|
0
|
0
|
|
|
|
0
|
|
2577
|
0
|
0
|
|
|
|
0
|
# assume global context if not provided one |
2578
|
|
|
|
|
|
|
$cxix = '_G_' if not defined $cxix; |
2579
|
|
|
|
|
|
|
$iter{$cxix} = 0 if not exists $iter{$cxix}; |
2580
|
0
|
0
|
|
|
|
0
|
|
2581
|
0
|
|
|
|
|
0
|
# if we're just beginning, do it all first |
2582
|
|
|
|
|
|
|
if ($iter{$cxix} == 0) { |
2583
|
|
|
|
|
|
|
$entries{$cxix} = [ _do_glob(1, _parse_line($expr)) ]; |
2584
|
|
|
|
|
|
|
} |
2585
|
0
|
0
|
|
|
|
0
|
|
2586
|
0
|
|
|
|
|
0
|
# chuck it all out, quick or slow |
2587
|
0
|
|
|
|
|
0
|
if (wantarray) { |
|
0
|
|
|
|
|
0
|
|
2588
|
|
|
|
|
|
|
delete $iter{$cxix}; |
2589
|
|
|
|
|
|
|
return @{delete $entries{$cxix}}; |
2590
|
0
|
0
|
|
|
|
0
|
} |
|
0
|
|
|
|
|
0
|
|
2591
|
0
|
|
|
|
|
0
|
else { |
|
0
|
|
|
|
|
0
|
|
2592
|
|
|
|
|
|
|
if ($iter{$cxix} = scalar @{$entries{$cxix}}) { |
2593
|
|
|
|
|
|
|
return shift @{$entries{$cxix}}; |
2594
|
|
|
|
|
|
|
} |
2595
|
0
|
|
|
|
|
0
|
else { |
2596
|
0
|
|
|
|
|
0
|
# return undef for EOL |
2597
|
0
|
|
|
|
|
0
|
delete $iter{$cxix}; |
2598
|
|
|
|
|
|
|
delete $entries{$cxix}; |
2599
|
|
|
|
|
|
|
return undef; |
2600
|
|
|
|
|
|
|
} |
2601
|
|
|
|
|
|
|
} |
2602
|
|
|
|
|
|
|
} |
2603
|
|
|
|
|
|
|
|
2604
|
|
|
|
|
|
|
# |
2605
|
|
|
|
|
|
|
# EUC-JP path globbing subroutine |
2606
|
|
|
|
|
|
|
# |
2607
|
0
|
|
|
0
|
|
0
|
sub _do_glob { |
2608
|
0
|
|
|
|
|
0
|
|
2609
|
0
|
|
|
|
|
0
|
my($cond,@expr) = @_; |
2610
|
|
|
|
|
|
|
my @glob = (); |
2611
|
|
|
|
|
|
|
my $fix_drive_relative_paths = 0; |
2612
|
0
|
|
|
|
|
0
|
|
2613
|
0
|
0
|
|
|
|
0
|
OUTER: |
2614
|
0
|
0
|
|
|
|
0
|
for my $expr (@expr) { |
2615
|
|
|
|
|
|
|
next OUTER if not defined $expr; |
2616
|
0
|
|
|
|
|
0
|
next OUTER if $expr eq ''; |
2617
|
0
|
|
|
|
|
0
|
|
2618
|
0
|
|
|
|
|
0
|
my @matched = (); |
2619
|
0
|
|
|
|
|
0
|
my @globdir = (); |
2620
|
0
|
|
|
|
|
0
|
my $head = '.'; |
2621
|
|
|
|
|
|
|
my $pathsep = '/'; |
2622
|
|
|
|
|
|
|
my $tail; |
2623
|
0
|
0
|
|
|
|
0
|
|
2624
|
0
|
|
|
|
|
0
|
# if argument is within quotes strip em and do no globbing |
2625
|
0
|
0
|
|
|
|
0
|
if ($expr =~ /\A " ((?:$q_char)*?) " \z/oxms) { |
2626
|
0
|
0
|
|
|
|
0
|
$expr = $1; |
2627
|
0
|
|
|
|
|
0
|
if ($cond eq 'd') { |
2628
|
|
|
|
|
|
|
if (-d $expr) { |
2629
|
|
|
|
|
|
|
push @glob, $expr; |
2630
|
|
|
|
|
|
|
} |
2631
|
0
|
0
|
|
|
|
0
|
} |
2632
|
0
|
|
|
|
|
0
|
else { |
2633
|
|
|
|
|
|
|
if (-e $expr) { |
2634
|
|
|
|
|
|
|
push @glob, $expr; |
2635
|
0
|
|
|
|
|
0
|
} |
2636
|
|
|
|
|
|
|
} |
2637
|
|
|
|
|
|
|
next OUTER; |
2638
|
|
|
|
|
|
|
} |
2639
|
|
|
|
|
|
|
|
2640
|
0
|
0
|
|
|
|
0
|
# wildcards with a drive prefix such as h:*.pm must be changed |
2641
|
0
|
0
|
|
|
|
0
|
# to h:./*.pm to expand correctly |
2642
|
0
|
|
|
|
|
0
|
if ($^O =~ /\A (?: MSWin32 | NetWare | symbian | dos ) \z/oxms) { |
2643
|
|
|
|
|
|
|
if ($expr =~ s# \A ((?:[A-Za-z]:)?) ([^\x8E\x8F\xA1-\xFE/\\]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF]) #$1./$2#oxms) { |
2644
|
|
|
|
|
|
|
$fix_drive_relative_paths = 1; |
2645
|
|
|
|
|
|
|
} |
2646
|
0
|
0
|
|
|
|
0
|
} |
2647
|
0
|
0
|
|
|
|
0
|
|
2648
|
0
|
|
|
|
|
0
|
if (($head, $tail) = _parse_path($expr,$pathsep)) { |
2649
|
0
|
|
|
|
|
0
|
if ($tail eq '') { |
2650
|
|
|
|
|
|
|
push @glob, $expr; |
2651
|
0
|
0
|
|
|
|
0
|
next OUTER; |
2652
|
0
|
0
|
|
|
|
0
|
} |
2653
|
0
|
|
|
|
|
0
|
if ($head =~ / \A (?:$q_char)*? [*?] /oxms) { |
|
0
|
|
|
|
|
0
|
|
2654
|
0
|
|
|
|
|
0
|
if (@globdir = _do_glob('d', $head)) { |
2655
|
|
|
|
|
|
|
push @glob, _do_glob($cond, map {"$_$pathsep$tail"} @globdir); |
2656
|
|
|
|
|
|
|
next OUTER; |
2657
|
0
|
0
|
0
|
|
|
0
|
} |
2658
|
0
|
|
|
|
|
0
|
} |
2659
|
|
|
|
|
|
|
if ($head eq '' or $head =~ /\A [A-Za-z]: \z/oxms) { |
2660
|
0
|
|
|
|
|
0
|
$head .= $pathsep; |
2661
|
|
|
|
|
|
|
} |
2662
|
|
|
|
|
|
|
$expr = $tail; |
2663
|
|
|
|
|
|
|
} |
2664
|
0
|
0
|
|
|
|
0
|
|
2665
|
0
|
0
|
|
|
|
0
|
# If file component has no wildcards, we can avoid opendir |
2666
|
0
|
|
|
|
|
0
|
if ($expr !~ / \A (?:$q_char)*? [*?] /oxms) { |
2667
|
|
|
|
|
|
|
if ($head eq '.') { |
2668
|
0
|
0
|
0
|
|
|
0
|
$head = ''; |
2669
|
0
|
|
|
|
|
0
|
} |
2670
|
|
|
|
|
|
|
if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) { |
2671
|
0
|
|
|
|
|
0
|
$head .= $pathsep; |
2672
|
0
|
0
|
|
|
|
0
|
} |
2673
|
0
|
0
|
|
|
|
0
|
$head .= $expr; |
2674
|
0
|
|
|
|
|
0
|
if ($cond eq 'd') { |
2675
|
|
|
|
|
|
|
if (-d $head) { |
2676
|
|
|
|
|
|
|
push @glob, $head; |
2677
|
|
|
|
|
|
|
} |
2678
|
0
|
0
|
|
|
|
0
|
} |
2679
|
0
|
|
|
|
|
0
|
else { |
2680
|
|
|
|
|
|
|
if (-e $head) { |
2681
|
|
|
|
|
|
|
push @glob, $head; |
2682
|
0
|
|
|
|
|
0
|
} |
2683
|
|
|
|
|
|
|
} |
2684
|
0
|
0
|
|
|
|
0
|
next OUTER; |
2685
|
0
|
|
|
|
|
0
|
} |
2686
|
0
|
|
|
|
|
0
|
opendir(*DIR, $head) or next OUTER; |
2687
|
|
|
|
|
|
|
my @leaf = readdir DIR; |
2688
|
0
|
0
|
|
|
|
0
|
closedir DIR; |
2689
|
0
|
|
|
|
|
0
|
|
2690
|
|
|
|
|
|
|
if ($head eq '.') { |
2691
|
0
|
0
|
0
|
|
|
0
|
$head = ''; |
2692
|
0
|
|
|
|
|
0
|
} |
2693
|
|
|
|
|
|
|
if ($head ne '' and ($head =~ / \G ($q_char) /oxmsg)[-1] ne $pathsep) { |
2694
|
|
|
|
|
|
|
$head .= $pathsep; |
2695
|
0
|
|
|
|
|
0
|
} |
2696
|
0
|
|
|
|
|
0
|
|
2697
|
0
|
|
|
|
|
0
|
my $pattern = ''; |
2698
|
|
|
|
|
|
|
while ($expr =~ / \G ($q_char) /oxgc) { |
2699
|
|
|
|
|
|
|
my $char = $1; |
2700
|
|
|
|
|
|
|
|
2701
|
|
|
|
|
|
|
# 6.9. Matching Shell Globs as Regular Expressions |
2702
|
|
|
|
|
|
|
# in Chapter 6. Pattern Matching |
2703
|
|
|
|
|
|
|
# of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition. |
2704
|
0
|
0
|
|
|
|
0
|
# (and so on) |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
2705
|
0
|
|
|
|
|
0
|
|
2706
|
|
|
|
|
|
|
if ($char eq '*') { |
2707
|
|
|
|
|
|
|
$pattern .= "(?:$your_char)*", |
2708
|
0
|
|
|
|
|
0
|
} |
2709
|
|
|
|
|
|
|
elsif ($char eq '?') { |
2710
|
|
|
|
|
|
|
$pattern .= "(?:$your_char)?", # DOS style |
2711
|
|
|
|
|
|
|
# $pattern .= "(?:$your_char)", # UNIX style |
2712
|
0
|
|
|
|
|
0
|
} |
2713
|
|
|
|
|
|
|
elsif ((my $fc = Eeucjp::fc($char)) ne $char) { |
2714
|
|
|
|
|
|
|
$pattern .= $fc; |
2715
|
0
|
|
|
|
|
0
|
} |
2716
|
|
|
|
|
|
|
else { |
2717
|
|
|
|
|
|
|
$pattern .= quotemeta $char; |
2718
|
0
|
|
|
0
|
|
0
|
} |
|
0
|
|
|
|
|
0
|
|
2719
|
|
|
|
|
|
|
} |
2720
|
|
|
|
|
|
|
my $matchsub = sub { Eeucjp::fc($_[0]) =~ /\A $pattern \z/xms }; |
2721
|
|
|
|
|
|
|
|
2722
|
|
|
|
|
|
|
# if ($@) { |
2723
|
|
|
|
|
|
|
# print STDERR "$0: $@\n"; |
2724
|
|
|
|
|
|
|
# next OUTER; |
2725
|
|
|
|
|
|
|
# } |
2726
|
0
|
|
|
|
|
0
|
|
2727
|
0
|
0
|
0
|
|
|
0
|
INNER: |
2728
|
0
|
|
|
|
|
0
|
for my $leaf (@leaf) { |
2729
|
|
|
|
|
|
|
if ($leaf eq '.' or $leaf eq '..') { |
2730
|
0
|
0
|
0
|
|
|
0
|
next INNER; |
2731
|
0
|
|
|
|
|
0
|
} |
2732
|
|
|
|
|
|
|
if ($cond eq 'd' and not -d "$head$leaf") { |
2733
|
|
|
|
|
|
|
next INNER; |
2734
|
0
|
0
|
|
|
|
0
|
} |
2735
|
0
|
|
|
|
|
0
|
|
2736
|
0
|
|
|
|
|
0
|
if (&$matchsub($leaf)) { |
2737
|
|
|
|
|
|
|
push @matched, "$head$leaf"; |
2738
|
|
|
|
|
|
|
next INNER; |
2739
|
|
|
|
|
|
|
} |
2740
|
|
|
|
|
|
|
|
2741
|
|
|
|
|
|
|
# [DOS compatibility special case] |
2742
|
0
|
0
|
0
|
|
|
0
|
# Failed, add a trailing dot and try again, but only... |
|
|
|
0
|
|
|
|
|
2743
|
|
|
|
|
|
|
|
2744
|
|
|
|
|
|
|
if (Eeucjp::index($leaf,'.') == -1 and # if name does not have a dot in it *and* |
2745
|
|
|
|
|
|
|
CORE::length($leaf) <= 8 and # name is shorter than or equal to 8 chars *and* |
2746
|
0
|
0
|
|
|
|
0
|
Eeucjp::index($pattern,'\\.') != -1 # pattern has a dot. |
2747
|
0
|
|
|
|
|
0
|
) { |
2748
|
0
|
|
|
|
|
0
|
if (&$matchsub("$leaf.")) { |
2749
|
|
|
|
|
|
|
push @matched, "$head$leaf"; |
2750
|
|
|
|
|
|
|
next INNER; |
2751
|
|
|
|
|
|
|
} |
2752
|
0
|
0
|
|
|
|
0
|
} |
2753
|
0
|
|
|
|
|
0
|
} |
2754
|
|
|
|
|
|
|
if (@matched) { |
2755
|
|
|
|
|
|
|
push @glob, @matched; |
2756
|
0
|
0
|
|
|
|
0
|
} |
2757
|
0
|
|
|
|
|
0
|
} |
2758
|
0
|
|
|
|
|
0
|
if ($fix_drive_relative_paths) { |
2759
|
|
|
|
|
|
|
for my $glob (@glob) { |
2760
|
|
|
|
|
|
|
$glob =~ s# \A ([A-Za-z]:) \./ #$1#oxms; |
2761
|
0
|
|
|
|
|
0
|
} |
2762
|
|
|
|
|
|
|
} |
2763
|
|
|
|
|
|
|
return @glob; |
2764
|
|
|
|
|
|
|
} |
2765
|
|
|
|
|
|
|
|
2766
|
|
|
|
|
|
|
# |
2767
|
|
|
|
|
|
|
# EUC-JP parse line |
2768
|
|
|
|
|
|
|
# |
2769
|
0
|
|
|
0
|
|
0
|
sub _parse_line { |
2770
|
|
|
|
|
|
|
|
2771
|
0
|
|
|
|
|
0
|
my($line) = @_; |
2772
|
0
|
|
|
|
|
0
|
|
2773
|
0
|
|
|
|
|
0
|
$line .= ' '; |
2774
|
|
|
|
|
|
|
my @piece = (); |
2775
|
|
|
|
|
|
|
while ($line =~ / |
2776
|
|
|
|
|
|
|
" ( (?>(?: [^\x8E\x8F\xA1-\xFE"] |[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] )* ) ) " (?>\s+) | |
2777
|
|
|
|
|
|
|
( (?>(?: [^\x8E\x8F\xA1-\xFE"\s]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] )* ) ) (?>\s+) |
2778
|
0
|
0
|
|
|
|
0
|
/oxmsg |
2779
|
|
|
|
|
|
|
) { |
2780
|
0
|
|
|
|
|
0
|
push @piece, defined($1) ? $1 : $2; |
2781
|
|
|
|
|
|
|
} |
2782
|
|
|
|
|
|
|
return @piece; |
2783
|
|
|
|
|
|
|
} |
2784
|
|
|
|
|
|
|
|
2785
|
|
|
|
|
|
|
# |
2786
|
|
|
|
|
|
|
# EUC-JP parse path |
2787
|
|
|
|
|
|
|
# |
2788
|
0
|
|
|
0
|
|
0
|
sub _parse_path { |
2789
|
|
|
|
|
|
|
|
2790
|
0
|
|
|
|
|
0
|
my($path,$pathsep) = @_; |
2791
|
0
|
|
|
|
|
0
|
|
2792
|
0
|
|
|
|
|
0
|
$path .= '/'; |
2793
|
|
|
|
|
|
|
my @subpath = (); |
2794
|
|
|
|
|
|
|
while ($path =~ / |
2795
|
|
|
|
|
|
|
((?: [^\x8E\x8F\xA1-\xFE\/\\]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] )+?) [\/\\] |
2796
|
0
|
|
|
|
|
0
|
/oxmsg |
2797
|
|
|
|
|
|
|
) { |
2798
|
|
|
|
|
|
|
push @subpath, $1; |
2799
|
0
|
|
|
|
|
0
|
} |
2800
|
0
|
|
|
|
|
0
|
|
2801
|
0
|
|
|
|
|
0
|
my $tail = pop @subpath; |
2802
|
|
|
|
|
|
|
my $head = join $pathsep, @subpath; |
2803
|
|
|
|
|
|
|
return $head, $tail; |
2804
|
|
|
|
|
|
|
} |
2805
|
|
|
|
|
|
|
|
2806
|
|
|
|
|
|
|
# |
2807
|
|
|
|
|
|
|
# via File::HomeDir::Windows 1.00 |
2808
|
|
|
|
|
|
|
# |
2809
|
|
|
|
|
|
|
sub my_home_MSWin32 { |
2810
|
|
|
|
|
|
|
|
2811
|
|
|
|
|
|
|
# A lot of unix people and unix-derived tools rely on |
2812
|
0
|
0
|
0
|
0
|
0
|
0
|
# the ability to overload HOME. We will support it too |
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
2813
|
0
|
|
|
|
|
0
|
# so that they can replace raw HOME calls with File::HomeDir. |
2814
|
|
|
|
|
|
|
if (exists $ENV{'HOME'} and $ENV{'HOME'}) { |
2815
|
|
|
|
|
|
|
return $ENV{'HOME'}; |
2816
|
|
|
|
|
|
|
} |
2817
|
|
|
|
|
|
|
|
2818
|
0
|
|
|
|
|
0
|
# Do we have a user profile? |
2819
|
|
|
|
|
|
|
elsif (exists $ENV{'USERPROFILE'} and $ENV{'USERPROFILE'}) { |
2820
|
|
|
|
|
|
|
return $ENV{'USERPROFILE'}; |
2821
|
|
|
|
|
|
|
} |
2822
|
|
|
|
|
|
|
|
2823
|
0
|
|
|
|
|
0
|
# Some Windows use something like $ENV{'HOME'} |
2824
|
|
|
|
|
|
|
elsif (exists $ENV{'HOMEDRIVE'} and exists $ENV{'HOMEPATH'} and $ENV{'HOMEDRIVE'} and $ENV{'HOMEPATH'}) { |
2825
|
|
|
|
|
|
|
return join '', $ENV{'HOMEDRIVE'}, $ENV{'HOMEPATH'}; |
2826
|
0
|
|
|
|
|
0
|
} |
2827
|
|
|
|
|
|
|
|
2828
|
|
|
|
|
|
|
return undef; |
2829
|
|
|
|
|
|
|
} |
2830
|
|
|
|
|
|
|
|
2831
|
|
|
|
|
|
|
# |
2832
|
|
|
|
|
|
|
# via File::HomeDir::Unix 1.00 |
2833
|
0
|
|
|
0
|
0
|
0
|
# |
2834
|
|
|
|
|
|
|
sub my_home { |
2835
|
0
|
0
|
0
|
|
|
0
|
my $home; |
|
|
0
|
0
|
|
|
|
|
2836
|
0
|
|
|
|
|
0
|
|
2837
|
|
|
|
|
|
|
if (exists $ENV{'HOME'} and defined $ENV{'HOME'}) { |
2838
|
|
|
|
|
|
|
$home = $ENV{'HOME'}; |
2839
|
|
|
|
|
|
|
} |
2840
|
|
|
|
|
|
|
|
2841
|
|
|
|
|
|
|
# This is from the original code, but I'm guessing |
2842
|
0
|
|
|
|
|
0
|
# it means "login directory" and exists on some Unixes. |
2843
|
|
|
|
|
|
|
elsif (exists $ENV{'LOGDIR'} and $ENV{'LOGDIR'}) { |
2844
|
|
|
|
|
|
|
$home = $ENV{'LOGDIR'}; |
2845
|
|
|
|
|
|
|
} |
2846
|
|
|
|
|
|
|
|
2847
|
|
|
|
|
|
|
### More-desperate methods |
2848
|
|
|
|
|
|
|
|
2849
|
0
|
|
|
|
|
0
|
# Light desperation on any (Unixish) platform |
2850
|
|
|
|
|
|
|
else { |
2851
|
|
|
|
|
|
|
$home = CORE::eval q{ (getpwuid($<))[7] }; |
2852
|
|
|
|
|
|
|
} |
2853
|
|
|
|
|
|
|
|
2854
|
0
|
0
|
0
|
|
|
0
|
# On Unix in general, a non-existant home means "no home" |
2855
|
0
|
|
|
|
|
0
|
# For example, "nobody"-like users might use /nonexistant |
2856
|
|
|
|
|
|
|
if (defined $home and ! -d($home)) { |
2857
|
0
|
|
|
|
|
0
|
$home = undef; |
2858
|
|
|
|
|
|
|
} |
2859
|
|
|
|
|
|
|
return $home; |
2860
|
|
|
|
|
|
|
} |
2861
|
|
|
|
|
|
|
|
2862
|
|
|
|
|
|
|
# |
2863
|
|
|
|
|
|
|
# ${^PREMATCH}, $PREMATCH, $` the string preceding what was matched |
2864
|
0
|
0
|
|
0
|
0
|
0
|
# |
2865
|
0
|
0
|
0
|
|
|
0
|
sub Eeucjp::PREMATCH { |
2866
|
0
|
|
|
|
|
0
|
if (defined($&)) { |
2867
|
|
|
|
|
|
|
if (defined($1) and (CORE::substr($&,-CORE::length($1),CORE::length($1)) eq $1)) { |
2868
|
|
|
|
|
|
|
return CORE::substr($&,0,CORE::length($&)-CORE::length($1)); |
2869
|
0
|
|
|
|
|
0
|
} |
2870
|
|
|
|
|
|
|
else { |
2871
|
|
|
|
|
|
|
croak 'Use of "$`", $PREMATCH, and ${^PREMATCH} need to /( capture all )/ in regexp'; |
2872
|
|
|
|
|
|
|
} |
2873
|
0
|
|
|
|
|
0
|
} |
2874
|
|
|
|
|
|
|
else { |
2875
|
0
|
|
|
|
|
0
|
return ''; |
2876
|
|
|
|
|
|
|
} |
2877
|
|
|
|
|
|
|
return $`; |
2878
|
|
|
|
|
|
|
} |
2879
|
|
|
|
|
|
|
|
2880
|
|
|
|
|
|
|
# |
2881
|
|
|
|
|
|
|
# ${^MATCH}, $MATCH, $& the string that matched |
2882
|
0
|
0
|
|
0
|
0
|
0
|
# |
2883
|
0
|
0
|
|
|
|
0
|
sub Eeucjp::MATCH { |
2884
|
0
|
|
|
|
|
0
|
if (defined($&)) { |
2885
|
|
|
|
|
|
|
if (defined($1)) { |
2886
|
|
|
|
|
|
|
return $1; |
2887
|
0
|
|
|
|
|
0
|
} |
2888
|
|
|
|
|
|
|
else { |
2889
|
|
|
|
|
|
|
croak 'Use of "$&", $MATCH, and ${^MATCH} need to /( capture all )/ in regexp'; |
2890
|
|
|
|
|
|
|
} |
2891
|
0
|
|
|
|
|
0
|
} |
2892
|
|
|
|
|
|
|
else { |
2893
|
0
|
|
|
|
|
0
|
return ''; |
2894
|
|
|
|
|
|
|
} |
2895
|
|
|
|
|
|
|
return $&; |
2896
|
|
|
|
|
|
|
} |
2897
|
|
|
|
|
|
|
|
2898
|
|
|
|
|
|
|
# |
2899
|
|
|
|
|
|
|
# ${^POSTMATCH}, $POSTMATCH, $' the string following what was matched |
2900
|
0
|
|
|
0
|
0
|
0
|
# |
2901
|
|
|
|
|
|
|
sub Eeucjp::POSTMATCH { |
2902
|
|
|
|
|
|
|
return $'; |
2903
|
|
|
|
|
|
|
} |
2904
|
|
|
|
|
|
|
|
2905
|
|
|
|
|
|
|
# |
2906
|
|
|
|
|
|
|
# EUC-JP character to order (with parameter) |
2907
|
|
|
|
|
|
|
# |
2908
|
0
|
0
|
|
0
|
1
|
0
|
sub EUCJP::ord(;$) { |
2909
|
|
|
|
|
|
|
|
2910
|
0
|
0
|
|
|
|
0
|
local $_ = shift if @_; |
2911
|
0
|
|
|
|
|
0
|
|
2912
|
0
|
|
|
|
|
0
|
if (/\A ($q_char) /oxms) { |
2913
|
0
|
|
|
|
|
0
|
my @ord = unpack 'C*', $1; |
2914
|
0
|
|
|
|
|
0
|
my $ord = 0; |
2915
|
|
|
|
|
|
|
while (my $o = shift @ord) { |
2916
|
0
|
|
|
|
|
0
|
$ord = $ord * 0x100 + $o; |
2917
|
|
|
|
|
|
|
} |
2918
|
|
|
|
|
|
|
return $ord; |
2919
|
0
|
|
|
|
|
0
|
} |
2920
|
|
|
|
|
|
|
else { |
2921
|
|
|
|
|
|
|
return CORE::ord $_; |
2922
|
|
|
|
|
|
|
} |
2923
|
|
|
|
|
|
|
} |
2924
|
|
|
|
|
|
|
|
2925
|
|
|
|
|
|
|
# |
2926
|
|
|
|
|
|
|
# EUC-JP character to order (without parameter) |
2927
|
|
|
|
|
|
|
# |
2928
|
0
|
0
|
|
0
|
0
|
0
|
sub EUCJP::ord_() { |
2929
|
0
|
|
|
|
|
0
|
|
2930
|
0
|
|
|
|
|
0
|
if (/\A ($q_char) /oxms) { |
2931
|
0
|
|
|
|
|
0
|
my @ord = unpack 'C*', $1; |
2932
|
0
|
|
|
|
|
0
|
my $ord = 0; |
2933
|
|
|
|
|
|
|
while (my $o = shift @ord) { |
2934
|
0
|
|
|
|
|
0
|
$ord = $ord * 0x100 + $o; |
2935
|
|
|
|
|
|
|
} |
2936
|
|
|
|
|
|
|
return $ord; |
2937
|
0
|
|
|
|
|
0
|
} |
2938
|
|
|
|
|
|
|
else { |
2939
|
|
|
|
|
|
|
return CORE::ord $_; |
2940
|
|
|
|
|
|
|
} |
2941
|
|
|
|
|
|
|
} |
2942
|
|
|
|
|
|
|
|
2943
|
|
|
|
|
|
|
# |
2944
|
|
|
|
|
|
|
# EUC-JP reverse |
2945
|
|
|
|
|
|
|
# |
2946
|
0
|
0
|
|
0
|
0
|
0
|
sub EUCJP::reverse(@) { |
2947
|
0
|
|
|
|
|
0
|
|
2948
|
|
|
|
|
|
|
if (wantarray) { |
2949
|
|
|
|
|
|
|
return CORE::reverse @_; |
2950
|
|
|
|
|
|
|
} |
2951
|
|
|
|
|
|
|
else { |
2952
|
|
|
|
|
|
|
|
2953
|
|
|
|
|
|
|
# One of us once cornered Larry in an elevator and asked him what |
2954
|
|
|
|
|
|
|
# problem he was solving with this, but he looked as far off into |
2955
|
|
|
|
|
|
|
# the distance as he could in an elevator and said, "It seemed like |
2956
|
0
|
|
|
|
|
0
|
# a good idea at the time." |
2957
|
|
|
|
|
|
|
|
2958
|
|
|
|
|
|
|
return join '', CORE::reverse(join('',@_) =~ /\G ($q_char) /oxmsg); |
2959
|
|
|
|
|
|
|
} |
2960
|
|
|
|
|
|
|
} |
2961
|
|
|
|
|
|
|
|
2962
|
|
|
|
|
|
|
# |
2963
|
|
|
|
|
|
|
# EUC-JP getc (with parameter, without parameter) |
2964
|
|
|
|
|
|
|
# |
2965
|
0
|
|
|
0
|
0
|
0
|
sub EUCJP::getc(;*@) { |
2966
|
0
|
0
|
|
|
|
0
|
|
2967
|
0
|
0
|
0
|
|
|
0
|
my($package) = caller; |
2968
|
|
|
|
|
|
|
my $fh = @_ ? qualify_to_ref(shift,$package) : \*STDIN; |
2969
|
0
|
|
|
|
|
0
|
croak 'Too many arguments for EUCJP::getc' if @_ and not wantarray; |
|
0
|
|
|
|
|
0
|
|
2970
|
0
|
|
|
|
|
0
|
|
2971
|
0
|
|
|
|
|
0
|
my @length = sort { $a <=> $b } keys %range_tr; |
2972
|
0
|
|
|
|
|
0
|
my $getc = ''; |
2973
|
0
|
0
|
|
|
|
0
|
for my $length ($length[0] .. $length[-1]) { |
2974
|
0
|
0
|
|
|
|
0
|
$getc .= CORE::getc($fh); |
2975
|
0
|
0
|
|
|
|
0
|
if (exists $range_tr{CORE::length($getc)}) { |
2976
|
|
|
|
|
|
|
if ($getc =~ /\A ${Eeucjp::dot_s} \z/oxms) { |
2977
|
|
|
|
|
|
|
return wantarray ? ($getc,@_) : $getc; |
2978
|
|
|
|
|
|
|
} |
2979
|
0
|
0
|
|
|
|
0
|
} |
2980
|
|
|
|
|
|
|
} |
2981
|
|
|
|
|
|
|
return wantarray ? ($getc,@_) : $getc; |
2982
|
|
|
|
|
|
|
} |
2983
|
|
|
|
|
|
|
|
2984
|
|
|
|
|
|
|
# |
2985
|
|
|
|
|
|
|
# EUC-JP length by character |
2986
|
|
|
|
|
|
|
# |
2987
|
0
|
0
|
|
0
|
1
|
0
|
sub EUCJP::length(;$) { |
2988
|
|
|
|
|
|
|
|
2989
|
0
|
|
|
|
|
0
|
local $_ = shift if @_; |
2990
|
0
|
|
|
|
|
0
|
|
2991
|
|
|
|
|
|
|
local @_ = /\G ($q_char) /oxmsg; |
2992
|
|
|
|
|
|
|
return scalar @_; |
2993
|
|
|
|
|
|
|
} |
2994
|
|
|
|
|
|
|
|
2995
|
|
|
|
|
|
|
# |
2996
|
|
|
|
|
|
|
# EUC-JP substr by character |
2997
|
|
|
|
|
|
|
# |
2998
|
|
|
|
|
|
|
BEGIN { |
2999
|
|
|
|
|
|
|
|
3000
|
|
|
|
|
|
|
# P.232 The lvalue Attribute |
3001
|
|
|
|
|
|
|
# in Chapter 6: Subroutines |
3002
|
|
|
|
|
|
|
# of ISBN 0-596-00027-8 Programming Perl Third Edition. |
3003
|
|
|
|
|
|
|
|
3004
|
|
|
|
|
|
|
# P.336 The lvalue Attribute |
3005
|
|
|
|
|
|
|
# in Chapter 7: Subroutines |
3006
|
|
|
|
|
|
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
3007
|
|
|
|
|
|
|
|
3008
|
|
|
|
|
|
|
# P.144 8.4 Lvalue subroutines |
3009
|
|
|
|
|
|
|
# in Chapter 8: perlsub: Perl subroutines |
3010
|
329
|
50
|
0
|
329
|
1
|
220924
|
# of ISBN-13: 978-1-906966-02-7 The Perl Language Reference Manual (for Perl version 5.12.1) |
|
0
|
0
|
|
0
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
3011
|
|
|
|
|
|
|
|
3012
|
|
|
|
|
|
|
CORE::eval sprintf(<<'END', ($] >= 5.014000) ? ':lvalue' : ''); |
3013
|
|
|
|
|
|
|
# vv----------------------******* |
3014
|
|
|
|
|
|
|
sub EUCJP::substr($$;$$) %s { |
3015
|
|
|
|
|
|
|
|
3016
|
|
|
|
|
|
|
my @char = $_[0] =~ /\G (?>$q_char) /oxmsg; |
3017
|
|
|
|
|
|
|
|
3018
|
|
|
|
|
|
|
# If the substring is beyond either end of the string, substr() returns the undefined |
3019
|
|
|
|
|
|
|
# value and produces a warning. When used as an lvalue, specifying a substring that |
3020
|
|
|
|
|
|
|
# is entirely outside the string raises an exception. |
3021
|
|
|
|
|
|
|
# http://perldoc.perl.org/functions/substr.html |
3022
|
|
|
|
|
|
|
|
3023
|
|
|
|
|
|
|
# A return with no argument returns the scalar value undef in scalar context, |
3024
|
|
|
|
|
|
|
# an empty list () in list context, and (naturally) nothing at all in void |
3025
|
|
|
|
|
|
|
# context. |
3026
|
|
|
|
|
|
|
|
3027
|
|
|
|
|
|
|
my $offset = $_[1]; |
3028
|
|
|
|
|
|
|
if (($offset > scalar(@char)) or ($offset < (-1 * scalar(@char)))) { |
3029
|
|
|
|
|
|
|
return; |
3030
|
|
|
|
|
|
|
} |
3031
|
|
|
|
|
|
|
|
3032
|
|
|
|
|
|
|
# substr($string,$offset,$length,$replacement) |
3033
|
|
|
|
|
|
|
if (@_ == 4) { |
3034
|
|
|
|
|
|
|
my(undef,undef,$length,$replacement) = @_; |
3035
|
|
|
|
|
|
|
my $substr = join '', splice(@char, $offset, $length, $replacement); |
3036
|
|
|
|
|
|
|
$_[0] = join '', @char; |
3037
|
|
|
|
|
|
|
|
3038
|
|
|
|
|
|
|
# return $substr; this doesn't work, don't say "return" |
3039
|
|
|
|
|
|
|
$substr; |
3040
|
|
|
|
|
|
|
} |
3041
|
|
|
|
|
|
|
|
3042
|
|
|
|
|
|
|
# substr($string,$offset,$length) |
3043
|
|
|
|
|
|
|
elsif (@_ == 3) { |
3044
|
|
|
|
|
|
|
my(undef,undef,$length) = @_; |
3045
|
|
|
|
|
|
|
my $octet_offset = 0; |
3046
|
|
|
|
|
|
|
my $octet_length = 0; |
3047
|
|
|
|
|
|
|
if ($offset == 0) { |
3048
|
|
|
|
|
|
|
$octet_offset = 0; |
3049
|
|
|
|
|
|
|
} |
3050
|
|
|
|
|
|
|
elsif ($offset > 0) { |
3051
|
|
|
|
|
|
|
$octet_offset = CORE::length(join '', @char[0..$offset-1]); |
3052
|
|
|
|
|
|
|
} |
3053
|
|
|
|
|
|
|
else { |
3054
|
|
|
|
|
|
|
$octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]); |
3055
|
|
|
|
|
|
|
} |
3056
|
|
|
|
|
|
|
if ($length == 0) { |
3057
|
|
|
|
|
|
|
$octet_length = 0; |
3058
|
|
|
|
|
|
|
} |
3059
|
|
|
|
|
|
|
elsif ($length > 0) { |
3060
|
|
|
|
|
|
|
$octet_length = CORE::length(join '', @char[$offset..$offset+$length-1]); |
3061
|
|
|
|
|
|
|
} |
3062
|
|
|
|
|
|
|
else { |
3063
|
|
|
|
|
|
|
$octet_length = -1 * CORE::length(join '', @char[$#char+$length+1..$#char]); |
3064
|
|
|
|
|
|
|
} |
3065
|
|
|
|
|
|
|
CORE::substr($_[0], $octet_offset, $octet_length); |
3066
|
|
|
|
|
|
|
} |
3067
|
|
|
|
|
|
|
|
3068
|
|
|
|
|
|
|
# substr($string,$offset) |
3069
|
|
|
|
|
|
|
else { |
3070
|
|
|
|
|
|
|
my $octet_offset = 0; |
3071
|
|
|
|
|
|
|
if ($offset == 0) { |
3072
|
|
|
|
|
|
|
$octet_offset = 0; |
3073
|
|
|
|
|
|
|
} |
3074
|
|
|
|
|
|
|
elsif ($offset > 0) { |
3075
|
|
|
|
|
|
|
$octet_offset = CORE::length(join '', @char[0..$offset-1]); |
3076
|
|
|
|
|
|
|
} |
3077
|
|
|
|
|
|
|
else { |
3078
|
|
|
|
|
|
|
$octet_offset = -1 * CORE::length(join '', @char[$#char+$offset+1..$#char]); |
3079
|
|
|
|
|
|
|
} |
3080
|
|
|
|
|
|
|
CORE::substr($_[0], $octet_offset); |
3081
|
|
|
|
|
|
|
} |
3082
|
|
|
|
|
|
|
} |
3083
|
|
|
|
|
|
|
END |
3084
|
|
|
|
|
|
|
} |
3085
|
|
|
|
|
|
|
|
3086
|
|
|
|
|
|
|
# |
3087
|
|
|
|
|
|
|
# EUC-JP index by character |
3088
|
|
|
|
|
|
|
# |
3089
|
0
|
|
|
0
|
1
|
0
|
sub EUCJP::index($$;$) { |
3090
|
0
|
0
|
|
|
|
0
|
|
3091
|
0
|
|
|
|
|
0
|
my $index; |
3092
|
|
|
|
|
|
|
if (@_ == 3) { |
3093
|
|
|
|
|
|
|
$index = Eeucjp::index($_[0], $_[1], CORE::length(EUCJP::substr($_[0], 0, $_[2]))); |
3094
|
0
|
|
|
|
|
0
|
} |
3095
|
|
|
|
|
|
|
else { |
3096
|
|
|
|
|
|
|
$index = Eeucjp::index($_[0], $_[1]); |
3097
|
0
|
0
|
|
|
|
0
|
} |
3098
|
0
|
|
|
|
|
0
|
|
3099
|
|
|
|
|
|
|
if ($index == -1) { |
3100
|
|
|
|
|
|
|
return -1; |
3101
|
0
|
|
|
|
|
0
|
} |
3102
|
|
|
|
|
|
|
else { |
3103
|
|
|
|
|
|
|
return EUCJP::length(CORE::substr $_[0], 0, $index); |
3104
|
|
|
|
|
|
|
} |
3105
|
|
|
|
|
|
|
} |
3106
|
|
|
|
|
|
|
|
3107
|
|
|
|
|
|
|
# |
3108
|
|
|
|
|
|
|
# EUC-JP rindex by character |
3109
|
|
|
|
|
|
|
# |
3110
|
0
|
|
|
0
|
1
|
0
|
sub EUCJP::rindex($$;$) { |
3111
|
0
|
0
|
|
|
|
0
|
|
3112
|
0
|
|
|
|
|
0
|
my $rindex; |
3113
|
|
|
|
|
|
|
if (@_ == 3) { |
3114
|
|
|
|
|
|
|
$rindex = Eeucjp::rindex($_[0], $_[1], CORE::length(EUCJP::substr($_[0], 0, $_[2]))); |
3115
|
0
|
|
|
|
|
0
|
} |
3116
|
|
|
|
|
|
|
else { |
3117
|
|
|
|
|
|
|
$rindex = Eeucjp::rindex($_[0], $_[1]); |
3118
|
0
|
0
|
|
|
|
0
|
} |
3119
|
0
|
|
|
|
|
0
|
|
3120
|
|
|
|
|
|
|
if ($rindex == -1) { |
3121
|
|
|
|
|
|
|
return -1; |
3122
|
0
|
|
|
|
|
0
|
} |
3123
|
|
|
|
|
|
|
else { |
3124
|
|
|
|
|
|
|
return EUCJP::length(CORE::substr $_[0], 0, $rindex); |
3125
|
|
|
|
|
|
|
} |
3126
|
|
|
|
|
|
|
} |
3127
|
|
|
|
|
|
|
|
3128
|
329
|
|
|
329
|
|
4529
|
# when 'm//', '/' means regexp match 'm//' and '?' means regexp match '??' |
|
329
|
|
|
|
|
3468
|
|
|
329
|
|
|
|
|
73128
|
|
3129
|
|
|
|
|
|
|
# when 'div', '/' means division operator and '?' means conditional operator (condition ? then : else) |
3130
|
|
|
|
|
|
|
use vars qw($slash); $slash = 'm//'; |
3131
|
|
|
|
|
|
|
|
3132
|
|
|
|
|
|
|
# ord() to ord() or EUCJP::ord() |
3133
|
|
|
|
|
|
|
my $function_ord = 'ord'; |
3134
|
|
|
|
|
|
|
|
3135
|
|
|
|
|
|
|
# ord to ord or EUCJP::ord_ |
3136
|
|
|
|
|
|
|
my $function_ord_ = 'ord'; |
3137
|
|
|
|
|
|
|
|
3138
|
|
|
|
|
|
|
# reverse to reverse or EUCJP::reverse |
3139
|
|
|
|
|
|
|
my $function_reverse = 'reverse'; |
3140
|
|
|
|
|
|
|
|
3141
|
|
|
|
|
|
|
# getc to getc or EUCJP::getc |
3142
|
|
|
|
|
|
|
my $function_getc = 'getc'; |
3143
|
|
|
|
|
|
|
|
3144
|
|
|
|
|
|
|
# P.1023 Appendix W.9 Multibyte Anchoring |
3145
|
|
|
|
|
|
|
# of ISBN 1-56592-224-7 CJKV Information Processing |
3146
|
|
|
|
|
|
|
|
3147
|
|
|
|
|
|
|
my $anchor = ''; |
3148
|
329
|
|
|
329
|
|
4060
|
$anchor = q{${Eeucjp::anchor}}; |
|
329
|
|
|
0
|
|
665
|
|
|
329
|
|
|
|
|
16306174
|
|
3149
|
|
|
|
|
|
|
|
3150
|
|
|
|
|
|
|
use vars qw($nest); |
3151
|
|
|
|
|
|
|
|
3152
|
|
|
|
|
|
|
# regexp of nested parens in qqXX |
3153
|
|
|
|
|
|
|
|
3154
|
|
|
|
|
|
|
# P.340 Matching Nested Constructs with Embedded Code |
3155
|
|
|
|
|
|
|
# in Chapter 7: Perl |
3156
|
|
|
|
|
|
|
# of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition |
3157
|
|
|
|
|
|
|
|
3158
|
|
|
|
|
|
|
my $qq_paren = qr{(?{local $nest=0}) (?>(?: |
3159
|
|
|
|
|
|
|
[^\x8E\x8F\xA1-\xFE\\()] | |
3160
|
|
|
|
|
|
|
\( (?{$nest++}) | |
3161
|
|
|
|
|
|
|
\) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) | |
3162
|
|
|
|
|
|
|
[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
3163
|
|
|
|
|
|
|
\\ [^\x8E\x8F\xA1-\xFEc] | |
3164
|
|
|
|
|
|
|
\\c[\x40-\x5F] | |
3165
|
|
|
|
|
|
|
\\ [\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
3166
|
|
|
|
|
|
|
[\x00-\xFF] |
3167
|
|
|
|
|
|
|
}xms; |
3168
|
|
|
|
|
|
|
|
3169
|
|
|
|
|
|
|
my $qq_brace = qr{(?{local $nest=0}) (?>(?: |
3170
|
|
|
|
|
|
|
[^\x8E\x8F\xA1-\xFE\\{}] | |
3171
|
|
|
|
|
|
|
\{ (?{$nest++}) | |
3172
|
|
|
|
|
|
|
\} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) | |
3173
|
|
|
|
|
|
|
[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
3174
|
|
|
|
|
|
|
\\ [^\x8E\x8F\xA1-\xFEc] | |
3175
|
|
|
|
|
|
|
\\c[\x40-\x5F] | |
3176
|
|
|
|
|
|
|
\\ [\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
3177
|
|
|
|
|
|
|
[\x00-\xFF] |
3178
|
|
|
|
|
|
|
}xms; |
3179
|
|
|
|
|
|
|
|
3180
|
|
|
|
|
|
|
my $qq_bracket = qr{(?{local $nest=0}) (?>(?: |
3181
|
|
|
|
|
|
|
[^\x8E\x8F\xA1-\xFE\\\[\]] | |
3182
|
|
|
|
|
|
|
\[ (?{$nest++}) | |
3183
|
|
|
|
|
|
|
\] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) | |
3184
|
|
|
|
|
|
|
[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
3185
|
|
|
|
|
|
|
\\ [^\x8E\x8F\xA1-\xFEc] | |
3186
|
|
|
|
|
|
|
\\c[\x40-\x5F] | |
3187
|
|
|
|
|
|
|
\\ [\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
3188
|
|
|
|
|
|
|
[\x00-\xFF] |
3189
|
|
|
|
|
|
|
}xms; |
3190
|
|
|
|
|
|
|
|
3191
|
|
|
|
|
|
|
my $qq_angle = qr{(?{local $nest=0}) (?>(?: |
3192
|
|
|
|
|
|
|
[^\x8E\x8F\xA1-\xFE\\<>] | |
3193
|
|
|
|
|
|
|
\< (?{$nest++}) | |
3194
|
|
|
|
|
|
|
\> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) | |
3195
|
|
|
|
|
|
|
[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
3196
|
|
|
|
|
|
|
\\ [^\x8E\x8F\xA1-\xFEc] | |
3197
|
|
|
|
|
|
|
\\c[\x40-\x5F] | |
3198
|
|
|
|
|
|
|
\\ [\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
3199
|
|
|
|
|
|
|
[\x00-\xFF] |
3200
|
|
|
|
|
|
|
}xms; |
3201
|
|
|
|
|
|
|
|
3202
|
|
|
|
|
|
|
my $qq_scalar = qr{(?: \{ (?:$qq_brace)*? \} | |
3203
|
|
|
|
|
|
|
(?: ::)? (?: |
3204
|
|
|
|
|
|
|
(?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* ) |
3205
|
|
|
|
|
|
|
(?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*) |
3206
|
|
|
|
|
|
|
(?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*) |
3207
|
|
|
|
|
|
|
)) |
3208
|
|
|
|
|
|
|
}xms; |
3209
|
|
|
|
|
|
|
|
3210
|
|
|
|
|
|
|
my $qq_variable = qr{(?: \{ (?:$qq_brace)*? \} | |
3211
|
|
|
|
|
|
|
(?: ::)? (?: |
3212
|
|
|
|
|
|
|
(?>[0-9]+) | |
3213
|
|
|
|
|
|
|
[^\x8E\x8F\xA1-\xFEa-zA-Z_0-9\[\]] | |
3214
|
|
|
|
|
|
|
^[A-Z] | |
3215
|
|
|
|
|
|
|
(?> [a-zA-Z_][a-zA-Z_0-9]* (?: ::[a-zA-Z_][a-zA-Z_0-9]*)* ) |
3216
|
|
|
|
|
|
|
(?>(?: \[ (?: \$\[ | \$\] | $qq_char )*? \] | \{ (?:$qq_brace)*? \} )*) |
3217
|
|
|
|
|
|
|
(?>(?: (?: -> )? (?: [\$\@\%\&\*]\* | \$\#\* | [\@\%]? \[ (?: \$\[ | \$\] | $qq_char )*? \] | [\@\%\*]? \{ (?:$qq_brace)*? \} ) )*) |
3218
|
|
|
|
|
|
|
)) |
3219
|
|
|
|
|
|
|
}xms; |
3220
|
|
|
|
|
|
|
|
3221
|
|
|
|
|
|
|
my $qq_substr = qr{(?> Char::substr | EUCJP::substr | CORE::substr | substr ) (?>\s*) \( $qq_paren \) |
3222
|
|
|
|
|
|
|
}xms; |
3223
|
|
|
|
|
|
|
|
3224
|
|
|
|
|
|
|
# regexp of nested parens in qXX |
3225
|
|
|
|
|
|
|
my $q_paren = qr{(?{local $nest=0}) (?>(?: |
3226
|
|
|
|
|
|
|
[^\x8E\x8F\xA1-\xFE()] | |
3227
|
|
|
|
|
|
|
[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
3228
|
|
|
|
|
|
|
\( (?{$nest++}) | |
3229
|
|
|
|
|
|
|
\) (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) | |
3230
|
|
|
|
|
|
|
[\x00-\xFF] |
3231
|
|
|
|
|
|
|
}xms; |
3232
|
|
|
|
|
|
|
|
3233
|
|
|
|
|
|
|
my $q_brace = qr{(?{local $nest=0}) (?>(?: |
3234
|
|
|
|
|
|
|
[^\x8E\x8F\xA1-\xFE\{\}] | |
3235
|
|
|
|
|
|
|
[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
3236
|
|
|
|
|
|
|
\{ (?{$nest++}) | |
3237
|
|
|
|
|
|
|
\} (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) | |
3238
|
|
|
|
|
|
|
[\x00-\xFF] |
3239
|
|
|
|
|
|
|
}xms; |
3240
|
|
|
|
|
|
|
|
3241
|
|
|
|
|
|
|
my $q_bracket = qr{(?{local $nest=0}) (?>(?: |
3242
|
|
|
|
|
|
|
[^\x8E\x8F\xA1-\xFE\[\]] | |
3243
|
|
|
|
|
|
|
[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
3244
|
|
|
|
|
|
|
\[ (?{$nest++}) | |
3245
|
|
|
|
|
|
|
\] (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) | |
3246
|
|
|
|
|
|
|
[\x00-\xFF] |
3247
|
|
|
|
|
|
|
}xms; |
3248
|
|
|
|
|
|
|
|
3249
|
|
|
|
|
|
|
my $q_angle = qr{(?{local $nest=0}) (?>(?: |
3250
|
|
|
|
|
|
|
[^\x8E\x8F\xA1-\xFE<>] | |
3251
|
|
|
|
|
|
|
[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
3252
|
|
|
|
|
|
|
\< (?{$nest++}) | |
3253
|
|
|
|
|
|
|
\> (?(?{$nest>0})(?{$nest--})|(?!)))*) (?(?{$nest!=0})(?!)) | |
3254
|
|
|
|
|
|
|
[\x00-\xFF] |
3255
|
|
|
|
|
|
|
}xms; |
3256
|
|
|
|
|
|
|
|
3257
|
|
|
|
|
|
|
my $matched = ''; |
3258
|
|
|
|
|
|
|
my $s_matched = ''; |
3259
|
|
|
|
|
|
|
$matched = q{$Eeucjp::matched}; |
3260
|
|
|
|
|
|
|
$s_matched = q{ Eeucjp::s_matched();}; |
3261
|
|
|
|
|
|
|
|
3262
|
|
|
|
|
|
|
my $tr_variable = ''; # variable of tr/// |
3263
|
|
|
|
|
|
|
my $sub_variable = ''; # variable of s/// |
3264
|
|
|
|
|
|
|
my $bind_operator = ''; # =~ or !~ |
3265
|
|
|
|
|
|
|
|
3266
|
|
|
|
|
|
|
my @heredoc = (); # here document |
3267
|
|
|
|
|
|
|
my @heredoc_delimiter = (); |
3268
|
|
|
|
|
|
|
my $here_script = ''; # here script |
3269
|
|
|
|
|
|
|
|
3270
|
|
|
|
|
|
|
# |
3271
|
|
|
|
|
|
|
# escape EUC-JP script |
3272
|
0
|
50
|
|
329
|
0
|
0
|
# |
3273
|
|
|
|
|
|
|
sub EUCJP::escape(;$) { |
3274
|
|
|
|
|
|
|
local($_) = $_[0] if @_; |
3275
|
|
|
|
|
|
|
|
3276
|
|
|
|
|
|
|
# P.359 The Study Function |
3277
|
|
|
|
|
|
|
# in Chapter 7: Perl |
3278
|
329
|
|
|
|
|
1131
|
# of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition |
3279
|
|
|
|
|
|
|
|
3280
|
|
|
|
|
|
|
study $_; # Yes, I studied study yesterday. |
3281
|
|
|
|
|
|
|
|
3282
|
|
|
|
|
|
|
# while all script |
3283
|
|
|
|
|
|
|
|
3284
|
|
|
|
|
|
|
# 6.14. Matching from Where the Last Pattern Left Off |
3285
|
|
|
|
|
|
|
# in Chapter 6. Pattern Matching |
3286
|
|
|
|
|
|
|
# of ISBN 0-596-00313-7 Perl Cookbook, 2nd Edition. |
3287
|
|
|
|
|
|
|
# (and so on) |
3288
|
|
|
|
|
|
|
|
3289
|
|
|
|
|
|
|
# one member of Tag-team |
3290
|
|
|
|
|
|
|
# |
3291
|
|
|
|
|
|
|
# P.128 Start of match (or end of previous match): \G |
3292
|
|
|
|
|
|
|
# P.130 Advanced Use of \G with Perl |
3293
|
|
|
|
|
|
|
# in Chapter 3: Overview of Regular Expression Features and Flavors |
3294
|
|
|
|
|
|
|
# P.255 Use leading anchors |
3295
|
|
|
|
|
|
|
# P.256 Expose ^ and \G at the front expressions |
3296
|
|
|
|
|
|
|
# in Chapter 6: Crafting an Efficient Expression |
3297
|
|
|
|
|
|
|
# P.315 "Tag-team" matching with /gc |
3298
|
|
|
|
|
|
|
# in Chapter 7: Perl |
3299
|
329
|
|
|
|
|
1742
|
# of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition |
3300
|
329
|
|
|
|
|
592
|
|
3301
|
329
|
|
|
|
|
1308
|
my $e_script = ''; |
3302
|
|
|
|
|
|
|
while (not /\G \z/oxgc) { # member |
3303
|
|
|
|
|
|
|
$e_script .= EUCJP::escape_token(); |
3304
|
131012
|
|
|
|
|
209974
|
} |
3305
|
|
|
|
|
|
|
|
3306
|
|
|
|
|
|
|
return $e_script; |
3307
|
|
|
|
|
|
|
} |
3308
|
|
|
|
|
|
|
|
3309
|
|
|
|
|
|
|
# |
3310
|
|
|
|
|
|
|
# escape EUC-JP token of script |
3311
|
|
|
|
|
|
|
# |
3312
|
|
|
|
|
|
|
sub EUCJP::escape_token { |
3313
|
|
|
|
|
|
|
|
3314
|
329
|
|
|
131012
|
0
|
4444
|
# \n output here document |
3315
|
|
|
|
|
|
|
|
3316
|
|
|
|
|
|
|
my $ignore_modules = join('|', qw( |
3317
|
|
|
|
|
|
|
utf8 |
3318
|
|
|
|
|
|
|
bytes |
3319
|
|
|
|
|
|
|
charnames |
3320
|
|
|
|
|
|
|
I18N::Japanese |
3321
|
|
|
|
|
|
|
I18N::Collate |
3322
|
|
|
|
|
|
|
I18N::JExt |
3323
|
|
|
|
|
|
|
File::DosGlob |
3324
|
|
|
|
|
|
|
Wild |
3325
|
|
|
|
|
|
|
Wildcard |
3326
|
|
|
|
|
|
|
Japanese |
3327
|
|
|
|
|
|
|
)); |
3328
|
|
|
|
|
|
|
|
3329
|
|
|
|
|
|
|
# another member of Tag-team |
3330
|
|
|
|
|
|
|
# |
3331
|
|
|
|
|
|
|
# P.315 "Tag-team" matching with /gc |
3332
|
|
|
|
|
|
|
# in Chapter 7: Perl |
3333
|
131012
|
100
|
100
|
|
|
170943
|
# of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition |
|
|
100
|
100
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
3334
|
131012
|
|
|
|
|
5968376
|
|
3335
|
22366
|
100
|
|
|
|
26850
|
if (/\G ( \n ) /oxgc) { # another member (and so on) |
3336
|
22366
|
|
|
|
|
38191
|
my $heredoc = ''; |
3337
|
|
|
|
|
|
|
if (scalar(@heredoc_delimiter) >= 1) { |
3338
|
191
|
|
|
|
|
237
|
$slash = 'm//'; |
3339
|
191
|
|
|
|
|
352
|
|
3340
|
|
|
|
|
|
|
$heredoc = join '', @heredoc; |
3341
|
|
|
|
|
|
|
@heredoc = (); |
3342
|
191
|
|
|
|
|
686
|
|
3343
|
191
|
|
|
|
|
339
|
# skip here document |
3344
|
|
|
|
|
|
|
for my $heredoc_delimiter (@heredoc_delimiter) { |
3345
|
199
|
|
|
|
|
1406
|
/\G .*? \n $heredoc_delimiter \n/xmsgc; |
3346
|
|
|
|
|
|
|
} |
3347
|
191
|
|
|
|
|
367
|
@heredoc_delimiter = (); |
3348
|
|
|
|
|
|
|
|
3349
|
191
|
|
|
|
|
247
|
$here_script = ''; |
3350
|
|
|
|
|
|
|
} |
3351
|
|
|
|
|
|
|
return "\n" . $heredoc; |
3352
|
|
|
|
|
|
|
} |
3353
|
22366
|
|
|
|
|
63657
|
|
3354
|
|
|
|
|
|
|
# ignore space, comment |
3355
|
|
|
|
|
|
|
elsif (/\G ((?>\s+)|\#.*) /oxgc) { return $1; } |
3356
|
|
|
|
|
|
|
|
3357
|
|
|
|
|
|
|
# if (, elsif (, unless (, while (, until (, given (, and when ( |
3358
|
|
|
|
|
|
|
|
3359
|
|
|
|
|
|
|
# given, when |
3360
|
|
|
|
|
|
|
|
3361
|
|
|
|
|
|
|
# P.225 The given Statement |
3362
|
|
|
|
|
|
|
# in Chapter 15: Smart Matching and given-when |
3363
|
|
|
|
|
|
|
# of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition |
3364
|
|
|
|
|
|
|
|
3365
|
|
|
|
|
|
|
# P.133 The given Statement |
3366
|
|
|
|
|
|
|
# in Chapter 4: Statements and Declarations |
3367
|
|
|
|
|
|
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
3368
|
31024
|
|
|
|
|
95110
|
|
3369
|
2622
|
|
|
|
|
3965
|
elsif (/\G ( (?: if | elsif | unless | while | until | given | when ) (?>\s*) \( ) /oxgc) { |
3370
|
|
|
|
|
|
|
$slash = 'm//'; |
3371
|
|
|
|
|
|
|
return $1; |
3372
|
|
|
|
|
|
|
} |
3373
|
|
|
|
|
|
|
|
3374
|
|
|
|
|
|
|
# scalar variable ($scalar = ...) =~ tr///; |
3375
|
|
|
|
|
|
|
# scalar variable ($scalar = ...) =~ s///; |
3376
|
|
|
|
|
|
|
|
3377
|
|
|
|
|
|
|
# state |
3378
|
|
|
|
|
|
|
|
3379
|
|
|
|
|
|
|
# P.68 Persistent, Private Variables |
3380
|
|
|
|
|
|
|
# in Chapter 4: Subroutines |
3381
|
|
|
|
|
|
|
# of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition |
3382
|
|
|
|
|
|
|
|
3383
|
|
|
|
|
|
|
# P.160 Persistent Lexically Scoped Variables: state |
3384
|
|
|
|
|
|
|
# in Chapter 4: Statements and Declarations |
3385
|
|
|
|
|
|
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
3386
|
|
|
|
|
|
|
|
3387
|
|
|
|
|
|
|
# (and so on) |
3388
|
2622
|
|
|
|
|
8269
|
|
3389
|
|
|
|
|
|
|
elsif (/\G ( \( (?>\s*) (?: local \b | my \b | our \b | state \b )? (?>\s*) \$ $qq_scalar ) /oxgc) { |
3390
|
139
|
50
|
|
|
|
310
|
my $e_string = e_string($1); |
|
|
50
|
|
|
|
|
|
3391
|
139
|
|
|
|
|
5716
|
|
3392
|
0
|
|
|
|
|
0
|
if (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /oxgc) { |
3393
|
0
|
|
|
|
|
0
|
$tr_variable = $e_string . e_string($1); |
3394
|
0
|
|
|
|
|
0
|
$bind_operator = $2; |
3395
|
|
|
|
|
|
|
$slash = 'm//'; |
3396
|
|
|
|
|
|
|
return ''; |
3397
|
0
|
|
|
|
|
0
|
} |
3398
|
0
|
|
|
|
|
0
|
elsif (/\G ( (?>\s*) = $qq_paren \) ) ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) { |
3399
|
0
|
|
|
|
|
0
|
$sub_variable = $e_string . e_string($1); |
3400
|
0
|
|
|
|
|
0
|
$bind_operator = $2; |
3401
|
|
|
|
|
|
|
$slash = 'm//'; |
3402
|
|
|
|
|
|
|
return ''; |
3403
|
0
|
|
|
|
|
0
|
} |
3404
|
139
|
|
|
|
|
326
|
else { |
3405
|
|
|
|
|
|
|
$slash = 'div'; |
3406
|
|
|
|
|
|
|
return $e_string; |
3407
|
|
|
|
|
|
|
} |
3408
|
|
|
|
|
|
|
} |
3409
|
|
|
|
|
|
|
|
3410
|
139
|
|
|
|
|
628
|
# $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Eeucjp::PREMATCH() |
3411
|
4
|
|
|
|
|
10
|
elsif (/\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) { |
3412
|
|
|
|
|
|
|
$slash = 'div'; |
3413
|
|
|
|
|
|
|
return q{Eeucjp::PREMATCH()}; |
3414
|
|
|
|
|
|
|
} |
3415
|
|
|
|
|
|
|
|
3416
|
4
|
|
|
|
|
13
|
# $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Eeucjp::MATCH() |
3417
|
28
|
|
|
|
|
54
|
elsif (/\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) { |
3418
|
|
|
|
|
|
|
$slash = 'div'; |
3419
|
|
|
|
|
|
|
return q{Eeucjp::MATCH()}; |
3420
|
|
|
|
|
|
|
} |
3421
|
|
|
|
|
|
|
|
3422
|
28
|
|
|
|
|
82
|
# $', ${'} --> $', ${'} |
3423
|
1
|
|
|
|
|
3
|
elsif (/\G ( \$' | \$\{'\} ) /oxmsgc) { |
3424
|
|
|
|
|
|
|
$slash = 'div'; |
3425
|
|
|
|
|
|
|
return $1; |
3426
|
|
|
|
|
|
|
} |
3427
|
|
|
|
|
|
|
|
3428
|
1
|
|
|
|
|
3
|
# $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Eeucjp::POSTMATCH() |
3429
|
3
|
|
|
|
|
6
|
elsif (/\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) { |
3430
|
|
|
|
|
|
|
$slash = 'div'; |
3431
|
|
|
|
|
|
|
return q{Eeucjp::POSTMATCH()}; |
3432
|
|
|
|
|
|
|
} |
3433
|
|
|
|
|
|
|
|
3434
|
|
|
|
|
|
|
# scalar variable $scalar =~ tr///; |
3435
|
|
|
|
|
|
|
# scalar variable $scalar =~ s///; |
3436
|
|
|
|
|
|
|
# substr() =~ tr///; |
3437
|
3
|
|
|
|
|
10
|
# substr() =~ s///; |
3438
|
|
|
|
|
|
|
elsif (/\G ( \$ $qq_scalar | $qq_substr ) /oxgc) { |
3439
|
2391
|
100
|
|
|
|
5222
|
my $scalar = e_string($1); |
|
|
100
|
|
|
|
|
|
3440
|
2391
|
|
|
|
|
25222
|
|
3441
|
9
|
|
|
|
|
18
|
if (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= (?: tr | y ) \b ) /oxgc) { |
3442
|
9
|
|
|
|
|
16
|
$tr_variable = $scalar; |
3443
|
9
|
|
|
|
|
14
|
$bind_operator = $1; |
3444
|
|
|
|
|
|
|
$slash = 'm//'; |
3445
|
|
|
|
|
|
|
return ''; |
3446
|
9
|
|
|
|
|
33
|
} |
3447
|
119
|
|
|
|
|
219
|
elsif (/\G ( (?>\s*) (?: =~ | !~ ) (?>\s*) ) (?= s \b ) /oxgc) { |
3448
|
119
|
|
|
|
|
233
|
$sub_variable = $scalar; |
3449
|
119
|
|
|
|
|
182
|
$bind_operator = $1; |
3450
|
|
|
|
|
|
|
$slash = 'm//'; |
3451
|
|
|
|
|
|
|
return ''; |
3452
|
119
|
|
|
|
|
345
|
} |
3453
|
2263
|
|
|
|
|
3247
|
else { |
3454
|
|
|
|
|
|
|
$slash = 'div'; |
3455
|
|
|
|
|
|
|
return $scalar; |
3456
|
|
|
|
|
|
|
} |
3457
|
|
|
|
|
|
|
} |
3458
|
|
|
|
|
|
|
|
3459
|
2263
|
|
|
|
|
5970
|
# end of statement |
3460
|
|
|
|
|
|
|
elsif (/\G ( [,;] ) /oxgc) { |
3461
|
|
|
|
|
|
|
$slash = 'm//'; |
3462
|
8374
|
|
|
|
|
14425
|
|
3463
|
|
|
|
|
|
|
# clear tr/// variable |
3464
|
|
|
|
|
|
|
$tr_variable = ''; |
3465
|
8374
|
|
|
|
|
10495
|
|
3466
|
|
|
|
|
|
|
# clear s/// variable |
3467
|
8374
|
|
|
|
|
9317
|
$sub_variable = ''; |
3468
|
|
|
|
|
|
|
|
3469
|
8374
|
|
|
|
|
9163
|
$bind_operator = ''; |
3470
|
|
|
|
|
|
|
|
3471
|
|
|
|
|
|
|
return $1; |
3472
|
|
|
|
|
|
|
} |
3473
|
|
|
|
|
|
|
|
3474
|
8374
|
|
|
|
|
41776
|
# bareword |
3475
|
|
|
|
|
|
|
elsif (/\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) { |
3476
|
|
|
|
|
|
|
return $1; |
3477
|
|
|
|
|
|
|
} |
3478
|
|
|
|
|
|
|
|
3479
|
0
|
|
|
|
|
0
|
# $0 --> $0 |
3480
|
2
|
|
|
|
|
6
|
elsif (/\G ( \$ 0 ) /oxmsgc) { |
3481
|
|
|
|
|
|
|
$slash = 'div'; |
3482
|
|
|
|
|
|
|
return $1; |
3483
|
2
|
|
|
|
|
8
|
} |
3484
|
0
|
|
|
|
|
0
|
elsif (/\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) { |
3485
|
|
|
|
|
|
|
$slash = 'div'; |
3486
|
|
|
|
|
|
|
return $1; |
3487
|
|
|
|
|
|
|
} |
3488
|
|
|
|
|
|
|
|
3489
|
0
|
|
|
|
|
0
|
# $$ --> $$ |
3490
|
1
|
|
|
|
|
2
|
elsif (/\G ( \$ \$ ) (?![\w\{]) /oxmsgc) { |
3491
|
|
|
|
|
|
|
$slash = 'div'; |
3492
|
|
|
|
|
|
|
return $1; |
3493
|
|
|
|
|
|
|
} |
3494
|
|
|
|
|
|
|
|
3495
|
|
|
|
|
|
|
# $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring |
3496
|
1
|
|
|
|
|
3
|
# $1, $2, $3 --> $1, $2, $3 otherwise |
3497
|
129
|
|
|
|
|
212
|
elsif (/\G \$ ((?>[1-9][0-9]*)) /oxmsgc) { |
3498
|
|
|
|
|
|
|
$slash = 'div'; |
3499
|
|
|
|
|
|
|
return e_capture($1); |
3500
|
129
|
|
|
|
|
279
|
} |
3501
|
0
|
|
|
|
|
0
|
elsif (/\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) { |
3502
|
|
|
|
|
|
|
$slash = 'div'; |
3503
|
|
|
|
|
|
|
return e_capture($1); |
3504
|
|
|
|
|
|
|
} |
3505
|
|
|
|
|
|
|
|
3506
|
0
|
|
|
|
|
0
|
# $$foo[ ... ] --> $ $foo->[ ... ] |
3507
|
0
|
|
|
|
|
0
|
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) { |
3508
|
|
|
|
|
|
|
$slash = 'div'; |
3509
|
|
|
|
|
|
|
return e_capture($1.'->'.$2); |
3510
|
|
|
|
|
|
|
} |
3511
|
|
|
|
|
|
|
|
3512
|
0
|
|
|
|
|
0
|
# $$foo{ ... } --> $ $foo->{ ... } |
3513
|
0
|
|
|
|
|
0
|
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) { |
3514
|
|
|
|
|
|
|
$slash = 'div'; |
3515
|
|
|
|
|
|
|
return e_capture($1.'->'.$2); |
3516
|
|
|
|
|
|
|
} |
3517
|
|
|
|
|
|
|
|
3518
|
0
|
|
|
|
|
0
|
# $$foo |
3519
|
0
|
|
|
|
|
0
|
elsif (/\G \$ ( \$ (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) { |
3520
|
|
|
|
|
|
|
$slash = 'div'; |
3521
|
|
|
|
|
|
|
return e_capture($1); |
3522
|
|
|
|
|
|
|
} |
3523
|
|
|
|
|
|
|
|
3524
|
0
|
|
|
|
|
0
|
# ${ foo } |
3525
|
0
|
|
|
|
|
0
|
elsif (/\G \$ (?>\s*) \{ ( (?>\s*) (?> [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* ) (?>\s*) ) \} /oxmsgc) { |
3526
|
|
|
|
|
|
|
$slash = 'div'; |
3527
|
|
|
|
|
|
|
return '${' . $1 . '}'; |
3528
|
|
|
|
|
|
|
} |
3529
|
|
|
|
|
|
|
|
3530
|
0
|
|
|
|
|
0
|
# ${ ... } |
3531
|
0
|
|
|
|
|
0
|
elsif (/\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) { |
3532
|
|
|
|
|
|
|
$slash = 'div'; |
3533
|
|
|
|
|
|
|
return e_capture($1); |
3534
|
|
|
|
|
|
|
} |
3535
|
|
|
|
|
|
|
|
3536
|
|
|
|
|
|
|
# variable or function |
3537
|
0
|
|
|
|
|
0
|
# $ @ % & * $ # |
3538
|
149
|
|
|
|
|
206
|
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) { |
3539
|
|
|
|
|
|
|
$slash = 'div'; |
3540
|
|
|
|
|
|
|
return $1; |
3541
|
|
|
|
|
|
|
} |
3542
|
|
|
|
|
|
|
# $ $ $ $ $ $ $ $ $ $ $ $ $ $ |
3543
|
149
|
|
|
|
|
470
|
# $ @ # \ ' " / ? ( ) [ ] < > |
3544
|
91
|
|
|
|
|
197
|
elsif (/\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) { |
3545
|
|
|
|
|
|
|
$slash = 'div'; |
3546
|
|
|
|
|
|
|
return $1; |
3547
|
|
|
|
|
|
|
} |
3548
|
|
|
|
|
|
|
|
3549
|
91
|
|
|
|
|
351
|
# while () |
3550
|
|
|
|
|
|
|
elsif (/\G \b (while (?>\s*) \( (?>\s*) <[\$]?[A-Za-z_][A-Za-z_0-9]*> (?>\s*) \)) \b /oxgc) { |
3551
|
|
|
|
|
|
|
return $1; |
3552
|
|
|
|
|
|
|
} |
3553
|
|
|
|
|
|
|
|
3554
|
|
|
|
|
|
|
# while () --- glob |
3555
|
|
|
|
|
|
|
|
3556
|
|
|
|
|
|
|
# avoid "Error: Runtime exception" of perl version 5.005_03 |
3557
|
0
|
|
|
|
|
0
|
|
3558
|
|
|
|
|
|
|
elsif (/\G \b while (?>\s*) \( (?>\s*) < ((?:[^\x8E\x8F\xA1-\xFE>\0\a\e\f\n\r\t]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])+?) > (?>\s*) \) \b /oxgc) { |
3559
|
|
|
|
|
|
|
return 'while ($_ = Eeucjp::glob("' . $1 . '"))'; |
3560
|
|
|
|
|
|
|
} |
3561
|
|
|
|
|
|
|
|
3562
|
0
|
|
|
|
|
0
|
# while (glob) |
3563
|
|
|
|
|
|
|
elsif (/\G \b while (?>\s*) \( (?>\s*) glob (?>\s*) \) /oxgc) { |
3564
|
|
|
|
|
|
|
return 'while ($_ = Eeucjp::glob_)'; |
3565
|
|
|
|
|
|
|
} |
3566
|
|
|
|
|
|
|
|
3567
|
0
|
|
|
|
|
0
|
# while (glob(WILDCARD)) |
3568
|
|
|
|
|
|
|
elsif (/\G \b while (?>\s*) \( (?>\s*) glob \b /oxgc) { |
3569
|
|
|
|
|
|
|
return 'while ($_ = Eeucjp::glob'; |
3570
|
|
|
|
|
|
|
} |
3571
|
0
|
|
|
|
|
0
|
|
|
425
|
|
|
|
|
900
|
|
3572
|
|
|
|
|
|
|
# doit if, doit unless, doit while, doit until, doit for, doit when |
3573
|
|
|
|
|
|
|
elsif (/\G \b ( if | unless | while | until | for | when ) \b /oxgc) { $slash = 'm//'; return $1; } |
3574
|
425
|
|
|
|
|
1546
|
|
|
19
|
|
|
|
|
38
|
|
3575
|
19
|
|
|
|
|
69
|
# subroutines of package Eeucjp |
|
0
|
|
|
|
|
0
|
|
3576
|
0
|
|
|
|
|
0
|
elsif (/\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $slash = 'm//'; return $1; } |
|
13
|
|
|
|
|
15
|
|
3577
|
13
|
|
|
|
|
35
|
elsif (/\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; } |
|
0
|
|
|
|
|
0
|
|
3578
|
0
|
|
|
|
|
0
|
elsif (/\G \b EUCJP::eval (?= (?>\s*) \{ ) /oxgc) { $slash = 'm//'; return 'eval'; } |
|
114
|
|
|
|
|
172
|
|
3579
|
114
|
|
|
|
|
324
|
elsif (/\G \b Char::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval Char::escape'; } |
|
2
|
|
|
|
|
4
|
|
3580
|
2
|
|
|
|
|
7
|
elsif (/\G \b EUCJP::eval \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'eval EUCJP::escape'; } |
|
2
|
|
|
|
|
4
|
|
3581
|
2
|
|
|
|
|
6
|
elsif (/\G \b bytes::substr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'substr'; } |
|
2
|
|
|
|
|
5
|
|
3582
|
2
|
|
|
|
|
5
|
elsif (/\G \b chop \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Eeucjp::chop'; } |
|
0
|
|
|
|
|
0
|
|
3583
|
0
|
|
|
|
|
0
|
elsif (/\G \b bytes::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'index'; } |
|
2
|
|
|
|
|
5
|
|
3584
|
2
|
|
|
|
|
5
|
elsif (/\G \b Char::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::index'; } |
|
2
|
|
|
|
|
3
|
|
3585
|
2
|
|
|
|
|
5
|
elsif (/\G \b EUCJP::index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'EUCJP::index'; } |
|
2
|
|
|
|
|
4
|
|
3586
|
2
|
|
|
|
|
7
|
elsif (/\G \b index \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Eeucjp::index'; } |
|
0
|
|
|
|
|
0
|
|
3587
|
0
|
|
|
|
|
0
|
elsif (/\G \b bytes::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'rindex'; } |
|
2
|
|
|
|
|
4
|
|
3588
|
2
|
|
|
|
|
14
|
elsif (/\G \b Char::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Char::rindex'; } |
|
2
|
|
|
|
|
4
|
|
3589
|
2
|
|
|
|
|
8
|
elsif (/\G \b EUCJP::rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'EUCJP::rindex'; } |
|
1
|
|
|
|
|
3
|
|
3590
|
1
|
|
|
|
|
3
|
elsif (/\G \b rindex \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Eeucjp::rindex'; } |
|
0
|
|
|
|
|
0
|
|
3591
|
0
|
|
|
|
|
0
|
elsif (/\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Eeucjp::lc'; } |
|
0
|
|
|
|
|
0
|
|
3592
|
0
|
|
|
|
|
0
|
elsif (/\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Eeucjp::lcfirst'; } |
|
0
|
|
|
|
|
0
|
|
3593
|
0
|
|
|
|
|
0
|
elsif (/\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Eeucjp::uc'; } |
|
3
|
|
|
|
|
6
|
|
3594
|
|
|
|
|
|
|
elsif (/\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Eeucjp::ucfirst'; } |
3595
|
|
|
|
|
|
|
elsif (/\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Eeucjp::fc'; } |
3596
|
3
|
|
|
|
|
8
|
|
|
0
|
|
|
|
|
0
|
|
3597
|
0
|
|
|
|
|
0
|
# "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...") |
|
0
|
|
|
|
|
0
|
|
3598
|
0
|
|
|
|
|
0
|
elsif (/\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $slash = 'm//'; return '-s ' . e_qq('', $1,$3,$2); } |
|
0
|
|
|
|
|
0
|
|
3599
|
0
|
|
|
|
|
0
|
elsif (/\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); } |
|
0
|
|
|
|
|
0
|
|
3600
|
0
|
|
|
|
|
0
|
elsif (/\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); } |
|
0
|
|
|
|
|
0
|
|
3601
|
0
|
|
|
|
|
0
|
elsif (/\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); } |
|
0
|
|
|
|
|
0
|
|
3602
|
0
|
|
|
|
|
0
|
elsif (/\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); } |
|
0
|
|
|
|
|
0
|
|
3603
|
|
|
|
|
|
|
elsif (/\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); } |
3604
|
0
|
|
|
|
|
0
|
elsif (/\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_qq('qq',$1,$3,$2); } |
|
0
|
|
|
|
|
0
|
|
3605
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
3606
|
0
|
|
|
|
|
0
|
elsif (/\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $slash = 'm//'; return '-s ' . e_q ('', $1,$3,$2); } |
|
0
|
|
|
|
|
0
|
|
3607
|
0
|
|
|
|
|
0
|
elsif (/\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); } |
|
0
|
|
|
|
|
0
|
|
3608
|
0
|
|
|
|
|
0
|
elsif (/\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); } |
|
0
|
|
|
|
|
0
|
|
3609
|
0
|
|
|
|
|
0
|
elsif (/\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); } |
|
0
|
|
|
|
|
0
|
|
3610
|
0
|
|
|
|
|
0
|
elsif (/\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); } |
|
0
|
|
|
|
|
0
|
|
3611
|
|
|
|
|
|
|
elsif (/\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); } |
3612
|
|
|
|
|
|
|
elsif (/\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $slash = 'm//'; return '-s ' . e_q ('q', $1,$3,$2); } |
3613
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
3614
|
0
|
|
|
|
|
0
|
elsif (/\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)* ) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ) )*) /oxgc) |
|
0
|
|
|
|
|
0
|
|
3615
|
0
|
|
|
|
|
0
|
{ $slash = 'm//'; return "-s $1"; } |
|
0
|
|
|
|
|
0
|
|
3616
|
0
|
|
|
|
|
0
|
elsif (/\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $slash = 'm//'; return "-s ($1)"; } |
|
0
|
|
|
|
|
0
|
|
3617
|
|
|
|
|
|
|
elsif (/\G -s (?= (?>\s+) [a-z]+) /oxgc) { $slash = 'm//'; return '-s'; } |
3618
|
0
|
|
|
|
|
0
|
elsif (/\G -s (?>\s+) ((?>\w+)) /oxgc) { $slash = 'm//'; return "-s $1"; } |
|
2
|
|
|
|
|
5
|
|
3619
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
5
|
|
3620
|
2
|
|
|
|
|
7
|
elsif (/\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'length'; } |
|
36
|
|
|
|
|
66
|
|
3621
|
36
|
|
|
|
|
143
|
elsif (/\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'chr'; } |
|
2
|
|
|
|
|
6
|
|
3622
|
2
|
|
|
|
|
7
|
elsif (/\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Eeucjp::chr'; } |
|
2
|
|
|
|
|
5
|
|
3623
|
2
|
|
|
|
|
6
|
elsif (/\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return 'ord'; } |
|
0
|
|
|
|
|
0
|
|
3624
|
0
|
|
|
|
|
0
|
elsif (/\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'div'; return $function_ord; } |
|
0
|
|
|
|
|
0
|
|
3625
|
0
|
|
|
|
|
0
|
elsif (/\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $slash = 'm//'; return 'Eeucjp::glob'; } |
|
0
|
|
|
|
|
0
|
|
3626
|
0
|
|
|
|
|
0
|
elsif (/\G \b lc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Eeucjp::lc_'; } |
|
0
|
|
|
|
|
0
|
|
3627
|
0
|
|
|
|
|
0
|
elsif (/\G \b lcfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Eeucjp::lcfirst_'; } |
|
0
|
|
|
|
|
0
|
|
3628
|
0
|
|
|
|
|
0
|
elsif (/\G \b uc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Eeucjp::uc_'; } |
|
0
|
|
|
|
|
0
|
|
3629
|
0
|
|
|
|
|
0
|
elsif (/\G \b ucfirst \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Eeucjp::ucfirst_'; } |
|
0
|
|
|
|
|
0
|
|
3630
|
|
|
|
|
|
|
elsif (/\G \b fc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Eeucjp::fc_'; } |
3631
|
0
|
|
|
|
|
0
|
elsif (/\G -s \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return '-s '; } |
|
0
|
|
|
|
|
0
|
|
3632
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
3633
|
0
|
|
|
|
|
0
|
elsif (/\G \b bytes::length \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'length'; } |
|
0
|
|
|
|
|
0
|
|
3634
|
0
|
|
|
|
|
0
|
elsif (/\G \b bytes::chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'chr'; } |
|
0
|
|
|
|
|
0
|
|
3635
|
0
|
|
|
|
|
0
|
elsif (/\G \b chr \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Eeucjp::chr_'; } |
|
2
|
|
|
|
|
5
|
|
3636
|
2
|
|
|
|
|
8
|
elsif (/\G \b bytes::ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return 'ord'; } |
|
0
|
|
|
|
|
0
|
|
3637
|
0
|
|
|
|
|
0
|
elsif (/\G \b ord \b (?! (?>\s*) => ) /oxgc) { $slash = 'div'; return $function_ord_; } |
|
4
|
|
|
|
|
8
|
|
3638
|
4
|
|
|
|
|
15
|
elsif (/\G \b glob \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return 'Eeucjp::glob_'; } |
|
8
|
|
|
|
|
20
|
|
3639
|
|
|
|
|
|
|
elsif (/\G \b reverse \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_reverse; } |
3640
|
|
|
|
|
|
|
elsif (/\G \b getc \b (?! (?>\s*) => ) /oxgc) { $slash = 'm//'; return $function_getc; } |
3641
|
8
|
|
|
|
|
28
|
# split |
3642
|
|
|
|
|
|
|
elsif (/\G \b (split) \b (?! (?>\s*) => ) /oxgc) { |
3643
|
180
|
|
|
|
|
360
|
$slash = 'm//'; |
3644
|
180
|
|
|
|
|
271
|
|
3645
|
180
|
|
|
|
|
621
|
my $e = ''; |
3646
|
|
|
|
|
|
|
while (/\G ( (?>\s+) | \( | \#.* ) /oxgc) { |
3647
|
|
|
|
|
|
|
$e .= $1; |
3648
|
|
|
|
|
|
|
} |
3649
|
177
|
100
|
|
|
|
644
|
|
|
180
|
100
|
|
|
|
12049
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
3650
|
|
|
|
|
|
|
# end of split |
3651
|
|
|
|
|
|
|
if (/\G (?= [,;\)\}\]] ) /oxgc) { return 'Eeucjp::split' . $e; } |
3652
|
3
|
|
|
|
|
16
|
|
3653
|
|
|
|
|
|
|
# split scalar value |
3654
|
|
|
|
|
|
|
elsif (/\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { return 'Eeucjp::split' . $e . e_string($1); } |
3655
|
1
|
|
|
|
|
7
|
|
3656
|
0
|
|
|
|
|
0
|
# split literal space |
3657
|
0
|
|
|
|
|
0
|
elsif (/\G \b qq (\#) [ ] (\#) /oxgc) { return 'Eeucjp::split' . $e . qq {qq$1 $2}; } |
3658
|
0
|
|
|
|
|
0
|
elsif (/\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Eeucjp::split' . $e . qq{$1qq$2 $3}; } |
3659
|
0
|
|
|
|
|
0
|
elsif (/\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Eeucjp::split' . $e . qq{$1qq$2 $3}; } |
3660
|
0
|
|
|
|
|
0
|
elsif (/\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Eeucjp::split' . $e . qq{$1qq$2 $3}; } |
3661
|
0
|
|
|
|
|
0
|
elsif (/\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Eeucjp::split' . $e . qq{$1qq$2 $3}; } |
3662
|
0
|
|
|
|
|
0
|
elsif (/\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Eeucjp::split' . $e . qq{$1qq$2 $3}; } |
3663
|
0
|
|
|
|
|
0
|
elsif (/\G \b q (\#) [ ] (\#) /oxgc) { return 'Eeucjp::split' . $e . qq {q$1 $2}; } |
3664
|
0
|
|
|
|
|
0
|
elsif (/\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { return 'Eeucjp::split' . $e . qq {$1q$2 $3}; } |
3665
|
0
|
|
|
|
|
0
|
elsif (/\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { return 'Eeucjp::split' . $e . qq {$1q$2 $3}; } |
3666
|
0
|
|
|
|
|
0
|
elsif (/\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { return 'Eeucjp::split' . $e . qq {$1q$2 $3}; } |
3667
|
0
|
|
|
|
|
0
|
elsif (/\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { return 'Eeucjp::split' . $e . qq {$1q$2 $3}; } |
3668
|
13
|
|
|
|
|
65
|
elsif (/\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { return 'Eeucjp::split' . $e . qq {$1q$2 $3}; } |
3669
|
|
|
|
|
|
|
elsif (/\G ' [ ] ' /oxgc) { return 'Eeucjp::split' . $e . qq {' '}; } |
3670
|
|
|
|
|
|
|
elsif (/\G " [ ] " /oxgc) { return 'Eeucjp::split' . $e . qq {" "}; } |
3671
|
|
|
|
|
|
|
|
3672
|
2
|
0
|
|
|
|
12
|
# split qq// |
|
0
|
|
|
|
|
0
|
|
3673
|
|
|
|
|
|
|
elsif (/\G \b (qq) \b /oxgc) { |
3674
|
0
|
|
|
|
|
0
|
if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq# # --> qr # # |
3675
|
0
|
0
|
|
|
|
0
|
else { |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
3676
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
3677
|
0
|
|
|
|
|
0
|
if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
3678
|
0
|
|
|
|
|
0
|
elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq ( ) --> qr ( ) |
3679
|
0
|
|
|
|
|
0
|
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq { } --> qr { } |
3680
|
0
|
|
|
|
|
0
|
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq [ ] --> qr [ ] |
3681
|
0
|
|
|
|
|
0
|
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq < > --> qr < > |
3682
|
|
|
|
|
|
|
elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr','{','}',$2,''); } # qq | | --> qr { } |
3683
|
0
|
|
|
|
|
0
|
elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return e_split($e.'qr',$1,$3,$2,''); } # qq * * --> qr * * |
3684
|
|
|
|
|
|
|
} |
3685
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
3686
|
|
|
|
|
|
|
} |
3687
|
|
|
|
|
|
|
} |
3688
|
|
|
|
|
|
|
|
3689
|
0
|
50
|
|
|
|
0
|
# split qr// |
|
36
|
|
|
|
|
677
|
|
3690
|
|
|
|
|
|
|
elsif (/\G \b (qr) \b /oxgc) { |
3691
|
0
|
|
|
|
|
0
|
if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # qr# # |
3692
|
36
|
50
|
|
|
|
127
|
else { |
|
36
|
50
|
|
|
|
5523
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
3693
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
3694
|
0
|
|
|
|
|
0
|
if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
3695
|
0
|
|
|
|
|
0
|
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr ( ) |
3696
|
0
|
|
|
|
|
0
|
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr { } |
3697
|
0
|
|
|
|
|
0
|
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr [ ] |
3698
|
12
|
|
|
|
|
44
|
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr < > |
3699
|
0
|
|
|
|
|
0
|
elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # qr ' ' |
3700
|
|
|
|
|
|
|
elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # qr | | --> qr { } |
3701
|
24
|
|
|
|
|
129
|
elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # qr * * |
3702
|
|
|
|
|
|
|
} |
3703
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
3704
|
|
|
|
|
|
|
} |
3705
|
|
|
|
|
|
|
} |
3706
|
|
|
|
|
|
|
|
3707
|
0
|
0
|
|
|
|
0
|
# split q// |
|
0
|
|
|
|
|
0
|
|
3708
|
|
|
|
|
|
|
elsif (/\G \b (q) \b /oxgc) { |
3709
|
0
|
|
|
|
|
0
|
if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q# # --> qr # # |
3710
|
0
|
0
|
|
|
|
0
|
else { |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
3711
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
3712
|
0
|
|
|
|
|
0
|
if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
3713
|
0
|
|
|
|
|
0
|
elsif (/\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q ( ) --> qr ( ) |
3714
|
0
|
|
|
|
|
0
|
elsif (/\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q { } --> qr { } |
3715
|
0
|
|
|
|
|
0
|
elsif (/\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q [ ] --> qr [ ] |
3716
|
0
|
|
|
|
|
0
|
elsif (/\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q < > --> qr < > |
3717
|
|
|
|
|
|
|
elsif (/\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr','{','}',$2,''); } # q | | --> qr { } |
3718
|
0
|
|
|
|
|
0
|
elsif (/\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { return e_split_q($e.'qr',$1,$3,$2,''); } # q * * --> qr * * |
3719
|
|
|
|
|
|
|
} |
3720
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
3721
|
|
|
|
|
|
|
} |
3722
|
|
|
|
|
|
|
} |
3723
|
|
|
|
|
|
|
|
3724
|
0
|
50
|
|
|
|
0
|
# split m// |
|
48
|
|
|
|
|
779
|
|
3725
|
|
|
|
|
|
|
elsif (/\G \b (m) \b /oxgc) { |
3726
|
0
|
|
|
|
|
0
|
if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1,$3,$2,$4); } # m# # --> qr # # |
3727
|
48
|
50
|
|
|
|
158
|
else { |
|
48
|
50
|
|
|
|
6825
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
3728
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
3729
|
0
|
|
|
|
|
0
|
if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
3730
|
0
|
|
|
|
|
0
|
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m ( ) --> qr ( ) |
3731
|
0
|
|
|
|
|
0
|
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m { } --> qr { } |
3732
|
0
|
|
|
|
|
0
|
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m [ ] --> qr [ ] |
3733
|
12
|
|
|
|
|
44
|
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m < > --> qr < > |
3734
|
0
|
|
|
|
|
0
|
elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return e_split_q($e.'qr',$1, $3, $2,$4); } # m ' ' --> qr ' ' |
3735
|
|
|
|
|
|
|
elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr','{','}',$2,$4); } # m | | --> qr { } |
3736
|
36
|
|
|
|
|
191
|
elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return e_split ($e.'qr',$1, $3, $2,$4); } # m * * --> qr * * |
3737
|
|
|
|
|
|
|
} |
3738
|
|
|
|
|
|
|
die __FILE__, ": Search pattern not terminated\n"; |
3739
|
|
|
|
|
|
|
} |
3740
|
|
|
|
|
|
|
} |
3741
|
|
|
|
|
|
|
|
3742
|
0
|
|
|
|
|
0
|
# split '' |
3743
|
0
|
|
|
|
|
0
|
elsif (/\G (\') /oxgc) { |
3744
|
0
|
0
|
|
|
|
0
|
my $q_string = ''; |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
3745
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
3746
|
0
|
|
|
|
|
0
|
if (/\G (\\\\) /oxgc) { $q_string .= $1; } |
3747
|
0
|
|
|
|
|
0
|
elsif (/\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr'' |
3748
|
|
|
|
|
|
|
elsif (/\G \' /oxgc) { return e_split_q($e.q{ qr},"'","'",$q_string,''); } # ' ' --> qr ' ' |
3749
|
0
|
|
|
|
|
0
|
elsif (/\G ($q_char) /oxgc) { $q_string .= $1; } |
3750
|
|
|
|
|
|
|
} |
3751
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
3752
|
|
|
|
|
|
|
} |
3753
|
|
|
|
|
|
|
|
3754
|
0
|
|
|
|
|
0
|
# split "" |
3755
|
0
|
|
|
|
|
0
|
elsif (/\G (\") /oxgc) { |
3756
|
0
|
0
|
|
|
|
0
|
my $qq_string = ''; |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
3757
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
3758
|
0
|
|
|
|
|
0
|
if (/\G (\\\\) /oxgc) { $qq_string .= $1; } |
3759
|
0
|
|
|
|
|
0
|
elsif (/\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr"" |
3760
|
|
|
|
|
|
|
elsif (/\G \" /oxgc) { return e_split($e.q{ qr},'"','"',$qq_string,''); } # " " --> qr " " |
3761
|
0
|
|
|
|
|
0
|
elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; } |
3762
|
|
|
|
|
|
|
} |
3763
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
3764
|
|
|
|
|
|
|
} |
3765
|
|
|
|
|
|
|
|
3766
|
0
|
|
|
|
|
0
|
# split // |
3767
|
77
|
|
|
|
|
180
|
elsif (/\G (\/) /oxgc) { |
3768
|
77
|
50
|
|
|
|
261
|
my $regexp = ''; |
|
458
|
50
|
|
|
|
2385
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
3769
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
3770
|
0
|
|
|
|
|
0
|
if (/\G (\\\\) /oxgc) { $regexp .= $1; } |
3771
|
77
|
|
|
|
|
386
|
elsif (/\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr// |
3772
|
|
|
|
|
|
|
elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_split($e.q{ qr}, '/','/',$regexp,$1); } # / / --> qr / / |
3773
|
381
|
|
|
|
|
884
|
elsif (/\G ($q_char) /oxgc) { $regexp .= $1; } |
3774
|
|
|
|
|
|
|
} |
3775
|
|
|
|
|
|
|
die __FILE__, ": Search pattern not terminated\n"; |
3776
|
|
|
|
|
|
|
} |
3777
|
|
|
|
|
|
|
} |
3778
|
|
|
|
|
|
|
|
3779
|
|
|
|
|
|
|
# tr/// or y/// |
3780
|
|
|
|
|
|
|
|
3781
|
|
|
|
|
|
|
# about [cdsrbB]* (/B modifier) |
3782
|
|
|
|
|
|
|
# |
3783
|
|
|
|
|
|
|
# P.559 appendix C |
3784
|
|
|
|
|
|
|
# of ISBN 4-89052-384-7 Programming perl |
3785
|
|
|
|
|
|
|
# (Japanese title is: Perl puroguramingu) |
3786
|
0
|
|
|
|
|
0
|
|
3787
|
|
|
|
|
|
|
elsif (/\G \b ( tr | y ) \b /oxgc) { |
3788
|
|
|
|
|
|
|
my $ope = $1; |
3789
|
11
|
50
|
|
|
|
27
|
|
3790
|
11
|
|
|
|
|
261
|
# $1 $2 $3 $4 $5 $6 |
3791
|
0
|
|
|
|
|
0
|
if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cdsrbB]*) /oxgc) { # tr# # # |
3792
|
|
|
|
|
|
|
my @tr = ($tr_variable,$2); |
3793
|
|
|
|
|
|
|
return e_tr(@tr,'',$4,$6); |
3794
|
0
|
|
|
|
|
0
|
} |
3795
|
11
|
|
|
|
|
22
|
else { |
3796
|
11
|
50
|
|
|
|
29
|
my $e = ''; |
|
11
|
50
|
|
|
|
942
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
3797
|
|
|
|
|
|
|
while (not /\G \z/oxgc) { |
3798
|
0
|
|
|
|
|
0
|
if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
3799
|
0
|
|
|
|
|
0
|
elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { |
3800
|
0
|
0
|
|
|
|
0
|
my @tr = ($tr_variable,$2); |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
3801
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
3802
|
0
|
|
|
|
|
0
|
if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
3803
|
0
|
|
|
|
|
0
|
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) ( ) |
3804
|
0
|
|
|
|
|
0
|
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) { } |
3805
|
0
|
|
|
|
|
0
|
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) [ ] |
3806
|
|
|
|
|
|
|
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) < > |
3807
|
0
|
|
|
|
|
0
|
elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr ( ) * * |
3808
|
|
|
|
|
|
|
} |
3809
|
|
|
|
|
|
|
die __FILE__, ": Transliteration replacement not terminated\n"; |
3810
|
0
|
|
|
|
|
0
|
} |
3811
|
0
|
|
|
|
|
0
|
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { |
3812
|
0
|
0
|
|
|
|
0
|
my @tr = ($tr_variable,$2); |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
3813
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
3814
|
0
|
|
|
|
|
0
|
if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
3815
|
0
|
|
|
|
|
0
|
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } ( ) |
3816
|
0
|
|
|
|
|
0
|
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } { } |
3817
|
0
|
|
|
|
|
0
|
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } [ ] |
3818
|
|
|
|
|
|
|
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } < > |
3819
|
0
|
|
|
|
|
0
|
elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr { } * * |
3820
|
|
|
|
|
|
|
} |
3821
|
|
|
|
|
|
|
die __FILE__, ": Transliteration replacement not terminated\n"; |
3822
|
0
|
|
|
|
|
0
|
} |
3823
|
0
|
|
|
|
|
0
|
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { |
3824
|
0
|
0
|
|
|
|
0
|
my @tr = ($tr_variable,$2); |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
3825
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
3826
|
0
|
|
|
|
|
0
|
if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
3827
|
0
|
|
|
|
|
0
|
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] ( ) |
3828
|
0
|
|
|
|
|
0
|
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] { } |
3829
|
0
|
|
|
|
|
0
|
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] [ ] |
3830
|
|
|
|
|
|
|
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] < > |
3831
|
0
|
|
|
|
|
0
|
elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr [ ] * * |
3832
|
|
|
|
|
|
|
} |
3833
|
|
|
|
|
|
|
die __FILE__, ": Transliteration replacement not terminated\n"; |
3834
|
0
|
|
|
|
|
0
|
} |
3835
|
0
|
|
|
|
|
0
|
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { |
3836
|
0
|
0
|
|
|
|
0
|
my @tr = ($tr_variable,$2); |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
3837
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
3838
|
0
|
|
|
|
|
0
|
if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
3839
|
0
|
|
|
|
|
0
|
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > ( ) |
3840
|
0
|
|
|
|
|
0
|
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > { } |
3841
|
0
|
|
|
|
|
0
|
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > [ ] |
3842
|
|
|
|
|
|
|
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > < > |
3843
|
0
|
|
|
|
|
0
|
elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { return e_tr(@tr,$e,$2,$4); } # tr < > * * |
3844
|
|
|
|
|
|
|
} |
3845
|
|
|
|
|
|
|
die __FILE__, ": Transliteration replacement not terminated\n"; |
3846
|
|
|
|
|
|
|
} |
3847
|
0
|
|
|
|
|
0
|
# $1 $2 $3 $4 $5 $6 |
3848
|
11
|
|
|
|
|
40
|
elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cdsrbB]*) /oxgc) { # tr * * * |
3849
|
|
|
|
|
|
|
my @tr = ($tr_variable,$2); |
3850
|
|
|
|
|
|
|
return e_tr(@tr,'',$4,$6); |
3851
|
11
|
|
|
|
|
31
|
} |
3852
|
|
|
|
|
|
|
} |
3853
|
|
|
|
|
|
|
die __FILE__, ": Transliteration pattern not terminated\n"; |
3854
|
|
|
|
|
|
|
} |
3855
|
|
|
|
|
|
|
} |
3856
|
|
|
|
|
|
|
|
3857
|
0
|
|
|
|
|
0
|
# qq// |
3858
|
|
|
|
|
|
|
elsif (/\G \b (qq) \b /oxgc) { |
3859
|
|
|
|
|
|
|
my $ope = $1; |
3860
|
4197
|
100
|
|
|
|
9191
|
|
3861
|
4197
|
|
|
|
|
7679
|
# if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { return e_qq($ope,$1,$3,$2); } # qq# # |
3862
|
40
|
|
|
|
|
48
|
if (/\G (\#) /oxgc) { # qq# # |
3863
|
40
|
100
|
|
|
|
79
|
my $qq_string = ''; |
|
1948
|
50
|
|
|
|
5222
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
3864
|
80
|
|
|
|
|
147
|
while (not /\G \z/oxgc) { |
3865
|
0
|
|
|
|
|
0
|
if (/\G (\\\\) /oxgc) { $qq_string .= $1; } |
3866
|
40
|
|
|
|
|
77
|
elsif (/\G (\\\#) /oxgc) { $qq_string .= $1; } |
3867
|
|
|
|
|
|
|
elsif (/\G (\#) /oxgc) { return e_qq($ope,'#','#',$qq_string); } |
3868
|
1828
|
|
|
|
|
3347
|
elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; } |
3869
|
|
|
|
|
|
|
} |
3870
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
3871
|
|
|
|
|
|
|
} |
3872
|
0
|
|
|
|
|
0
|
|
3873
|
4157
|
|
|
|
|
5553
|
else { |
3874
|
4157
|
50
|
|
|
|
9449
|
my $e = ''; |
|
4157
|
50
|
|
|
|
15202
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
3875
|
|
|
|
|
|
|
while (not /\G \z/oxgc) { |
3876
|
|
|
|
|
|
|
if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
3877
|
|
|
|
|
|
|
|
3878
|
0
|
|
|
|
|
0
|
# elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq ( ) |
3879
|
0
|
|
|
|
|
0
|
elsif (/\G (\() /oxgc) { # qq ( ) |
3880
|
0
|
|
|
|
|
0
|
my $qq_string = ''; |
3881
|
0
|
0
|
|
|
|
0
|
local $nest = 1; |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
3882
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
3883
|
0
|
|
|
|
|
0
|
if (/\G (\\\\) /oxgc) { $qq_string .= $1; } |
|
0
|
|
|
|
|
0
|
|
3884
|
|
|
|
|
|
|
elsif (/\G (\\\)) /oxgc) { $qq_string .= $1; } |
3885
|
0
|
0
|
|
|
|
0
|
elsif (/\G (\() /oxgc) { $qq_string .= $1; $nest++; } |
|
0
|
|
|
|
|
0
|
|
3886
|
0
|
|
|
|
|
0
|
elsif (/\G (\)) /oxgc) { |
3887
|
|
|
|
|
|
|
if (--$nest == 0) { return $e . e_qq($ope,'(',')',$qq_string); } |
3888
|
0
|
|
|
|
|
0
|
else { $qq_string .= $1; } |
3889
|
|
|
|
|
|
|
} |
3890
|
0
|
|
|
|
|
0
|
elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; } |
3891
|
|
|
|
|
|
|
} |
3892
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
3893
|
|
|
|
|
|
|
} |
3894
|
|
|
|
|
|
|
|
3895
|
0
|
|
|
|
|
0
|
# elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq { } |
3896
|
4099
|
|
|
|
|
5439
|
elsif (/\G (\{) /oxgc) { # qq { } |
3897
|
4099
|
|
|
|
|
5485
|
my $qq_string = ''; |
3898
|
4099
|
100
|
|
|
|
7991
|
local $nest = 1; |
|
172339
|
50
|
|
|
|
543826
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
3899
|
708
|
|
|
|
|
1328
|
while (not /\G \z/oxgc) { |
3900
|
0
|
|
|
|
|
0
|
if (/\G (\\\\) /oxgc) { $qq_string .= $1; } |
|
1384
|
|
|
|
|
1835
|
|
3901
|
|
|
|
|
|
|
elsif (/\G (\\\}) /oxgc) { $qq_string .= $1; } |
3902
|
1384
|
100
|
|
|
|
2619
|
elsif (/\G (\{) /oxgc) { $qq_string .= $1; $nest++; } |
|
5483
|
|
|
|
|
8270
|
|
3903
|
4099
|
|
|
|
|
7820
|
elsif (/\G (\}) /oxgc) { |
3904
|
|
|
|
|
|
|
if (--$nest == 0) { return $e . e_qq($ope,'{','}',$qq_string); } |
3905
|
1384
|
|
|
|
|
2828
|
else { $qq_string .= $1; } |
3906
|
|
|
|
|
|
|
} |
3907
|
164764
|
|
|
|
|
329635
|
elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; } |
3908
|
|
|
|
|
|
|
} |
3909
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
3910
|
|
|
|
|
|
|
} |
3911
|
|
|
|
|
|
|
|
3912
|
0
|
|
|
|
|
0
|
# elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq [ ] |
3913
|
0
|
|
|
|
|
0
|
elsif (/\G (\[) /oxgc) { # qq [ ] |
3914
|
0
|
|
|
|
|
0
|
my $qq_string = ''; |
3915
|
0
|
0
|
|
|
|
0
|
local $nest = 1; |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
3916
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
3917
|
0
|
|
|
|
|
0
|
if (/\G (\\\\) /oxgc) { $qq_string .= $1; } |
|
0
|
|
|
|
|
0
|
|
3918
|
|
|
|
|
|
|
elsif (/\G (\\\]) /oxgc) { $qq_string .= $1; } |
3919
|
0
|
0
|
|
|
|
0
|
elsif (/\G (\[) /oxgc) { $qq_string .= $1; $nest++; } |
|
0
|
|
|
|
|
0
|
|
3920
|
0
|
|
|
|
|
0
|
elsif (/\G (\]) /oxgc) { |
3921
|
|
|
|
|
|
|
if (--$nest == 0) { return $e . e_qq($ope,'[',']',$qq_string); } |
3922
|
0
|
|
|
|
|
0
|
else { $qq_string .= $1; } |
3923
|
|
|
|
|
|
|
} |
3924
|
0
|
|
|
|
|
0
|
elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; } |
3925
|
|
|
|
|
|
|
} |
3926
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
3927
|
|
|
|
|
|
|
} |
3928
|
|
|
|
|
|
|
|
3929
|
0
|
|
|
|
|
0
|
# elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq < > |
3930
|
38
|
|
|
|
|
65
|
elsif (/\G (\<) /oxgc) { # qq < > |
3931
|
38
|
|
|
|
|
65
|
my $qq_string = ''; |
3932
|
38
|
100
|
|
|
|
120
|
local $nest = 1; |
|
1418
|
50
|
|
|
|
7409
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
3933
|
22
|
|
|
|
|
52
|
while (not /\G \z/oxgc) { |
3934
|
0
|
|
|
|
|
0
|
if (/\G (\\\\) /oxgc) { $qq_string .= $1; } |
|
0
|
|
|
|
|
0
|
|
3935
|
|
|
|
|
|
|
elsif (/\G (\\\>) /oxgc) { $qq_string .= $1; } |
3936
|
0
|
50
|
|
|
|
0
|
elsif (/\G (\<) /oxgc) { $qq_string .= $1; $nest++; } |
|
38
|
|
|
|
|
388
|
|
3937
|
38
|
|
|
|
|
91
|
elsif (/\G (\>) /oxgc) { |
3938
|
|
|
|
|
|
|
if (--$nest == 0) { return $e . e_qq($ope,'<','>',$qq_string); } |
3939
|
0
|
|
|
|
|
0
|
else { $qq_string .= $1; } |
3940
|
|
|
|
|
|
|
} |
3941
|
1358
|
|
|
|
|
6243
|
elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; } |
3942
|
|
|
|
|
|
|
} |
3943
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
3944
|
|
|
|
|
|
|
} |
3945
|
|
|
|
|
|
|
|
3946
|
0
|
|
|
|
|
0
|
# elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qq * * |
3947
|
20
|
|
|
|
|
29
|
elsif (/\G (\S) /oxgc) { # qq * * |
3948
|
20
|
|
|
|
|
23
|
my $delimiter = $1; |
3949
|
20
|
50
|
|
|
|
34
|
my $qq_string = ''; |
|
840
|
50
|
|
|
|
2275
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
3950
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
3951
|
0
|
|
|
|
|
0
|
if (/\G (\\\\) /oxgc) { $qq_string .= $1; } |
3952
|
20
|
|
|
|
|
34
|
elsif (/\G (\\\Q$delimiter\E) /oxgc) { $qq_string .= $1; } |
3953
|
|
|
|
|
|
|
elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_qq($ope,$delimiter,$delimiter,$qq_string); } |
3954
|
820
|
|
|
|
|
1458
|
elsif (/\G ($qq_char) /oxgc) { $qq_string .= $1; } |
3955
|
|
|
|
|
|
|
} |
3956
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
3957
|
0
|
|
|
|
|
0
|
} |
3958
|
|
|
|
|
|
|
} |
3959
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
3960
|
|
|
|
|
|
|
} |
3961
|
|
|
|
|
|
|
} |
3962
|
|
|
|
|
|
|
|
3963
|
0
|
|
|
|
|
0
|
# qr// |
3964
|
60
|
50
|
|
|
|
136
|
elsif (/\G \b (qr) \b /oxgc) { |
3965
|
60
|
|
|
|
|
492
|
my $ope = $1; |
3966
|
|
|
|
|
|
|
if (/\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { # qr# # # |
3967
|
|
|
|
|
|
|
return e_qr($ope,$1,$3,$2,$4); |
3968
|
0
|
|
|
|
|
0
|
} |
3969
|
60
|
|
|
|
|
95
|
else { |
3970
|
60
|
50
|
|
|
|
150
|
my $e = ''; |
|
60
|
50
|
|
|
|
4210
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
3971
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
3972
|
0
|
|
|
|
|
0
|
if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
3973
|
1
|
|
|
|
|
5
|
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr ( ) |
3974
|
0
|
|
|
|
|
0
|
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr { } |
3975
|
0
|
|
|
|
|
0
|
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr [ ] |
3976
|
14
|
|
|
|
|
47
|
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr < > |
3977
|
0
|
|
|
|
|
0
|
elsif (/\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # qr ' ' |
3978
|
|
|
|
|
|
|
elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # qr | | --> qr { } |
3979
|
45
|
|
|
|
|
144
|
elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # qr * * |
3980
|
|
|
|
|
|
|
} |
3981
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
3982
|
|
|
|
|
|
|
} |
3983
|
|
|
|
|
|
|
} |
3984
|
|
|
|
|
|
|
|
3985
|
0
|
|
|
|
|
0
|
# qw// |
3986
|
34
|
50
|
|
|
|
95
|
elsif (/\G \b (qw) \b /oxgc) { |
3987
|
34
|
|
|
|
|
103
|
my $ope = $1; |
3988
|
|
|
|
|
|
|
if (/\G (\#) (.*?) (\#) /oxmsgc) { # qw# # |
3989
|
|
|
|
|
|
|
return e_qw($ope,$1,$3,$2); |
3990
|
0
|
|
|
|
|
0
|
} |
3991
|
34
|
|
|
|
|
54
|
else { |
3992
|
34
|
50
|
|
|
|
100
|
my $e = ''; |
|
34
|
50
|
|
|
|
196
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
3993
|
|
|
|
|
|
|
while (not /\G \z/oxgc) { |
3994
|
0
|
|
|
|
|
0
|
if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
3995
|
34
|
|
|
|
|
104
|
|
3996
|
|
|
|
|
|
|
elsif (/\G (\() ([^(]*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( ) |
3997
|
0
|
|
|
|
|
0
|
elsif (/\G (\() ((?:$q_paren)*?) (\)) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw ( ) |
3998
|
0
|
|
|
|
|
0
|
|
3999
|
|
|
|
|
|
|
elsif (/\G (\{) ([^{]*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { } |
4000
|
0
|
|
|
|
|
0
|
elsif (/\G (\{) ((?:$q_brace)*?) (\}) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw { } |
4001
|
0
|
|
|
|
|
0
|
|
4002
|
|
|
|
|
|
|
elsif (/\G (\[) ([^[]*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ] |
4003
|
0
|
|
|
|
|
0
|
elsif (/\G (\[) ((?:$q_bracket)*?) (\]) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw [ ] |
4004
|
0
|
|
|
|
|
0
|
|
4005
|
|
|
|
|
|
|
elsif (/\G (\<) ([^<]*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < > |
4006
|
0
|
|
|
|
|
0
|
elsif (/\G (\<) ((?:$q_angle)*?) (\>) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw < > |
4007
|
0
|
|
|
|
|
0
|
|
4008
|
|
|
|
|
|
|
elsif (/\G ([\x21-\x3F]) (.*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * * |
4009
|
0
|
|
|
|
|
0
|
elsif (/\G (\S) ((?:$q_char)*?) (\1) /oxmsgc) { return $e . e_qw($ope,$1,$3,$2); } # qw * * |
4010
|
|
|
|
|
|
|
} |
4011
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
4012
|
|
|
|
|
|
|
} |
4013
|
|
|
|
|
|
|
} |
4014
|
|
|
|
|
|
|
|
4015
|
0
|
|
|
|
|
0
|
# qx// |
4016
|
2
|
50
|
|
|
|
5
|
elsif (/\G \b (qx) \b /oxgc) { |
4017
|
2
|
|
|
|
|
54
|
my $ope = $1; |
4018
|
|
|
|
|
|
|
if (/\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# # |
4019
|
|
|
|
|
|
|
return e_qq($ope,$1,$3,$2); |
4020
|
0
|
|
|
|
|
0
|
} |
4021
|
2
|
|
|
|
|
10
|
else { |
4022
|
2
|
50
|
|
|
|
9
|
my $e = ''; |
|
2
|
50
|
|
|
|
147
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
4023
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
4024
|
0
|
|
|
|
|
0
|
if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
4025
|
2
|
|
|
|
|
12
|
elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx ( ) |
4026
|
0
|
|
|
|
|
0
|
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx { } |
4027
|
0
|
|
|
|
|
0
|
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx [ ] |
4028
|
0
|
|
|
|
|
0
|
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx < > |
4029
|
|
|
|
|
|
|
elsif (/\G (\') ((?:$qq_char)*?) (\') /oxgc) { return $e . e_q ($ope,$1,$3,$2); } # qx ' ' |
4030
|
0
|
|
|
|
|
0
|
elsif (/\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { return $e . e_qq($ope,$1,$3,$2); } # qx * * |
4031
|
|
|
|
|
|
|
} |
4032
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
4033
|
|
|
|
|
|
|
} |
4034
|
|
|
|
|
|
|
} |
4035
|
|
|
|
|
|
|
|
4036
|
0
|
|
|
|
|
0
|
# q// |
4037
|
|
|
|
|
|
|
elsif (/\G \b (q) \b /oxgc) { |
4038
|
|
|
|
|
|
|
my $ope = $1; |
4039
|
|
|
|
|
|
|
|
4040
|
|
|
|
|
|
|
# if (/\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { return e_q($ope,$1,$3,$2); } # q# # |
4041
|
|
|
|
|
|
|
|
4042
|
|
|
|
|
|
|
# avoid "Error: Runtime exception" of perl version 5.005_03 |
4043
|
550
|
50
|
|
|
|
1479
|
# (and so on) |
4044
|
550
|
|
|
|
|
1534
|
|
4045
|
0
|
|
|
|
|
0
|
if (/\G (\#) /oxgc) { # q# # |
4046
|
0
|
0
|
|
|
|
0
|
my $q_string = ''; |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
4047
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
4048
|
0
|
|
|
|
|
0
|
if (/\G (\\\\) /oxgc) { $q_string .= $1; } |
4049
|
0
|
|
|
|
|
0
|
elsif (/\G (\\\#) /oxgc) { $q_string .= $1; } |
4050
|
|
|
|
|
|
|
elsif (/\G (\#) /oxgc) { return e_q($ope,'#','#',$q_string); } |
4051
|
0
|
|
|
|
|
0
|
elsif (/\G ($q_char) /oxgc) { $q_string .= $1; } |
4052
|
|
|
|
|
|
|
} |
4053
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
4054
|
|
|
|
|
|
|
} |
4055
|
0
|
|
|
|
|
0
|
|
4056
|
550
|
|
|
|
|
1101
|
else { |
4057
|
550
|
50
|
|
|
|
2006
|
my $e = ''; |
|
550
|
50
|
|
|
|
5883
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
4058
|
|
|
|
|
|
|
while (not /\G \z/oxgc) { |
4059
|
|
|
|
|
|
|
if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
4060
|
|
|
|
|
|
|
|
4061
|
0
|
|
|
|
|
0
|
# elsif (/\G (\() ((?:\\\)|\\\\|$q_paren)*?) (\)) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q ( ) |
4062
|
0
|
|
|
|
|
0
|
elsif (/\G (\() /oxgc) { # q ( ) |
4063
|
0
|
|
|
|
|
0
|
my $q_string = ''; |
4064
|
0
|
0
|
|
|
|
0
|
local $nest = 1; |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
4065
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
4066
|
0
|
|
|
|
|
0
|
if (/\G (\\\\) /oxgc) { $q_string .= $1; } |
4067
|
0
|
|
|
|
|
0
|
elsif (/\G (\\\)) /oxgc) { $q_string .= $1; } |
|
0
|
|
|
|
|
0
|
|
4068
|
|
|
|
|
|
|
elsif (/\G (\\\() /oxgc) { $q_string .= $1; } |
4069
|
0
|
0
|
|
|
|
0
|
elsif (/\G (\() /oxgc) { $q_string .= $1; $nest++; } |
|
0
|
|
|
|
|
0
|
|
4070
|
0
|
|
|
|
|
0
|
elsif (/\G (\)) /oxgc) { |
4071
|
|
|
|
|
|
|
if (--$nest == 0) { return $e . e_q($ope,'(',')',$q_string); } |
4072
|
0
|
|
|
|
|
0
|
else { $q_string .= $1; } |
4073
|
|
|
|
|
|
|
} |
4074
|
0
|
|
|
|
|
0
|
elsif (/\G ($q_char) /oxgc) { $q_string .= $1; } |
4075
|
|
|
|
|
|
|
} |
4076
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
4077
|
|
|
|
|
|
|
} |
4078
|
|
|
|
|
|
|
|
4079
|
0
|
|
|
|
|
0
|
# elsif (/\G (\{) ((?:\\\}|\\\\|$q_brace)*?) (\}) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q { } |
4080
|
544
|
|
|
|
|
1023
|
elsif (/\G (\{) /oxgc) { # q { } |
4081
|
544
|
|
|
|
|
932
|
my $q_string = ''; |
4082
|
544
|
50
|
|
|
|
1556
|
local $nest = 1; |
|
8103
|
50
|
|
|
|
38354
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
4083
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
4084
|
0
|
|
|
|
|
0
|
if (/\G (\\\\) /oxgc) { $q_string .= $1; } |
4085
|
0
|
|
|
|
|
0
|
elsif (/\G (\\\}) /oxgc) { $q_string .= $1; } |
|
114
|
|
|
|
|
194
|
|
4086
|
|
|
|
|
|
|
elsif (/\G (\\\{) /oxgc) { $q_string .= $1; } |
4087
|
114
|
100
|
|
|
|
223
|
elsif (/\G (\{) /oxgc) { $q_string .= $1; $nest++; } |
|
658
|
|
|
|
|
1397
|
|
4088
|
544
|
|
|
|
|
1761
|
elsif (/\G (\}) /oxgc) { |
4089
|
|
|
|
|
|
|
if (--$nest == 0) { return $e . e_q($ope,'{','}',$q_string); } |
4090
|
114
|
|
|
|
|
235
|
else { $q_string .= $1; } |
4091
|
|
|
|
|
|
|
} |
4092
|
7331
|
|
|
|
|
15010
|
elsif (/\G ($q_char) /oxgc) { $q_string .= $1; } |
4093
|
|
|
|
|
|
|
} |
4094
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
4095
|
|
|
|
|
|
|
} |
4096
|
|
|
|
|
|
|
|
4097
|
0
|
|
|
|
|
0
|
# elsif (/\G (\[) ((?:\\\]|\\\\|$q_bracket)*?) (\]) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q [ ] |
4098
|
0
|
|
|
|
|
0
|
elsif (/\G (\[) /oxgc) { # q [ ] |
4099
|
0
|
|
|
|
|
0
|
my $q_string = ''; |
4100
|
0
|
0
|
|
|
|
0
|
local $nest = 1; |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
4101
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
4102
|
0
|
|
|
|
|
0
|
if (/\G (\\\\) /oxgc) { $q_string .= $1; } |
4103
|
0
|
|
|
|
|
0
|
elsif (/\G (\\\]) /oxgc) { $q_string .= $1; } |
|
0
|
|
|
|
|
0
|
|
4104
|
|
|
|
|
|
|
elsif (/\G (\\\[) /oxgc) { $q_string .= $1; } |
4105
|
0
|
0
|
|
|
|
0
|
elsif (/\G (\[) /oxgc) { $q_string .= $1; $nest++; } |
|
0
|
|
|
|
|
0
|
|
4106
|
0
|
|
|
|
|
0
|
elsif (/\G (\]) /oxgc) { |
4107
|
|
|
|
|
|
|
if (--$nest == 0) { return $e . e_q($ope,'[',']',$q_string); } |
4108
|
0
|
|
|
|
|
0
|
else { $q_string .= $1; } |
4109
|
|
|
|
|
|
|
} |
4110
|
0
|
|
|
|
|
0
|
elsif (/\G ($q_char) /oxgc) { $q_string .= $1; } |
4111
|
|
|
|
|
|
|
} |
4112
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
4113
|
|
|
|
|
|
|
} |
4114
|
|
|
|
|
|
|
|
4115
|
0
|
|
|
|
|
0
|
# elsif (/\G (\<) ((?:\\\>|\\\\|$q_angle)*?) (\>) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q < > |
4116
|
5
|
|
|
|
|
16
|
elsif (/\G (\<) /oxgc) { # q < > |
4117
|
5
|
|
|
|
|
12
|
my $q_string = ''; |
4118
|
5
|
50
|
|
|
|
18
|
local $nest = 1; |
|
82
|
50
|
|
|
|
414
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
4119
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
4120
|
0
|
|
|
|
|
0
|
if (/\G (\\\\) /oxgc) { $q_string .= $1; } |
4121
|
0
|
|
|
|
|
0
|
elsif (/\G (\\\>) /oxgc) { $q_string .= $1; } |
|
0
|
|
|
|
|
0
|
|
4122
|
|
|
|
|
|
|
elsif (/\G (\\\<) /oxgc) { $q_string .= $1; } |
4123
|
0
|
50
|
|
|
|
0
|
elsif (/\G (\<) /oxgc) { $q_string .= $1; $nest++; } |
|
5
|
|
|
|
|
13
|
|
4124
|
5
|
|
|
|
|
14
|
elsif (/\G (\>) /oxgc) { |
4125
|
|
|
|
|
|
|
if (--$nest == 0) { return $e . e_q($ope,'<','>',$q_string); } |
4126
|
0
|
|
|
|
|
0
|
else { $q_string .= $1; } |
4127
|
|
|
|
|
|
|
} |
4128
|
77
|
|
|
|
|
155
|
elsif (/\G ($q_char) /oxgc) { $q_string .= $1; } |
4129
|
|
|
|
|
|
|
} |
4130
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
4131
|
|
|
|
|
|
|
} |
4132
|
|
|
|
|
|
|
|
4133
|
0
|
|
|
|
|
0
|
# elsif (/\G (\S) ((?:\\\1|\\\\|$q_char)*?) (\1) /oxgc) { return $e . e_q($ope,$1,$3,$2); } # q * * |
4134
|
1
|
|
|
|
|
2
|
elsif (/\G (\S) /oxgc) { # q * * |
4135
|
1
|
|
|
|
|
2
|
my $delimiter = $1; |
4136
|
1
|
50
|
|
|
|
3
|
my $q_string = ''; |
|
14
|
50
|
|
|
|
74
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
4137
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
4138
|
0
|
|
|
|
|
0
|
if (/\G (\\\\) /oxgc) { $q_string .= $1; } |
4139
|
1
|
|
|
|
|
2
|
elsif (/\G (\\\Q$delimiter\E) /oxgc) { $q_string .= $1; } |
4140
|
|
|
|
|
|
|
elsif (/\G (\Q$delimiter\E) /oxgc) { return $e . e_q($ope,$delimiter,$delimiter,$q_string); } |
4141
|
13
|
|
|
|
|
28
|
elsif (/\G ($q_char) /oxgc) { $q_string .= $1; } |
4142
|
|
|
|
|
|
|
} |
4143
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
4144
|
0
|
|
|
|
|
0
|
} |
4145
|
|
|
|
|
|
|
} |
4146
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
4147
|
|
|
|
|
|
|
} |
4148
|
|
|
|
|
|
|
} |
4149
|
|
|
|
|
|
|
|
4150
|
0
|
|
|
|
|
0
|
# m// |
4151
|
305
|
50
|
|
|
|
742
|
elsif (/\G \b (m) \b /oxgc) { |
4152
|
305
|
|
|
|
|
2447
|
my $ope = $1; |
4153
|
|
|
|
|
|
|
if (/\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { # m# # |
4154
|
|
|
|
|
|
|
return e_qr($ope,$1,$3,$2,$4); |
4155
|
0
|
|
|
|
|
0
|
} |
4156
|
305
|
|
|
|
|
658
|
else { |
4157
|
305
|
50
|
|
|
|
799
|
my $e = ''; |
|
305
|
50
|
|
|
|
21947
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
4158
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
4159
|
0
|
|
|
|
|
0
|
if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
4160
|
0
|
|
|
|
|
0
|
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ( ) |
4161
|
0
|
|
|
|
|
0
|
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m { } |
4162
|
0
|
|
|
|
|
0
|
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m [ ] |
4163
|
30
|
|
|
|
|
88
|
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m < > |
4164
|
25
|
|
|
|
|
74
|
elsif (/\G (\?) ((?:$qq_char)*?) (\?) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m ? ? |
4165
|
0
|
|
|
|
|
0
|
elsif (/\G (\') ((?:$qq_char)*?) (\') ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr_q($ope,$1, $3, $2,$4); } # m ' ' |
4166
|
|
|
|
|
|
|
elsif (/\G ([*\-:\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,'{','}',$2,$4); } # m | | --> m { } |
4167
|
250
|
|
|
|
|
912
|
elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { return $e . e_qr ($ope,$1, $3, $2,$4); } # m * * |
4168
|
|
|
|
|
|
|
} |
4169
|
|
|
|
|
|
|
die __FILE__, ": Search pattern not terminated\n"; |
4170
|
|
|
|
|
|
|
} |
4171
|
|
|
|
|
|
|
} |
4172
|
|
|
|
|
|
|
|
4173
|
|
|
|
|
|
|
# s/// |
4174
|
|
|
|
|
|
|
|
4175
|
|
|
|
|
|
|
# about [cegimosxpradlunbB]* (/cg modifier) |
4176
|
|
|
|
|
|
|
# |
4177
|
|
|
|
|
|
|
# P.67 Pattern-Matching Operators |
4178
|
|
|
|
|
|
|
# of ISBN 0-596-00241-6 Perl in a Nutshell, Second Edition. |
4179
|
0
|
|
|
|
|
0
|
|
4180
|
|
|
|
|
|
|
elsif (/\G \b (s) \b /oxgc) { |
4181
|
|
|
|
|
|
|
my $ope = $1; |
4182
|
156
|
100
|
|
|
|
422
|
|
4183
|
156
|
|
|
|
|
4469
|
# $1 $2 $3 $4 $5 $6 |
4184
|
|
|
|
|
|
|
if (/\G (\#) ((?:$qq_char)*?) (\#) ((?:$qq_char)*?) (\#) ([cegimosxpradlunbB]*) /oxgc) { # s# # # |
4185
|
|
|
|
|
|
|
return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6); |
4186
|
1
|
|
|
|
|
6
|
} |
4187
|
155
|
|
|
|
|
323
|
else { |
4188
|
155
|
50
|
|
|
|
503
|
my $e = ''; |
|
155
|
50
|
|
|
|
38446
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
4189
|
|
|
|
|
|
|
while (not /\G \z/oxgc) { |
4190
|
0
|
|
|
|
|
0
|
if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
4191
|
0
|
|
|
|
|
0
|
elsif (/\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { |
4192
|
0
|
0
|
|
|
|
0
|
my @s = ($1,$2,$3); |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
4193
|
|
|
|
|
|
|
while (not /\G \z/oxgc) { |
4194
|
0
|
|
|
|
|
0
|
if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
4195
|
0
|
|
|
|
|
0
|
# $1 $2 $3 $4 |
4196
|
0
|
|
|
|
|
0
|
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4197
|
0
|
|
|
|
|
0
|
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4198
|
0
|
|
|
|
|
0
|
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4199
|
0
|
|
|
|
|
0
|
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4200
|
0
|
|
|
|
|
0
|
elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4201
|
0
|
|
|
|
|
0
|
elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4202
|
0
|
|
|
|
|
0
|
elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4203
|
|
|
|
|
|
|
elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4204
|
0
|
|
|
|
|
0
|
elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4205
|
|
|
|
|
|
|
} |
4206
|
|
|
|
|
|
|
die __FILE__, ": Substitution replacement not terminated\n"; |
4207
|
0
|
|
|
|
|
0
|
} |
4208
|
0
|
|
|
|
|
0
|
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { |
4209
|
0
|
0
|
|
|
|
0
|
my @s = ($1,$2,$3); |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
4210
|
|
|
|
|
|
|
while (not /\G \z/oxgc) { |
4211
|
0
|
|
|
|
|
0
|
if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
4212
|
0
|
|
|
|
|
0
|
# $1 $2 $3 $4 |
4213
|
0
|
|
|
|
|
0
|
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4214
|
0
|
|
|
|
|
0
|
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4215
|
0
|
|
|
|
|
0
|
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4216
|
0
|
|
|
|
|
0
|
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4217
|
0
|
|
|
|
|
0
|
elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4218
|
0
|
|
|
|
|
0
|
elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4219
|
0
|
|
|
|
|
0
|
elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4220
|
|
|
|
|
|
|
elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4221
|
0
|
|
|
|
|
0
|
elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4222
|
|
|
|
|
|
|
} |
4223
|
|
|
|
|
|
|
die __FILE__, ": Substitution replacement not terminated\n"; |
4224
|
0
|
|
|
|
|
0
|
} |
4225
|
0
|
|
|
|
|
0
|
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { |
4226
|
0
|
0
|
|
|
|
0
|
my @s = ($1,$2,$3); |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
4227
|
|
|
|
|
|
|
while (not /\G \z/oxgc) { |
4228
|
0
|
|
|
|
|
0
|
if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
4229
|
0
|
|
|
|
|
0
|
# $1 $2 $3 $4 |
4230
|
0
|
|
|
|
|
0
|
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4231
|
0
|
|
|
|
|
0
|
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4232
|
0
|
|
|
|
|
0
|
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4233
|
0
|
|
|
|
|
0
|
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4234
|
0
|
|
|
|
|
0
|
elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4235
|
|
|
|
|
|
|
elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4236
|
0
|
|
|
|
|
0
|
elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4237
|
|
|
|
|
|
|
} |
4238
|
|
|
|
|
|
|
die __FILE__, ": Substitution replacement not terminated\n"; |
4239
|
0
|
|
|
|
|
0
|
} |
4240
|
0
|
|
|
|
|
0
|
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { |
4241
|
0
|
0
|
|
|
|
0
|
my @s = ($1,$2,$3); |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
4242
|
|
|
|
|
|
|
while (not /\G \z/oxgc) { |
4243
|
0
|
|
|
|
|
0
|
if (/\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
4244
|
0
|
|
|
|
|
0
|
# $1 $2 $3 $4 |
4245
|
0
|
|
|
|
|
0
|
elsif (/\G (\() ((?:$qq_paren)*?) (\)) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4246
|
0
|
|
|
|
|
0
|
elsif (/\G (\{) ((?:$qq_brace)*?) (\}) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4247
|
0
|
|
|
|
|
0
|
elsif (/\G (\[) ((?:$qq_bracket)*?) (\]) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4248
|
0
|
|
|
|
|
0
|
elsif (/\G (\<) ((?:$qq_angle)*?) (\>) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4249
|
0
|
|
|
|
|
0
|
elsif (/\G (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4250
|
0
|
|
|
|
|
0
|
elsif (/\G (\$) ((?:$qq_char)*?) (\$) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4251
|
0
|
|
|
|
|
0
|
elsif (/\G (\:) ((?:$qq_char)*?) (\:) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4252
|
|
|
|
|
|
|
elsif (/\G (\@) ((?:$qq_char)*?) (\@) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4253
|
0
|
|
|
|
|
0
|
elsif (/\G (\S) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { return e_sub($sub_variable,@s,$1,$2,$3,$4); } |
4254
|
|
|
|
|
|
|
} |
4255
|
|
|
|
|
|
|
die __FILE__, ": Substitution replacement not terminated\n"; |
4256
|
|
|
|
|
|
|
} |
4257
|
0
|
|
|
|
|
0
|
# $1 $2 $3 $4 $5 $6 |
4258
|
|
|
|
|
|
|
elsif (/\G (\') ((?:$qq_char)*?) (\') ((?:$qq_char)*?) (\') ([cegimosxpradlunbB]*) /oxgc) { |
4259
|
|
|
|
|
|
|
return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6); |
4260
|
|
|
|
|
|
|
} |
4261
|
34
|
|
|
|
|
107
|
# $1 $2 $3 $4 $5 $6 |
4262
|
|
|
|
|
|
|
elsif (/\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { |
4263
|
|
|
|
|
|
|
return e_sub($sub_variable,'{',$2,'}','{',$4,'}',$6); # s | | | --> s { } { } |
4264
|
|
|
|
|
|
|
} |
4265
|
2
|
|
|
|
|
14
|
# $1 $2 $3 $4 $5 $6 |
4266
|
|
|
|
|
|
|
elsif (/\G (\$) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { |
4267
|
|
|
|
|
|
|
return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6); |
4268
|
|
|
|
|
|
|
} |
4269
|
0
|
|
|
|
|
0
|
# $1 $2 $3 $4 $5 $6 |
4270
|
|
|
|
|
|
|
elsif (/\G (\S) ((?:$qq_char)*?) (\1) ((?:$qq_char)*?) (\1) ([cegimosxpradlunbB]*) /oxgc) { |
4271
|
|
|
|
|
|
|
return e_sub($sub_variable,$1,$2,$3,$3,$4,$5,$6); |
4272
|
119
|
|
|
|
|
603
|
} |
4273
|
|
|
|
|
|
|
} |
4274
|
|
|
|
|
|
|
die __FILE__, ": Substitution pattern not terminated\n"; |
4275
|
|
|
|
|
|
|
} |
4276
|
|
|
|
|
|
|
} |
4277
|
0
|
|
|
|
|
0
|
|
4278
|
0
|
|
|
|
|
0
|
# require ignore module |
4279
|
0
|
|
|
|
|
0
|
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# require$1$2"; } |
4280
|
|
|
|
|
|
|
elsif (/\G \b require ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^\x8E\x8F\xA1-\xFE#]) /oxmsgc) { return "# require$1\n$2"; } |
4281
|
|
|
|
|
|
|
elsif (/\G \b require ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# require$1"; } |
4282
|
0
|
|
|
|
|
0
|
|
4283
|
66
|
|
|
|
|
541
|
# use strict; --> use strict; no strict qw(refs); |
4284
|
0
|
|
|
|
|
0
|
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "use$1 no strict qw(refs);$2"; } |
4285
|
|
|
|
|
|
|
elsif (/\G \b use ((?>\s+) strict .*? ;) ([ \t]* [^\x8E\x8F\xA1-\xFE#]) /oxmsgc) { return "use$1 no strict qw(refs);\n$2"; } |
4286
|
|
|
|
|
|
|
elsif (/\G \b use ((?>\s+) strict) \b /oxmsgc) { return "use$1; no strict qw(refs)"; } |
4287
|
|
|
|
|
|
|
|
4288
|
0
|
50
|
33
|
|
|
0
|
# use 5.12.0; --> use 5.12.0; no strict qw(refs); |
|
|
|
33
|
|
|
|
|
4289
|
3
|
|
|
|
|
37
|
elsif (/\G \b use (?>\s+) ((?>([1-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) { |
4290
|
|
|
|
|
|
|
if (($2 >= 6) or (($2 == 5) and ($3 ge '012'))) { |
4291
|
|
|
|
|
|
|
return "use $1; no strict qw(refs);"; |
4292
|
0
|
|
|
|
|
0
|
} |
4293
|
|
|
|
|
|
|
else { |
4294
|
|
|
|
|
|
|
return "use $1;"; |
4295
|
|
|
|
|
|
|
} |
4296
|
3
|
0
|
0
|
|
|
17
|
} |
|
|
|
0
|
|
|
|
|
4297
|
0
|
|
|
|
|
0
|
elsif (/\G \b use (?>\s+) ((?>v([0-9][0-9_]*)(?:\.([0-9_]+))*)) (?>\s*) ; /oxmsgc) { |
4298
|
|
|
|
|
|
|
if (($2 >= 6) or (($2 == 5) and ($3 >= 12))) { |
4299
|
|
|
|
|
|
|
return "use $1; no strict qw(refs);"; |
4300
|
0
|
|
|
|
|
0
|
} |
4301
|
|
|
|
|
|
|
else { |
4302
|
|
|
|
|
|
|
return "use $1;"; |
4303
|
|
|
|
|
|
|
} |
4304
|
|
|
|
|
|
|
} |
4305
|
0
|
|
|
|
|
0
|
|
4306
|
2
|
|
|
|
|
15
|
# ignore use module |
4307
|
0
|
|
|
|
|
0
|
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# use$1$2"; } |
4308
|
|
|
|
|
|
|
elsif (/\G \b use ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^\x8E\x8F\xA1-\xFE#]) /oxmsgc) { return "# use$1\n$2"; } |
4309
|
|
|
|
|
|
|
elsif (/\G \b use ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# use$1"; } |
4310
|
0
|
|
|
|
|
0
|
|
4311
|
0
|
|
|
|
|
0
|
# ignore no module |
4312
|
0
|
|
|
|
|
0
|
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [#\n]) /oxmsgc) { return "# no$1$2"; } |
4313
|
|
|
|
|
|
|
elsif (/\G \b no ((?>\s+) (?:$ignore_modules) .*? ;) ([ \t]* [^\x8E\x8F\xA1-\xFE#]) /oxmsgc) { return "# no$1\n$2"; } |
4314
|
|
|
|
|
|
|
elsif (/\G \b no ((?>\s+) (?:$ignore_modules)) \b /oxmsgc) { return "# no$1"; } |
4315
|
0
|
|
|
|
|
0
|
|
4316
|
|
|
|
|
|
|
# use else |
4317
|
|
|
|
|
|
|
elsif (/\G \b use \b /oxmsgc) { return "use"; } |
4318
|
0
|
|
|
|
|
0
|
|
4319
|
|
|
|
|
|
|
# use else |
4320
|
|
|
|
|
|
|
elsif (/\G \b no \b /oxmsgc) { return "no"; } |
4321
|
|
|
|
|
|
|
|
4322
|
2
|
|
|
|
|
8
|
# '' |
4323
|
1832
|
|
|
|
|
3743
|
elsif (/\G (?
|
4324
|
1832
|
100
|
|
|
|
4910
|
my $q_string = ''; |
|
11101
|
100
|
|
|
|
40974
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
4325
|
4
|
|
|
|
|
9
|
while (not /\G \z/oxgc) { |
4326
|
48
|
|
|
|
|
90
|
if (/\G (\\\\) /oxgc) { $q_string .= $1; } |
4327
|
1832
|
|
|
|
|
4168
|
elsif (/\G (\\\') /oxgc) { $q_string .= $1; } |
4328
|
|
|
|
|
|
|
elsif (/\G \' /oxgc) { return e_q('', "'","'",$q_string); } |
4329
|
9217
|
|
|
|
|
19077
|
elsif (/\G ($q_char) /oxgc) { $q_string .= $1; } |
4330
|
|
|
|
|
|
|
} |
4331
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
4332
|
|
|
|
|
|
|
} |
4333
|
|
|
|
|
|
|
|
4334
|
0
|
|
|
|
|
0
|
# "" |
4335
|
2657
|
|
|
|
|
5756
|
elsif (/\G (\") /oxgc) { |
4336
|
2657
|
100
|
|
|
|
6743
|
my $qq_string = ''; |
|
49993
|
100
|
|
|
|
173882
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
4337
|
109
|
|
|
|
|
386
|
while (not /\G \z/oxgc) { |
4338
|
12
|
|
|
|
|
28
|
if (/\G (\\\\) /oxgc) { $qq_string .= $1; } |
4339
|
2657
|
|
|
|
|
6035
|
elsif (/\G (\\\") /oxgc) { $qq_string .= $1; } |
4340
|
|
|
|
|
|
|
elsif (/\G \" /oxgc) { return e_qq('', '"','"',$qq_string); } |
4341
|
47215
|
|
|
|
|
96527
|
elsif (/\G ($q_char) /oxgc) { $qq_string .= $1; } |
4342
|
|
|
|
|
|
|
} |
4343
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
4344
|
|
|
|
|
|
|
} |
4345
|
|
|
|
|
|
|
|
4346
|
0
|
|
|
|
|
0
|
# `` |
4347
|
1
|
|
|
|
|
4
|
elsif (/\G (\`) /oxgc) { |
4348
|
1
|
50
|
|
|
|
5
|
my $qx_string = ''; |
|
19
|
50
|
|
|
|
85
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
4349
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
4350
|
0
|
|
|
|
|
0
|
if (/\G (\\\\) /oxgc) { $qx_string .= $1; } |
4351
|
1
|
|
|
|
|
2
|
elsif (/\G (\\\`) /oxgc) { $qx_string .= $1; } |
4352
|
|
|
|
|
|
|
elsif (/\G \` /oxgc) { return e_qq('', '`','`',$qx_string); } |
4353
|
18
|
|
|
|
|
33
|
elsif (/\G ($q_char) /oxgc) { $qx_string .= $1; } |
4354
|
|
|
|
|
|
|
} |
4355
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
4356
|
|
|
|
|
|
|
} |
4357
|
|
|
|
|
|
|
|
4358
|
0
|
|
|
|
|
0
|
# // --- not divide operator (num / num), not defined-or |
4359
|
1070
|
|
|
|
|
2340
|
elsif (($slash eq 'm//') and /\G (\/) /oxgc) { |
4360
|
1070
|
100
|
|
|
|
2769
|
my $regexp = ''; |
|
10084
|
50
|
|
|
|
35194
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
4361
|
1
|
|
|
|
|
5
|
while (not /\G \z/oxgc) { |
4362
|
0
|
|
|
|
|
0
|
if (/\G (\\\\) /oxgc) { $regexp .= $1; } |
4363
|
1070
|
|
|
|
|
2619
|
elsif (/\G (\\\/) /oxgc) { $regexp .= $1; } |
4364
|
|
|
|
|
|
|
elsif (/\G \/ ([cgimosxpadlunbB]*) /oxgc) { return e_qr('', '/','/',$regexp,$1); } |
4365
|
9013
|
|
|
|
|
18079
|
elsif (/\G ($q_char) /oxgc) { $regexp .= $1; } |
4366
|
|
|
|
|
|
|
} |
4367
|
|
|
|
|
|
|
die __FILE__, ": Search pattern not terminated\n"; |
4368
|
|
|
|
|
|
|
} |
4369
|
|
|
|
|
|
|
|
4370
|
0
|
|
|
|
|
0
|
# ?? --- not conditional operator (condition ? then : else) |
4371
|
30
|
|
|
|
|
62
|
elsif (($slash eq 'm//') and /\G (\?) /oxgc) { |
4372
|
30
|
50
|
|
|
|
76
|
my $regexp = ''; |
|
122
|
50
|
|
|
|
586
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
4373
|
0
|
|
|
|
|
0
|
while (not /\G \z/oxgc) { |
4374
|
0
|
|
|
|
|
0
|
if (/\G (\\\\) /oxgc) { $regexp .= $1; } |
4375
|
30
|
|
|
|
|
75
|
elsif (/\G (\\\?) /oxgc) { $regexp .= $1; } |
4376
|
|
|
|
|
|
|
elsif (/\G \? ([cgimosxpadlunbB]*) /oxgc) { return e_qr('m','?','?',$regexp,$1); } |
4377
|
92
|
|
|
|
|
223
|
elsif (/\G ($q_char) /oxgc) { $regexp .= $1; } |
4378
|
|
|
|
|
|
|
} |
4379
|
|
|
|
|
|
|
die __FILE__, ": Search pattern not terminated\n"; |
4380
|
|
|
|
|
|
|
} |
4381
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
4382
|
|
|
|
|
|
|
# <<>> (a safer ARGV) |
4383
|
|
|
|
|
|
|
elsif (/\G ( <<>> ) /oxgc) { $slash = 'm//'; return $1; } |
4384
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
4385
|
|
|
|
|
|
|
# << (bit shift) --- not here document |
4386
|
|
|
|
|
|
|
elsif (/\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) { $slash = 'm//'; return $1; } |
4387
|
|
|
|
|
|
|
|
4388
|
0
|
|
|
|
|
0
|
# <<~'HEREDOC' |
4389
|
6
|
|
|
|
|
14
|
elsif (/\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) { |
4390
|
6
|
|
|
|
|
10
|
$slash = 'm//'; |
4391
|
|
|
|
|
|
|
my $here_quote = $1; |
4392
|
|
|
|
|
|
|
my $delimiter = $2; |
4393
|
6
|
50
|
|
|
|
9
|
|
4394
|
6
|
|
|
|
|
14
|
# get here document |
4395
|
6
|
|
|
|
|
30
|
if ($here_script eq '') { |
4396
|
|
|
|
|
|
|
$here_script = CORE::substr $_, pos $_; |
4397
|
6
|
50
|
|
|
|
33
|
$here_script =~ s/.*?\n//oxm; |
4398
|
6
|
|
|
|
|
57
|
} |
4399
|
6
|
|
|
|
|
13
|
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) { |
4400
|
6
|
|
|
|
|
9
|
my $heredoc = $1; |
4401
|
6
|
|
|
|
|
55
|
my $indent = $2; |
4402
|
6
|
|
|
|
|
18
|
$heredoc =~ s{^$indent}{}msg; # no /ox |
4403
|
|
|
|
|
|
|
push @heredoc, $heredoc . qq{\n$delimiter\n}; |
4404
|
|
|
|
|
|
|
push @heredoc_delimiter, qq{\\s*$delimiter}; |
4405
|
6
|
|
|
|
|
12
|
} |
4406
|
|
|
|
|
|
|
else { |
4407
|
0
|
|
|
|
|
0
|
die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n"; |
4408
|
|
|
|
|
|
|
} |
4409
|
|
|
|
|
|
|
return qq{<<'$delimiter'}; |
4410
|
|
|
|
|
|
|
} |
4411
|
|
|
|
|
|
|
|
4412
|
|
|
|
|
|
|
# <<~\HEREDOC |
4413
|
|
|
|
|
|
|
|
4414
|
|
|
|
|
|
|
# P.66 2.6.6. "Here" Documents |
4415
|
|
|
|
|
|
|
# in Chapter 2: Bits and Pieces |
4416
|
|
|
|
|
|
|
# of ISBN 0-596-00027-8 Programming Perl Third Edition. |
4417
|
|
|
|
|
|
|
|
4418
|
|
|
|
|
|
|
# P.73 "Here" Documents |
4419
|
|
|
|
|
|
|
# in Chapter 2: Bits and Pieces |
4420
|
|
|
|
|
|
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
4421
|
6
|
|
|
|
|
25
|
|
4422
|
3
|
|
|
|
|
7
|
elsif (/\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) { |
4423
|
3
|
|
|
|
|
8
|
$slash = 'm//'; |
4424
|
|
|
|
|
|
|
my $here_quote = $1; |
4425
|
|
|
|
|
|
|
my $delimiter = $2; |
4426
|
3
|
50
|
|
|
|
6
|
|
4427
|
3
|
|
|
|
|
9
|
# get here document |
4428
|
3
|
|
|
|
|
23
|
if ($here_script eq '') { |
4429
|
|
|
|
|
|
|
$here_script = CORE::substr $_, pos $_; |
4430
|
3
|
50
|
|
|
|
27
|
$here_script =~ s/.*?\n//oxm; |
4431
|
3
|
|
|
|
|
46
|
} |
4432
|
3
|
|
|
|
|
10
|
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) { |
4433
|
3
|
|
|
|
|
5
|
my $heredoc = $1; |
4434
|
3
|
|
|
|
|
35
|
my $indent = $2; |
4435
|
3
|
|
|
|
|
11
|
$heredoc =~ s{^$indent}{}msg; # no /ox |
4436
|
|
|
|
|
|
|
push @heredoc, $heredoc . qq{\n$delimiter\n}; |
4437
|
|
|
|
|
|
|
push @heredoc_delimiter, qq{\\s*$delimiter}; |
4438
|
3
|
|
|
|
|
7
|
} |
4439
|
|
|
|
|
|
|
else { |
4440
|
0
|
|
|
|
|
0
|
die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n"; |
4441
|
|
|
|
|
|
|
} |
4442
|
|
|
|
|
|
|
return qq{<<\\$delimiter}; |
4443
|
|
|
|
|
|
|
} |
4444
|
|
|
|
|
|
|
|
4445
|
3
|
|
|
|
|
15
|
# <<~"HEREDOC" |
4446
|
6
|
|
|
|
|
11
|
elsif (/\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) { |
4447
|
6
|
|
|
|
|
12
|
$slash = 'm//'; |
4448
|
|
|
|
|
|
|
my $here_quote = $1; |
4449
|
|
|
|
|
|
|
my $delimiter = $2; |
4450
|
6
|
50
|
|
|
|
8
|
|
4451
|
6
|
|
|
|
|
11
|
# get here document |
4452
|
6
|
|
|
|
|
31
|
if ($here_script eq '') { |
4453
|
|
|
|
|
|
|
$here_script = CORE::substr $_, pos $_; |
4454
|
6
|
50
|
|
|
|
35
|
$here_script =~ s/.*?\n//oxm; |
4455
|
6
|
|
|
|
|
51
|
} |
4456
|
6
|
|
|
|
|
13
|
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) { |
4457
|
6
|
|
|
|
|
8
|
my $heredoc = $1; |
4458
|
6
|
|
|
|
|
41
|
my $indent = $2; |
4459
|
6
|
|
|
|
|
14
|
$heredoc =~ s{^$indent}{}msg; # no /ox |
4460
|
|
|
|
|
|
|
push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n}; |
4461
|
|
|
|
|
|
|
push @heredoc_delimiter, qq{\\s*$delimiter}; |
4462
|
6
|
|
|
|
|
13
|
} |
4463
|
|
|
|
|
|
|
else { |
4464
|
0
|
|
|
|
|
0
|
die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n"; |
4465
|
|
|
|
|
|
|
} |
4466
|
|
|
|
|
|
|
return qq{<<"$delimiter"}; |
4467
|
|
|
|
|
|
|
} |
4468
|
|
|
|
|
|
|
|
4469
|
6
|
|
|
|
|
20
|
# <<~HEREDOC |
4470
|
3
|
|
|
|
|
6
|
elsif (/\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) { |
4471
|
3
|
|
|
|
|
7
|
$slash = 'm//'; |
4472
|
|
|
|
|
|
|
my $here_quote = $1; |
4473
|
|
|
|
|
|
|
my $delimiter = $2; |
4474
|
3
|
50
|
|
|
|
5
|
|
4475
|
3
|
|
|
|
|
7
|
# get here document |
4476
|
3
|
|
|
|
|
10
|
if ($here_script eq '') { |
4477
|
|
|
|
|
|
|
$here_script = CORE::substr $_, pos $_; |
4478
|
3
|
50
|
|
|
|
22
|
$here_script =~ s/.*?\n//oxm; |
4479
|
3
|
|
|
|
|
41
|
} |
4480
|
3
|
|
|
|
|
8
|
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) { |
4481
|
3
|
|
|
|
|
4
|
my $heredoc = $1; |
4482
|
3
|
|
|
|
|
35
|
my $indent = $2; |
4483
|
3
|
|
|
|
|
9
|
$heredoc =~ s{^$indent}{}msg; # no /ox |
4484
|
|
|
|
|
|
|
push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n}; |
4485
|
|
|
|
|
|
|
push @heredoc_delimiter, qq{\\s*$delimiter}; |
4486
|
3
|
|
|
|
|
5
|
} |
4487
|
|
|
|
|
|
|
else { |
4488
|
0
|
|
|
|
|
0
|
die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n"; |
4489
|
|
|
|
|
|
|
} |
4490
|
|
|
|
|
|
|
return qq{<<$delimiter}; |
4491
|
|
|
|
|
|
|
} |
4492
|
|
|
|
|
|
|
|
4493
|
3
|
|
|
|
|
13
|
# <<~`HEREDOC` |
4494
|
6
|
|
|
|
|
10
|
elsif (/\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) { |
4495
|
6
|
|
|
|
|
11
|
$slash = 'm//'; |
4496
|
|
|
|
|
|
|
my $here_quote = $1; |
4497
|
|
|
|
|
|
|
my $delimiter = $2; |
4498
|
6
|
50
|
|
|
|
9
|
|
4499
|
6
|
|
|
|
|
19
|
# get here document |
4500
|
6
|
|
|
|
|
19
|
if ($here_script eq '') { |
4501
|
|
|
|
|
|
|
$here_script = CORE::substr $_, pos $_; |
4502
|
6
|
50
|
|
|
|
29
|
$here_script =~ s/.*?\n//oxm; |
4503
|
6
|
|
|
|
|
54
|
} |
4504
|
6
|
|
|
|
|
13
|
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) { |
4505
|
6
|
|
|
|
|
8
|
my $heredoc = $1; |
4506
|
6
|
|
|
|
|
44
|
my $indent = $2; |
4507
|
6
|
|
|
|
|
18
|
$heredoc =~ s{^$indent}{}msg; # no /ox |
4508
|
|
|
|
|
|
|
push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n}; |
4509
|
|
|
|
|
|
|
push @heredoc_delimiter, qq{\\s*$delimiter}; |
4510
|
6
|
|
|
|
|
14
|
} |
4511
|
|
|
|
|
|
|
else { |
4512
|
0
|
|
|
|
|
0
|
die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n"; |
4513
|
|
|
|
|
|
|
} |
4514
|
|
|
|
|
|
|
return qq{<<`$delimiter`}; |
4515
|
|
|
|
|
|
|
} |
4516
|
|
|
|
|
|
|
|
4517
|
6
|
|
|
|
|
23
|
# <<'HEREDOC' |
4518
|
80
|
|
|
|
|
156
|
elsif (/\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) { |
4519
|
80
|
|
|
|
|
172
|
$slash = 'm//'; |
4520
|
|
|
|
|
|
|
my $here_quote = $1; |
4521
|
|
|
|
|
|
|
my $delimiter = $2; |
4522
|
80
|
100
|
|
|
|
127
|
|
4523
|
80
|
|
|
|
|
156
|
# get here document |
4524
|
77
|
|
|
|
|
354
|
if ($here_script eq '') { |
4525
|
|
|
|
|
|
|
$here_script = CORE::substr $_, pos $_; |
4526
|
77
|
50
|
|
|
|
423
|
$here_script =~ s/.*?\n//oxm; |
4527
|
80
|
|
|
|
|
623
|
} |
4528
|
80
|
|
|
|
|
257
|
if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) { |
4529
|
|
|
|
|
|
|
push @heredoc, $1 . qq{\n$delimiter\n}; |
4530
|
|
|
|
|
|
|
push @heredoc_delimiter, $delimiter; |
4531
|
80
|
|
|
|
|
126
|
} |
4532
|
|
|
|
|
|
|
else { |
4533
|
0
|
|
|
|
|
0
|
die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n"; |
4534
|
|
|
|
|
|
|
} |
4535
|
|
|
|
|
|
|
return $here_quote; |
4536
|
|
|
|
|
|
|
} |
4537
|
|
|
|
|
|
|
|
4538
|
|
|
|
|
|
|
# <<\HEREDOC |
4539
|
|
|
|
|
|
|
|
4540
|
|
|
|
|
|
|
# P.66 2.6.6. "Here" Documents |
4541
|
|
|
|
|
|
|
# in Chapter 2: Bits and Pieces |
4542
|
|
|
|
|
|
|
# of ISBN 0-596-00027-8 Programming Perl Third Edition. |
4543
|
|
|
|
|
|
|
|
4544
|
|
|
|
|
|
|
# P.73 "Here" Documents |
4545
|
|
|
|
|
|
|
# in Chapter 2: Bits and Pieces |
4546
|
|
|
|
|
|
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
4547
|
80
|
|
|
|
|
310
|
|
4548
|
2
|
|
|
|
|
5
|
elsif (/\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) { |
4549
|
2
|
|
|
|
|
5
|
$slash = 'm//'; |
4550
|
|
|
|
|
|
|
my $here_quote = $1; |
4551
|
|
|
|
|
|
|
my $delimiter = $2; |
4552
|
2
|
100
|
|
|
|
4
|
|
4553
|
2
|
|
|
|
|
5
|
# get here document |
4554
|
1
|
|
|
|
|
7
|
if ($here_script eq '') { |
4555
|
|
|
|
|
|
|
$here_script = CORE::substr $_, pos $_; |
4556
|
1
|
50
|
|
|
|
16
|
$here_script =~ s/.*?\n//oxm; |
4557
|
2
|
|
|
|
|
27
|
} |
4558
|
2
|
|
|
|
|
7
|
if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) { |
4559
|
|
|
|
|
|
|
push @heredoc, $1 . qq{\n$delimiter\n}; |
4560
|
|
|
|
|
|
|
push @heredoc_delimiter, $delimiter; |
4561
|
2
|
|
|
|
|
4
|
} |
4562
|
|
|
|
|
|
|
else { |
4563
|
0
|
|
|
|
|
0
|
die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n"; |
4564
|
|
|
|
|
|
|
} |
4565
|
|
|
|
|
|
|
return $here_quote; |
4566
|
|
|
|
|
|
|
} |
4567
|
|
|
|
|
|
|
|
4568
|
2
|
|
|
|
|
9
|
# <<"HEREDOC" |
4569
|
39
|
|
|
|
|
93
|
elsif (/\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) { |
4570
|
39
|
|
|
|
|
88
|
$slash = 'm//'; |
4571
|
|
|
|
|
|
|
my $here_quote = $1; |
4572
|
|
|
|
|
|
|
my $delimiter = $2; |
4573
|
39
|
100
|
|
|
|
70
|
|
4574
|
39
|
|
|
|
|
147
|
# get here document |
4575
|
38
|
|
|
|
|
213
|
if ($here_script eq '') { |
4576
|
|
|
|
|
|
|
$here_script = CORE::substr $_, pos $_; |
4577
|
38
|
50
|
|
|
|
199
|
$here_script =~ s/.*?\n//oxm; |
4578
|
39
|
|
|
|
|
504
|
} |
4579
|
39
|
|
|
|
|
123
|
if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) { |
4580
|
|
|
|
|
|
|
push @heredoc, e_heredoc($1) . qq{\n$delimiter\n}; |
4581
|
|
|
|
|
|
|
push @heredoc_delimiter, $delimiter; |
4582
|
39
|
|
|
|
|
83
|
} |
4583
|
|
|
|
|
|
|
else { |
4584
|
0
|
|
|
|
|
0
|
die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n"; |
4585
|
|
|
|
|
|
|
} |
4586
|
|
|
|
|
|
|
return $here_quote; |
4587
|
|
|
|
|
|
|
} |
4588
|
|
|
|
|
|
|
|
4589
|
39
|
|
|
|
|
148
|
# <
|
4590
|
54
|
|
|
|
|
153
|
elsif (/\G ( << ([a-zA-Z_0-9]+) ) /oxgc) { |
4591
|
54
|
|
|
|
|
113
|
$slash = 'm//'; |
4592
|
|
|
|
|
|
|
my $here_quote = $1; |
4593
|
|
|
|
|
|
|
my $delimiter = $2; |
4594
|
54
|
100
|
|
|
|
203
|
|
4595
|
54
|
|
|
|
|
261
|
# get here document |
4596
|
51
|
|
|
|
|
411
|
if ($here_script eq '') { |
4597
|
|
|
|
|
|
|
$here_script = CORE::substr $_, pos $_; |
4598
|
51
|
50
|
|
|
|
368
|
$here_script =~ s/.*?\n//oxm; |
4599
|
54
|
|
|
|
|
755
|
} |
4600
|
54
|
|
|
|
|
212
|
if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) { |
4601
|
|
|
|
|
|
|
push @heredoc, e_heredoc($1) . qq{\n$delimiter\n}; |
4602
|
|
|
|
|
|
|
push @heredoc_delimiter, $delimiter; |
4603
|
54
|
|
|
|
|
541
|
} |
4604
|
|
|
|
|
|
|
else { |
4605
|
0
|
|
|
|
|
0
|
die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n"; |
4606
|
|
|
|
|
|
|
} |
4607
|
|
|
|
|
|
|
return $here_quote; |
4608
|
|
|
|
|
|
|
} |
4609
|
|
|
|
|
|
|
|
4610
|
54
|
|
|
|
|
239
|
# <<`HEREDOC` |
4611
|
0
|
|
|
|
|
0
|
elsif (/\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) { |
4612
|
0
|
|
|
|
|
0
|
$slash = 'm//'; |
4613
|
|
|
|
|
|
|
my $here_quote = $1; |
4614
|
|
|
|
|
|
|
my $delimiter = $2; |
4615
|
0
|
0
|
|
|
|
0
|
|
4616
|
0
|
|
|
|
|
0
|
# get here document |
4617
|
0
|
|
|
|
|
0
|
if ($here_script eq '') { |
4618
|
|
|
|
|
|
|
$here_script = CORE::substr $_, pos $_; |
4619
|
0
|
0
|
|
|
|
0
|
$here_script =~ s/.*?\n//oxm; |
4620
|
0
|
|
|
|
|
0
|
} |
4621
|
0
|
|
|
|
|
0
|
if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) { |
4622
|
|
|
|
|
|
|
push @heredoc, e_heredoc($1) . qq{\n$delimiter\n}; |
4623
|
|
|
|
|
|
|
push @heredoc_delimiter, $delimiter; |
4624
|
0
|
|
|
|
|
0
|
} |
4625
|
|
|
|
|
|
|
else { |
4626
|
0
|
|
|
|
|
0
|
die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n"; |
4627
|
|
|
|
|
|
|
} |
4628
|
|
|
|
|
|
|
return $here_quote; |
4629
|
|
|
|
|
|
|
} |
4630
|
|
|
|
|
|
|
|
4631
|
0
|
|
|
|
|
0
|
# <<= <=> <= < operator |
4632
|
|
|
|
|
|
|
elsif (/\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) { |
4633
|
|
|
|
|
|
|
return $1; |
4634
|
|
|
|
|
|
|
} |
4635
|
|
|
|
|
|
|
|
4636
|
13
|
|
|
|
|
67
|
# |
4637
|
|
|
|
|
|
|
elsif (/\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) { |
4638
|
|
|
|
|
|
|
return $1; |
4639
|
|
|
|
|
|
|
} |
4640
|
|
|
|
|
|
|
|
4641
|
|
|
|
|
|
|
# --- glob |
4642
|
|
|
|
|
|
|
|
4643
|
|
|
|
|
|
|
# avoid "Error: Runtime exception" of perl version 5.005_03 |
4644
|
0
|
|
|
|
|
0
|
|
4645
|
|
|
|
|
|
|
elsif (/\G < ((?:[^\x8E\x8F\xA1-\xFE>\0\a\e\f\n\r\t]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF])+?) > /oxgc) { |
4646
|
|
|
|
|
|
|
return 'Eeucjp::glob("' . $1 . '")'; |
4647
|
|
|
|
|
|
|
} |
4648
|
0
|
|
|
|
|
0
|
|
4649
|
|
|
|
|
|
|
# __DATA__ |
4650
|
|
|
|
|
|
|
elsif (/\G ^ ( __DATA__ \n .*) \z /oxmsgc) { return $1; } |
4651
|
0
|
|
|
|
|
0
|
|
4652
|
|
|
|
|
|
|
# __END__ |
4653
|
|
|
|
|
|
|
elsif (/\G ^ ( __END__ \n .*) \z /oxmsgc) { return $1; } |
4654
|
|
|
|
|
|
|
|
4655
|
|
|
|
|
|
|
# \cD Control-D |
4656
|
|
|
|
|
|
|
|
4657
|
|
|
|
|
|
|
# P.68 2.6.8. Other Literal Tokens |
4658
|
|
|
|
|
|
|
# in Chapter 2: Bits and Pieces |
4659
|
|
|
|
|
|
|
# of ISBN 0-596-00027-8 Programming Perl Third Edition. |
4660
|
|
|
|
|
|
|
|
4661
|
|
|
|
|
|
|
# P.76 Other Literal Tokens |
4662
|
|
|
|
|
|
|
# in Chapter 2: Bits and Pieces |
4663
|
329
|
|
|
|
|
2319
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
4664
|
|
|
|
|
|
|
|
4665
|
|
|
|
|
|
|
elsif (/\G ( \cD .*) \z /oxmsgc) { return $1; } |
4666
|
0
|
|
|
|
|
0
|
|
4667
|
|
|
|
|
|
|
# \cZ Control-Z |
4668
|
|
|
|
|
|
|
elsif (/\G ( \cZ .*) \z /oxmsgc) { return $1; } |
4669
|
|
|
|
|
|
|
|
4670
|
|
|
|
|
|
|
# any operator before div |
4671
|
|
|
|
|
|
|
elsif (/\G ( |
4672
|
|
|
|
|
|
|
-- | \+\+ | |
4673
|
0
|
|
|
|
|
0
|
[\)\}\]] |
|
9408
|
|
|
|
|
18305
|
|
4674
|
|
|
|
|
|
|
|
4675
|
|
|
|
|
|
|
) /oxgc) { $slash = 'div'; return $1; } |
4676
|
|
|
|
|
|
|
|
4677
|
|
|
|
|
|
|
# yada-yada or triple-dot operator |
4678
|
|
|
|
|
|
|
elsif (/\G ( |
4679
|
9408
|
|
|
|
|
41064
|
\.\.\. |
|
7
|
|
|
|
|
14
|
|
4680
|
|
|
|
|
|
|
|
4681
|
|
|
|
|
|
|
) /oxgc) { $slash = 'm//'; return q{die('Unimplemented')}; } |
4682
|
|
|
|
|
|
|
|
4683
|
|
|
|
|
|
|
# any operator before m// |
4684
|
|
|
|
|
|
|
|
4685
|
|
|
|
|
|
|
# //, //= (defined-or) |
4686
|
|
|
|
|
|
|
|
4687
|
|
|
|
|
|
|
# P.164 Logical Operators |
4688
|
|
|
|
|
|
|
# in Chapter 10: More Control Structures |
4689
|
|
|
|
|
|
|
# of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition |
4690
|
|
|
|
|
|
|
|
4691
|
|
|
|
|
|
|
# P.119 C-Style Logical (Short-Circuit) Operators |
4692
|
|
|
|
|
|
|
# in Chapter 3: Unary and Binary Operators |
4693
|
|
|
|
|
|
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
4694
|
|
|
|
|
|
|
|
4695
|
|
|
|
|
|
|
# (and so on) |
4696
|
|
|
|
|
|
|
|
4697
|
|
|
|
|
|
|
# ~~ |
4698
|
|
|
|
|
|
|
|
4699
|
|
|
|
|
|
|
# P.221 The Smart Match Operator |
4700
|
|
|
|
|
|
|
# in Chapter 15: Smart Matching and given-when |
4701
|
|
|
|
|
|
|
# of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition |
4702
|
|
|
|
|
|
|
|
4703
|
|
|
|
|
|
|
# P.112 Smartmatch Operator |
4704
|
|
|
|
|
|
|
# in Chapter 3: Unary and Binary Operators |
4705
|
|
|
|
|
|
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
4706
|
|
|
|
|
|
|
|
4707
|
|
|
|
|
|
|
# (and so on) |
4708
|
|
|
|
|
|
|
|
4709
|
|
|
|
|
|
|
elsif (/\G ((?> |
4710
|
|
|
|
|
|
|
|
4711
|
|
|
|
|
|
|
!~~ | !~ | != | ! | |
4712
|
|
|
|
|
|
|
%= | % | |
4713
|
|
|
|
|
|
|
&&= | && | &= | &\.= | &\. | & | |
4714
|
|
|
|
|
|
|
-= | -> | - | |
4715
|
|
|
|
|
|
|
:(?>\s*)= | |
4716
|
|
|
|
|
|
|
: | |
4717
|
|
|
|
|
|
|
<<>> | |
4718
|
|
|
|
|
|
|
<<= | <=> | <= | < | |
4719
|
|
|
|
|
|
|
== | => | =~ | = | |
4720
|
|
|
|
|
|
|
>>= | >> | >= | > | |
4721
|
|
|
|
|
|
|
\*\*= | \*\* | \*= | \* | |
4722
|
|
|
|
|
|
|
\+= | \+ | |
4723
|
|
|
|
|
|
|
\.\. | \.= | \. | |
4724
|
|
|
|
|
|
|
\/\/= | \/\/ | |
4725
|
|
|
|
|
|
|
\/= | \/ | |
4726
|
|
|
|
|
|
|
\? | |
4727
|
|
|
|
|
|
|
\\ | |
4728
|
|
|
|
|
|
|
\^= | \^\.= | \^\. | \^ | |
4729
|
|
|
|
|
|
|
\b x= | |
4730
|
|
|
|
|
|
|
\|\|= | \|\| | \|= | \|\.= | \|\. | \| | |
4731
|
|
|
|
|
|
|
~~ | ~\. | ~ | |
4732
|
|
|
|
|
|
|
\b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | |
4733
|
|
|
|
|
|
|
\b(?: print )\b | |
4734
|
|
|
|
|
|
|
|
4735
|
7
|
|
|
|
|
36
|
[,;\(\{\[] |
|
16200
|
|
|
|
|
32217
|
|
4736
|
|
|
|
|
|
|
|
4737
|
|
|
|
|
|
|
)) /oxgc) { $slash = 'm//'; return $1; } |
4738
|
16200
|
|
|
|
|
77915
|
|
|
25725
|
|
|
|
|
48571
|
|
4739
|
|
|
|
|
|
|
# other any character |
4740
|
|
|
|
|
|
|
elsif (/\G ($q_char) /oxgc) { $slash = 'div'; return $1; } |
4741
|
|
|
|
|
|
|
|
4742
|
25725
|
|
|
|
|
113928
|
# system error |
4743
|
|
|
|
|
|
|
else { |
4744
|
|
|
|
|
|
|
die __FILE__, ": Oops, this shouldn't happen!\n"; |
4745
|
|
|
|
|
|
|
} |
4746
|
|
|
|
|
|
|
} |
4747
|
|
|
|
|
|
|
|
4748
|
0
|
|
|
2572
|
0
|
0
|
# escape EUC-JP string |
4749
|
2572
|
|
|
|
|
5921
|
sub e_string { |
4750
|
|
|
|
|
|
|
my($string) = @_; |
4751
|
2572
|
|
|
|
|
3589
|
my $e_string = ''; |
4752
|
|
|
|
|
|
|
|
4753
|
|
|
|
|
|
|
local $slash = 'm//'; |
4754
|
|
|
|
|
|
|
|
4755
|
|
|
|
|
|
|
# P.1024 Appendix W.10 Multibyte Processing |
4756
|
|
|
|
|
|
|
# of ISBN 1-56592-224-7 CJKV Information Processing |
4757
|
2572
|
|
|
|
|
3656
|
# (and so on) |
4758
|
|
|
|
|
|
|
|
4759
|
|
|
|
|
|
|
my @char = $string =~ / \G (?>[^\x8E\x8F\xA1-\xFE\\]|\\$q_char|$q_char) /oxmsg; |
4760
|
2572
|
100
|
66
|
|
|
28503
|
|
4761
|
2572
|
50
|
|
|
|
11821
|
# without { ... } |
4762
|
2534
|
|
|
|
|
5529
|
if (not (grep(/\A \{ \z/xms, @char) and grep(/\A \} \z/xms, @char))) { |
4763
|
|
|
|
|
|
|
if ($string !~ /<
|
4764
|
|
|
|
|
|
|
return $string; |
4765
|
|
|
|
|
|
|
} |
4766
|
|
|
|
|
|
|
} |
4767
|
2534
|
|
|
|
|
6217
|
|
4768
|
38
|
50
|
|
|
|
101
|
E_STRING_LOOP: |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
4769
|
|
|
|
|
|
|
while ($string !~ /\G \z/oxgc) { |
4770
|
|
|
|
|
|
|
if (0) { |
4771
|
|
|
|
|
|
|
} |
4772
|
288
|
|
|
|
|
20685
|
|
4773
|
0
|
|
|
|
|
0
|
# $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> @{[Eeucjp::PREMATCH()]} |
4774
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH \b | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) /oxmsgc) { |
4775
|
|
|
|
|
|
|
$e_string .= q{Eeucjp::PREMATCH()}; |
4776
|
|
|
|
|
|
|
$slash = 'div'; |
4777
|
|
|
|
|
|
|
} |
4778
|
|
|
|
|
|
|
|
4779
|
0
|
|
|
|
|
0
|
# $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> @{[Eeucjp::MATCH()]} |
4780
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ( \$& | \$\{&\} | \$ (?>\s*) MATCH \b | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) /oxmsgc) { |
4781
|
|
|
|
|
|
|
$e_string .= q{Eeucjp::MATCH()}; |
4782
|
|
|
|
|
|
|
$slash = 'div'; |
4783
|
|
|
|
|
|
|
} |
4784
|
|
|
|
|
|
|
|
4785
|
0
|
|
|
|
|
0
|
# $', ${'} --> $', ${'} |
4786
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ( \$' | \$\{'\} ) /oxmsgc) { |
4787
|
|
|
|
|
|
|
$e_string .= $1; |
4788
|
|
|
|
|
|
|
$slash = 'div'; |
4789
|
|
|
|
|
|
|
} |
4790
|
|
|
|
|
|
|
|
4791
|
0
|
|
|
|
|
0
|
# $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> @{[Eeucjp::POSTMATCH()]} |
4792
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ( \$ (?>\s*) POSTMATCH \b | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) /oxmsgc) { |
4793
|
|
|
|
|
|
|
$e_string .= q{Eeucjp::POSTMATCH()}; |
4794
|
|
|
|
|
|
|
$slash = 'div'; |
4795
|
|
|
|
|
|
|
} |
4796
|
|
|
|
|
|
|
|
4797
|
0
|
|
|
|
|
0
|
# bareword |
4798
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ( \{ (?>\s*) (?: tr | index | rindex | reverse ) (?>\s*) \} ) /oxmsgc) { |
4799
|
|
|
|
|
|
|
$e_string .= $1; |
4800
|
|
|
|
|
|
|
$slash = 'div'; |
4801
|
|
|
|
|
|
|
} |
4802
|
|
|
|
|
|
|
|
4803
|
0
|
|
|
|
|
0
|
# $0 --> $0 |
4804
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ( \$ 0 ) /oxmsgc) { |
4805
|
|
|
|
|
|
|
$e_string .= $1; |
4806
|
|
|
|
|
|
|
$slash = 'div'; |
4807
|
0
|
|
|
|
|
0
|
} |
4808
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ( \$ \{ (?>\s*) 0 (?>\s*) \} ) /oxmsgc) { |
4809
|
|
|
|
|
|
|
$e_string .= $1; |
4810
|
|
|
|
|
|
|
$slash = 'div'; |
4811
|
|
|
|
|
|
|
} |
4812
|
|
|
|
|
|
|
|
4813
|
0
|
|
|
|
|
0
|
# $$ --> $$ |
4814
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ( \$ \$ ) (?![\w\{]) /oxmsgc) { |
4815
|
|
|
|
|
|
|
$e_string .= $1; |
4816
|
|
|
|
|
|
|
$slash = 'div'; |
4817
|
|
|
|
|
|
|
} |
4818
|
|
|
|
|
|
|
|
4819
|
|
|
|
|
|
|
# $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring |
4820
|
0
|
|
|
|
|
0
|
# $1, $2, $3 --> $1, $2, $3 otherwise |
4821
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \$ ((?>[1-9][0-9]*)) /oxmsgc) { |
4822
|
|
|
|
|
|
|
$e_string .= e_capture($1); |
4823
|
|
|
|
|
|
|
$slash = 'div'; |
4824
|
0
|
|
|
|
|
0
|
} |
4825
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} /oxmsgc) { |
4826
|
|
|
|
|
|
|
$e_string .= e_capture($1); |
4827
|
|
|
|
|
|
|
$slash = 'div'; |
4828
|
|
|
|
|
|
|
} |
4829
|
|
|
|
|
|
|
|
4830
|
0
|
|
|
|
|
0
|
# $$foo[ ... ] --> $ $foo->[ ... ] |
4831
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ .+? \] ) /oxmsgc) { |
4832
|
|
|
|
|
|
|
$e_string .= e_capture($1.'->'.$2); |
4833
|
|
|
|
|
|
|
$slash = 'div'; |
4834
|
|
|
|
|
|
|
} |
4835
|
|
|
|
|
|
|
|
4836
|
0
|
|
|
|
|
0
|
# $$foo{ ... } --> $ $foo->{ ... } |
4837
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ .+? \} ) /oxmsgc) { |
4838
|
|
|
|
|
|
|
$e_string .= e_capture($1.'->'.$2); |
4839
|
|
|
|
|
|
|
$slash = 'div'; |
4840
|
|
|
|
|
|
|
} |
4841
|
|
|
|
|
|
|
|
4842
|
0
|
|
|
|
|
0
|
# $$foo |
4843
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) /oxmsgc) { |
4844
|
|
|
|
|
|
|
$e_string .= e_capture($1); |
4845
|
|
|
|
|
|
|
$slash = 'div'; |
4846
|
|
|
|
|
|
|
} |
4847
|
|
|
|
|
|
|
|
4848
|
0
|
|
|
|
|
0
|
# ${ foo } |
4849
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} /oxmsgc) { |
4850
|
|
|
|
|
|
|
$e_string .= '${' . $1 . '}'; |
4851
|
|
|
|
|
|
|
$slash = 'div'; |
4852
|
|
|
|
|
|
|
} |
4853
|
|
|
|
|
|
|
|
4854
|
0
|
|
|
|
|
0
|
# ${ ... } |
4855
|
3
|
|
|
|
|
11
|
elsif ($string =~ /\G \$ (?>\s*) \{ (?>\s*) ( $qq_brace ) (?>\s*) \} /oxmsgc) { |
4856
|
|
|
|
|
|
|
$e_string .= e_capture($1); |
4857
|
|
|
|
|
|
|
$slash = 'div'; |
4858
|
|
|
|
|
|
|
} |
4859
|
|
|
|
|
|
|
|
4860
|
|
|
|
|
|
|
# variable or function |
4861
|
3
|
|
|
|
|
14
|
# $ @ % & * $ # |
4862
|
0
|
|
|
|
|
0
|
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) { |
4863
|
|
|
|
|
|
|
$e_string .= $1; |
4864
|
|
|
|
|
|
|
$slash = 'div'; |
4865
|
|
|
|
|
|
|
} |
4866
|
|
|
|
|
|
|
# $ $ $ $ $ $ $ $ $ $ $ $ $ $ |
4867
|
0
|
|
|
|
|
0
|
# $ @ # \ ' " / ? ( ) [ ] < > |
4868
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ( \$[\$\@\#\\\'\"\/\?\(\)\[\]\<\>] ) /oxmsgc) { |
4869
|
|
|
|
|
|
|
$e_string .= $1; |
4870
|
|
|
|
|
|
|
$slash = 'div'; |
4871
|
|
|
|
|
|
|
} |
4872
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
4873
|
0
|
|
|
|
|
0
|
# subroutines of package Eeucjp |
|
0
|
|
|
|
|
0
|
|
4874
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b (CORE:: | ->(>?\s*) (?: atan2 | [a-z]{2,})) \b /oxgc) { $e_string .= $1; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4875
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b Char::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4876
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b EUCJP::eval (?= (?>\s*) \{ ) /oxgc) { $e_string .= 'eval'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4877
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b Char::eval \b /oxgc) { $e_string .= 'eval Char::escape'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4878
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b EUCJP::eval \b /oxgc) { $e_string .= 'eval EUCJP::escape'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4879
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b bytes::substr \b /oxgc) { $e_string .= 'substr'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4880
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b chop \b /oxgc) { $e_string .= 'Eeucjp::chop'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4881
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b bytes::index \b /oxgc) { $e_string .= 'index'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4882
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b Char::index \b /oxgc) { $e_string .= 'Char::index'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4883
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b EUCJP::index \b /oxgc) { $e_string .= 'EUCJP::index'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4884
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b index \b /oxgc) { $e_string .= 'Eeucjp::index'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4885
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b bytes::rindex \b /oxgc) { $e_string .= 'rindex'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4886
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b Char::rindex \b /oxgc) { $e_string .= 'Char::rindex'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4887
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b EUCJP::rindex \b /oxgc) { $e_string .= 'EUCJP::rindex'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4888
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b rindex \b /oxgc) { $e_string .= 'Eeucjp::rindex'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4889
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b lc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Eeucjp::lc'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4890
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b lcfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Eeucjp::lcfirst'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4891
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b uc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Eeucjp::uc'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4892
|
|
|
|
|
|
|
elsif ($string =~ /\G \b ucfirst (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Eeucjp::ucfirst'; $slash = 'm//'; } |
4893
|
|
|
|
|
|
|
elsif ($string =~ /\G \b fc (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Eeucjp::fc'; $slash = 'm//'; } |
4894
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
4895
|
0
|
|
|
|
|
0
|
# "-s '' ..." means file test "-s 'filename' ..." (not means "- s/// ...") |
|
0
|
|
|
|
|
0
|
|
4896
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G -s (?>\s*) (\") ((?:$qq_char)+?) (\") /oxgc) { $e_string .= '-s ' . e_qq('', $1,$3,$2); $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4897
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\#) ((?:$qq_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4898
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\() ((?:$qq_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4899
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\{) ((?:$qq_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4900
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\[) ((?:$qq_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4901
|
|
|
|
|
|
|
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\<) ((?:$qq_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; } |
4902
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G -s (?>\s+) qq (?>\s*) (\S) ((?:$qq_char)+?) (\1) /oxgc) { $e_string .= '-s ' . e_qq('qq',$1,$3,$2); $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4903
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
4904
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G -s (?>\s*) (\') ((?:\\\'|\\\\|$q_char)+?) (\') /oxgc) { $e_string .= '-s ' . e_q ('', $1,$3,$2); $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4905
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\#) ((?:\\\#|\\\\|$q_char)+?) (\#) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4906
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\() ((?:\\\)|\\\\|$q_paren)+?) (\)) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4907
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\{) ((?:\\\}|\\\\|$q_brace)+?) (\}) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4908
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\[) ((?:\\\]|\\\\|$q_bracket)+?) (\]) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4909
|
|
|
|
|
|
|
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\<) ((?:\\\>|\\\\|$q_angle)+?) (\>) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; } |
4910
|
|
|
|
|
|
|
elsif ($string =~ /\G -s (?>\s+) q (?>\s*) (\S) ((?:\\\1|\\\\|$q_char)+?) (\1) /oxgc) { $e_string .= '-s ' . e_q ('q', $1,$3,$2); $slash = 'm//'; } |
4911
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
4912
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G -s (?>\s*) (\$ (?> \w+ (?: ::\w+)*) (?: (?: ->)? (?: [\$\@\%\&\*]\* | \$\#\* | \( (?:$qq_paren)*? \) | [\@\%\*]? \{ (?:$qq_brace)+? \} | [\@\%]? \[ (?:$qq_bracket)+? \] ))*) /oxgc) |
|
0
|
|
|
|
|
0
|
|
4913
|
0
|
|
|
|
|
0
|
{ $e_string .= "-s $1"; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4914
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G -s (?>\s*) \( ((?:$qq_paren)*?) \) /oxgc) { $e_string .= "-s ($1)"; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4915
|
|
|
|
|
|
|
elsif ($string =~ /\G -s (?= (?>\s+) [a-z]+) /oxgc) { $e_string .= '-s'; $slash = 'm//'; } |
4916
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G -s (?>\s+) ((?>\w+)) /oxgc) { $e_string .= "-s $1"; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4917
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
4918
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b bytes::length (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'length'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4919
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b bytes::chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'chr'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4920
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b chr (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Eeucjp::chr'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4921
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b bytes::ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'ord'; $slash = 'div'; } |
|
0
|
|
|
|
|
0
|
|
4922
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b ord (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= $function_ord; $slash = 'div'; } |
|
0
|
|
|
|
|
0
|
|
4923
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b glob (?= (?>\s+)[A-Za-z_]|(?>\s*)['"`\$\@\&\*\(]) /oxgc) { $e_string .= 'Eeucjp::glob'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4924
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b lc \b /oxgc) { $e_string .= 'Eeucjp::lc_'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4925
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b lcfirst \b /oxgc) { $e_string .= 'Eeucjp::lcfirst_'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4926
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b uc \b /oxgc) { $e_string .= 'Eeucjp::uc_'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4927
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b ucfirst \b /oxgc) { $e_string .= 'Eeucjp::ucfirst_'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4928
|
|
|
|
|
|
|
elsif ($string =~ /\G \b fc \b /oxgc) { $e_string .= 'Eeucjp::fc_'; $slash = 'm//'; } |
4929
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G -s \b /oxgc) { $e_string .= '-s '; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4930
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
4931
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b bytes::length \b /oxgc) { $e_string .= 'length'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4932
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b bytes::chr \b /oxgc) { $e_string .= 'chr'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4933
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b chr \b /oxgc) { $e_string .= 'Eeucjp::chr_'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4934
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b bytes::ord \b /oxgc) { $e_string .= 'ord'; $slash = 'div'; } |
|
0
|
|
|
|
|
0
|
|
4935
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b ord \b /oxgc) { $e_string .= $function_ord_; $slash = 'div'; } |
|
0
|
|
|
|
|
0
|
|
4936
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b glob \b /oxgc) { $e_string .= 'Eeucjp::glob_'; $slash = 'm//'; } |
|
0
|
|
|
|
|
0
|
|
4937
|
|
|
|
|
|
|
elsif ($string =~ /\G \b reverse \b /oxgc) { $e_string .= $function_reverse; $slash = 'm//'; } |
4938
|
|
|
|
|
|
|
elsif ($string =~ /\G \b getc \b /oxgc) { $e_string .= $function_getc; $slash = 'm//'; } |
4939
|
0
|
|
|
|
|
0
|
# split |
4940
|
|
|
|
|
|
|
elsif ($string =~ /\G \b (split) \b (?! (?>\s*) => ) /oxgc) { |
4941
|
0
|
|
|
|
|
0
|
$slash = 'm//'; |
4942
|
0
|
|
|
|
|
0
|
|
4943
|
0
|
|
|
|
|
0
|
my $e = ''; |
4944
|
|
|
|
|
|
|
while ($string =~ /\G ( (?>\s+) | \( | \#.* ) /oxgc) { |
4945
|
|
|
|
|
|
|
$e .= $1; |
4946
|
|
|
|
|
|
|
} |
4947
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
4948
|
|
|
|
|
|
|
# end of split |
4949
|
|
|
|
|
|
|
if ($string =~ /\G (?= [,;\)\}\]] ) /oxgc) { return 'Eeucjp::split' . $e; } |
4950
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
4951
|
|
|
|
|
|
|
# split scalar value |
4952
|
|
|
|
|
|
|
elsif ($string =~ /\G ( [\$\@\&\*] $qq_scalar ) /oxgc) { $e_string .= 'Eeucjp::split' . $e . e_string($1); next E_STRING_LOOP; } |
4953
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
4954
|
0
|
|
|
|
|
0
|
# split literal space |
|
0
|
|
|
|
|
0
|
|
4955
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b qq (\#) [ ] (\#) /oxgc) { $e_string .= 'Eeucjp::split' . $e . qq {qq$1 $2}; next E_STRING_LOOP; } |
|
0
|
|
|
|
|
0
|
|
4956
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b qq ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Eeucjp::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; } |
|
0
|
|
|
|
|
0
|
|
4957
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b qq ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Eeucjp::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; } |
|
0
|
|
|
|
|
0
|
|
4958
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b qq ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Eeucjp::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; } |
|
0
|
|
|
|
|
0
|
|
4959
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b qq ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Eeucjp::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; } |
|
0
|
|
|
|
|
0
|
|
4960
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b qq ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Eeucjp::split' . $e . qq{$1qq$2 $3}; next E_STRING_LOOP; } |
|
0
|
|
|
|
|
0
|
|
4961
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b q (\#) [ ] (\#) /oxgc) { $e_string .= 'Eeucjp::split' . $e . qq {q$1 $2}; next E_STRING_LOOP; } |
|
0
|
|
|
|
|
0
|
|
4962
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b q ((?>\s*)) (\() [ ] (\)) /oxgc) { $e_string .= 'Eeucjp::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; } |
|
0
|
|
|
|
|
0
|
|
4963
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b q ((?>\s*)) (\{) [ ] (\}) /oxgc) { $e_string .= 'Eeucjp::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; } |
|
0
|
|
|
|
|
0
|
|
4964
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b q ((?>\s*)) (\[) [ ] (\]) /oxgc) { $e_string .= 'Eeucjp::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; } |
|
0
|
|
|
|
|
0
|
|
4965
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b q ((?>\s*)) (\<) [ ] (\>) /oxgc) { $e_string .= 'Eeucjp::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; } |
|
0
|
|
|
|
|
0
|
|
4966
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G \b q ((?>\s*)) (\S) [ ] (\2) /oxgc) { $e_string .= 'Eeucjp::split' . $e . qq {$1q$2 $3}; next E_STRING_LOOP; } |
|
0
|
|
|
|
|
0
|
|
4967
|
|
|
|
|
|
|
elsif ($string =~ /\G ' [ ] ' /oxgc) { $e_string .= 'Eeucjp::split' . $e . qq {' '}; next E_STRING_LOOP; } |
4968
|
|
|
|
|
|
|
elsif ($string =~ /\G " [ ] " /oxgc) { $e_string .= 'Eeucjp::split' . $e . qq {" "}; next E_STRING_LOOP; } |
4969
|
|
|
|
|
|
|
|
4970
|
0
|
0
|
|
|
|
0
|
# split qq// |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
4971
|
|
|
|
|
|
|
elsif ($string =~ /\G \b (qq) \b /oxgc) { |
4972
|
0
|
|
|
|
|
0
|
if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq# # --> qr # # |
4973
|
0
|
0
|
|
|
|
0
|
else { |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
4974
|
0
|
|
|
|
|
0
|
while ($string !~ /\G \z/oxgc) { |
|
0
|
|
|
|
|
0
|
|
4975
|
0
|
|
|
|
|
0
|
if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; } |
|
0
|
|
|
|
|
0
|
|
4976
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq ( ) --> qr ( ) |
|
0
|
|
|
|
|
0
|
|
4977
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq { } --> qr { } |
|
0
|
|
|
|
|
0
|
|
4978
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq [ ] --> qr [ ] |
|
0
|
|
|
|
|
0
|
|
4979
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq < > --> qr < > |
|
0
|
|
|
|
|
0
|
|
4980
|
|
|
|
|
|
|
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # qq | | --> qr { } |
4981
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= e_split($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # qq * * --> qr * * |
4982
|
|
|
|
|
|
|
} |
4983
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
4984
|
|
|
|
|
|
|
} |
4985
|
|
|
|
|
|
|
} |
4986
|
|
|
|
|
|
|
|
4987
|
0
|
0
|
|
|
|
0
|
# split qr// |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
4988
|
|
|
|
|
|
|
elsif ($string =~ /\G \b (qr) \b /oxgc) { |
4989
|
0
|
|
|
|
|
0
|
if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1,$3,$2,$4); next E_STRING_LOOP; } # qr# # |
4990
|
0
|
0
|
|
|
|
0
|
else { |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
4991
|
0
|
|
|
|
|
0
|
while ($string !~ /\G \z/oxgc) { |
|
0
|
|
|
|
|
0
|
|
4992
|
0
|
|
|
|
|
0
|
if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; } |
|
0
|
|
|
|
|
0
|
|
4993
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ( ) |
|
0
|
|
|
|
|
0
|
|
4994
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr { } |
|
0
|
|
|
|
|
0
|
|
4995
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr [ ] |
|
0
|
|
|
|
|
0
|
|
4996
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr < > |
|
0
|
|
|
|
|
0
|
|
4997
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split_q($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # qr ' ' |
|
0
|
|
|
|
|
0
|
|
4998
|
|
|
|
|
|
|
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([imosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # qr | | --> qr { } |
4999
|
0
|
|
|
|
|
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 * * |
5000
|
|
|
|
|
|
|
} |
5001
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
5002
|
|
|
|
|
|
|
} |
5003
|
|
|
|
|
|
|
} |
5004
|
|
|
|
|
|
|
|
5005
|
0
|
0
|
|
|
|
0
|
# split q// |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
5006
|
|
|
|
|
|
|
elsif ($string =~ /\G \b (q) \b /oxgc) { |
5007
|
0
|
|
|
|
|
0
|
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q# # --> qr # # |
5008
|
0
|
0
|
|
|
|
0
|
else { |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
5009
|
0
|
|
|
|
|
0
|
while ($string !~ /\G \z/oxgc) { |
|
0
|
|
|
|
|
0
|
|
5010
|
0
|
|
|
|
|
0
|
if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; } |
|
0
|
|
|
|
|
0
|
|
5011
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q ( ) --> qr ( ) |
|
0
|
|
|
|
|
0
|
|
5012
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q { } --> qr { } |
|
0
|
|
|
|
|
0
|
|
5013
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q [ ] --> qr [ ] |
|
0
|
|
|
|
|
0
|
|
5014
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= e_split_q($e.'qr',$1,$3,$2,''); next E_STRING_LOOP; } # q < > --> qr < > |
|
0
|
|
|
|
|
0
|
|
5015
|
|
|
|
|
|
|
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$q_char)*?) (\1) /oxgc) { $e_string .= e_split_q($e.'qr','{','}',$2,''); next E_STRING_LOOP; } # q | | --> qr { } |
5016
|
0
|
|
|
|
|
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 * * |
5017
|
|
|
|
|
|
|
} |
5018
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
5019
|
|
|
|
|
|
|
} |
5020
|
|
|
|
|
|
|
} |
5021
|
|
|
|
|
|
|
|
5022
|
0
|
0
|
|
|
|
0
|
# split m// |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
5023
|
|
|
|
|
|
|
elsif ($string =~ /\G \b (m) \b /oxgc) { |
5024
|
0
|
|
|
|
|
0
|
if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1,$3,$2,$4); next E_STRING_LOOP; } # m# # --> qr # # |
5025
|
0
|
0
|
|
|
|
0
|
else { |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
5026
|
0
|
|
|
|
|
0
|
while ($string !~ /\G \z/oxgc) { |
|
0
|
|
|
|
|
0
|
|
5027
|
0
|
|
|
|
|
0
|
if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e_string .= $e . $1; } |
|
0
|
|
|
|
|
0
|
|
5028
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m ( ) --> qr ( ) |
|
0
|
|
|
|
|
0
|
|
5029
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m { } --> qr { } |
|
0
|
|
|
|
|
0
|
|
5030
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m [ ] --> qr [ ] |
|
0
|
|
|
|
|
0
|
|
5031
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr',$1, $3, $2,$4); next E_STRING_LOOP; } # m < > --> qr < > |
|
0
|
|
|
|
|
0
|
|
5032
|
0
|
|
|
|
|
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 ' ' |
|
0
|
|
|
|
|
0
|
|
5033
|
|
|
|
|
|
|
elsif ($string =~ /\G ([*\-:?\\^|]) ((?:$qq_char)*?) (\1) ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split ($e.'qr','{','}',$2,$4); next E_STRING_LOOP; } # m | | --> qr { } |
5034
|
0
|
|
|
|
|
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 * * |
5035
|
|
|
|
|
|
|
} |
5036
|
|
|
|
|
|
|
die __FILE__, ": Search pattern not terminated\n"; |
5037
|
|
|
|
|
|
|
} |
5038
|
|
|
|
|
|
|
} |
5039
|
|
|
|
|
|
|
|
5040
|
0
|
|
|
|
|
0
|
# split '' |
5041
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\') /oxgc) { |
5042
|
0
|
0
|
|
|
|
0
|
my $q_string = ''; |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
5043
|
0
|
|
|
|
|
0
|
while ($string !~ /\G \z/oxgc) { |
5044
|
0
|
|
|
|
|
0
|
if ($string =~ /\G (\\\\) /oxgc) { $q_string .= $1; } |
|
0
|
|
|
|
|
0
|
|
5045
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\\\') /oxgc) { $q_string .= $1; } # splitqr'' --> split qr'' |
5046
|
|
|
|
|
|
|
elsif ($string =~ /\G \' /oxgc) { $e_string .= e_split_q($e.q{ qr},"'","'",$q_string,''); next E_STRING_LOOP; } # ' ' --> qr ' ' |
5047
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ($q_char) /oxgc) { $q_string .= $1; } |
5048
|
|
|
|
|
|
|
} |
5049
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
5050
|
|
|
|
|
|
|
} |
5051
|
|
|
|
|
|
|
|
5052
|
0
|
|
|
|
|
0
|
# split "" |
5053
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\") /oxgc) { |
5054
|
0
|
0
|
|
|
|
0
|
my $qq_string = ''; |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
5055
|
0
|
|
|
|
|
0
|
while ($string !~ /\G \z/oxgc) { |
5056
|
0
|
|
|
|
|
0
|
if ($string =~ /\G (\\\\) /oxgc) { $qq_string .= $1; } |
|
0
|
|
|
|
|
0
|
|
5057
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\\\") /oxgc) { $qq_string .= $1; } # splitqr"" --> split qr"" |
5058
|
|
|
|
|
|
|
elsif ($string =~ /\G \" /oxgc) { $e_string .= e_split($e.q{ qr},'"','"',$qq_string,''); next E_STRING_LOOP; } # " " --> qr " " |
5059
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ($q_char) /oxgc) { $qq_string .= $1; } |
5060
|
|
|
|
|
|
|
} |
5061
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
5062
|
|
|
|
|
|
|
} |
5063
|
|
|
|
|
|
|
|
5064
|
0
|
|
|
|
|
0
|
# split // |
5065
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\/) /oxgc) { |
5066
|
0
|
0
|
|
|
|
0
|
my $regexp = ''; |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
5067
|
0
|
|
|
|
|
0
|
while ($string !~ /\G \z/oxgc) { |
5068
|
0
|
|
|
|
|
0
|
if ($string =~ /\G (\\\\) /oxgc) { $regexp .= $1; } |
|
0
|
|
|
|
|
0
|
|
5069
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\\\/) /oxgc) { $regexp .= $1; } # splitqr// --> split qr// |
5070
|
|
|
|
|
|
|
elsif ($string =~ /\G \/ ([cgimosxpadlunbB]*) /oxgc) { $e_string .= e_split($e.q{ qr}, '/','/',$regexp,$1); next E_STRING_LOOP; } # / / --> qr / / |
5071
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ($q_char) /oxgc) { $regexp .= $1; } |
5072
|
|
|
|
|
|
|
} |
5073
|
|
|
|
|
|
|
die __FILE__, ": Search pattern not terminated\n"; |
5074
|
|
|
|
|
|
|
} |
5075
|
|
|
|
|
|
|
} |
5076
|
|
|
|
|
|
|
|
5077
|
0
|
|
|
|
|
0
|
# qq// |
5078
|
0
|
0
|
|
|
|
0
|
elsif ($string =~ /\G \b (qq) \b /oxgc) { |
5079
|
0
|
|
|
|
|
0
|
my $ope = $1; |
5080
|
|
|
|
|
|
|
if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qq# # |
5081
|
|
|
|
|
|
|
$e_string .= e_qq($ope,$1,$3,$2); |
5082
|
0
|
|
|
|
|
0
|
} |
5083
|
0
|
|
|
|
|
0
|
else { |
5084
|
0
|
0
|
|
|
|
0
|
my $e = ''; |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
5085
|
0
|
|
|
|
|
0
|
while ($string !~ /\G \z/oxgc) { |
|
0
|
|
|
|
|
0
|
|
5086
|
0
|
|
|
|
|
0
|
if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
|
0
|
|
|
|
|
0
|
|
5087
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq ( ) |
|
0
|
|
|
|
|
0
|
|
5088
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq { } |
|
0
|
|
|
|
|
0
|
|
5089
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq [ ] |
|
0
|
|
|
|
|
0
|
|
5090
|
|
|
|
|
|
|
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq < > |
5091
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qq * * |
5092
|
|
|
|
|
|
|
} |
5093
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
5094
|
|
|
|
|
|
|
} |
5095
|
|
|
|
|
|
|
} |
5096
|
|
|
|
|
|
|
|
5097
|
0
|
|
|
|
|
0
|
# qx// |
5098
|
0
|
0
|
|
|
|
0
|
elsif ($string =~ /\G \b (qx) \b /oxgc) { |
5099
|
0
|
|
|
|
|
0
|
my $ope = $1; |
5100
|
|
|
|
|
|
|
if ($string =~ /\G (\#) ((?:$qq_char)*?) (\#) /oxgc) { # qx# # |
5101
|
|
|
|
|
|
|
$e_string .= e_qq($ope,$1,$3,$2); |
5102
|
0
|
|
|
|
|
0
|
} |
5103
|
0
|
|
|
|
|
0
|
else { |
5104
|
0
|
0
|
|
|
|
0
|
my $e = ''; |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
5105
|
0
|
|
|
|
|
0
|
while ($string !~ /\G \z/oxgc) { |
|
0
|
|
|
|
|
0
|
|
5106
|
0
|
|
|
|
|
0
|
if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
|
0
|
|
|
|
|
0
|
|
5107
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\() ((?:$qq_paren)*?) (\)) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ( ) |
|
0
|
|
|
|
|
0
|
|
5108
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\{) ((?:$qq_brace)*?) (\}) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx { } |
|
0
|
|
|
|
|
0
|
|
5109
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\[) ((?:$qq_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx [ ] |
|
0
|
|
|
|
|
0
|
|
5110
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\<) ((?:$qq_angle)*?) (\>) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx < > |
|
0
|
|
|
|
|
0
|
|
5111
|
|
|
|
|
|
|
elsif ($string =~ /\G (\') ((?:$qq_char)*?) (\') /oxgc) { $e_string .= $e . e_q ($ope,$1,$3,$2); next E_STRING_LOOP; } # qx ' ' |
5112
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\S) ((?:$qq_char)*?) (\1) /oxgc) { $e_string .= $e . e_qq($ope,$1,$3,$2); next E_STRING_LOOP; } # qx * * |
5113
|
|
|
|
|
|
|
} |
5114
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
5115
|
|
|
|
|
|
|
} |
5116
|
|
|
|
|
|
|
} |
5117
|
|
|
|
|
|
|
|
5118
|
0
|
|
|
|
|
0
|
# q// |
5119
|
0
|
0
|
|
|
|
0
|
elsif ($string =~ /\G \b (q) \b /oxgc) { |
5120
|
0
|
|
|
|
|
0
|
my $ope = $1; |
5121
|
|
|
|
|
|
|
if ($string =~ /\G (\#) ((?:\\\#|\\\\|$q_char)*?) (\#) /oxgc) { # q# # |
5122
|
|
|
|
|
|
|
$e_string .= e_q($ope,$1,$3,$2); |
5123
|
0
|
|
|
|
|
0
|
} |
5124
|
0
|
|
|
|
|
0
|
else { |
5125
|
0
|
0
|
|
|
|
0
|
my $e = ''; |
|
0
|
0
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
5126
|
0
|
|
|
|
|
0
|
while ($string !~ /\G \z/oxgc) { |
|
0
|
|
|
|
|
0
|
|
5127
|
0
|
|
|
|
|
0
|
if ($string =~ /\G ((?>\s+)|\#.*) /oxgc) { $e .= $1; } |
|
0
|
|
|
|
|
0
|
|
5128
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\() ((?:\\\\|\\\)|\\\(|$q_paren)*?) (\)) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q ( ) |
|
0
|
|
|
|
|
0
|
|
5129
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\{) ((?:\\\\|\\\}|\\\{|$q_brace)*?) (\}) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q { } |
|
0
|
|
|
|
|
0
|
|
5130
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\[) ((?:\\\\|\\\]|\\\[|$q_bracket)*?) (\]) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q [ ] |
|
0
|
|
|
|
|
0
|
|
5131
|
|
|
|
|
|
|
elsif ($string =~ /\G (\<) ((?:\\\\|\\\>|\\\<|$q_angle)*?) (\>) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q < > |
5132
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G (\S) ((?:\\\\|\\\1| $q_char)*?) (\1) /oxgc) { $e_string .= $e . e_q($ope,$1,$3,$2); next E_STRING_LOOP; } # q * * |
5133
|
|
|
|
|
|
|
} |
5134
|
|
|
|
|
|
|
die __FILE__, ": Can't find string terminator anywhere before EOF\n"; |
5135
|
|
|
|
|
|
|
} |
5136
|
|
|
|
|
|
|
} |
5137
|
0
|
|
|
|
|
0
|
|
5138
|
|
|
|
|
|
|
# '' |
5139
|
|
|
|
|
|
|
elsif ($string =~ /\G (?
|
5140
|
12
|
|
|
|
|
35
|
|
5141
|
|
|
|
|
|
|
# "" |
5142
|
|
|
|
|
|
|
elsif ($string =~ /\G (\") ((?:$qq_char)*?) (\") /oxgc) { $e_string .= e_qq('',$1,$3,$2); } |
5143
|
6
|
|
|
|
|
36
|
|
5144
|
|
|
|
|
|
|
# `` |
5145
|
|
|
|
|
|
|
elsif ($string =~ /\G (\`) ((?:$qq_char)*?) (\`) /oxgc) { $e_string .= e_qq('',$1,$3,$2); } |
5146
|
0
|
|
|
|
|
0
|
|
5147
|
|
|
|
|
|
|
# <<>> (a safer ARGV) |
5148
|
|
|
|
|
|
|
elsif ($string =~ /\G ( <<>> ) /oxgc) { $e_string .= $1; } |
5149
|
0
|
|
|
|
|
0
|
|
5150
|
|
|
|
|
|
|
# <<= <=> <= < operator |
5151
|
|
|
|
|
|
|
elsif ($string =~ /\G ( <<= | <=> | <= | < ) (?= (?>\s*) [A-Za-z_0-9'"`\$\@\&\*\(\+\-] )/oxgc) { $e_string .= $1; } |
5152
|
0
|
|
|
|
|
0
|
|
5153
|
|
|
|
|
|
|
# |
5154
|
|
|
|
|
|
|
elsif ($string =~ /\G (<[\$]?[A-Za-z_][A-Za-z_0-9]*>) /oxgc) { $e_string .= $1; } |
5155
|
|
|
|
|
|
|
|
5156
|
0
|
|
|
|
|
0
|
# --- glob |
5157
|
|
|
|
|
|
|
elsif ($string =~ /\G < ((?:$q_char)+?) > /oxgc) { |
5158
|
|
|
|
|
|
|
$e_string .= 'Eeucjp::glob("' . $1 . '")'; |
5159
|
|
|
|
|
|
|
} |
5160
|
|
|
|
|
|
|
|
5161
|
0
|
|
|
|
|
0
|
# << (bit shift) --- not here document |
5162
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ( << (?>\s*) ) (?= [0-9\$\@\&] ) /oxgc) { |
5163
|
|
|
|
|
|
|
$slash = 'm//'; |
5164
|
|
|
|
|
|
|
$e_string .= $1; |
5165
|
|
|
|
|
|
|
} |
5166
|
|
|
|
|
|
|
|
5167
|
0
|
|
|
|
|
0
|
# <<~'HEREDOC' |
5168
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ( <<~ [\t ]* '([a-zA-Z_0-9]*)' ) /oxgc) { |
5169
|
0
|
|
|
|
|
0
|
$slash = 'm//'; |
5170
|
|
|
|
|
|
|
my $here_quote = $1; |
5171
|
|
|
|
|
|
|
my $delimiter = $2; |
5172
|
0
|
0
|
|
|
|
0
|
|
5173
|
0
|
|
|
|
|
0
|
# get here document |
5174
|
0
|
|
|
|
|
0
|
if ($here_script eq '') { |
5175
|
|
|
|
|
|
|
$here_script = CORE::substr $_, pos $_; |
5176
|
0
|
0
|
|
|
|
0
|
$here_script =~ s/.*?\n//oxm; |
5177
|
0
|
|
|
|
|
0
|
} |
5178
|
0
|
|
|
|
|
0
|
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) { |
5179
|
0
|
|
|
|
|
0
|
my $heredoc = $1; |
5180
|
0
|
|
|
|
|
0
|
my $indent = $2; |
5181
|
0
|
|
|
|
|
0
|
$heredoc =~ s{^$indent}{}msg; # no /ox |
5182
|
|
|
|
|
|
|
push @heredoc, $heredoc . qq{\n$delimiter\n}; |
5183
|
|
|
|
|
|
|
push @heredoc_delimiter, qq{\\s*$delimiter}; |
5184
|
0
|
|
|
|
|
0
|
} |
5185
|
|
|
|
|
|
|
else { |
5186
|
0
|
|
|
|
|
0
|
die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n"; |
5187
|
|
|
|
|
|
|
} |
5188
|
|
|
|
|
|
|
$e_string .= qq{<<'$delimiter'}; |
5189
|
|
|
|
|
|
|
} |
5190
|
|
|
|
|
|
|
|
5191
|
0
|
|
|
|
|
0
|
# <<~\HEREDOC |
5192
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ( <<~ \\([a-zA-Z_0-9]+) ) /oxgc) { |
5193
|
0
|
|
|
|
|
0
|
$slash = 'm//'; |
5194
|
|
|
|
|
|
|
my $here_quote = $1; |
5195
|
|
|
|
|
|
|
my $delimiter = $2; |
5196
|
0
|
0
|
|
|
|
0
|
|
5197
|
0
|
|
|
|
|
0
|
# get here document |
5198
|
0
|
|
|
|
|
0
|
if ($here_script eq '') { |
5199
|
|
|
|
|
|
|
$here_script = CORE::substr $_, pos $_; |
5200
|
0
|
0
|
|
|
|
0
|
$here_script =~ s/.*?\n//oxm; |
5201
|
0
|
|
|
|
|
0
|
} |
5202
|
0
|
|
|
|
|
0
|
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) { |
5203
|
0
|
|
|
|
|
0
|
my $heredoc = $1; |
5204
|
0
|
|
|
|
|
0
|
my $indent = $2; |
5205
|
0
|
|
|
|
|
0
|
$heredoc =~ s{^$indent}{}msg; # no /ox |
5206
|
|
|
|
|
|
|
push @heredoc, $heredoc . qq{\n$delimiter\n}; |
5207
|
|
|
|
|
|
|
push @heredoc_delimiter, qq{\\s*$delimiter}; |
5208
|
0
|
|
|
|
|
0
|
} |
5209
|
|
|
|
|
|
|
else { |
5210
|
0
|
|
|
|
|
0
|
die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n"; |
5211
|
|
|
|
|
|
|
} |
5212
|
|
|
|
|
|
|
$e_string .= qq{<<\\$delimiter}; |
5213
|
|
|
|
|
|
|
} |
5214
|
|
|
|
|
|
|
|
5215
|
0
|
|
|
|
|
0
|
# <<~"HEREDOC" |
5216
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ( <<~ [\t ]* "([a-zA-Z_0-9]*)" ) /oxgc) { |
5217
|
0
|
|
|
|
|
0
|
$slash = 'm//'; |
5218
|
|
|
|
|
|
|
my $here_quote = $1; |
5219
|
|
|
|
|
|
|
my $delimiter = $2; |
5220
|
0
|
0
|
|
|
|
0
|
|
5221
|
0
|
|
|
|
|
0
|
# get here document |
5222
|
0
|
|
|
|
|
0
|
if ($here_script eq '') { |
5223
|
|
|
|
|
|
|
$here_script = CORE::substr $_, pos $_; |
5224
|
0
|
0
|
|
|
|
0
|
$here_script =~ s/.*?\n//oxm; |
5225
|
0
|
|
|
|
|
0
|
} |
5226
|
0
|
|
|
|
|
0
|
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) { |
5227
|
0
|
|
|
|
|
0
|
my $heredoc = $1; |
5228
|
0
|
|
|
|
|
0
|
my $indent = $2; |
5229
|
0
|
|
|
|
|
0
|
$heredoc =~ s{^$indent}{}msg; # no /ox |
5230
|
|
|
|
|
|
|
push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n}; |
5231
|
|
|
|
|
|
|
push @heredoc_delimiter, qq{\\s*$delimiter}; |
5232
|
0
|
|
|
|
|
0
|
} |
5233
|
|
|
|
|
|
|
else { |
5234
|
0
|
|
|
|
|
0
|
die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n"; |
5235
|
|
|
|
|
|
|
} |
5236
|
|
|
|
|
|
|
$e_string .= qq{<<"$delimiter"}; |
5237
|
|
|
|
|
|
|
} |
5238
|
|
|
|
|
|
|
|
5239
|
0
|
|
|
|
|
0
|
# <<~HEREDOC |
5240
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ( <<~ ([a-zA-Z_0-9]+) ) /oxgc) { |
5241
|
0
|
|
|
|
|
0
|
$slash = 'm//'; |
5242
|
|
|
|
|
|
|
my $here_quote = $1; |
5243
|
|
|
|
|
|
|
my $delimiter = $2; |
5244
|
0
|
0
|
|
|
|
0
|
|
5245
|
0
|
|
|
|
|
0
|
# get here document |
5246
|
0
|
|
|
|
|
0
|
if ($here_script eq '') { |
5247
|
|
|
|
|
|
|
$here_script = CORE::substr $_, pos $_; |
5248
|
0
|
0
|
|
|
|
0
|
$here_script =~ s/.*?\n//oxm; |
5249
|
0
|
|
|
|
|
0
|
} |
5250
|
0
|
|
|
|
|
0
|
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) { |
5251
|
0
|
|
|
|
|
0
|
my $heredoc = $1; |
5252
|
0
|
|
|
|
|
0
|
my $indent = $2; |
5253
|
0
|
|
|
|
|
0
|
$heredoc =~ s{^$indent}{}msg; # no /ox |
5254
|
|
|
|
|
|
|
push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n}; |
5255
|
|
|
|
|
|
|
push @heredoc_delimiter, qq{\\s*$delimiter}; |
5256
|
0
|
|
|
|
|
0
|
} |
5257
|
|
|
|
|
|
|
else { |
5258
|
0
|
|
|
|
|
0
|
die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n"; |
5259
|
|
|
|
|
|
|
} |
5260
|
|
|
|
|
|
|
$e_string .= qq{<<$delimiter}; |
5261
|
|
|
|
|
|
|
} |
5262
|
|
|
|
|
|
|
|
5263
|
0
|
|
|
|
|
0
|
# <<~`HEREDOC` |
5264
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ( <<~ [\t ]* `([a-zA-Z_0-9]*)` ) /oxgc) { |
5265
|
0
|
|
|
|
|
0
|
$slash = 'm//'; |
5266
|
|
|
|
|
|
|
my $here_quote = $1; |
5267
|
|
|
|
|
|
|
my $delimiter = $2; |
5268
|
0
|
0
|
|
|
|
0
|
|
5269
|
0
|
|
|
|
|
0
|
# get here document |
5270
|
0
|
|
|
|
|
0
|
if ($here_script eq '') { |
5271
|
|
|
|
|
|
|
$here_script = CORE::substr $_, pos $_; |
5272
|
0
|
0
|
|
|
|
0
|
$here_script =~ s/.*?\n//oxm; |
5273
|
0
|
|
|
|
|
0
|
} |
5274
|
0
|
|
|
|
|
0
|
if ($here_script =~ s/\A (.*?) \n ([\t ]*) $delimiter \n //xms) { |
5275
|
0
|
|
|
|
|
0
|
my $heredoc = $1; |
5276
|
0
|
|
|
|
|
0
|
my $indent = $2; |
5277
|
0
|
|
|
|
|
0
|
$heredoc =~ s{^$indent}{}msg; # no /ox |
5278
|
|
|
|
|
|
|
push @heredoc, e_heredoc($heredoc) . qq{\n$delimiter\n}; |
5279
|
|
|
|
|
|
|
push @heredoc_delimiter, qq{\\s*$delimiter}; |
5280
|
0
|
|
|
|
|
0
|
} |
5281
|
|
|
|
|
|
|
else { |
5282
|
0
|
|
|
|
|
0
|
die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n"; |
5283
|
|
|
|
|
|
|
} |
5284
|
|
|
|
|
|
|
$e_string .= qq{<<`$delimiter`}; |
5285
|
|
|
|
|
|
|
} |
5286
|
|
|
|
|
|
|
|
5287
|
0
|
|
|
|
|
0
|
# <<'HEREDOC' |
5288
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ( << '([a-zA-Z_0-9]*)' ) /oxgc) { |
5289
|
0
|
|
|
|
|
0
|
$slash = 'm//'; |
5290
|
|
|
|
|
|
|
my $here_quote = $1; |
5291
|
|
|
|
|
|
|
my $delimiter = $2; |
5292
|
0
|
0
|
|
|
|
0
|
|
5293
|
0
|
|
|
|
|
0
|
# get here document |
5294
|
0
|
|
|
|
|
0
|
if ($here_script eq '') { |
5295
|
|
|
|
|
|
|
$here_script = CORE::substr $_, pos $_; |
5296
|
0
|
0
|
|
|
|
0
|
$here_script =~ s/.*?\n//oxm; |
5297
|
0
|
|
|
|
|
0
|
} |
5298
|
0
|
|
|
|
|
0
|
if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) { |
5299
|
|
|
|
|
|
|
push @heredoc, $1 . qq{\n$delimiter\n}; |
5300
|
|
|
|
|
|
|
push @heredoc_delimiter, $delimiter; |
5301
|
0
|
|
|
|
|
0
|
} |
5302
|
|
|
|
|
|
|
else { |
5303
|
0
|
|
|
|
|
0
|
die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n"; |
5304
|
|
|
|
|
|
|
} |
5305
|
|
|
|
|
|
|
$e_string .= $here_quote; |
5306
|
|
|
|
|
|
|
} |
5307
|
|
|
|
|
|
|
|
5308
|
0
|
|
|
|
|
0
|
# <<\HEREDOC |
5309
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ( << \\([a-zA-Z_0-9]+) ) /oxgc) { |
5310
|
0
|
|
|
|
|
0
|
$slash = 'm//'; |
5311
|
|
|
|
|
|
|
my $here_quote = $1; |
5312
|
|
|
|
|
|
|
my $delimiter = $2; |
5313
|
0
|
0
|
|
|
|
0
|
|
5314
|
0
|
|
|
|
|
0
|
# get here document |
5315
|
0
|
|
|
|
|
0
|
if ($here_script eq '') { |
5316
|
|
|
|
|
|
|
$here_script = CORE::substr $_, pos $_; |
5317
|
0
|
0
|
|
|
|
0
|
$here_script =~ s/.*?\n//oxm; |
5318
|
0
|
|
|
|
|
0
|
} |
5319
|
0
|
|
|
|
|
0
|
if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) { |
5320
|
|
|
|
|
|
|
push @heredoc, $1 . qq{\n$delimiter\n}; |
5321
|
|
|
|
|
|
|
push @heredoc_delimiter, $delimiter; |
5322
|
0
|
|
|
|
|
0
|
} |
5323
|
|
|
|
|
|
|
else { |
5324
|
0
|
|
|
|
|
0
|
die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n"; |
5325
|
|
|
|
|
|
|
} |
5326
|
|
|
|
|
|
|
$e_string .= $here_quote; |
5327
|
|
|
|
|
|
|
} |
5328
|
|
|
|
|
|
|
|
5329
|
0
|
|
|
|
|
0
|
# <<"HEREDOC" |
5330
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ( << "([a-zA-Z_0-9]*)" ) /oxgc) { |
5331
|
0
|
|
|
|
|
0
|
$slash = 'm//'; |
5332
|
|
|
|
|
|
|
my $here_quote = $1; |
5333
|
|
|
|
|
|
|
my $delimiter = $2; |
5334
|
0
|
0
|
|
|
|
0
|
|
5335
|
0
|
|
|
|
|
0
|
# get here document |
5336
|
0
|
|
|
|
|
0
|
if ($here_script eq '') { |
5337
|
|
|
|
|
|
|
$here_script = CORE::substr $_, pos $_; |
5338
|
0
|
0
|
|
|
|
0
|
$here_script =~ s/.*?\n//oxm; |
5339
|
0
|
|
|
|
|
0
|
} |
5340
|
0
|
|
|
|
|
0
|
if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) { |
5341
|
|
|
|
|
|
|
push @heredoc, e_heredoc($1) . qq{\n$delimiter\n}; |
5342
|
|
|
|
|
|
|
push @heredoc_delimiter, $delimiter; |
5343
|
0
|
|
|
|
|
0
|
} |
5344
|
|
|
|
|
|
|
else { |
5345
|
0
|
|
|
|
|
0
|
die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n"; |
5346
|
|
|
|
|
|
|
} |
5347
|
|
|
|
|
|
|
$e_string .= $here_quote; |
5348
|
|
|
|
|
|
|
} |
5349
|
|
|
|
|
|
|
|
5350
|
0
|
|
|
|
|
0
|
# <
|
5351
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ( << ([a-zA-Z_0-9]+) ) /oxgc) { |
5352
|
0
|
|
|
|
|
0
|
$slash = 'm//'; |
5353
|
|
|
|
|
|
|
my $here_quote = $1; |
5354
|
|
|
|
|
|
|
my $delimiter = $2; |
5355
|
0
|
0
|
|
|
|
0
|
|
5356
|
0
|
|
|
|
|
0
|
# get here document |
5357
|
0
|
|
|
|
|
0
|
if ($here_script eq '') { |
5358
|
|
|
|
|
|
|
$here_script = CORE::substr $_, pos $_; |
5359
|
0
|
0
|
|
|
|
0
|
$here_script =~ s/.*?\n//oxm; |
5360
|
0
|
|
|
|
|
0
|
} |
5361
|
0
|
|
|
|
|
0
|
if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) { |
5362
|
|
|
|
|
|
|
push @heredoc, e_heredoc($1) . qq{\n$delimiter\n}; |
5363
|
|
|
|
|
|
|
push @heredoc_delimiter, $delimiter; |
5364
|
0
|
|
|
|
|
0
|
} |
5365
|
|
|
|
|
|
|
else { |
5366
|
0
|
|
|
|
|
0
|
die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n"; |
5367
|
|
|
|
|
|
|
} |
5368
|
|
|
|
|
|
|
$e_string .= $here_quote; |
5369
|
|
|
|
|
|
|
} |
5370
|
|
|
|
|
|
|
|
5371
|
0
|
|
|
|
|
0
|
# <<`HEREDOC` |
5372
|
0
|
|
|
|
|
0
|
elsif ($string =~ /\G ( << `([a-zA-Z_0-9]*)` ) /oxgc) { |
5373
|
0
|
|
|
|
|
0
|
$slash = 'm//'; |
5374
|
|
|
|
|
|
|
my $here_quote = $1; |
5375
|
|
|
|
|
|
|
my $delimiter = $2; |
5376
|
0
|
0
|
|
|
|
0
|
|
5377
|
0
|
|
|
|
|
0
|
# get here document |
5378
|
0
|
|
|
|
|
0
|
if ($here_script eq '') { |
5379
|
|
|
|
|
|
|
$here_script = CORE::substr $_, pos $_; |
5380
|
0
|
0
|
|
|
|
0
|
$here_script =~ s/.*?\n//oxm; |
5381
|
0
|
|
|
|
|
0
|
} |
5382
|
0
|
|
|
|
|
0
|
if ($here_script =~ s/\A (.*?) \n $delimiter \n //xms) { |
5383
|
|
|
|
|
|
|
push @heredoc, e_heredoc($1) . qq{\n$delimiter\n}; |
5384
|
|
|
|
|
|
|
push @heredoc_delimiter, $delimiter; |
5385
|
0
|
|
|
|
|
0
|
} |
5386
|
|
|
|
|
|
|
else { |
5387
|
0
|
|
|
|
|
0
|
die __FILE__, ": Can't find string terminator $delimiter anywhere before EOF\n"; |
5388
|
|
|
|
|
|
|
} |
5389
|
|
|
|
|
|
|
$e_string .= $here_quote; |
5390
|
|
|
|
|
|
|
} |
5391
|
|
|
|
|
|
|
|
5392
|
|
|
|
|
|
|
# any operator before div |
5393
|
|
|
|
|
|
|
elsif ($string =~ /\G ( |
5394
|
|
|
|
|
|
|
-- | \+\+ | |
5395
|
0
|
|
|
|
|
0
|
[\)\}\]] |
|
39
|
|
|
|
|
63
|
|
5396
|
|
|
|
|
|
|
|
5397
|
|
|
|
|
|
|
) /oxgc) { $slash = 'div'; $e_string .= $1; } |
5398
|
|
|
|
|
|
|
|
5399
|
|
|
|
|
|
|
# yada-yada or triple-dot operator |
5400
|
|
|
|
|
|
|
elsif ($string =~ /\G ( |
5401
|
39
|
|
|
|
|
115
|
\.\.\. |
|
0
|
|
|
|
|
0
|
|
5402
|
|
|
|
|
|
|
|
5403
|
|
|
|
|
|
|
) /oxgc) { $slash = 'm//'; $e_string .= q{die('Unimplemented')}; } |
5404
|
|
|
|
|
|
|
|
5405
|
|
|
|
|
|
|
# any operator before m// |
5406
|
|
|
|
|
|
|
elsif ($string =~ /\G ((?> |
5407
|
|
|
|
|
|
|
|
5408
|
|
|
|
|
|
|
!~~ | !~ | != | ! | |
5409
|
|
|
|
|
|
|
%= | % | |
5410
|
|
|
|
|
|
|
&&= | && | &= | &\.= | &\. | & | |
5411
|
|
|
|
|
|
|
-= | -> | - | |
5412
|
|
|
|
|
|
|
:(?>\s*)= | |
5413
|
|
|
|
|
|
|
: | |
5414
|
|
|
|
|
|
|
<<>> | |
5415
|
|
|
|
|
|
|
<<= | <=> | <= | < | |
5416
|
|
|
|
|
|
|
== | => | =~ | = | |
5417
|
|
|
|
|
|
|
>>= | >> | >= | > | |
5418
|
|
|
|
|
|
|
\*\*= | \*\* | \*= | \* | |
5419
|
|
|
|
|
|
|
\+= | \+ | |
5420
|
|
|
|
|
|
|
\.\. | \.= | \. | |
5421
|
|
|
|
|
|
|
\/\/= | \/\/ | |
5422
|
|
|
|
|
|
|
\/= | \/ | |
5423
|
|
|
|
|
|
|
\? | |
5424
|
|
|
|
|
|
|
\\ | |
5425
|
|
|
|
|
|
|
\^= | \^\.= | \^\. | \^ | |
5426
|
|
|
|
|
|
|
\b x= | |
5427
|
|
|
|
|
|
|
\|\|= | \|\| | \|= | \|\.= | \|\. | \| | |
5428
|
|
|
|
|
|
|
~~ | ~\. | ~ | |
5429
|
|
|
|
|
|
|
\b(?: and | cmp | eq | ge | gt | le | lt | ne | not | or | xor | x )\b | |
5430
|
|
|
|
|
|
|
\b(?: print )\b | |
5431
|
|
|
|
|
|
|
|
5432
|
0
|
|
|
|
|
0
|
[,;\(\{\[] |
|
49
|
|
|
|
|
87
|
|
5433
|
|
|
|
|
|
|
|
5434
|
|
|
|
|
|
|
)) /oxgc) { $slash = 'm//'; $e_string .= $1; } |
5435
|
49
|
|
|
|
|
251
|
|
5436
|
|
|
|
|
|
|
# other any character |
5437
|
|
|
|
|
|
|
elsif ($string =~ /\G ($q_char) /oxgc) { $e_string .= $1; } |
5438
|
|
|
|
|
|
|
|
5439
|
179
|
|
|
|
|
680
|
# system error |
5440
|
|
|
|
|
|
|
else { |
5441
|
|
|
|
|
|
|
die __FILE__, ": Oops, this shouldn't happen!\n"; |
5442
|
|
|
|
|
|
|
} |
5443
|
0
|
|
|
|
|
0
|
} |
5444
|
|
|
|
|
|
|
|
5445
|
|
|
|
|
|
|
return $e_string; |
5446
|
|
|
|
|
|
|
} |
5447
|
|
|
|
|
|
|
|
5448
|
|
|
|
|
|
|
# |
5449
|
|
|
|
|
|
|
# character class |
5450
|
38
|
|
|
3059
|
0
|
149
|
# |
5451
|
|
|
|
|
|
|
sub character_class { |
5452
|
3059
|
100
|
|
|
|
5450
|
my($char,$modifier) = @_; |
5453
|
3059
|
100
|
|
|
|
4956
|
|
5454
|
115
|
|
|
|
|
274
|
if ($char eq '.') { |
5455
|
|
|
|
|
|
|
if ($modifier =~ /s/) { |
5456
|
|
|
|
|
|
|
return '${Eeucjp::dot_s}'; |
5457
|
23
|
|
|
|
|
62
|
} |
5458
|
|
|
|
|
|
|
else { |
5459
|
|
|
|
|
|
|
return '${Eeucjp::dot}'; |
5460
|
|
|
|
|
|
|
} |
5461
|
92
|
|
|
|
|
271
|
} |
5462
|
|
|
|
|
|
|
else { |
5463
|
|
|
|
|
|
|
return Eeucjp::classic_character_class($char); |
5464
|
|
|
|
|
|
|
} |
5465
|
|
|
|
|
|
|
} |
5466
|
|
|
|
|
|
|
|
5467
|
|
|
|
|
|
|
# |
5468
|
|
|
|
|
|
|
# escape capture ($1, $2, $3, ...) |
5469
|
|
|
|
|
|
|
# |
5470
|
2944
|
|
|
547
|
0
|
7643
|
sub e_capture { |
5471
|
547
|
|
|
|
|
2319
|
|
5472
|
|
|
|
|
|
|
return join '', '${Eeucjp::capture(', $_[0], ')}'; |
5473
|
|
|
|
|
|
|
return join '', '${', $_[0], '}'; |
5474
|
|
|
|
|
|
|
} |
5475
|
|
|
|
|
|
|
|
5476
|
|
|
|
|
|
|
# |
5477
|
|
|
|
|
|
|
# escape transliteration (tr/// or y///) |
5478
|
0
|
|
|
11
|
0
|
0
|
# |
5479
|
11
|
|
|
|
|
100
|
sub e_tr { |
5480
|
11
|
|
100
|
|
|
20
|
my($variable,$charclass,$e,$charclass2,$modifier) = @_; |
5481
|
|
|
|
|
|
|
my $e_tr = ''; |
5482
|
11
|
|
|
|
|
33
|
$modifier ||= ''; |
5483
|
|
|
|
|
|
|
|
5484
|
|
|
|
|
|
|
$slash = 'div'; |
5485
|
11
|
|
|
|
|
15
|
|
5486
|
|
|
|
|
|
|
# quote character class 1 |
5487
|
|
|
|
|
|
|
$charclass = q_tr($charclass); |
5488
|
11
|
|
|
|
|
23
|
|
5489
|
|
|
|
|
|
|
# quote character class 2 |
5490
|
|
|
|
|
|
|
$charclass2 = q_tr($charclass2); |
5491
|
11
|
50
|
|
|
|
21
|
|
5492
|
11
|
0
|
|
|
|
44
|
# /b /B modifier |
5493
|
0
|
|
|
|
|
0
|
if ($modifier =~ tr/bB//d) { |
5494
|
|
|
|
|
|
|
if ($variable eq '') { |
5495
|
|
|
|
|
|
|
$e_tr = qq{tr$charclass$e$charclass2$modifier}; |
5496
|
0
|
|
|
|
|
0
|
} |
5497
|
|
|
|
|
|
|
else { |
5498
|
|
|
|
|
|
|
$e_tr = qq{$variable${bind_operator}tr$charclass$e$charclass2$modifier}; |
5499
|
|
|
|
|
|
|
} |
5500
|
0
|
100
|
|
|
|
0
|
} |
5501
|
11
|
|
|
|
|
24
|
else { |
5502
|
|
|
|
|
|
|
if ($variable eq '') { |
5503
|
|
|
|
|
|
|
$e_tr = qq{Eeucjp::tr(\$_,' =~ ',$charclass,$e$charclass2,'$modifier')}; |
5504
|
2
|
|
|
|
|
9
|
} |
5505
|
|
|
|
|
|
|
else { |
5506
|
|
|
|
|
|
|
$e_tr = qq{Eeucjp::tr($variable,'$bind_operator',$charclass,$e$charclass2,'$modifier')}; |
5507
|
|
|
|
|
|
|
} |
5508
|
|
|
|
|
|
|
} |
5509
|
9
|
|
|
|
|
29
|
|
5510
|
11
|
|
|
|
|
17
|
# clear tr/// variable |
5511
|
|
|
|
|
|
|
$tr_variable = ''; |
5512
|
11
|
|
|
|
|
14
|
$bind_operator = ''; |
5513
|
|
|
|
|
|
|
|
5514
|
|
|
|
|
|
|
return $e_tr; |
5515
|
|
|
|
|
|
|
} |
5516
|
|
|
|
|
|
|
|
5517
|
|
|
|
|
|
|
# |
5518
|
|
|
|
|
|
|
# quote for escape transliteration (tr/// or y///) |
5519
|
11
|
|
|
22
|
0
|
67
|
# |
5520
|
|
|
|
|
|
|
sub q_tr { |
5521
|
|
|
|
|
|
|
my($charclass) = @_; |
5522
|
22
|
50
|
|
|
|
33
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
5523
|
22
|
|
|
|
|
45
|
# quote character class |
5524
|
|
|
|
|
|
|
if ($charclass !~ /'/oxms) { |
5525
|
|
|
|
|
|
|
return e_q('', "'", "'", $charclass); # --> q' ' |
5526
|
22
|
|
|
|
|
33
|
} |
5527
|
|
|
|
|
|
|
elsif ($charclass !~ /\//oxms) { |
5528
|
|
|
|
|
|
|
return e_q('q', '/', '/', $charclass); # --> q/ / |
5529
|
0
|
|
|
|
|
0
|
} |
5530
|
|
|
|
|
|
|
elsif ($charclass !~ /\#/oxms) { |
5531
|
|
|
|
|
|
|
return e_q('q', '#', '#', $charclass); # --> q# # |
5532
|
0
|
|
|
|
|
0
|
} |
5533
|
|
|
|
|
|
|
elsif ($charclass !~ /[\<\>]/oxms) { |
5534
|
|
|
|
|
|
|
return e_q('q', '<', '>', $charclass); # --> q< > |
5535
|
0
|
|
|
|
|
0
|
} |
5536
|
|
|
|
|
|
|
elsif ($charclass !~ /[\(\)]/oxms) { |
5537
|
|
|
|
|
|
|
return e_q('q', '(', ')', $charclass); # --> q( ) |
5538
|
0
|
|
|
|
|
0
|
} |
5539
|
|
|
|
|
|
|
elsif ($charclass !~ /[\{\}]/oxms) { |
5540
|
|
|
|
|
|
|
return e_q('q', '{', '}', $charclass); # --> q{ } |
5541
|
0
|
|
|
|
|
0
|
} |
5542
|
0
|
0
|
|
|
|
0
|
else { |
5543
|
0
|
|
|
|
|
0
|
for my $char (qw( ! " $ % & * + . : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") { |
5544
|
|
|
|
|
|
|
if ($charclass !~ /\Q$char\E/xms) { |
5545
|
|
|
|
|
|
|
return e_q('q', $char, $char, $charclass); |
5546
|
|
|
|
|
|
|
} |
5547
|
|
|
|
|
|
|
} |
5548
|
0
|
|
|
|
|
0
|
} |
5549
|
|
|
|
|
|
|
|
5550
|
|
|
|
|
|
|
return e_q('q', '{', '}', $charclass); |
5551
|
|
|
|
|
|
|
} |
5552
|
|
|
|
|
|
|
|
5553
|
|
|
|
|
|
|
# |
5554
|
|
|
|
|
|
|
# escape q string (q//, '') |
5555
|
0
|
|
|
2416
|
0
|
0
|
# |
5556
|
|
|
|
|
|
|
sub e_q { |
5557
|
2416
|
|
|
|
|
5938
|
my($ope,$delimiter,$end_delimiter,$string) = @_; |
5558
|
|
|
|
|
|
|
|
5559
|
2416
|
|
|
|
|
4423
|
$slash = 'div'; |
5560
|
|
|
|
|
|
|
|
5561
|
|
|
|
|
|
|
return join '', $ope, $delimiter, $string, $end_delimiter; |
5562
|
|
|
|
|
|
|
} |
5563
|
|
|
|
|
|
|
|
5564
|
|
|
|
|
|
|
# |
5565
|
|
|
|
|
|
|
# escape qq string (qq//, "", qx//, ``) |
5566
|
2416
|
|
|
6990
|
0
|
11538
|
# |
5567
|
|
|
|
|
|
|
sub e_qq { |
5568
|
6990
|
|
|
|
|
20995
|
my($ope,$delimiter,$end_delimiter,$string) = @_; |
5569
|
|
|
|
|
|
|
|
5570
|
6990
|
|
|
|
|
10114
|
$slash = 'div'; |
5571
|
6990
|
|
|
|
|
8353
|
|
5572
|
|
|
|
|
|
|
my $left_e = 0; |
5573
|
|
|
|
|
|
|
my $right_e = 0; |
5574
|
6990
|
|
|
|
|
8142
|
|
5575
|
|
|
|
|
|
|
# split regexp |
5576
|
|
|
|
|
|
|
my @char = $string =~ /\G((?> |
5577
|
|
|
|
|
|
|
[^\x8E\x8F\xA1-\xFE\\\$]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
5578
|
|
|
|
|
|
|
\\x\{ (?>[0-9A-Fa-f]+) \} | |
5579
|
|
|
|
|
|
|
\\o\{ (?>[0-7]+) \} | |
5580
|
|
|
|
|
|
|
\\N\{ (?>[^\x8E\x8F\xA1-\xFE0-9\}][^\x8E\x8F\xA1-\xFE\}]*) \} | |
5581
|
|
|
|
|
|
|
\\ $q_char | |
5582
|
|
|
|
|
|
|
\$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} | |
5583
|
|
|
|
|
|
|
\$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} | |
5584
|
|
|
|
|
|
|
\$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} | |
5585
|
|
|
|
|
|
|
\$ (?>\s* [0-9]+) | |
5586
|
|
|
|
|
|
|
\$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} | |
5587
|
|
|
|
|
|
|
\$ \$ (?![\w\{]) | |
5588
|
|
|
|
|
|
|
\$ (?>\s*) \$ (?>\s*) $qq_variable | |
5589
|
|
|
|
|
|
|
$q_char |
5590
|
6990
|
|
|
|
|
283904
|
))/oxmsg; |
5591
|
|
|
|
|
|
|
|
5592
|
|
|
|
|
|
|
for (my $i=0; $i <= $#char; $i++) { |
5593
|
6990
|
50
|
66
|
|
|
21674
|
|
|
|
50
|
33
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
5594
|
216502
|
|
|
|
|
720189
|
# "\L\u" --> "\u\L" |
5595
|
|
|
|
|
|
|
if (($char[$i] eq '\L') and ($char[$i+1] eq '\u')) { |
5596
|
|
|
|
|
|
|
@char[$i,$i+1] = @char[$i+1,$i]; |
5597
|
|
|
|
|
|
|
} |
5598
|
|
|
|
|
|
|
|
5599
|
0
|
|
|
|
|
0
|
# "\U\l" --> "\l\U" |
5600
|
|
|
|
|
|
|
elsif (($char[$i] eq '\U') and ($char[$i+1] eq '\l')) { |
5601
|
|
|
|
|
|
|
@char[$i,$i+1] = @char[$i+1,$i]; |
5602
|
|
|
|
|
|
|
} |
5603
|
|
|
|
|
|
|
|
5604
|
0
|
|
|
|
|
0
|
# octal escape sequence |
5605
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) { |
5606
|
|
|
|
|
|
|
$char[$i] = Eeucjp::octchr($1); |
5607
|
|
|
|
|
|
|
} |
5608
|
|
|
|
|
|
|
|
5609
|
1
|
|
|
|
|
5
|
# hexadecimal escape sequence |
5610
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) { |
5611
|
|
|
|
|
|
|
$char[$i] = Eeucjp::hexchr($1); |
5612
|
|
|
|
|
|
|
} |
5613
|
|
|
|
|
|
|
|
5614
|
1
|
|
|
|
|
5
|
# \N{CHARNAME} --> N{CHARNAME} |
5615
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\ ( N\{ ([^\x8E\x8F\xA1-\xFE0-9\}][^\x8E\x8F\xA1-\xFE\}]*) \} ) \z/oxms) { |
5616
|
|
|
|
|
|
|
$char[$i] = $1; |
5617
|
0
|
100
|
|
|
|
0
|
} |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
5618
|
|
|
|
|
|
|
|
5619
|
|
|
|
|
|
|
if (0) { |
5620
|
|
|
|
|
|
|
} |
5621
|
|
|
|
|
|
|
|
5622
|
|
|
|
|
|
|
# \F |
5623
|
|
|
|
|
|
|
# |
5624
|
|
|
|
|
|
|
# P.69 Table 2-6. Translation escapes |
5625
|
|
|
|
|
|
|
# in Chapter 2: Bits and Pieces |
5626
|
|
|
|
|
|
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
5627
|
|
|
|
|
|
|
# (and so on) |
5628
|
216502
|
|
|
|
|
1688072
|
|
5629
|
0
|
50
|
|
|
|
0
|
# \u \l \U \L \F \Q \E |
5630
|
602
|
|
|
|
|
1258
|
elsif ($char[$i] =~ /\A ([<>]) \z/oxms) { |
5631
|
|
|
|
|
|
|
if ($right_e < $left_e) { |
5632
|
|
|
|
|
|
|
$char[$i] = '\\' . $char[$i]; |
5633
|
|
|
|
|
|
|
} |
5634
|
|
|
|
|
|
|
} |
5635
|
|
|
|
|
|
|
elsif ($char[$i] eq '\u') { |
5636
|
|
|
|
|
|
|
|
5637
|
|
|
|
|
|
|
# "STRING @{[ LIST EXPR ]} MORE STRING" |
5638
|
|
|
|
|
|
|
|
5639
|
|
|
|
|
|
|
# P.257 Other Tricks You Can Do with Hard References |
5640
|
|
|
|
|
|
|
# in Chapter 8: References |
5641
|
|
|
|
|
|
|
# of ISBN 0-596-00027-8 Programming Perl Third Edition. |
5642
|
|
|
|
|
|
|
|
5643
|
|
|
|
|
|
|
# P.353 Other Tricks You Can Do with Hard References |
5644
|
|
|
|
|
|
|
# in Chapter 8: References |
5645
|
|
|
|
|
|
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
5646
|
|
|
|
|
|
|
|
5647
|
0
|
|
|
|
|
0
|
# (and so on) |
5648
|
0
|
|
|
|
|
0
|
|
5649
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ucfirst qq<'; |
5650
|
|
|
|
|
|
|
$left_e++; |
5651
|
0
|
|
|
|
|
0
|
} |
5652
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\l') { |
5653
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::lcfirst qq<'; |
5654
|
|
|
|
|
|
|
$left_e++; |
5655
|
0
|
|
|
|
|
0
|
} |
5656
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\U') { |
5657
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::uc qq<'; |
5658
|
|
|
|
|
|
|
$left_e++; |
5659
|
0
|
|
|
|
|
0
|
} |
5660
|
6
|
|
|
|
|
10
|
elsif ($char[$i] eq '\L') { |
5661
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::lc qq<'; |
5662
|
|
|
|
|
|
|
$left_e++; |
5663
|
6
|
|
|
|
|
10
|
} |
5664
|
9
|
|
|
|
|
13
|
elsif ($char[$i] eq '\F') { |
5665
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::fc qq<'; |
5666
|
|
|
|
|
|
|
$left_e++; |
5667
|
9
|
|
|
|
|
17
|
} |
5668
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\Q') { |
5669
|
|
|
|
|
|
|
$char[$i] = '@{[CORE::quotemeta qq<'; |
5670
|
|
|
|
|
|
|
$left_e++; |
5671
|
0
|
50
|
|
|
|
0
|
} |
5672
|
12
|
|
|
|
|
22
|
elsif ($char[$i] eq '\E') { |
5673
|
12
|
|
|
|
|
15
|
if ($right_e < $left_e) { |
5674
|
|
|
|
|
|
|
$char[$i] = '>]}'; |
5675
|
|
|
|
|
|
|
$right_e++; |
5676
|
12
|
|
|
|
|
36
|
} |
5677
|
|
|
|
|
|
|
else { |
5678
|
|
|
|
|
|
|
$char[$i] = ''; |
5679
|
|
|
|
|
|
|
} |
5680
|
0
|
|
|
|
|
0
|
} |
5681
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] eq '\Q') { |
5682
|
0
|
|
|
|
|
0
|
while (1) { |
5683
|
|
|
|
|
|
|
if (++$i > $#char) { |
5684
|
0
|
0
|
|
|
|
0
|
last; |
5685
|
0
|
|
|
|
|
0
|
} |
5686
|
|
|
|
|
|
|
if ($char[$i] eq '\E') { |
5687
|
|
|
|
|
|
|
last; |
5688
|
|
|
|
|
|
|
} |
5689
|
|
|
|
|
|
|
} |
5690
|
|
|
|
|
|
|
} |
5691
|
|
|
|
|
|
|
elsif ($char[$i] eq '\E') { |
5692
|
|
|
|
|
|
|
} |
5693
|
|
|
|
|
|
|
|
5694
|
|
|
|
|
|
|
# $0 --> $0 |
5695
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$ 0 \z/oxms) { |
5696
|
|
|
|
|
|
|
} |
5697
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) { |
5698
|
|
|
|
|
|
|
} |
5699
|
|
|
|
|
|
|
|
5700
|
|
|
|
|
|
|
# $$ --> $$ |
5701
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$\$ \z/oxms) { |
5702
|
|
|
|
|
|
|
} |
5703
|
|
|
|
|
|
|
|
5704
|
|
|
|
|
|
|
# $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring |
5705
|
0
|
|
|
|
|
0
|
# $1, $2, $3 --> $1, $2, $3 otherwise |
5706
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) { |
5707
|
|
|
|
|
|
|
$char[$i] = e_capture($1); |
5708
|
415
|
|
|
|
|
890
|
} |
5709
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) { |
5710
|
|
|
|
|
|
|
$char[$i] = e_capture($1); |
5711
|
|
|
|
|
|
|
} |
5712
|
|
|
|
|
|
|
|
5713
|
0
|
|
|
|
|
0
|
# $$foo[ ... ] --> $ $foo->[ ... ] |
5714
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) { |
5715
|
|
|
|
|
|
|
$char[$i] = e_capture($1.'->'.$2); |
5716
|
|
|
|
|
|
|
} |
5717
|
|
|
|
|
|
|
|
5718
|
0
|
|
|
|
|
0
|
# $$foo{ ... } --> $ $foo->{ ... } |
5719
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) { |
5720
|
|
|
|
|
|
|
$char[$i] = e_capture($1.'->'.$2); |
5721
|
|
|
|
|
|
|
} |
5722
|
|
|
|
|
|
|
|
5723
|
0
|
|
|
|
|
0
|
# $$foo |
5724
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) { |
5725
|
|
|
|
|
|
|
$char[$i] = e_capture($1); |
5726
|
|
|
|
|
|
|
} |
5727
|
|
|
|
|
|
|
|
5728
|
0
|
|
|
|
|
0
|
# $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Eeucjp::PREMATCH() |
5729
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) { |
5730
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::PREMATCH()]}'; |
5731
|
|
|
|
|
|
|
} |
5732
|
|
|
|
|
|
|
|
5733
|
44
|
|
|
|
|
155
|
# $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Eeucjp::MATCH() |
5734
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) { |
5735
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::MATCH()]}'; |
5736
|
|
|
|
|
|
|
} |
5737
|
|
|
|
|
|
|
|
5738
|
45
|
|
|
|
|
124
|
# $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Eeucjp::POSTMATCH() |
5739
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) { |
5740
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::POSTMATCH()]}'; |
5741
|
|
|
|
|
|
|
} |
5742
|
|
|
|
|
|
|
|
5743
|
|
|
|
|
|
|
# ${ foo } --> ${ foo } |
5744
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) { |
5745
|
|
|
|
|
|
|
} |
5746
|
|
|
|
|
|
|
|
5747
|
33
|
|
|
|
|
89
|
# ${ ... } |
5748
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) { |
5749
|
|
|
|
|
|
|
$char[$i] = e_capture($1); |
5750
|
|
|
|
|
|
|
} |
5751
|
|
|
|
|
|
|
} |
5752
|
0
|
100
|
|
|
|
0
|
|
5753
|
6990
|
|
|
|
|
12936
|
# return string |
5754
|
|
|
|
|
|
|
if ($left_e > $right_e) { |
5755
|
3
|
|
|
|
|
25
|
return join '', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter; |
5756
|
|
|
|
|
|
|
} |
5757
|
|
|
|
|
|
|
return join '', $ope, $delimiter, @char, $end_delimiter; |
5758
|
|
|
|
|
|
|
} |
5759
|
|
|
|
|
|
|
|
5760
|
|
|
|
|
|
|
# |
5761
|
|
|
|
|
|
|
# escape qw string (qw//) |
5762
|
6987
|
|
|
34
|
0
|
61079
|
# |
5763
|
|
|
|
|
|
|
sub e_qw { |
5764
|
34
|
|
|
|
|
151
|
my($ope,$delimiter,$end_delimiter,$string) = @_; |
5765
|
|
|
|
|
|
|
|
5766
|
|
|
|
|
|
|
$slash = 'div'; |
5767
|
34
|
|
|
|
|
63
|
|
|
34
|
|
|
|
|
319
|
|
5768
|
621
|
50
|
|
|
|
979
|
# choice again delimiter |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
5769
|
34
|
|
|
|
|
164
|
my %octet = map {$_ => 1} ($string =~ /\G ([\x00-\xFF]) /oxmsg); |
5770
|
|
|
|
|
|
|
if (not $octet{$end_delimiter}) { |
5771
|
|
|
|
|
|
|
return join '', $ope, $delimiter, $string, $end_delimiter; |
5772
|
34
|
|
|
|
|
229
|
} |
5773
|
|
|
|
|
|
|
elsif (not $octet{')'}) { |
5774
|
|
|
|
|
|
|
return join '', $ope, '(', $string, ')'; |
5775
|
0
|
|
|
|
|
0
|
} |
5776
|
|
|
|
|
|
|
elsif (not $octet{'}'}) { |
5777
|
|
|
|
|
|
|
return join '', $ope, '{', $string, '}'; |
5778
|
0
|
|
|
|
|
0
|
} |
5779
|
|
|
|
|
|
|
elsif (not $octet{']'}) { |
5780
|
|
|
|
|
|
|
return join '', $ope, '[', $string, ']'; |
5781
|
0
|
|
|
|
|
0
|
} |
5782
|
|
|
|
|
|
|
elsif (not $octet{'>'}) { |
5783
|
|
|
|
|
|
|
return join '', $ope, '<', $string, '>'; |
5784
|
0
|
|
|
|
|
0
|
} |
5785
|
0
|
0
|
|
|
|
0
|
else { |
5786
|
0
|
|
|
|
|
0
|
for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") { |
5787
|
|
|
|
|
|
|
if (not $octet{$char}) { |
5788
|
|
|
|
|
|
|
return join '', $ope, $char, $string, $char; |
5789
|
|
|
|
|
|
|
} |
5790
|
|
|
|
|
|
|
} |
5791
|
|
|
|
|
|
|
} |
5792
|
0
|
|
|
|
|
0
|
|
5793
|
0
|
|
|
|
|
0
|
# qw/AAA BBB C'CC/ --> ('AAA', 'BBB', 'C\'CC') |
5794
|
0
|
|
|
|
|
0
|
my @string = CORE::split(/\s+/, $string); |
5795
|
0
|
|
|
|
|
0
|
for my $string (@string) { |
5796
|
0
|
0
|
|
|
|
0
|
my @octet = $string =~ /\G ([\x00-\xFF]) /oxmsg; |
5797
|
0
|
|
|
|
|
0
|
for my $octet (@octet) { |
5798
|
|
|
|
|
|
|
if ($octet =~ /\A (['\\]) \z/oxms) { |
5799
|
|
|
|
|
|
|
$octet = '\\' . $1; |
5800
|
0
|
|
|
|
|
0
|
} |
5801
|
|
|
|
|
|
|
} |
5802
|
0
|
|
|
|
|
0
|
$string = join '', @octet; |
|
0
|
|
|
|
|
0
|
|
5803
|
|
|
|
|
|
|
} |
5804
|
|
|
|
|
|
|
return join '', '(', (join ', ', map { "'$_'" } @string), ')'; |
5805
|
|
|
|
|
|
|
} |
5806
|
|
|
|
|
|
|
|
5807
|
|
|
|
|
|
|
# |
5808
|
|
|
|
|
|
|
# escape here document (<<"HEREDOC", <
|
5809
|
0
|
|
|
108
|
0
|
0
|
# |
5810
|
|
|
|
|
|
|
sub e_heredoc { |
5811
|
108
|
|
|
|
|
296
|
my($string) = @_; |
5812
|
|
|
|
|
|
|
|
5813
|
108
|
|
|
|
|
183
|
$slash = 'm//'; |
5814
|
|
|
|
|
|
|
|
5815
|
108
|
|
|
|
|
365
|
my $metachar = qr/[\@\\|]/oxms; # '|' is for <<`HEREDOC` |
5816
|
108
|
|
|
|
|
179
|
|
5817
|
|
|
|
|
|
|
my $left_e = 0; |
5818
|
|
|
|
|
|
|
my $right_e = 0; |
5819
|
108
|
|
|
|
|
144
|
|
5820
|
|
|
|
|
|
|
# split regexp |
5821
|
|
|
|
|
|
|
my @char = $string =~ /\G((?> |
5822
|
|
|
|
|
|
|
[^\x8E\x8F\xA1-\xFE\\\$]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
5823
|
|
|
|
|
|
|
\\x\{ (?>[0-9A-Fa-f]+) \} | |
5824
|
|
|
|
|
|
|
\\o\{ (?>[0-7]+) \} | |
5825
|
|
|
|
|
|
|
\\N\{ (?>[^\x8E\x8F\xA1-\xFE0-9\}][^\x8E\x8F\xA1-\xFE\}]*) \} | |
5826
|
|
|
|
|
|
|
\\ $q_char | |
5827
|
|
|
|
|
|
|
\$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} | |
5828
|
|
|
|
|
|
|
\$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} | |
5829
|
|
|
|
|
|
|
\$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} | |
5830
|
|
|
|
|
|
|
\$ (?>\s* [0-9]+) | |
5831
|
|
|
|
|
|
|
\$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} | |
5832
|
|
|
|
|
|
|
\$ \$ (?![\w\{]) | |
5833
|
|
|
|
|
|
|
\$ (?>\s*) \$ (?>\s*) $qq_variable | |
5834
|
|
|
|
|
|
|
$q_char |
5835
|
108
|
|
|
|
|
11533
|
))/oxmsg; |
5836
|
|
|
|
|
|
|
|
5837
|
|
|
|
|
|
|
for (my $i=0; $i <= $#char; $i++) { |
5838
|
108
|
50
|
66
|
|
|
510
|
|
|
|
50
|
33
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
5839
|
3251
|
|
|
|
|
9663
|
# "\L\u" --> "\u\L" |
5840
|
|
|
|
|
|
|
if (($char[$i] eq '\L') and ($char[$i+1] eq '\u')) { |
5841
|
|
|
|
|
|
|
@char[$i,$i+1] = @char[$i+1,$i]; |
5842
|
|
|
|
|
|
|
} |
5843
|
|
|
|
|
|
|
|
5844
|
0
|
|
|
|
|
0
|
# "\U\l" --> "\l\U" |
5845
|
|
|
|
|
|
|
elsif (($char[$i] eq '\U') and ($char[$i+1] eq '\l')) { |
5846
|
|
|
|
|
|
|
@char[$i,$i+1] = @char[$i+1,$i]; |
5847
|
|
|
|
|
|
|
} |
5848
|
|
|
|
|
|
|
|
5849
|
0
|
|
|
|
|
0
|
# octal escape sequence |
5850
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) { |
5851
|
|
|
|
|
|
|
$char[$i] = Eeucjp::octchr($1); |
5852
|
|
|
|
|
|
|
} |
5853
|
|
|
|
|
|
|
|
5854
|
1
|
|
|
|
|
4
|
# hexadecimal escape sequence |
5855
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) { |
5856
|
|
|
|
|
|
|
$char[$i] = Eeucjp::hexchr($1); |
5857
|
|
|
|
|
|
|
} |
5858
|
|
|
|
|
|
|
|
5859
|
1
|
|
|
|
|
4
|
# \N{CHARNAME} --> N{CHARNAME} |
5860
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\ ( N\{ ([^\x8E\x8F\xA1-\xFE0-9\}][^\x8E\x8F\xA1-\xFE\}]*) \} ) \z/oxms) { |
5861
|
|
|
|
|
|
|
$char[$i] = $1; |
5862
|
0
|
100
|
|
|
|
0
|
} |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
5863
|
|
|
|
|
|
|
|
5864
|
|
|
|
|
|
|
if (0) { |
5865
|
|
|
|
|
|
|
} |
5866
|
3251
|
|
|
|
|
28549
|
|
5867
|
0
|
50
|
|
|
|
0
|
# \u \l \U \L \F \Q \E |
5868
|
72
|
|
|
|
|
139
|
elsif ($char[$i] =~ /\A ([<>]) \z/oxms) { |
5869
|
|
|
|
|
|
|
if ($right_e < $left_e) { |
5870
|
|
|
|
|
|
|
$char[$i] = '\\' . $char[$i]; |
5871
|
|
|
|
|
|
|
} |
5872
|
0
|
|
|
|
|
0
|
} |
5873
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\u') { |
5874
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ucfirst qq<'; |
5875
|
|
|
|
|
|
|
$left_e++; |
5876
|
0
|
|
|
|
|
0
|
} |
5877
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\l') { |
5878
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::lcfirst qq<'; |
5879
|
|
|
|
|
|
|
$left_e++; |
5880
|
0
|
|
|
|
|
0
|
} |
5881
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\U') { |
5882
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::uc qq<'; |
5883
|
|
|
|
|
|
|
$left_e++; |
5884
|
0
|
|
|
|
|
0
|
} |
5885
|
6
|
|
|
|
|
9
|
elsif ($char[$i] eq '\L') { |
5886
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::lc qq<'; |
5887
|
|
|
|
|
|
|
$left_e++; |
5888
|
6
|
|
|
|
|
12
|
} |
5889
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\F') { |
5890
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::fc qq<'; |
5891
|
|
|
|
|
|
|
$left_e++; |
5892
|
0
|
|
|
|
|
0
|
} |
5893
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\Q') { |
5894
|
|
|
|
|
|
|
$char[$i] = '@{[CORE::quotemeta qq<'; |
5895
|
|
|
|
|
|
|
$left_e++; |
5896
|
0
|
50
|
|
|
|
0
|
} |
5897
|
3
|
|
|
|
|
7
|
elsif ($char[$i] eq '\E') { |
5898
|
3
|
|
|
|
|
4
|
if ($right_e < $left_e) { |
5899
|
|
|
|
|
|
|
$char[$i] = '>]}'; |
5900
|
|
|
|
|
|
|
$right_e++; |
5901
|
3
|
|
|
|
|
4
|
} |
5902
|
|
|
|
|
|
|
else { |
5903
|
|
|
|
|
|
|
$char[$i] = ''; |
5904
|
|
|
|
|
|
|
} |
5905
|
0
|
|
|
|
|
0
|
} |
5906
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] eq '\Q') { |
5907
|
0
|
|
|
|
|
0
|
while (1) { |
5908
|
|
|
|
|
|
|
if (++$i > $#char) { |
5909
|
0
|
0
|
|
|
|
0
|
last; |
5910
|
0
|
|
|
|
|
0
|
} |
5911
|
|
|
|
|
|
|
if ($char[$i] eq '\E') { |
5912
|
|
|
|
|
|
|
last; |
5913
|
|
|
|
|
|
|
} |
5914
|
|
|
|
|
|
|
} |
5915
|
|
|
|
|
|
|
} |
5916
|
|
|
|
|
|
|
elsif ($char[$i] eq '\E') { |
5917
|
|
|
|
|
|
|
} |
5918
|
|
|
|
|
|
|
|
5919
|
|
|
|
|
|
|
# $0 --> $0 |
5920
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$ 0 \z/oxms) { |
5921
|
|
|
|
|
|
|
} |
5922
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) { |
5923
|
|
|
|
|
|
|
} |
5924
|
|
|
|
|
|
|
|
5925
|
|
|
|
|
|
|
# $$ --> $$ |
5926
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$\$ \z/oxms) { |
5927
|
|
|
|
|
|
|
} |
5928
|
|
|
|
|
|
|
|
5929
|
|
|
|
|
|
|
# $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring |
5930
|
0
|
|
|
|
|
0
|
# $1, $2, $3 --> $1, $2, $3 otherwise |
5931
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) { |
5932
|
|
|
|
|
|
|
$char[$i] = e_capture($1); |
5933
|
0
|
|
|
|
|
0
|
} |
5934
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) { |
5935
|
|
|
|
|
|
|
$char[$i] = e_capture($1); |
5936
|
|
|
|
|
|
|
} |
5937
|
|
|
|
|
|
|
|
5938
|
0
|
|
|
|
|
0
|
# $$foo[ ... ] --> $ $foo->[ ... ] |
5939
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) { |
5940
|
|
|
|
|
|
|
$char[$i] = e_capture($1.'->'.$2); |
5941
|
|
|
|
|
|
|
} |
5942
|
|
|
|
|
|
|
|
5943
|
0
|
|
|
|
|
0
|
# $$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
|
|
|
|
|
|
|
$char[$i] = e_capture($1.'->'.$2); |
5946
|
|
|
|
|
|
|
} |
5947
|
|
|
|
|
|
|
|
5948
|
0
|
|
|
|
|
0
|
# $$foo |
5949
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) { |
5950
|
|
|
|
|
|
|
$char[$i] = e_capture($1); |
5951
|
|
|
|
|
|
|
} |
5952
|
|
|
|
|
|
|
|
5953
|
0
|
|
|
|
|
0
|
# $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Eeucjp::PREMATCH() |
5954
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) { |
5955
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::PREMATCH()]}'; |
5956
|
|
|
|
|
|
|
} |
5957
|
|
|
|
|
|
|
|
5958
|
8
|
|
|
|
|
49
|
# $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Eeucjp::MATCH() |
5959
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) { |
5960
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::MATCH()]}'; |
5961
|
|
|
|
|
|
|
} |
5962
|
|
|
|
|
|
|
|
5963
|
8
|
|
|
|
|
47
|
# $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Eeucjp::POSTMATCH() |
5964
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) { |
5965
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::POSTMATCH()]}'; |
5966
|
|
|
|
|
|
|
} |
5967
|
|
|
|
|
|
|
|
5968
|
|
|
|
|
|
|
# ${ foo } --> ${ foo } |
5969
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ (?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* ) \} \z/oxms) { |
5970
|
|
|
|
|
|
|
} |
5971
|
|
|
|
|
|
|
|
5972
|
6
|
|
|
|
|
35
|
# ${ ... } |
5973
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) { |
5974
|
|
|
|
|
|
|
$char[$i] = e_capture($1); |
5975
|
|
|
|
|
|
|
} |
5976
|
|
|
|
|
|
|
} |
5977
|
0
|
100
|
|
|
|
0
|
|
5978
|
108
|
|
|
|
|
236
|
# return string |
5979
|
|
|
|
|
|
|
if ($left_e > $right_e) { |
5980
|
3
|
|
|
|
|
28
|
return join '', @char, '>]}' x ($left_e - $right_e); |
5981
|
|
|
|
|
|
|
} |
5982
|
|
|
|
|
|
|
return join '', @char; |
5983
|
|
|
|
|
|
|
} |
5984
|
|
|
|
|
|
|
|
5985
|
|
|
|
|
|
|
# |
5986
|
|
|
|
|
|
|
# escape regexp (m//, qr//) |
5987
|
105
|
|
|
1426
|
0
|
781
|
# |
5988
|
1426
|
|
100
|
|
|
5857
|
sub e_qr { |
5989
|
|
|
|
|
|
|
my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_; |
5990
|
1426
|
|
|
|
|
4884
|
$modifier ||= ''; |
5991
|
1426
|
50
|
|
|
|
2917
|
|
5992
|
1426
|
|
|
|
|
3357
|
$modifier =~ tr/p//d; |
5993
|
0
|
|
|
|
|
0
|
if ($modifier =~ /([adlu])/oxms) { |
5994
|
0
|
0
|
|
|
|
0
|
my $line = 0; |
5995
|
0
|
|
|
|
|
0
|
for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) { |
5996
|
0
|
|
|
|
|
0
|
if ($filename ne __FILE__) { |
5997
|
|
|
|
|
|
|
$line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1; |
5998
|
|
|
|
|
|
|
last; |
5999
|
0
|
|
|
|
|
0
|
} |
6000
|
|
|
|
|
|
|
} |
6001
|
|
|
|
|
|
|
die qq{Unsupported modifier "$1" used at line $line.\n}; |
6002
|
0
|
|
|
|
|
0
|
} |
6003
|
|
|
|
|
|
|
|
6004
|
|
|
|
|
|
|
$slash = 'div'; |
6005
|
1426
|
100
|
|
|
|
2173
|
|
|
|
100
|
|
|
|
|
|
6006
|
1426
|
|
|
|
|
4093
|
# literal null string pattern |
6007
|
8
|
|
|
|
|
13
|
if ($string eq '') { |
6008
|
8
|
|
|
|
|
8
|
$modifier =~ tr/bB//d; |
6009
|
|
|
|
|
|
|
$modifier =~ tr/i//d; |
6010
|
|
|
|
|
|
|
return join '', $ope, $delimiter, $end_delimiter, $modifier; |
6011
|
|
|
|
|
|
|
} |
6012
|
|
|
|
|
|
|
|
6013
|
|
|
|
|
|
|
# /b /B modifier |
6014
|
|
|
|
|
|
|
elsif ($modifier =~ tr/bB//d) { |
6015
|
8
|
50
|
|
|
|
40
|
|
6016
|
60
|
|
|
|
|
339
|
# choice again delimiter |
6017
|
0
|
|
|
|
|
0
|
if ($delimiter =~ / [\@:] /oxms) { |
|
0
|
|
|
|
|
0
|
|
6018
|
0
|
0
|
|
|
|
0
|
my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
6019
|
0
|
|
|
|
|
0
|
my %octet = map {$_ => 1} @char; |
6020
|
0
|
|
|
|
|
0
|
if (not $octet{')'}) { |
6021
|
|
|
|
|
|
|
$delimiter = '('; |
6022
|
|
|
|
|
|
|
$end_delimiter = ')'; |
6023
|
0
|
|
|
|
|
0
|
} |
6024
|
0
|
|
|
|
|
0
|
elsif (not $octet{'}'}) { |
6025
|
|
|
|
|
|
|
$delimiter = '{'; |
6026
|
|
|
|
|
|
|
$end_delimiter = '}'; |
6027
|
0
|
|
|
|
|
0
|
} |
6028
|
0
|
|
|
|
|
0
|
elsif (not $octet{']'}) { |
6029
|
|
|
|
|
|
|
$delimiter = '['; |
6030
|
|
|
|
|
|
|
$end_delimiter = ']'; |
6031
|
0
|
|
|
|
|
0
|
} |
6032
|
0
|
|
|
|
|
0
|
elsif (not $octet{'>'}) { |
6033
|
|
|
|
|
|
|
$delimiter = '<'; |
6034
|
|
|
|
|
|
|
$end_delimiter = '>'; |
6035
|
0
|
|
|
|
|
0
|
} |
6036
|
0
|
0
|
|
|
|
0
|
else { |
6037
|
0
|
|
|
|
|
0
|
for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") { |
6038
|
0
|
|
|
|
|
0
|
if (not $octet{$char}) { |
6039
|
0
|
|
|
|
|
0
|
$delimiter = $char; |
6040
|
|
|
|
|
|
|
$end_delimiter = $char; |
6041
|
|
|
|
|
|
|
last; |
6042
|
|
|
|
|
|
|
} |
6043
|
|
|
|
|
|
|
} |
6044
|
|
|
|
|
|
|
} |
6045
|
0
|
100
|
100
|
|
|
0
|
} |
6046
|
60
|
|
|
|
|
318
|
|
6047
|
|
|
|
|
|
|
if (($ope =~ /\A m? \z/oxms) and ($delimiter eq '?')) { |
6048
|
|
|
|
|
|
|
return join '', $ope, $delimiter, $string, $matched, $end_delimiter, $modifier; |
6049
|
18
|
|
|
|
|
101
|
} |
6050
|
|
|
|
|
|
|
else { |
6051
|
|
|
|
|
|
|
return join '', $ope, $delimiter, '(?:', $string, ')', $matched, $end_delimiter, $modifier; |
6052
|
|
|
|
|
|
|
} |
6053
|
42
|
100
|
|
|
|
254
|
} |
6054
|
1358
|
|
|
|
|
2973
|
|
6055
|
|
|
|
|
|
|
my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0; |
6056
|
|
|
|
|
|
|
my $metachar = qr/[\@\\|[\]{^]/oxms; |
6057
|
1358
|
|
|
|
|
4380
|
|
6058
|
|
|
|
|
|
|
# split regexp |
6059
|
|
|
|
|
|
|
my @char = $string =~ /\G((?> |
6060
|
|
|
|
|
|
|
[^\x8E\x8F\xA1-\xFE\\\$\@\[\(]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
6061
|
|
|
|
|
|
|
\\x (?>[0-9A-Fa-f]{1,2}) | |
6062
|
|
|
|
|
|
|
\\ (?>[0-7]{2,3}) | |
6063
|
|
|
|
|
|
|
\\c [\x40-\x5F] | |
6064
|
|
|
|
|
|
|
\\x\{ (?>[0-9A-Fa-f]+) \} | |
6065
|
|
|
|
|
|
|
\\o\{ (?>[0-7]+) \} | |
6066
|
|
|
|
|
|
|
\\[bBNpP]\{ (?>[^\x8E\x8F\xA1-\xFE0-9\}][^\x8E\x8F\xA1-\xFE\}]*) \} | |
6067
|
|
|
|
|
|
|
\\ $q_char | |
6068
|
|
|
|
|
|
|
\$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} | |
6069
|
|
|
|
|
|
|
\$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} | |
6070
|
|
|
|
|
|
|
\$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} | |
6071
|
|
|
|
|
|
|
[\$\@] $qq_variable | |
6072
|
|
|
|
|
|
|
\$ (?>\s* [0-9]+) | |
6073
|
|
|
|
|
|
|
\$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} | |
6074
|
|
|
|
|
|
|
\$ \$ (?![\w\{]) | |
6075
|
|
|
|
|
|
|
\$ (?>\s*) \$ (?>\s*) $qq_variable | |
6076
|
|
|
|
|
|
|
\[\^ | |
6077
|
|
|
|
|
|
|
\[\: (?>[a-z]+) :\] | |
6078
|
|
|
|
|
|
|
\[\:\^ (?>[a-z]+) :\] | |
6079
|
|
|
|
|
|
|
\(\? | |
6080
|
|
|
|
|
|
|
$q_char |
6081
|
|
|
|
|
|
|
))/oxmsg; |
6082
|
1358
|
50
|
|
|
|
138471
|
|
6083
|
1358
|
|
|
|
|
6972
|
# choice again delimiter |
|
0
|
|
|
|
|
0
|
|
6084
|
0
|
0
|
|
|
|
0
|
if ($delimiter =~ / [\@:] /oxms) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
6085
|
0
|
|
|
|
|
0
|
my %octet = map {$_ => 1} @char; |
6086
|
0
|
|
|
|
|
0
|
if (not $octet{')'}) { |
6087
|
|
|
|
|
|
|
$delimiter = '('; |
6088
|
|
|
|
|
|
|
$end_delimiter = ')'; |
6089
|
0
|
|
|
|
|
0
|
} |
6090
|
0
|
|
|
|
|
0
|
elsif (not $octet{'}'}) { |
6091
|
|
|
|
|
|
|
$delimiter = '{'; |
6092
|
|
|
|
|
|
|
$end_delimiter = '}'; |
6093
|
0
|
|
|
|
|
0
|
} |
6094
|
0
|
|
|
|
|
0
|
elsif (not $octet{']'}) { |
6095
|
|
|
|
|
|
|
$delimiter = '['; |
6096
|
|
|
|
|
|
|
$end_delimiter = ']'; |
6097
|
0
|
|
|
|
|
0
|
} |
6098
|
0
|
|
|
|
|
0
|
elsif (not $octet{'>'}) { |
6099
|
|
|
|
|
|
|
$delimiter = '<'; |
6100
|
|
|
|
|
|
|
$end_delimiter = '>'; |
6101
|
0
|
|
|
|
|
0
|
} |
6102
|
0
|
0
|
|
|
|
0
|
else { |
6103
|
0
|
|
|
|
|
0
|
for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") { |
6104
|
0
|
|
|
|
|
0
|
if (not $octet{$char}) { |
6105
|
0
|
|
|
|
|
0
|
$delimiter = $char; |
6106
|
|
|
|
|
|
|
$end_delimiter = $char; |
6107
|
|
|
|
|
|
|
last; |
6108
|
|
|
|
|
|
|
} |
6109
|
|
|
|
|
|
|
} |
6110
|
|
|
|
|
|
|
} |
6111
|
0
|
|
|
|
|
0
|
} |
6112
|
1358
|
|
|
|
|
2017
|
|
6113
|
1358
|
|
|
|
|
1714
|
my $left_e = 0; |
6114
|
|
|
|
|
|
|
my $right_e = 0; |
6115
|
|
|
|
|
|
|
for (my $i=0; $i <= $#char; $i++) { |
6116
|
1358
|
50
|
66
|
|
|
3116
|
|
|
|
50
|
66
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
6117
|
3269
|
|
|
|
|
17001
|
# "\L\u" --> "\u\L" |
6118
|
|
|
|
|
|
|
if (($char[$i] eq '\L') and ($char[$i+1] eq '\u')) { |
6119
|
|
|
|
|
|
|
@char[$i,$i+1] = @char[$i+1,$i]; |
6120
|
|
|
|
|
|
|
} |
6121
|
|
|
|
|
|
|
|
6122
|
0
|
|
|
|
|
0
|
# "\U\l" --> "\l\U" |
6123
|
|
|
|
|
|
|
elsif (($char[$i] eq '\U') and ($char[$i+1] eq '\l')) { |
6124
|
|
|
|
|
|
|
@char[$i,$i+1] = @char[$i+1,$i]; |
6125
|
|
|
|
|
|
|
} |
6126
|
|
|
|
|
|
|
|
6127
|
0
|
|
|
|
|
0
|
# octal escape sequence |
6128
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) { |
6129
|
|
|
|
|
|
|
$char[$i] = Eeucjp::octchr($1); |
6130
|
|
|
|
|
|
|
} |
6131
|
|
|
|
|
|
|
|
6132
|
1
|
|
|
|
|
4
|
# hexadecimal escape sequence |
6133
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) { |
6134
|
|
|
|
|
|
|
$char[$i] = Eeucjp::hexchr($1); |
6135
|
|
|
|
|
|
|
} |
6136
|
|
|
|
|
|
|
|
6137
|
|
|
|
|
|
|
# \b{...} --> b\{...} |
6138
|
|
|
|
|
|
|
# \B{...} --> B\{...} |
6139
|
|
|
|
|
|
|
# \N{CHARNAME} --> N\{CHARNAME} |
6140
|
|
|
|
|
|
|
# \p{PROPERTY} --> p\{PROPERTY} |
6141
|
1
|
|
|
|
|
3
|
# \P{PROPERTY} --> P\{PROPERTY} |
6142
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^\x8E\x8F\xA1-\xFE0-9\}][^\x8E\x8F\xA1-\xFE\}]*) \} ) \z/oxms) { |
6143
|
|
|
|
|
|
|
$char[$i] = $1 . '\\' . $2; |
6144
|
|
|
|
|
|
|
} |
6145
|
|
|
|
|
|
|
|
6146
|
6
|
|
|
|
|
19
|
# \p, \P, \X --> p, P, X |
6147
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) { |
6148
|
|
|
|
|
|
|
$char[$i] = $1; |
6149
|
4
|
100
|
100
|
|
|
10
|
} |
|
|
100
|
100
|
|
|
|
|
|
|
100
|
100
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
6150
|
|
|
|
|
|
|
|
6151
|
|
|
|
|
|
|
if (0) { |
6152
|
|
|
|
|
|
|
} |
6153
|
3269
|
|
|
|
|
9466
|
|
6154
|
0
|
50
|
33
|
|
|
0
|
# join separated multiple-octet |
|
|
50
|
33
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
33
|
|
|
|
|
6155
|
6
|
|
|
|
|
90
|
elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) { |
6156
|
|
|
|
|
|
|
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)) { |
6157
|
|
|
|
|
|
|
$char[$i] .= join '', splice @char, $i+1, 3; |
6158
|
0
|
|
|
|
|
0
|
} |
6159
|
|
|
|
|
|
|
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)) { |
6160
|
|
|
|
|
|
|
$char[$i] .= join '', splice @char, $i+1, 2; |
6161
|
0
|
|
|
|
|
0
|
} |
6162
|
|
|
|
|
|
|
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)) { |
6163
|
|
|
|
|
|
|
$char[$i] .= join '', splice @char, $i+1, 1; |
6164
|
|
|
|
|
|
|
} |
6165
|
|
|
|
|
|
|
} |
6166
|
|
|
|
|
|
|
|
6167
|
0
|
|
|
|
|
0
|
# open character class [...] |
6168
|
|
|
|
|
|
|
elsif ($char[$i] eq '[') { |
6169
|
|
|
|
|
|
|
my $left = $i; |
6170
|
|
|
|
|
|
|
|
6171
|
|
|
|
|
|
|
# [] make die "Unmatched [] in regexp ...\n" |
6172
|
586
|
100
|
|
|
|
795
|
# (and so on) |
6173
|
586
|
|
|
|
|
1507
|
|
6174
|
|
|
|
|
|
|
if ($char[$i+1] eq ']') { |
6175
|
|
|
|
|
|
|
$i++; |
6176
|
3
|
|
|
|
|
6
|
} |
6177
|
586
|
50
|
|
|
|
759
|
|
6178
|
2583
|
|
|
|
|
3777
|
while (1) { |
6179
|
|
|
|
|
|
|
if (++$i > $#char) { |
6180
|
0
|
100
|
|
|
|
0
|
die __FILE__, ": Unmatched [] in regexp\n"; |
6181
|
2583
|
|
|
|
|
4984
|
} |
6182
|
|
|
|
|
|
|
if ($char[$i] eq ']') { |
6183
|
|
|
|
|
|
|
my $right = $i; |
6184
|
586
|
100
|
|
|
|
687
|
|
6185
|
586
|
|
|
|
|
2906
|
# [...] |
|
90
|
|
|
|
|
229
|
|
6186
|
|
|
|
|
|
|
if (grep(/\A [\$\@]/oxms,@char[$left+1..$right-1]) >= 1) { |
6187
|
|
|
|
|
|
|
splice @char, $left, $right-$left+1, sprintf(q{@{[Eeucjp::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier); |
6188
|
270
|
|
|
|
|
442
|
} |
6189
|
|
|
|
|
|
|
else { |
6190
|
|
|
|
|
|
|
splice @char, $left, $right-$left+1, Eeucjp::charlist_qr(@char[$left+1..$right-1], $modifier); |
6191
|
496
|
|
|
|
|
1761
|
} |
6192
|
586
|
|
|
|
|
1026
|
|
6193
|
|
|
|
|
|
|
$i = $left; |
6194
|
|
|
|
|
|
|
last; |
6195
|
|
|
|
|
|
|
} |
6196
|
|
|
|
|
|
|
} |
6197
|
|
|
|
|
|
|
} |
6198
|
|
|
|
|
|
|
|
6199
|
586
|
|
|
|
|
1513
|
# open character class [^...] |
6200
|
|
|
|
|
|
|
elsif ($char[$i] eq '[^') { |
6201
|
|
|
|
|
|
|
my $left = $i; |
6202
|
|
|
|
|
|
|
|
6203
|
|
|
|
|
|
|
# [^] make die "Unmatched [] in regexp ...\n" |
6204
|
328
|
100
|
|
|
|
425
|
# (and so on) |
6205
|
328
|
|
|
|
|
624
|
|
6206
|
|
|
|
|
|
|
if ($char[$i+1] eq ']') { |
6207
|
|
|
|
|
|
|
$i++; |
6208
|
5
|
|
|
|
|
10
|
} |
6209
|
328
|
50
|
|
|
|
387
|
|
6210
|
1447
|
|
|
|
|
1884
|
while (1) { |
6211
|
|
|
|
|
|
|
if (++$i > $#char) { |
6212
|
0
|
100
|
|
|
|
0
|
die __FILE__, ": Unmatched [] in regexp\n"; |
6213
|
1447
|
|
|
|
|
2427
|
} |
6214
|
|
|
|
|
|
|
if ($char[$i] eq ']') { |
6215
|
|
|
|
|
|
|
my $right = $i; |
6216
|
328
|
100
|
|
|
|
363
|
|
6217
|
328
|
|
|
|
|
1412
|
# [^...] |
|
90
|
|
|
|
|
202
|
|
6218
|
|
|
|
|
|
|
if (grep(/\A [\$\@]/oxms,@char[$left+1..$right-1]) >= 1) { |
6219
|
|
|
|
|
|
|
splice @char, $left, $right-$left+1, sprintf(q{@{[Eeucjp::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier); |
6220
|
270
|
|
|
|
|
405
|
} |
6221
|
|
|
|
|
|
|
else { |
6222
|
|
|
|
|
|
|
splice @char, $left, $right-$left+1, Eeucjp::charlist_not_qr(@char[$left+1..$right-1], $modifier); |
6223
|
238
|
|
|
|
|
660
|
} |
6224
|
328
|
|
|
|
|
580
|
|
6225
|
|
|
|
|
|
|
$i = $left; |
6226
|
|
|
|
|
|
|
last; |
6227
|
|
|
|
|
|
|
} |
6228
|
|
|
|
|
|
|
} |
6229
|
|
|
|
|
|
|
} |
6230
|
|
|
|
|
|
|
|
6231
|
328
|
|
|
|
|
770
|
# rewrite character class or escape character |
6232
|
|
|
|
|
|
|
elsif (my $char = character_class($char[$i],$modifier)) { |
6233
|
|
|
|
|
|
|
$char[$i] = $char; |
6234
|
|
|
|
|
|
|
} |
6235
|
|
|
|
|
|
|
|
6236
|
215
|
50
|
|
|
|
540
|
# /i modifier |
6237
|
54
|
|
|
|
|
246
|
elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Eeucjp::uc($char[$i]) ne Eeucjp::fc($char[$i]))) { |
6238
|
|
|
|
|
|
|
if (CORE::length(Eeucjp::fc($char[$i])) == 1) { |
6239
|
|
|
|
|
|
|
$char[$i] = '[' . Eeucjp::uc($char[$i]) . Eeucjp::fc($char[$i]) . ']'; |
6240
|
54
|
|
|
|
|
122
|
} |
6241
|
|
|
|
|
|
|
else { |
6242
|
|
|
|
|
|
|
$char[$i] = '(?:' . Eeucjp::uc($char[$i]) . '|' . Eeucjp::fc($char[$i]) . ')'; |
6243
|
|
|
|
|
|
|
} |
6244
|
|
|
|
|
|
|
} |
6245
|
|
|
|
|
|
|
|
6246
|
0
|
50
|
|
|
|
0
|
# \u \l \U \L \F \Q \E |
6247
|
1
|
|
|
|
|
5
|
elsif ($char[$i] =~ /\A [<>] \z/oxms) { |
6248
|
|
|
|
|
|
|
if ($right_e < $left_e) { |
6249
|
|
|
|
|
|
|
$char[$i] = '\\' . $char[$i]; |
6250
|
|
|
|
|
|
|
} |
6251
|
0
|
|
|
|
|
0
|
} |
6252
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\u') { |
6253
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ucfirst qq<'; |
6254
|
|
|
|
|
|
|
$left_e++; |
6255
|
0
|
|
|
|
|
0
|
} |
6256
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\l') { |
6257
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::lcfirst qq<'; |
6258
|
|
|
|
|
|
|
$left_e++; |
6259
|
0
|
|
|
|
|
0
|
} |
6260
|
1
|
|
|
|
|
3
|
elsif ($char[$i] eq '\U') { |
6261
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::uc qq<'; |
6262
|
|
|
|
|
|
|
$left_e++; |
6263
|
1
|
|
|
|
|
3
|
} |
6264
|
1
|
|
|
|
|
3
|
elsif ($char[$i] eq '\L') { |
6265
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::lc qq<'; |
6266
|
|
|
|
|
|
|
$left_e++; |
6267
|
1
|
|
|
|
|
3
|
} |
6268
|
9
|
|
|
|
|
15
|
elsif ($char[$i] eq '\F') { |
6269
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::fc qq<'; |
6270
|
|
|
|
|
|
|
$left_e++; |
6271
|
9
|
|
|
|
|
18
|
} |
6272
|
20
|
|
|
|
|
40
|
elsif ($char[$i] eq '\Q') { |
6273
|
|
|
|
|
|
|
$char[$i] = '@{[CORE::quotemeta qq<'; |
6274
|
|
|
|
|
|
|
$left_e++; |
6275
|
20
|
50
|
|
|
|
43
|
} |
6276
|
31
|
|
|
|
|
64
|
elsif ($char[$i] eq '\E') { |
6277
|
31
|
|
|
|
|
41
|
if ($right_e < $left_e) { |
6278
|
|
|
|
|
|
|
$char[$i] = '>]}'; |
6279
|
|
|
|
|
|
|
$right_e++; |
6280
|
31
|
|
|
|
|
67
|
} |
6281
|
|
|
|
|
|
|
else { |
6282
|
|
|
|
|
|
|
$char[$i] = ''; |
6283
|
|
|
|
|
|
|
} |
6284
|
0
|
|
|
|
|
0
|
} |
6285
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] eq '\Q') { |
6286
|
0
|
|
|
|
|
0
|
while (1) { |
6287
|
|
|
|
|
|
|
if (++$i > $#char) { |
6288
|
0
|
0
|
|
|
|
0
|
last; |
6289
|
0
|
|
|
|
|
0
|
} |
6290
|
|
|
|
|
|
|
if ($char[$i] eq '\E') { |
6291
|
|
|
|
|
|
|
last; |
6292
|
|
|
|
|
|
|
} |
6293
|
|
|
|
|
|
|
} |
6294
|
|
|
|
|
|
|
} |
6295
|
|
|
|
|
|
|
elsif ($char[$i] eq '\E') { |
6296
|
|
|
|
|
|
|
} |
6297
|
|
|
|
|
|
|
|
6298
|
0
|
0
|
|
|
|
0
|
# $0 --> $0 |
6299
|
0
|
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ 0 \z/oxms) { |
6300
|
|
|
|
|
|
|
if ($ignorecase) { |
6301
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
6302
|
|
|
|
|
|
|
} |
6303
|
0
|
0
|
|
|
|
0
|
} |
6304
|
0
|
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) { |
6305
|
|
|
|
|
|
|
if ($ignorecase) { |
6306
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
6307
|
|
|
|
|
|
|
} |
6308
|
|
|
|
|
|
|
} |
6309
|
|
|
|
|
|
|
|
6310
|
|
|
|
|
|
|
# $$ --> $$ |
6311
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$\$ \z/oxms) { |
6312
|
|
|
|
|
|
|
} |
6313
|
|
|
|
|
|
|
|
6314
|
|
|
|
|
|
|
# $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring |
6315
|
0
|
|
|
|
|
0
|
# $1, $2, $3 --> $1, $2, $3 otherwise |
6316
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) { |
6317
|
0
|
|
|
|
|
0
|
$char[$i] = e_capture($1); |
6318
|
|
|
|
|
|
|
if ($ignorecase) { |
6319
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
6320
|
|
|
|
|
|
|
} |
6321
|
0
|
|
|
|
|
0
|
} |
6322
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) { |
6323
|
0
|
|
|
|
|
0
|
$char[$i] = e_capture($1); |
6324
|
|
|
|
|
|
|
if ($ignorecase) { |
6325
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
6326
|
|
|
|
|
|
|
} |
6327
|
|
|
|
|
|
|
} |
6328
|
|
|
|
|
|
|
|
6329
|
0
|
|
|
|
|
0
|
# $$foo[ ... ] --> $ $foo->[ ... ] |
6330
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) { |
6331
|
0
|
|
|
|
|
0
|
$char[$i] = e_capture($1.'->'.$2); |
6332
|
|
|
|
|
|
|
if ($ignorecase) { |
6333
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
6334
|
|
|
|
|
|
|
} |
6335
|
|
|
|
|
|
|
} |
6336
|
|
|
|
|
|
|
|
6337
|
0
|
|
|
|
|
0
|
# $$foo{ ... } --> $ $foo->{ ... } |
6338
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) { |
6339
|
0
|
|
|
|
|
0
|
$char[$i] = e_capture($1.'->'.$2); |
6340
|
|
|
|
|
|
|
if ($ignorecase) { |
6341
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
6342
|
|
|
|
|
|
|
} |
6343
|
|
|
|
|
|
|
} |
6344
|
|
|
|
|
|
|
|
6345
|
0
|
|
|
|
|
0
|
# $$foo |
6346
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) { |
6347
|
0
|
|
|
|
|
0
|
$char[$i] = e_capture($1); |
6348
|
|
|
|
|
|
|
if ($ignorecase) { |
6349
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
6350
|
|
|
|
|
|
|
} |
6351
|
|
|
|
|
|
|
} |
6352
|
|
|
|
|
|
|
|
6353
|
0
|
50
|
|
|
|
0
|
# $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Eeucjp::PREMATCH() |
6354
|
8
|
|
|
|
|
27
|
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) { |
6355
|
|
|
|
|
|
|
if ($ignorecase) { |
6356
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(Eeucjp::PREMATCH())]}'; |
6357
|
0
|
|
|
|
|
0
|
} |
6358
|
|
|
|
|
|
|
else { |
6359
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::PREMATCH()]}'; |
6360
|
|
|
|
|
|
|
} |
6361
|
|
|
|
|
|
|
} |
6362
|
|
|
|
|
|
|
|
6363
|
8
|
50
|
|
|
|
27
|
# $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Eeucjp::MATCH() |
6364
|
8
|
|
|
|
|
22
|
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) { |
6365
|
|
|
|
|
|
|
if ($ignorecase) { |
6366
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(Eeucjp::MATCH())]}'; |
6367
|
0
|
|
|
|
|
0
|
} |
6368
|
|
|
|
|
|
|
else { |
6369
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::MATCH()]}'; |
6370
|
|
|
|
|
|
|
} |
6371
|
|
|
|
|
|
|
} |
6372
|
|
|
|
|
|
|
|
6373
|
8
|
50
|
|
|
|
22
|
# $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Eeucjp::POSTMATCH() |
6374
|
6
|
|
|
|
|
17
|
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) { |
6375
|
|
|
|
|
|
|
if ($ignorecase) { |
6376
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(Eeucjp::POSTMATCH())]}'; |
6377
|
0
|
|
|
|
|
0
|
} |
6378
|
|
|
|
|
|
|
else { |
6379
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::POSTMATCH()]}'; |
6380
|
|
|
|
|
|
|
} |
6381
|
|
|
|
|
|
|
} |
6382
|
|
|
|
|
|
|
|
6383
|
6
|
0
|
|
|
|
17
|
# ${ foo } |
6384
|
0
|
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) { |
6385
|
|
|
|
|
|
|
if ($ignorecase) { |
6386
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
6387
|
|
|
|
|
|
|
} |
6388
|
|
|
|
|
|
|
} |
6389
|
|
|
|
|
|
|
|
6390
|
0
|
|
|
|
|
0
|
# ${ ... } |
6391
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) { |
6392
|
0
|
|
|
|
|
0
|
$char[$i] = e_capture($1); |
6393
|
|
|
|
|
|
|
if ($ignorecase) { |
6394
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
6395
|
|
|
|
|
|
|
} |
6396
|
|
|
|
|
|
|
} |
6397
|
|
|
|
|
|
|
|
6398
|
0
|
|
|
|
|
0
|
# $scalar or @array |
6399
|
29
|
100
|
|
|
|
85
|
elsif ($char[$i] =~ /\A [\$\@].+ /oxms) { |
6400
|
29
|
|
|
|
|
100
|
$char[$i] = e_string($char[$i]); |
6401
|
|
|
|
|
|
|
if ($ignorecase) { |
6402
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
6403
|
|
|
|
|
|
|
} |
6404
|
|
|
|
|
|
|
} |
6405
|
|
|
|
|
|
|
|
6406
|
4
|
100
|
66
|
|
|
13
|
# quote character before ? + * { |
|
|
50
|
|
|
|
|
|
6407
|
|
|
|
|
|
|
elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) { |
6408
|
|
|
|
|
|
|
if ($char[$i-1] =~ /\A (?:[\x00-\xFF]|\\[0-7]{2,3}|\\x[0-9-A-Fa-f]{1,2}) \z/oxms) { |
6409
|
188
|
|
|
|
|
1536
|
} |
6410
|
0
|
0
|
|
|
|
0
|
elsif (($ope =~ /\A m? \z/oxms) and ($delimiter eq '?')) { |
6411
|
0
|
|
|
|
|
0
|
my $char = $char[$i-1]; |
6412
|
|
|
|
|
|
|
if ($char[$i] eq '{') { |
6413
|
|
|
|
|
|
|
die __FILE__, qq{: "MULTIBYTE{n}" should be "(MULTIBYTE){n}" in m?? (and shift \$1,\$2,\$3,...) ($char){n}\n}; |
6414
|
0
|
|
|
|
|
0
|
} |
6415
|
|
|
|
|
|
|
else { |
6416
|
|
|
|
|
|
|
die __FILE__, qq{: "MULTIBYTE$char[$i]" should be "(MULTIBYTE)$char[$i]" in m?? (and shift \$1,\$2,\$3,...) ($char)$char[$i]\n}; |
6417
|
|
|
|
|
|
|
} |
6418
|
0
|
|
|
|
|
0
|
} |
6419
|
|
|
|
|
|
|
else { |
6420
|
|
|
|
|
|
|
$char[$i-1] = '(?:' . $char[$i-1] . ')'; |
6421
|
|
|
|
|
|
|
} |
6422
|
|
|
|
|
|
|
} |
6423
|
|
|
|
|
|
|
} |
6424
|
187
|
|
|
|
|
1937
|
|
6425
|
1358
|
50
|
|
|
|
2572
|
# make regexp string |
6426
|
1358
|
0
|
0
|
|
|
3045
|
$modifier =~ tr/i//d; |
6427
|
0
|
|
|
|
|
0
|
if ($left_e > $right_e) { |
6428
|
|
|
|
|
|
|
if (($ope =~ /\A m? \z/oxms) and ($delimiter eq '?')) { |
6429
|
|
|
|
|
|
|
return join '', $ope, $delimiter, $anchor, @char, '>]}' x ($left_e - $right_e), $matched, $end_delimiter, $modifier; |
6430
|
0
|
|
|
|
|
0
|
} |
6431
|
|
|
|
|
|
|
else { |
6432
|
|
|
|
|
|
|
return join '', $ope, $delimiter, $anchor, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier; |
6433
|
0
|
100
|
100
|
|
|
0
|
} |
6434
|
1358
|
|
|
|
|
7655
|
} |
6435
|
|
|
|
|
|
|
if (($ope =~ /\A m? \z/oxms) and ($delimiter eq '?')) { |
6436
|
|
|
|
|
|
|
return join '', $ope, $delimiter, $anchor, @char, $matched, $end_delimiter, $modifier; |
6437
|
42
|
|
|
|
|
351
|
} |
6438
|
|
|
|
|
|
|
else { |
6439
|
|
|
|
|
|
|
return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier; |
6440
|
|
|
|
|
|
|
} |
6441
|
|
|
|
|
|
|
} |
6442
|
|
|
|
|
|
|
|
6443
|
|
|
|
|
|
|
# |
6444
|
|
|
|
|
|
|
# double quote stuff |
6445
|
1316
|
|
|
540
|
0
|
10748
|
# |
6446
|
|
|
|
|
|
|
sub qq_stuff { |
6447
|
|
|
|
|
|
|
my($delimiter,$end_delimiter,$stuff) = @_; |
6448
|
540
|
100
|
|
|
|
892
|
|
6449
|
540
|
|
|
|
|
1058
|
# scalar variable or array variable |
6450
|
|
|
|
|
|
|
if ($stuff =~ /\A [\$\@] /oxms) { |
6451
|
|
|
|
|
|
|
return $stuff; |
6452
|
|
|
|
|
|
|
} |
6453
|
300
|
|
|
|
|
1026
|
|
|
240
|
|
|
|
|
591
|
|
6454
|
280
|
|
|
|
|
751
|
# quote by delimiter |
6455
|
240
|
50
|
|
|
|
557
|
my %octet = map {$_ => 1} ($stuff =~ /\G ([\x00-\xFF]) /oxmsg); |
6456
|
240
|
50
|
|
|
|
445
|
for my $char (qw( ! " $ % & * + - . / : = ? @ ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") { |
6457
|
240
|
50
|
|
|
|
360
|
next if $char eq $delimiter; |
6458
|
240
|
|
|
|
|
399
|
next if $char eq $end_delimiter; |
6459
|
|
|
|
|
|
|
if (not $octet{$char}) { |
6460
|
|
|
|
|
|
|
return join '', 'qq', $char, $stuff, $char; |
6461
|
240
|
|
|
|
|
907
|
} |
6462
|
|
|
|
|
|
|
} |
6463
|
|
|
|
|
|
|
return join '', 'qq', '<', $stuff, '>'; |
6464
|
|
|
|
|
|
|
} |
6465
|
|
|
|
|
|
|
|
6466
|
|
|
|
|
|
|
# |
6467
|
|
|
|
|
|
|
# escape regexp (m'', qr'', and m''b, qr''b) |
6468
|
0
|
|
|
39
|
0
|
0
|
# |
6469
|
39
|
|
100
|
|
|
173
|
sub e_qr_q { |
6470
|
|
|
|
|
|
|
my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_; |
6471
|
39
|
|
|
|
|
129
|
$modifier ||= ''; |
6472
|
39
|
50
|
|
|
|
68
|
|
6473
|
39
|
|
|
|
|
93
|
$modifier =~ tr/p//d; |
6474
|
0
|
|
|
|
|
0
|
if ($modifier =~ /([adlu])/oxms) { |
6475
|
0
|
0
|
|
|
|
0
|
my $line = 0; |
6476
|
0
|
|
|
|
|
0
|
for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) { |
6477
|
0
|
|
|
|
|
0
|
if ($filename ne __FILE__) { |
6478
|
|
|
|
|
|
|
$line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1; |
6479
|
|
|
|
|
|
|
last; |
6480
|
0
|
|
|
|
|
0
|
} |
6481
|
|
|
|
|
|
|
} |
6482
|
|
|
|
|
|
|
die qq{Unsupported modifier "$1" used at line $line.\n}; |
6483
|
0
|
|
|
|
|
0
|
} |
6484
|
|
|
|
|
|
|
|
6485
|
|
|
|
|
|
|
$slash = 'div'; |
6486
|
39
|
100
|
|
|
|
65
|
|
|
|
100
|
|
|
|
|
|
6487
|
39
|
|
|
|
|
125
|
# literal null string pattern |
6488
|
8
|
|
|
|
|
9
|
if ($string eq '') { |
6489
|
8
|
|
|
|
|
12
|
$modifier =~ tr/bB//d; |
6490
|
|
|
|
|
|
|
$modifier =~ tr/i//d; |
6491
|
|
|
|
|
|
|
return join '', $ope, $delimiter, $end_delimiter, $modifier; |
6492
|
|
|
|
|
|
|
} |
6493
|
|
|
|
|
|
|
|
6494
|
8
|
|
|
|
|
37
|
# with /b /B modifier |
6495
|
|
|
|
|
|
|
elsif ($modifier =~ tr/bB//d) { |
6496
|
|
|
|
|
|
|
return e_qr_qb($ope,$delimiter,$end_delimiter,$string,$modifier); |
6497
|
|
|
|
|
|
|
} |
6498
|
|
|
|
|
|
|
|
6499
|
17
|
|
|
|
|
43
|
# without /b /B modifier |
6500
|
|
|
|
|
|
|
else { |
6501
|
|
|
|
|
|
|
return e_qr_qt($ope,$delimiter,$end_delimiter,$string,$modifier); |
6502
|
|
|
|
|
|
|
} |
6503
|
|
|
|
|
|
|
} |
6504
|
|
|
|
|
|
|
|
6505
|
|
|
|
|
|
|
# |
6506
|
|
|
|
|
|
|
# escape regexp (m'', qr'') |
6507
|
14
|
|
|
14
|
0
|
50
|
# |
6508
|
|
|
|
|
|
|
sub e_qr_qt { |
6509
|
14
|
100
|
|
|
|
44
|
my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_; |
6510
|
|
|
|
|
|
|
|
6511
|
|
|
|
|
|
|
my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0; |
6512
|
14
|
|
|
|
|
42
|
|
6513
|
|
|
|
|
|
|
# split regexp |
6514
|
|
|
|
|
|
|
my @char = $string =~ /\G((?> |
6515
|
|
|
|
|
|
|
[^\x8E\x8F\xA1-\xFE\\\[\$\@\/] | |
6516
|
|
|
|
|
|
|
[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
6517
|
|
|
|
|
|
|
\[\^ | |
6518
|
|
|
|
|
|
|
\[\: (?>[a-z]+) \:\] | |
6519
|
|
|
|
|
|
|
\[\:\^ (?>[a-z]+) \:\] | |
6520
|
|
|
|
|
|
|
[\$\@\/] | |
6521
|
|
|
|
|
|
|
\\ (?:$q_char) | |
6522
|
|
|
|
|
|
|
(?:$q_char) |
6523
|
|
|
|
|
|
|
))/oxmsg; |
6524
|
14
|
|
|
|
|
578
|
|
6525
|
14
|
50
|
100
|
|
|
74
|
# unescape character |
|
|
50
|
100
|
|
|
|
|
|
|
50
|
66
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
6526
|
|
|
|
|
|
|
for (my $i=0; $i <= $#char; $i++) { |
6527
|
|
|
|
|
|
|
if (0) { |
6528
|
|
|
|
|
|
|
} |
6529
|
27
|
|
|
|
|
139
|
|
6530
|
0
|
|
|
|
|
0
|
# open character class [...] |
6531
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] eq '[') { |
6532
|
0
|
|
|
|
|
0
|
my $left = $i; |
6533
|
|
|
|
|
|
|
if ($char[$i+1] eq ']') { |
6534
|
0
|
|
|
|
|
0
|
$i++; |
6535
|
0
|
0
|
|
|
|
0
|
} |
6536
|
0
|
|
|
|
|
0
|
while (1) { |
6537
|
|
|
|
|
|
|
if (++$i > $#char) { |
6538
|
0
|
0
|
|
|
|
0
|
die __FILE__, ": Unmatched [] in regexp\n"; |
6539
|
0
|
|
|
|
|
0
|
} |
6540
|
|
|
|
|
|
|
if ($char[$i] eq ']') { |
6541
|
|
|
|
|
|
|
my $right = $i; |
6542
|
0
|
|
|
|
|
0
|
|
6543
|
|
|
|
|
|
|
# [...] |
6544
|
0
|
|
|
|
|
0
|
splice @char, $left, $right-$left+1, Eeucjp::charlist_qr(@char[$left+1..$right-1], $modifier); |
6545
|
0
|
|
|
|
|
0
|
|
6546
|
|
|
|
|
|
|
$i = $left; |
6547
|
|
|
|
|
|
|
last; |
6548
|
|
|
|
|
|
|
} |
6549
|
|
|
|
|
|
|
} |
6550
|
|
|
|
|
|
|
} |
6551
|
|
|
|
|
|
|
|
6552
|
0
|
|
|
|
|
0
|
# open character class [^...] |
6553
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] eq '[^') { |
6554
|
0
|
|
|
|
|
0
|
my $left = $i; |
6555
|
|
|
|
|
|
|
if ($char[$i+1] eq ']') { |
6556
|
0
|
|
|
|
|
0
|
$i++; |
6557
|
0
|
0
|
|
|
|
0
|
} |
6558
|
0
|
|
|
|
|
0
|
while (1) { |
6559
|
|
|
|
|
|
|
if (++$i > $#char) { |
6560
|
0
|
0
|
|
|
|
0
|
die __FILE__, ": Unmatched [] in regexp\n"; |
6561
|
0
|
|
|
|
|
0
|
} |
6562
|
|
|
|
|
|
|
if ($char[$i] eq ']') { |
6563
|
|
|
|
|
|
|
my $right = $i; |
6564
|
0
|
|
|
|
|
0
|
|
6565
|
|
|
|
|
|
|
# [^...] |
6566
|
0
|
|
|
|
|
0
|
splice @char, $left, $right-$left+1, Eeucjp::charlist_not_qr(@char[$left+1..$right-1], $modifier); |
6567
|
0
|
|
|
|
|
0
|
|
6568
|
|
|
|
|
|
|
$i = $left; |
6569
|
|
|
|
|
|
|
last; |
6570
|
|
|
|
|
|
|
} |
6571
|
|
|
|
|
|
|
} |
6572
|
|
|
|
|
|
|
} |
6573
|
|
|
|
|
|
|
|
6574
|
0
|
|
|
|
|
0
|
# escape $ @ / and \ |
6575
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) { |
6576
|
|
|
|
|
|
|
$char[$i] = '\\' . $char[$i]; |
6577
|
|
|
|
|
|
|
} |
6578
|
|
|
|
|
|
|
|
6579
|
0
|
|
|
|
|
0
|
# rewrite character class or escape character |
6580
|
|
|
|
|
|
|
elsif (my $char = character_class($char[$i],$modifier)) { |
6581
|
|
|
|
|
|
|
$char[$i] = $char; |
6582
|
|
|
|
|
|
|
} |
6583
|
|
|
|
|
|
|
|
6584
|
0
|
50
|
|
|
|
0
|
# /i modifier |
6585
|
4
|
|
|
|
|
7
|
elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Eeucjp::uc($char[$i]) ne Eeucjp::fc($char[$i]))) { |
6586
|
|
|
|
|
|
|
if (CORE::length(Eeucjp::fc($char[$i])) == 1) { |
6587
|
|
|
|
|
|
|
$char[$i] = '[' . Eeucjp::uc($char[$i]) . Eeucjp::fc($char[$i]) . ']'; |
6588
|
4
|
|
|
|
|
10
|
} |
6589
|
|
|
|
|
|
|
else { |
6590
|
|
|
|
|
|
|
$char[$i] = '(?:' . Eeucjp::uc($char[$i]) . '|' . Eeucjp::fc($char[$i]) . ')'; |
6591
|
|
|
|
|
|
|
} |
6592
|
|
|
|
|
|
|
} |
6593
|
|
|
|
|
|
|
|
6594
|
0
|
0
|
|
|
|
0
|
# quote character before ? + * { |
6595
|
|
|
|
|
|
|
elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) { |
6596
|
|
|
|
|
|
|
if ($char[$i-1] =~ /\A [\x00-\xFF] \z/oxms) { |
6597
|
0
|
|
|
|
|
0
|
} |
6598
|
|
|
|
|
|
|
else { |
6599
|
|
|
|
|
|
|
$char[$i-1] = '(?:' . $char[$i-1] . ')'; |
6600
|
|
|
|
|
|
|
} |
6601
|
|
|
|
|
|
|
} |
6602
|
0
|
|
|
|
|
0
|
} |
6603
|
14
|
|
|
|
|
33
|
|
6604
|
|
|
|
|
|
|
$delimiter = '/'; |
6605
|
14
|
|
|
|
|
28
|
$end_delimiter = '/'; |
6606
|
14
|
|
|
|
|
100
|
|
6607
|
|
|
|
|
|
|
$modifier =~ tr/i//d; |
6608
|
|
|
|
|
|
|
return join '', $ope, $delimiter, $anchor, '(?:', @char, ')', $matched, $end_delimiter, $modifier; |
6609
|
|
|
|
|
|
|
} |
6610
|
|
|
|
|
|
|
|
6611
|
|
|
|
|
|
|
# |
6612
|
|
|
|
|
|
|
# escape regexp (m''b, qr''b) |
6613
|
14
|
|
|
17
|
0
|
221
|
# |
6614
|
|
|
|
|
|
|
sub e_qr_qb { |
6615
|
|
|
|
|
|
|
my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_; |
6616
|
17
|
|
|
|
|
45
|
|
6617
|
|
|
|
|
|
|
# split regexp |
6618
|
|
|
|
|
|
|
my @char = $string =~ /\G ((?>[^\\]|\\\\|[\x00-\xFF])) /oxmsg; |
6619
|
17
|
|
|
|
|
73
|
|
6620
|
17
|
50
|
|
|
|
65
|
# unescape character |
|
|
50
|
|
|
|
|
|
6621
|
|
|
|
|
|
|
for (my $i=0; $i <= $#char; $i++) { |
6622
|
|
|
|
|
|
|
if (0) { |
6623
|
|
|
|
|
|
|
} |
6624
|
51
|
|
|
|
|
197
|
|
6625
|
|
|
|
|
|
|
# remain \\ |
6626
|
|
|
|
|
|
|
elsif ($char[$i] eq '\\\\') { |
6627
|
|
|
|
|
|
|
} |
6628
|
|
|
|
|
|
|
|
6629
|
0
|
|
|
|
|
0
|
# escape $ @ / and \ |
6630
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) { |
6631
|
|
|
|
|
|
|
$char[$i] = '\\' . $char[$i]; |
6632
|
|
|
|
|
|
|
} |
6633
|
0
|
|
|
|
|
0
|
} |
6634
|
17
|
|
|
|
|
31
|
|
6635
|
17
|
|
|
|
|
22
|
$delimiter = '/'; |
6636
|
|
|
|
|
|
|
$end_delimiter = '/'; |
6637
|
|
|
|
|
|
|
return join '', $ope, $delimiter, '(?:', @char, ')', $matched, $end_delimiter, $modifier; |
6638
|
|
|
|
|
|
|
} |
6639
|
|
|
|
|
|
|
|
6640
|
|
|
|
|
|
|
# |
6641
|
|
|
|
|
|
|
# escape regexp (s/here//) |
6642
|
17
|
|
|
122
|
0
|
103
|
# |
6643
|
122
|
|
100
|
|
|
395
|
sub e_s1 { |
6644
|
|
|
|
|
|
|
my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_; |
6645
|
122
|
|
|
|
|
560
|
$modifier ||= ''; |
6646
|
122
|
50
|
|
|
|
210
|
|
6647
|
122
|
|
|
|
|
378
|
$modifier =~ tr/p//d; |
6648
|
0
|
|
|
|
|
0
|
if ($modifier =~ /([adlu])/oxms) { |
6649
|
0
|
0
|
|
|
|
0
|
my $line = 0; |
6650
|
0
|
|
|
|
|
0
|
for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) { |
6651
|
0
|
|
|
|
|
0
|
if ($filename ne __FILE__) { |
6652
|
|
|
|
|
|
|
$line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1; |
6653
|
|
|
|
|
|
|
last; |
6654
|
0
|
|
|
|
|
0
|
} |
6655
|
|
|
|
|
|
|
} |
6656
|
|
|
|
|
|
|
die qq{Unsupported modifier "$1" used at line $line.\n}; |
6657
|
0
|
|
|
|
|
0
|
} |
6658
|
|
|
|
|
|
|
|
6659
|
|
|
|
|
|
|
$slash = 'div'; |
6660
|
122
|
100
|
|
|
|
282
|
|
|
|
100
|
|
|
|
|
|
6661
|
122
|
|
|
|
|
519
|
# literal null string pattern |
6662
|
8
|
|
|
|
|
8
|
if ($string eq '') { |
6663
|
8
|
|
|
|
|
9
|
$modifier =~ tr/bB//d; |
6664
|
|
|
|
|
|
|
$modifier =~ tr/i//d; |
6665
|
|
|
|
|
|
|
return join '', $ope, $delimiter, $end_delimiter, $modifier; |
6666
|
|
|
|
|
|
|
} |
6667
|
|
|
|
|
|
|
|
6668
|
|
|
|
|
|
|
# /b /B modifier |
6669
|
|
|
|
|
|
|
elsif ($modifier =~ tr/bB//d) { |
6670
|
8
|
50
|
|
|
|
51
|
|
6671
|
8
|
|
|
|
|
23
|
# choice again delimiter |
6672
|
0
|
|
|
|
|
0
|
if ($delimiter =~ / [\@:] /oxms) { |
|
0
|
|
|
|
|
0
|
|
6673
|
0
|
0
|
|
|
|
0
|
my @char = $string =~ /\G ([\x00-\xFF]) /oxmsg; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
6674
|
0
|
|
|
|
|
0
|
my %octet = map {$_ => 1} @char; |
6675
|
0
|
|
|
|
|
0
|
if (not $octet{')'}) { |
6676
|
|
|
|
|
|
|
$delimiter = '('; |
6677
|
|
|
|
|
|
|
$end_delimiter = ')'; |
6678
|
0
|
|
|
|
|
0
|
} |
6679
|
0
|
|
|
|
|
0
|
elsif (not $octet{'}'}) { |
6680
|
|
|
|
|
|
|
$delimiter = '{'; |
6681
|
|
|
|
|
|
|
$end_delimiter = '}'; |
6682
|
0
|
|
|
|
|
0
|
} |
6683
|
0
|
|
|
|
|
0
|
elsif (not $octet{']'}) { |
6684
|
|
|
|
|
|
|
$delimiter = '['; |
6685
|
|
|
|
|
|
|
$end_delimiter = ']'; |
6686
|
0
|
|
|
|
|
0
|
} |
6687
|
0
|
|
|
|
|
0
|
elsif (not $octet{'>'}) { |
6688
|
|
|
|
|
|
|
$delimiter = '<'; |
6689
|
|
|
|
|
|
|
$end_delimiter = '>'; |
6690
|
0
|
|
|
|
|
0
|
} |
6691
|
0
|
0
|
|
|
|
0
|
else { |
6692
|
0
|
|
|
|
|
0
|
for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") { |
6693
|
0
|
|
|
|
|
0
|
if (not $octet{$char}) { |
6694
|
0
|
|
|
|
|
0
|
$delimiter = $char; |
6695
|
|
|
|
|
|
|
$end_delimiter = $char; |
6696
|
|
|
|
|
|
|
last; |
6697
|
|
|
|
|
|
|
} |
6698
|
|
|
|
|
|
|
} |
6699
|
|
|
|
|
|
|
} |
6700
|
0
|
|
|
|
|
0
|
} |
6701
|
8
|
|
|
|
|
13
|
|
6702
|
8
|
|
|
|
|
15
|
my $prematch = ''; |
6703
|
|
|
|
|
|
|
$prematch = q{(\G[\x00-\xFF]*?)}; |
6704
|
|
|
|
|
|
|
return join '', $ope, $delimiter, $prematch, '(?:', $string, ')', $matched, $end_delimiter, $modifier; |
6705
|
8
|
100
|
|
|
|
62
|
} |
6706
|
106
|
|
|
|
|
358
|
|
6707
|
|
|
|
|
|
|
my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0; |
6708
|
|
|
|
|
|
|
my $metachar = qr/[\@\\|[\]{^]/oxms; |
6709
|
106
|
|
|
|
|
504
|
|
6710
|
|
|
|
|
|
|
# split regexp |
6711
|
|
|
|
|
|
|
my @char = $string =~ /\G((?> |
6712
|
|
|
|
|
|
|
[^\x8E\x8F\xA1-\xFE\\\$\@\[\(]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
6713
|
|
|
|
|
|
|
\\ (?>[1-9][0-9]*) | |
6714
|
|
|
|
|
|
|
\\g (?>\s*) (?>[1-9][0-9]*) | |
6715
|
|
|
|
|
|
|
\\g (?>\s*) \{ (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} | |
6716
|
|
|
|
|
|
|
\\g (?>\s*) \{ (?>\s*) - (?>\s*) (?>[1-9][0-9]*) (?>\s*) \} | |
6717
|
|
|
|
|
|
|
\\x (?>[0-9A-Fa-f]{1,2}) | |
6718
|
|
|
|
|
|
|
\\ (?>[0-7]{2,3}) | |
6719
|
|
|
|
|
|
|
\\c [\x40-\x5F] | |
6720
|
|
|
|
|
|
|
\\x\{ (?>[0-9A-Fa-f]+) \} | |
6721
|
|
|
|
|
|
|
\\o\{ (?>[0-7]+) \} | |
6722
|
|
|
|
|
|
|
\\[bBNpP]\{ (?>[^\x8E\x8F\xA1-\xFE0-9\}][^\x8E\x8F\xA1-\xFE\}]*) \} | |
6723
|
|
|
|
|
|
|
\\ $q_char | |
6724
|
|
|
|
|
|
|
\$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} | |
6725
|
|
|
|
|
|
|
\$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} | |
6726
|
|
|
|
|
|
|
\$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} | |
6727
|
|
|
|
|
|
|
[\$\@] $qq_variable | |
6728
|
|
|
|
|
|
|
\$ (?>\s* [0-9]+) | |
6729
|
|
|
|
|
|
|
\$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} | |
6730
|
|
|
|
|
|
|
\$ \$ (?![\w\{]) | |
6731
|
|
|
|
|
|
|
\$ (?>\s*) \$ (?>\s*) $qq_variable | |
6732
|
|
|
|
|
|
|
\[\^ | |
6733
|
|
|
|
|
|
|
\[\: (?>[a-z]+) :\] | |
6734
|
|
|
|
|
|
|
\[\:\^ (?>[a-z]+) :\] | |
6735
|
|
|
|
|
|
|
\(\? | |
6736
|
|
|
|
|
|
|
$q_char |
6737
|
|
|
|
|
|
|
))/oxmsg; |
6738
|
106
|
50
|
|
|
|
55959
|
|
6739
|
106
|
|
|
|
|
1324
|
# choice again delimiter |
|
0
|
|
|
|
|
0
|
|
6740
|
0
|
0
|
|
|
|
0
|
if ($delimiter =~ / [\@:] /oxms) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
6741
|
0
|
|
|
|
|
0
|
my %octet = map {$_ => 1} @char; |
6742
|
0
|
|
|
|
|
0
|
if (not $octet{')'}) { |
6743
|
|
|
|
|
|
|
$delimiter = '('; |
6744
|
|
|
|
|
|
|
$end_delimiter = ')'; |
6745
|
0
|
|
|
|
|
0
|
} |
6746
|
0
|
|
|
|
|
0
|
elsif (not $octet{'}'}) { |
6747
|
|
|
|
|
|
|
$delimiter = '{'; |
6748
|
|
|
|
|
|
|
$end_delimiter = '}'; |
6749
|
0
|
|
|
|
|
0
|
} |
6750
|
0
|
|
|
|
|
0
|
elsif (not $octet{']'}) { |
6751
|
|
|
|
|
|
|
$delimiter = '['; |
6752
|
|
|
|
|
|
|
$end_delimiter = ']'; |
6753
|
0
|
|
|
|
|
0
|
} |
6754
|
0
|
|
|
|
|
0
|
elsif (not $octet{'>'}) { |
6755
|
|
|
|
|
|
|
$delimiter = '<'; |
6756
|
|
|
|
|
|
|
$end_delimiter = '>'; |
6757
|
0
|
|
|
|
|
0
|
} |
6758
|
0
|
0
|
|
|
|
0
|
else { |
6759
|
0
|
|
|
|
|
0
|
for my $char (qw( ! " $ % & * + - . / = ? ^ ` | ~ ), "\x00".."\x1F", "\x7F", "\xFF") { |
6760
|
0
|
|
|
|
|
0
|
if (not $octet{$char}) { |
6761
|
0
|
|
|
|
|
0
|
$delimiter = $char; |
6762
|
|
|
|
|
|
|
$end_delimiter = $char; |
6763
|
|
|
|
|
|
|
last; |
6764
|
|
|
|
|
|
|
} |
6765
|
|
|
|
|
|
|
} |
6766
|
|
|
|
|
|
|
} |
6767
|
|
|
|
|
|
|
} |
6768
|
0
|
|
|
|
|
0
|
|
|
106
|
|
|
|
|
244
|
|
6769
|
|
|
|
|
|
|
# count '(' |
6770
|
436
|
|
|
|
|
836
|
my $parens = grep { $_ eq '(' } @char; |
6771
|
106
|
|
|
|
|
222
|
|
6772
|
106
|
|
|
|
|
266
|
my $left_e = 0; |
6773
|
|
|
|
|
|
|
my $right_e = 0; |
6774
|
|
|
|
|
|
|
for (my $i=0; $i <= $#char; $i++) { |
6775
|
106
|
50
|
33
|
|
|
387
|
|
|
|
50
|
33
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
6776
|
357
|
|
|
|
|
2583
|
# "\L\u" --> "\u\L" |
6777
|
|
|
|
|
|
|
if (($char[$i] eq '\L') and ($char[$i+1] eq '\u')) { |
6778
|
|
|
|
|
|
|
@char[$i,$i+1] = @char[$i+1,$i]; |
6779
|
|
|
|
|
|
|
} |
6780
|
|
|
|
|
|
|
|
6781
|
0
|
|
|
|
|
0
|
# "\U\l" --> "\l\U" |
6782
|
|
|
|
|
|
|
elsif (($char[$i] eq '\U') and ($char[$i+1] eq '\l')) { |
6783
|
|
|
|
|
|
|
@char[$i,$i+1] = @char[$i+1,$i]; |
6784
|
|
|
|
|
|
|
} |
6785
|
|
|
|
|
|
|
|
6786
|
0
|
|
|
|
|
0
|
# octal escape sequence |
6787
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) { |
6788
|
|
|
|
|
|
|
$char[$i] = Eeucjp::octchr($1); |
6789
|
|
|
|
|
|
|
} |
6790
|
|
|
|
|
|
|
|
6791
|
1
|
|
|
|
|
4
|
# hexadecimal escape sequence |
6792
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) { |
6793
|
|
|
|
|
|
|
$char[$i] = Eeucjp::hexchr($1); |
6794
|
|
|
|
|
|
|
} |
6795
|
|
|
|
|
|
|
|
6796
|
|
|
|
|
|
|
# \b{...} --> b\{...} |
6797
|
|
|
|
|
|
|
# \B{...} --> B\{...} |
6798
|
|
|
|
|
|
|
# \N{CHARNAME} --> N\{CHARNAME} |
6799
|
|
|
|
|
|
|
# \p{PROPERTY} --> p\{PROPERTY} |
6800
|
1
|
|
|
|
|
4
|
# \P{PROPERTY} --> P\{PROPERTY} |
6801
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^\x8E\x8F\xA1-\xFE0-9\}][^\x8E\x8F\xA1-\xFE\}]*) \} ) \z/oxms) { |
6802
|
|
|
|
|
|
|
$char[$i] = $1 . '\\' . $2; |
6803
|
|
|
|
|
|
|
} |
6804
|
|
|
|
|
|
|
|
6805
|
0
|
|
|
|
|
0
|
# \p, \P, \X --> p, P, X |
6806
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) { |
6807
|
|
|
|
|
|
|
$char[$i] = $1; |
6808
|
0
|
50
|
100
|
|
|
0
|
} |
|
|
100
|
100
|
|
|
|
|
|
|
50
|
100
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
6809
|
|
|
|
|
|
|
|
6810
|
|
|
|
|
|
|
if (0) { |
6811
|
|
|
|
|
|
|
} |
6812
|
357
|
|
|
|
|
1480
|
|
6813
|
0
|
0
|
0
|
|
|
0
|
# join separated multiple-octet |
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
6814
|
0
|
|
|
|
|
0
|
elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) { |
6815
|
|
|
|
|
|
|
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)) { |
6816
|
|
|
|
|
|
|
$char[$i] .= join '', splice @char, $i+1, 3; |
6817
|
0
|
|
|
|
|
0
|
} |
6818
|
|
|
|
|
|
|
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)) { |
6819
|
|
|
|
|
|
|
$char[$i] .= join '', splice @char, $i+1, 2; |
6820
|
0
|
|
|
|
|
0
|
} |
6821
|
|
|
|
|
|
|
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)) { |
6822
|
|
|
|
|
|
|
$char[$i] .= join '', splice @char, $i+1, 1; |
6823
|
|
|
|
|
|
|
} |
6824
|
|
|
|
|
|
|
} |
6825
|
|
|
|
|
|
|
|
6826
|
0
|
|
|
|
|
0
|
# open character class [...] |
6827
|
20
|
50
|
|
|
|
35
|
elsif ($char[$i] eq '[') { |
6828
|
20
|
|
|
|
|
75
|
my $left = $i; |
6829
|
|
|
|
|
|
|
if ($char[$i+1] eq ']') { |
6830
|
0
|
|
|
|
|
0
|
$i++; |
6831
|
20
|
50
|
|
|
|
28
|
} |
6832
|
79
|
|
|
|
|
158
|
while (1) { |
6833
|
|
|
|
|
|
|
if (++$i > $#char) { |
6834
|
0
|
100
|
|
|
|
0
|
die __FILE__, ": Unmatched [] in regexp\n"; |
6835
|
79
|
|
|
|
|
167
|
} |
6836
|
|
|
|
|
|
|
if ($char[$i] eq ']') { |
6837
|
|
|
|
|
|
|
my $right = $i; |
6838
|
20
|
50
|
|
|
|
38
|
|
6839
|
20
|
|
|
|
|
139
|
# [...] |
|
0
|
|
|
|
|
0
|
|
6840
|
|
|
|
|
|
|
if (grep(/\A [\$\@]/oxms,@char[$left+1..$right-1]) >= 1) { |
6841
|
|
|
|
|
|
|
splice @char, $left, $right-$left+1, sprintf(q{@{[Eeucjp::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier); |
6842
|
0
|
|
|
|
|
0
|
} |
6843
|
|
|
|
|
|
|
else { |
6844
|
|
|
|
|
|
|
splice @char, $left, $right-$left+1, Eeucjp::charlist_qr(@char[$left+1..$right-1], $modifier); |
6845
|
20
|
|
|
|
|
108
|
} |
6846
|
20
|
|
|
|
|
42
|
|
6847
|
|
|
|
|
|
|
$i = $left; |
6848
|
|
|
|
|
|
|
last; |
6849
|
|
|
|
|
|
|
} |
6850
|
|
|
|
|
|
|
} |
6851
|
|
|
|
|
|
|
} |
6852
|
|
|
|
|
|
|
|
6853
|
20
|
|
|
|
|
111
|
# open character class [^...] |
6854
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] eq '[^') { |
6855
|
0
|
|
|
|
|
0
|
my $left = $i; |
6856
|
|
|
|
|
|
|
if ($char[$i+1] eq ']') { |
6857
|
0
|
|
|
|
|
0
|
$i++; |
6858
|
0
|
0
|
|
|
|
0
|
} |
6859
|
0
|
|
|
|
|
0
|
while (1) { |
6860
|
|
|
|
|
|
|
if (++$i > $#char) { |
6861
|
0
|
0
|
|
|
|
0
|
die __FILE__, ": Unmatched [] in regexp\n"; |
6862
|
0
|
|
|
|
|
0
|
} |
6863
|
|
|
|
|
|
|
if ($char[$i] eq ']') { |
6864
|
|
|
|
|
|
|
my $right = $i; |
6865
|
0
|
0
|
|
|
|
0
|
|
6866
|
0
|
|
|
|
|
0
|
# [^...] |
|
0
|
|
|
|
|
0
|
|
6867
|
|
|
|
|
|
|
if (grep(/\A [\$\@]/oxms,@char[$left+1..$right-1]) >= 1) { |
6868
|
|
|
|
|
|
|
splice @char, $left, $right-$left+1, sprintf(q{@{[Eeucjp::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier); |
6869
|
0
|
|
|
|
|
0
|
} |
6870
|
|
|
|
|
|
|
else { |
6871
|
|
|
|
|
|
|
splice @char, $left, $right-$left+1, Eeucjp::charlist_not_qr(@char[$left+1..$right-1], $modifier); |
6872
|
0
|
|
|
|
|
0
|
} |
6873
|
0
|
|
|
|
|
0
|
|
6874
|
|
|
|
|
|
|
$i = $left; |
6875
|
|
|
|
|
|
|
last; |
6876
|
|
|
|
|
|
|
} |
6877
|
|
|
|
|
|
|
} |
6878
|
|
|
|
|
|
|
} |
6879
|
|
|
|
|
|
|
|
6880
|
0
|
|
|
|
|
0
|
# rewrite character class or escape character |
6881
|
|
|
|
|
|
|
elsif (my $char = character_class($char[$i],$modifier)) { |
6882
|
|
|
|
|
|
|
$char[$i] = $char; |
6883
|
|
|
|
|
|
|
} |
6884
|
|
|
|
|
|
|
|
6885
|
11
|
50
|
|
|
|
28
|
# /i modifier |
6886
|
5
|
|
|
|
|
11
|
elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Eeucjp::uc($char[$i]) ne Eeucjp::fc($char[$i]))) { |
6887
|
|
|
|
|
|
|
if (CORE::length(Eeucjp::fc($char[$i])) == 1) { |
6888
|
|
|
|
|
|
|
$char[$i] = '[' . Eeucjp::uc($char[$i]) . Eeucjp::fc($char[$i]) . ']'; |
6889
|
5
|
|
|
|
|
11
|
} |
6890
|
|
|
|
|
|
|
else { |
6891
|
|
|
|
|
|
|
$char[$i] = '(?:' . Eeucjp::uc($char[$i]) . '|' . Eeucjp::fc($char[$i]) . ')'; |
6892
|
|
|
|
|
|
|
} |
6893
|
|
|
|
|
|
|
} |
6894
|
|
|
|
|
|
|
|
6895
|
0
|
50
|
|
|
|
0
|
# \u \l \U \L \F \Q \E |
6896
|
8
|
|
|
|
|
27
|
elsif ($char[$i] =~ /\A [<>] \z/oxms) { |
6897
|
|
|
|
|
|
|
if ($right_e < $left_e) { |
6898
|
|
|
|
|
|
|
$char[$i] = '\\' . $char[$i]; |
6899
|
|
|
|
|
|
|
} |
6900
|
0
|
|
|
|
|
0
|
} |
6901
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\u') { |
6902
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ucfirst qq<'; |
6903
|
|
|
|
|
|
|
$left_e++; |
6904
|
0
|
|
|
|
|
0
|
} |
6905
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\l') { |
6906
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::lcfirst qq<'; |
6907
|
|
|
|
|
|
|
$left_e++; |
6908
|
0
|
|
|
|
|
0
|
} |
6909
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\U') { |
6910
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::uc qq<'; |
6911
|
|
|
|
|
|
|
$left_e++; |
6912
|
0
|
|
|
|
|
0
|
} |
6913
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\L') { |
6914
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::lc qq<'; |
6915
|
|
|
|
|
|
|
$left_e++; |
6916
|
0
|
|
|
|
|
0
|
} |
6917
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\F') { |
6918
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::fc qq<'; |
6919
|
|
|
|
|
|
|
$left_e++; |
6920
|
0
|
|
|
|
|
0
|
} |
6921
|
5
|
|
|
|
|
8
|
elsif ($char[$i] eq '\Q') { |
6922
|
|
|
|
|
|
|
$char[$i] = '@{[CORE::quotemeta qq<'; |
6923
|
|
|
|
|
|
|
$left_e++; |
6924
|
5
|
50
|
|
|
|
10
|
} |
6925
|
5
|
|
|
|
|
10
|
elsif ($char[$i] eq '\E') { |
6926
|
5
|
|
|
|
|
8
|
if ($right_e < $left_e) { |
6927
|
|
|
|
|
|
|
$char[$i] = '>]}'; |
6928
|
|
|
|
|
|
|
$right_e++; |
6929
|
5
|
|
|
|
|
8
|
} |
6930
|
|
|
|
|
|
|
else { |
6931
|
|
|
|
|
|
|
$char[$i] = ''; |
6932
|
|
|
|
|
|
|
} |
6933
|
0
|
|
|
|
|
0
|
} |
6934
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] eq '\Q') { |
6935
|
0
|
|
|
|
|
0
|
while (1) { |
6936
|
|
|
|
|
|
|
if (++$i > $#char) { |
6937
|
0
|
0
|
|
|
|
0
|
last; |
6938
|
0
|
|
|
|
|
0
|
} |
6939
|
|
|
|
|
|
|
if ($char[$i] eq '\E') { |
6940
|
|
|
|
|
|
|
last; |
6941
|
|
|
|
|
|
|
} |
6942
|
|
|
|
|
|
|
} |
6943
|
|
|
|
|
|
|
} |
6944
|
|
|
|
|
|
|
elsif ($char[$i] eq '\E') { |
6945
|
|
|
|
|
|
|
} |
6946
|
|
|
|
|
|
|
|
6947
|
|
|
|
|
|
|
# \0 --> \0 |
6948
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\ (?>\s*) 0 \z/oxms) { |
6949
|
|
|
|
|
|
|
} |
6950
|
|
|
|
|
|
|
|
6951
|
|
|
|
|
|
|
# \g{N}, \g{-N} |
6952
|
|
|
|
|
|
|
|
6953
|
|
|
|
|
|
|
# P.108 Using Simple Patterns |
6954
|
|
|
|
|
|
|
# in Chapter 7: In the World of Regular Expressions |
6955
|
|
|
|
|
|
|
# of ISBN 978-0-596-52010-6 Learning Perl, Fifth Edition |
6956
|
|
|
|
|
|
|
|
6957
|
|
|
|
|
|
|
# P.221 Capturing |
6958
|
|
|
|
|
|
|
# in Chapter 5: Pattern Matching |
6959
|
|
|
|
|
|
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
6960
|
|
|
|
|
|
|
|
6961
|
|
|
|
|
|
|
# \g{-1}, \g{-2}, \g{-3} --> \g{-1}, \g{-2}, \g{-3} |
6962
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) - (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) { |
6963
|
|
|
|
|
|
|
} |
6964
|
|
|
|
|
|
|
|
6965
|
0
|
0
|
|
|
|
0
|
# \g{1}, \g{2}, \g{3} --> \g{2}, \g{3}, \g{4} (only when multibyte anchoring is enable) |
6966
|
0
|
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \\g (?>\s*) \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) { |
6967
|
|
|
|
|
|
|
if ($1 <= $parens) { |
6968
|
|
|
|
|
|
|
$char[$i] = '\\g{' . ($1 + 1) . '}'; |
6969
|
|
|
|
|
|
|
} |
6970
|
|
|
|
|
|
|
} |
6971
|
|
|
|
|
|
|
|
6972
|
0
|
0
|
|
|
|
0
|
# \g1, \g2, \g3 --> \g2, \g3, \g4 (only when multibyte anchoring is enable) |
6973
|
0
|
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \\g (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) { |
6974
|
|
|
|
|
|
|
if ($1 <= $parens) { |
6975
|
|
|
|
|
|
|
$char[$i] = '\\g' . ($1 + 1); |
6976
|
|
|
|
|
|
|
} |
6977
|
|
|
|
|
|
|
} |
6978
|
|
|
|
|
|
|
|
6979
|
0
|
0
|
|
|
|
0
|
# \1, \2, \3 --> \2, \3, \4 (only when multibyte anchoring is enable) |
6980
|
0
|
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \\ (?>\s*) ((?>[1-9][0-9]*)) \z/oxms) { |
6981
|
|
|
|
|
|
|
if ($1 <= $parens) { |
6982
|
|
|
|
|
|
|
$char[$i] = '\\' . ($1 + 1); |
6983
|
|
|
|
|
|
|
} |
6984
|
|
|
|
|
|
|
} |
6985
|
|
|
|
|
|
|
|
6986
|
0
|
0
|
|
|
|
0
|
# $0 --> $0 |
6987
|
0
|
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ 0 \z/oxms) { |
6988
|
|
|
|
|
|
|
if ($ignorecase) { |
6989
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
6990
|
|
|
|
|
|
|
} |
6991
|
0
|
0
|
|
|
|
0
|
} |
6992
|
0
|
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) { |
6993
|
|
|
|
|
|
|
if ($ignorecase) { |
6994
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
6995
|
|
|
|
|
|
|
} |
6996
|
|
|
|
|
|
|
} |
6997
|
|
|
|
|
|
|
|
6998
|
|
|
|
|
|
|
# $$ --> $$ |
6999
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$\$ \z/oxms) { |
7000
|
|
|
|
|
|
|
} |
7001
|
|
|
|
|
|
|
|
7002
|
|
|
|
|
|
|
# $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring |
7003
|
0
|
|
|
|
|
0
|
# $1, $2, $3 --> $1, $2, $3 otherwise |
7004
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) { |
7005
|
0
|
|
|
|
|
0
|
$char[$i] = e_capture($1); |
7006
|
|
|
|
|
|
|
if ($ignorecase) { |
7007
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
7008
|
|
|
|
|
|
|
} |
7009
|
0
|
|
|
|
|
0
|
} |
7010
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) { |
7011
|
0
|
|
|
|
|
0
|
$char[$i] = e_capture($1); |
7012
|
|
|
|
|
|
|
if ($ignorecase) { |
7013
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
7014
|
|
|
|
|
|
|
} |
7015
|
|
|
|
|
|
|
} |
7016
|
|
|
|
|
|
|
|
7017
|
0
|
|
|
|
|
0
|
# $$foo[ ... ] --> $ $foo->[ ... ] |
7018
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) { |
7019
|
0
|
|
|
|
|
0
|
$char[$i] = e_capture($1.'->'.$2); |
7020
|
|
|
|
|
|
|
if ($ignorecase) { |
7021
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
7022
|
|
|
|
|
|
|
} |
7023
|
|
|
|
|
|
|
} |
7024
|
|
|
|
|
|
|
|
7025
|
0
|
|
|
|
|
0
|
# $$foo{ ... } --> $ $foo->{ ... } |
7026
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) { |
7027
|
0
|
|
|
|
|
0
|
$char[$i] = e_capture($1.'->'.$2); |
7028
|
|
|
|
|
|
|
if ($ignorecase) { |
7029
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
7030
|
|
|
|
|
|
|
} |
7031
|
|
|
|
|
|
|
} |
7032
|
|
|
|
|
|
|
|
7033
|
0
|
|
|
|
|
0
|
# $$foo |
7034
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) { |
7035
|
0
|
|
|
|
|
0
|
$char[$i] = e_capture($1); |
7036
|
|
|
|
|
|
|
if ($ignorecase) { |
7037
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
7038
|
|
|
|
|
|
|
} |
7039
|
|
|
|
|
|
|
} |
7040
|
|
|
|
|
|
|
|
7041
|
0
|
50
|
|
|
|
0
|
# $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Eeucjp::PREMATCH() |
7042
|
4
|
|
|
|
|
17
|
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) { |
7043
|
|
|
|
|
|
|
if ($ignorecase) { |
7044
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(Eeucjp::PREMATCH())]}'; |
7045
|
0
|
|
|
|
|
0
|
} |
7046
|
|
|
|
|
|
|
else { |
7047
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::PREMATCH()]}'; |
7048
|
|
|
|
|
|
|
} |
7049
|
|
|
|
|
|
|
} |
7050
|
|
|
|
|
|
|
|
7051
|
4
|
50
|
|
|
|
17
|
# $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Eeucjp::MATCH() |
7052
|
4
|
|
|
|
|
12
|
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) { |
7053
|
|
|
|
|
|
|
if ($ignorecase) { |
7054
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(Eeucjp::MATCH())]}'; |
7055
|
0
|
|
|
|
|
0
|
} |
7056
|
|
|
|
|
|
|
else { |
7057
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::MATCH()]}'; |
7058
|
|
|
|
|
|
|
} |
7059
|
|
|
|
|
|
|
} |
7060
|
|
|
|
|
|
|
|
7061
|
4
|
50
|
|
|
|
16
|
# $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Eeucjp::POSTMATCH() |
7062
|
3
|
|
|
|
|
11
|
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) { |
7063
|
|
|
|
|
|
|
if ($ignorecase) { |
7064
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(Eeucjp::POSTMATCH())]}'; |
7065
|
0
|
|
|
|
|
0
|
} |
7066
|
|
|
|
|
|
|
else { |
7067
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::POSTMATCH()]}'; |
7068
|
|
|
|
|
|
|
} |
7069
|
|
|
|
|
|
|
} |
7070
|
|
|
|
|
|
|
|
7071
|
3
|
0
|
|
|
|
10
|
# ${ foo } |
7072
|
0
|
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) { |
7073
|
|
|
|
|
|
|
if ($ignorecase) { |
7074
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
7075
|
|
|
|
|
|
|
} |
7076
|
|
|
|
|
|
|
} |
7077
|
|
|
|
|
|
|
|
7078
|
0
|
|
|
|
|
0
|
# ${ ... } |
7079
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) { |
7080
|
0
|
|
|
|
|
0
|
$char[$i] = e_capture($1); |
7081
|
|
|
|
|
|
|
if ($ignorecase) { |
7082
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
7083
|
|
|
|
|
|
|
} |
7084
|
|
|
|
|
|
|
} |
7085
|
|
|
|
|
|
|
|
7086
|
0
|
|
|
|
|
0
|
# $scalar or @array |
7087
|
9
|
50
|
|
|
|
25
|
elsif ($char[$i] =~ /\A [\$\@].+ /oxms) { |
7088
|
9
|
|
|
|
|
45
|
$char[$i] = e_string($char[$i]); |
7089
|
|
|
|
|
|
|
if ($ignorecase) { |
7090
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
7091
|
|
|
|
|
|
|
} |
7092
|
|
|
|
|
|
|
} |
7093
|
|
|
|
|
|
|
|
7094
|
0
|
50
|
|
|
|
0
|
# quote character before ? + * { |
7095
|
|
|
|
|
|
|
elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) { |
7096
|
|
|
|
|
|
|
if ($char[$i-1] =~ /\A (?:[\x00-\xFF]|\\[0-7]{2,3}|\\x[0-9-A-Fa-f]{1,2}) \z/oxms) { |
7097
|
23
|
|
|
|
|
178
|
} |
7098
|
|
|
|
|
|
|
else { |
7099
|
|
|
|
|
|
|
$char[$i-1] = '(?:' . $char[$i-1] . ')'; |
7100
|
|
|
|
|
|
|
} |
7101
|
|
|
|
|
|
|
} |
7102
|
|
|
|
|
|
|
} |
7103
|
23
|
|
|
|
|
127
|
|
7104
|
106
|
|
|
|
|
355
|
# make regexp string |
7105
|
106
|
|
|
|
|
308
|
my $prematch = ''; |
7106
|
106
|
50
|
|
|
|
192
|
$prematch = "($anchor)"; |
7107
|
106
|
|
|
|
|
454
|
$modifier =~ tr/i//d; |
7108
|
|
|
|
|
|
|
if ($left_e > $right_e) { |
7109
|
0
|
|
|
|
|
0
|
return join '', $ope, $delimiter, $prematch, '(?:', @char, '>]}' x ($left_e - $right_e), ')', $matched, $end_delimiter, $modifier; |
7110
|
|
|
|
|
|
|
} |
7111
|
|
|
|
|
|
|
return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier; |
7112
|
|
|
|
|
|
|
} |
7113
|
|
|
|
|
|
|
|
7114
|
|
|
|
|
|
|
# |
7115
|
|
|
|
|
|
|
# escape regexp (s'here'' or s'here''b) |
7116
|
106
|
|
|
34
|
0
|
1390
|
# |
7117
|
34
|
|
100
|
|
|
92
|
sub e_s1_q { |
7118
|
|
|
|
|
|
|
my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_; |
7119
|
34
|
|
|
|
|
150
|
$modifier ||= ''; |
7120
|
34
|
50
|
|
|
|
44
|
|
7121
|
34
|
|
|
|
|
83
|
$modifier =~ tr/p//d; |
7122
|
0
|
|
|
|
|
0
|
if ($modifier =~ /([adlu])/oxms) { |
7123
|
0
|
0
|
|
|
|
0
|
my $line = 0; |
7124
|
0
|
|
|
|
|
0
|
for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) { |
7125
|
0
|
|
|
|
|
0
|
if ($filename ne __FILE__) { |
7126
|
|
|
|
|
|
|
$line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1; |
7127
|
|
|
|
|
|
|
last; |
7128
|
0
|
|
|
|
|
0
|
} |
7129
|
|
|
|
|
|
|
} |
7130
|
|
|
|
|
|
|
die qq{Unsupported modifier "$1" used at line $line.\n}; |
7131
|
0
|
|
|
|
|
0
|
} |
7132
|
|
|
|
|
|
|
|
7133
|
|
|
|
|
|
|
$slash = 'div'; |
7134
|
34
|
100
|
|
|
|
55
|
|
|
|
100
|
|
|
|
|
|
7135
|
34
|
|
|
|
|
84
|
# literal null string pattern |
7136
|
8
|
|
|
|
|
12
|
if ($string eq '') { |
7137
|
8
|
|
|
|
|
10
|
$modifier =~ tr/bB//d; |
7138
|
|
|
|
|
|
|
$modifier =~ tr/i//d; |
7139
|
|
|
|
|
|
|
return join '', $ope, $delimiter, $end_delimiter, $modifier; |
7140
|
|
|
|
|
|
|
} |
7141
|
|
|
|
|
|
|
|
7142
|
8
|
|
|
|
|
48
|
# with /b /B modifier |
7143
|
|
|
|
|
|
|
elsif ($modifier =~ tr/bB//d) { |
7144
|
|
|
|
|
|
|
return e_s1_qb($ope,$delimiter,$end_delimiter,$string,$modifier); |
7145
|
|
|
|
|
|
|
} |
7146
|
|
|
|
|
|
|
|
7147
|
8
|
|
|
|
|
115
|
# without /b /B modifier |
7148
|
|
|
|
|
|
|
else { |
7149
|
|
|
|
|
|
|
return e_s1_qt($ope,$delimiter,$end_delimiter,$string,$modifier); |
7150
|
|
|
|
|
|
|
} |
7151
|
|
|
|
|
|
|
} |
7152
|
|
|
|
|
|
|
|
7153
|
|
|
|
|
|
|
# |
7154
|
|
|
|
|
|
|
# escape regexp (s'here'') |
7155
|
18
|
|
|
18
|
0
|
44
|
# |
7156
|
|
|
|
|
|
|
sub e_s1_qt { |
7157
|
18
|
100
|
|
|
|
44
|
my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_; |
7158
|
|
|
|
|
|
|
|
7159
|
|
|
|
|
|
|
my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0; |
7160
|
18
|
|
|
|
|
92
|
|
7161
|
|
|
|
|
|
|
# split regexp |
7162
|
|
|
|
|
|
|
my @char = $string =~ /\G((?> |
7163
|
|
|
|
|
|
|
[^\x8E\x8F\xA1-\xFE\\\[\$\@\/] | |
7164
|
|
|
|
|
|
|
[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
7165
|
|
|
|
|
|
|
\[\^ | |
7166
|
|
|
|
|
|
|
\[\: (?>[a-z]+) \:\] | |
7167
|
|
|
|
|
|
|
\[\:\^ (?>[a-z]+) \:\] | |
7168
|
|
|
|
|
|
|
[\$\@\/] | |
7169
|
|
|
|
|
|
|
\\ (?:$q_char) | |
7170
|
|
|
|
|
|
|
(?:$q_char) |
7171
|
|
|
|
|
|
|
))/oxmsg; |
7172
|
18
|
|
|
|
|
563
|
|
7173
|
18
|
50
|
100
|
|
|
284
|
# unescape character |
|
|
50
|
100
|
|
|
|
|
|
|
50
|
66
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
7174
|
|
|
|
|
|
|
for (my $i=0; $i <= $#char; $i++) { |
7175
|
|
|
|
|
|
|
if (0) { |
7176
|
|
|
|
|
|
|
} |
7177
|
36
|
|
|
|
|
183
|
|
7178
|
0
|
|
|
|
|
0
|
# open character class [...] |
7179
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] eq '[') { |
7180
|
0
|
|
|
|
|
0
|
my $left = $i; |
7181
|
|
|
|
|
|
|
if ($char[$i+1] eq ']') { |
7182
|
0
|
|
|
|
|
0
|
$i++; |
7183
|
0
|
0
|
|
|
|
0
|
} |
7184
|
0
|
|
|
|
|
0
|
while (1) { |
7185
|
|
|
|
|
|
|
if (++$i > $#char) { |
7186
|
0
|
0
|
|
|
|
0
|
die __FILE__, ": Unmatched [] in regexp\n"; |
7187
|
0
|
|
|
|
|
0
|
} |
7188
|
|
|
|
|
|
|
if ($char[$i] eq ']') { |
7189
|
|
|
|
|
|
|
my $right = $i; |
7190
|
0
|
|
|
|
|
0
|
|
7191
|
|
|
|
|
|
|
# [...] |
7192
|
0
|
|
|
|
|
0
|
splice @char, $left, $right-$left+1, Eeucjp::charlist_qr(@char[$left+1..$right-1], $modifier); |
7193
|
0
|
|
|
|
|
0
|
|
7194
|
|
|
|
|
|
|
$i = $left; |
7195
|
|
|
|
|
|
|
last; |
7196
|
|
|
|
|
|
|
} |
7197
|
|
|
|
|
|
|
} |
7198
|
|
|
|
|
|
|
} |
7199
|
|
|
|
|
|
|
|
7200
|
0
|
|
|
|
|
0
|
# open character class [^...] |
7201
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] eq '[^') { |
7202
|
0
|
|
|
|
|
0
|
my $left = $i; |
7203
|
|
|
|
|
|
|
if ($char[$i+1] eq ']') { |
7204
|
0
|
|
|
|
|
0
|
$i++; |
7205
|
0
|
0
|
|
|
|
0
|
} |
7206
|
0
|
|
|
|
|
0
|
while (1) { |
7207
|
|
|
|
|
|
|
if (++$i > $#char) { |
7208
|
0
|
0
|
|
|
|
0
|
die __FILE__, ": Unmatched [] in regexp\n"; |
7209
|
0
|
|
|
|
|
0
|
} |
7210
|
|
|
|
|
|
|
if ($char[$i] eq ']') { |
7211
|
|
|
|
|
|
|
my $right = $i; |
7212
|
0
|
|
|
|
|
0
|
|
7213
|
|
|
|
|
|
|
# [^...] |
7214
|
0
|
|
|
|
|
0
|
splice @char, $left, $right-$left+1, Eeucjp::charlist_not_qr(@char[$left+1..$right-1], $modifier); |
7215
|
0
|
|
|
|
|
0
|
|
7216
|
|
|
|
|
|
|
$i = $left; |
7217
|
|
|
|
|
|
|
last; |
7218
|
|
|
|
|
|
|
} |
7219
|
|
|
|
|
|
|
} |
7220
|
|
|
|
|
|
|
} |
7221
|
|
|
|
|
|
|
|
7222
|
0
|
|
|
|
|
0
|
# escape $ @ / and \ |
7223
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) { |
7224
|
|
|
|
|
|
|
$char[$i] = '\\' . $char[$i]; |
7225
|
|
|
|
|
|
|
} |
7226
|
|
|
|
|
|
|
|
7227
|
0
|
|
|
|
|
0
|
# rewrite character class or escape character |
7228
|
|
|
|
|
|
|
elsif (my $char = character_class($char[$i],$modifier)) { |
7229
|
|
|
|
|
|
|
$char[$i] = $char; |
7230
|
|
|
|
|
|
|
} |
7231
|
|
|
|
|
|
|
|
7232
|
6
|
50
|
|
|
|
21
|
# /i modifier |
7233
|
2
|
|
|
|
|
3
|
elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Eeucjp::uc($char[$i]) ne Eeucjp::fc($char[$i]))) { |
7234
|
|
|
|
|
|
|
if (CORE::length(Eeucjp::fc($char[$i])) == 1) { |
7235
|
|
|
|
|
|
|
$char[$i] = '[' . Eeucjp::uc($char[$i]) . Eeucjp::fc($char[$i]) . ']'; |
7236
|
2
|
|
|
|
|
5
|
} |
7237
|
|
|
|
|
|
|
else { |
7238
|
|
|
|
|
|
|
$char[$i] = '(?:' . Eeucjp::uc($char[$i]) . '|' . Eeucjp::fc($char[$i]) . ')'; |
7239
|
|
|
|
|
|
|
} |
7240
|
|
|
|
|
|
|
} |
7241
|
|
|
|
|
|
|
|
7242
|
0
|
0
|
|
|
|
0
|
# quote character before ? + * { |
7243
|
|
|
|
|
|
|
elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) { |
7244
|
|
|
|
|
|
|
if ($char[$i-1] =~ /\A [\x00-\xFF] \z/oxms) { |
7245
|
0
|
|
|
|
|
0
|
} |
7246
|
|
|
|
|
|
|
else { |
7247
|
|
|
|
|
|
|
$char[$i-1] = '(?:' . $char[$i-1] . ')'; |
7248
|
|
|
|
|
|
|
} |
7249
|
|
|
|
|
|
|
} |
7250
|
0
|
|
|
|
|
0
|
} |
7251
|
18
|
|
|
|
|
33
|
|
7252
|
18
|
|
|
|
|
30
|
$modifier =~ tr/i//d; |
7253
|
18
|
|
|
|
|
26
|
$delimiter = '/'; |
7254
|
18
|
|
|
|
|
21
|
$end_delimiter = '/'; |
7255
|
18
|
|
|
|
|
41
|
my $prematch = ''; |
7256
|
|
|
|
|
|
|
$prematch = "($anchor)"; |
7257
|
|
|
|
|
|
|
return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier; |
7258
|
|
|
|
|
|
|
} |
7259
|
|
|
|
|
|
|
|
7260
|
|
|
|
|
|
|
# |
7261
|
|
|
|
|
|
|
# escape regexp (s'here''b) |
7262
|
18
|
|
|
8
|
0
|
150
|
# |
7263
|
|
|
|
|
|
|
sub e_s1_qb { |
7264
|
|
|
|
|
|
|
my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_; |
7265
|
8
|
|
|
|
|
23
|
|
7266
|
|
|
|
|
|
|
# split regexp |
7267
|
|
|
|
|
|
|
my @char = $string =~ /\G (?>[^\\]|\\\\|[\x00-\xFF]) /oxmsg; |
7268
|
8
|
|
|
|
|
225
|
|
7269
|
8
|
50
|
|
|
|
41
|
# unescape character |
|
|
50
|
|
|
|
|
|
7270
|
|
|
|
|
|
|
for (my $i=0; $i <= $#char; $i++) { |
7271
|
|
|
|
|
|
|
if (0) { |
7272
|
|
|
|
|
|
|
} |
7273
|
24
|
|
|
|
|
74
|
|
7274
|
|
|
|
|
|
|
# remain \\ |
7275
|
|
|
|
|
|
|
elsif ($char[$i] eq '\\\\') { |
7276
|
|
|
|
|
|
|
} |
7277
|
|
|
|
|
|
|
|
7278
|
0
|
|
|
|
|
0
|
# escape $ @ / and \ |
7279
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) { |
7280
|
|
|
|
|
|
|
$char[$i] = '\\' . $char[$i]; |
7281
|
|
|
|
|
|
|
} |
7282
|
0
|
|
|
|
|
0
|
} |
7283
|
8
|
|
|
|
|
13
|
|
7284
|
8
|
|
|
|
|
11
|
$delimiter = '/'; |
7285
|
8
|
|
|
|
|
9
|
$end_delimiter = '/'; |
7286
|
8
|
|
|
|
|
12
|
my $prematch = ''; |
7287
|
|
|
|
|
|
|
$prematch = q{(\G[\x00-\xFF]*?)}; |
7288
|
|
|
|
|
|
|
return join '', $ope, $delimiter, $prematch, '(?:', @char, ')', $matched, $end_delimiter, $modifier; |
7289
|
|
|
|
|
|
|
} |
7290
|
|
|
|
|
|
|
|
7291
|
|
|
|
|
|
|
# |
7292
|
|
|
|
|
|
|
# escape regexp (s''here') |
7293
|
8
|
|
|
29
|
0
|
55
|
# |
7294
|
|
|
|
|
|
|
sub e_s2_q { |
7295
|
29
|
|
|
|
|
66
|
my($ope,$delimiter,$end_delimiter,$string) = @_; |
7296
|
|
|
|
|
|
|
|
7297
|
29
|
|
|
|
|
39
|
$slash = 'div'; |
7298
|
29
|
|
|
|
|
253
|
|
7299
|
29
|
100
|
|
|
|
81
|
my @char = $string =~ / \G (?>[^\x8E\x8F\xA1-\xFE\\]|\\\\|$q_char) /oxmsg; |
|
|
100
|
|
|
|
|
|
7300
|
|
|
|
|
|
|
for (my $i=0; $i <= $#char; $i++) { |
7301
|
|
|
|
|
|
|
if (0) { |
7302
|
|
|
|
|
|
|
} |
7303
|
9
|
|
|
|
|
33
|
|
7304
|
|
|
|
|
|
|
# not escape \\ |
7305
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\\\ \z/oxms) { |
7306
|
|
|
|
|
|
|
} |
7307
|
|
|
|
|
|
|
|
7308
|
0
|
|
|
|
|
0
|
# escape $ @ / and \ |
7309
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A [\$\@\/\\] \z/oxms) { |
7310
|
|
|
|
|
|
|
$char[$i] = '\\' . $char[$i]; |
7311
|
|
|
|
|
|
|
} |
7312
|
5
|
|
|
|
|
16
|
} |
7313
|
|
|
|
|
|
|
|
7314
|
|
|
|
|
|
|
return join '', $ope, $delimiter, @char, $end_delimiter; |
7315
|
|
|
|
|
|
|
} |
7316
|
|
|
|
|
|
|
|
7317
|
|
|
|
|
|
|
# |
7318
|
|
|
|
|
|
|
# escape regexp (s/here/and here/modifier) |
7319
|
29
|
|
|
156
|
0
|
91
|
# |
7320
|
156
|
|
100
|
|
|
1387
|
sub e_sub { |
7321
|
|
|
|
|
|
|
my($variable,$delimiter1,$pattern,$end_delimiter1,$delimiter2,$replacement,$end_delimiter2,$modifier) = @_; |
7322
|
156
|
|
|
|
|
666
|
$modifier ||= ''; |
7323
|
156
|
50
|
|
|
|
325
|
|
7324
|
156
|
|
|
|
|
494
|
$modifier =~ tr/p//d; |
7325
|
0
|
|
|
|
|
0
|
if ($modifier =~ /([adlu])/oxms) { |
7326
|
0
|
0
|
|
|
|
0
|
my $line = 0; |
7327
|
0
|
|
|
|
|
0
|
for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) { |
7328
|
0
|
|
|
|
|
0
|
if ($filename ne __FILE__) { |
7329
|
|
|
|
|
|
|
$line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1; |
7330
|
|
|
|
|
|
|
last; |
7331
|
0
|
|
|
|
|
0
|
} |
7332
|
|
|
|
|
|
|
} |
7333
|
|
|
|
|
|
|
die qq{Unsupported modifier "$1" used at line $line.\n}; |
7334
|
0
|
100
|
|
|
|
0
|
} |
7335
|
156
|
|
|
|
|
497
|
|
7336
|
37
|
|
|
|
|
56
|
if ($variable eq '') { |
7337
|
|
|
|
|
|
|
$variable = '$_'; |
7338
|
|
|
|
|
|
|
$bind_operator = ' =~ '; |
7339
|
37
|
|
|
|
|
49
|
} |
7340
|
|
|
|
|
|
|
|
7341
|
|
|
|
|
|
|
$slash = 'div'; |
7342
|
|
|
|
|
|
|
|
7343
|
|
|
|
|
|
|
# P.128 Start of match (or end of previous match): \G |
7344
|
|
|
|
|
|
|
# P.130 Advanced Use of \G with Perl |
7345
|
|
|
|
|
|
|
# in Chapter 3: Overview of Regular Expression Features and Flavors |
7346
|
|
|
|
|
|
|
# P.312 Iterative Matching: Scalar Context, with /g |
7347
|
|
|
|
|
|
|
# in Chapter 7: Perl |
7348
|
|
|
|
|
|
|
# of ISBN 0-596-00289-0 Mastering Regular Expressions, Second edition |
7349
|
|
|
|
|
|
|
|
7350
|
|
|
|
|
|
|
# P.181 Where You Left Off: The \G Assertion |
7351
|
|
|
|
|
|
|
# in Chapter 5: Pattern Matching |
7352
|
|
|
|
|
|
|
# of ISBN 0-596-00027-8 Programming Perl Third Edition. |
7353
|
|
|
|
|
|
|
|
7354
|
|
|
|
|
|
|
# P.220 Where You Left Off: The \G Assertion |
7355
|
|
|
|
|
|
|
# in Chapter 5: Pattern Matching |
7356
|
156
|
|
|
|
|
306
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
7357
|
156
|
|
|
|
|
427
|
|
7358
|
|
|
|
|
|
|
my $e_modifier = $modifier =~ tr/e//d; |
7359
|
156
|
|
|
|
|
251
|
my $r_modifier = $modifier =~ tr/r//d; |
7360
|
156
|
50
|
|
|
|
240
|
|
7361
|
156
|
|
|
|
|
459
|
my $my = ''; |
7362
|
0
|
|
|
|
|
0
|
if ($variable =~ s/\A \( (?>\s*) ( (?>(?: local \b | my \b | our \b | state \b )?) .+ ) \) \z/$1/oxms) { |
7363
|
0
|
|
|
|
|
0
|
$my = $variable; |
7364
|
|
|
|
|
|
|
$variable =~ s/ (?: local \b | my \b | our \b | state \b ) (?>\s*) //oxms; |
7365
|
|
|
|
|
|
|
$variable =~ s/ = .+ \z//oxms; |
7366
|
0
|
|
|
|
|
0
|
} |
7367
|
156
|
|
|
|
|
443
|
|
7368
|
|
|
|
|
|
|
(my $variable_basename = $variable) =~ s/ [\[\{].* \z//oxms; |
7369
|
|
|
|
|
|
|
$variable_basename =~ s/ \s+ \z//oxms; |
7370
|
156
|
|
|
|
|
319
|
|
7371
|
156
|
100
|
|
|
|
237
|
# quote replacement string |
7372
|
156
|
|
|
|
|
387
|
my $e_replacement = ''; |
7373
|
17
|
|
|
|
|
99
|
if ($e_modifier >= 1) { |
7374
|
|
|
|
|
|
|
$e_replacement = e_qq('', '', '', $replacement); |
7375
|
|
|
|
|
|
|
$e_modifier--; |
7376
|
17
|
100
|
|
|
|
29
|
} |
7377
|
139
|
|
|
|
|
458
|
else { |
7378
|
|
|
|
|
|
|
if ($delimiter2 eq "'") { |
7379
|
|
|
|
|
|
|
$e_replacement = e_s2_q('qq', '/', '/', $replacement); |
7380
|
29
|
|
|
|
|
59
|
} |
7381
|
|
|
|
|
|
|
else { |
7382
|
|
|
|
|
|
|
$e_replacement = e_qq ('qq', $delimiter2, $end_delimiter2, $replacement); |
7383
|
|
|
|
|
|
|
} |
7384
|
110
|
|
|
|
|
397
|
} |
7385
|
|
|
|
|
|
|
|
7386
|
|
|
|
|
|
|
my $sub = ''; |
7387
|
156
|
100
|
|
|
|
293
|
|
7388
|
156
|
100
|
|
|
|
395
|
# with /r |
|
|
50
|
|
|
|
|
|
7389
|
|
|
|
|
|
|
if ($r_modifier) { |
7390
|
|
|
|
|
|
|
if (0) { |
7391
|
|
|
|
|
|
|
} |
7392
|
8
|
|
|
|
|
27
|
|
7393
|
0
|
50
|
|
|
|
0
|
# s///gr with multibyte anchoring |
7394
|
|
|
|
|
|
|
elsif ($modifier =~ /g/oxms) { |
7395
|
|
|
|
|
|
|
$sub = sprintf( |
7396
|
|
|
|
|
|
|
# 1 2 3 4 5 |
7397
|
|
|
|
|
|
|
q, |
7398
|
|
|
|
|
|
|
|
7399
|
|
|
|
|
|
|
$variable, # 1 |
7400
|
|
|
|
|
|
|
($delimiter1 eq "'") ? # 2 |
7401
|
|
|
|
|
|
|
e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # : |
7402
|
|
|
|
|
|
|
e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # : |
7403
|
|
|
|
|
|
|
$s_matched, # 3 |
7404
|
|
|
|
|
|
|
$e_replacement, # 4 |
7405
|
|
|
|
|
|
|
'$Eeucjp::re_r=CORE::eval $Eeucjp::re_r; ' x $e_modifier, # 5 |
7406
|
|
|
|
|
|
|
); |
7407
|
|
|
|
|
|
|
} |
7408
|
|
|
|
|
|
|
|
7409
|
4
|
0
|
|
|
|
21
|
# s///gr without multibyte anchoring |
7410
|
|
|
|
|
|
|
elsif ($modifier =~ /g/oxms) { |
7411
|
|
|
|
|
|
|
$sub = sprintf( |
7412
|
|
|
|
|
|
|
# 1 2 3 4 5 |
7413
|
|
|
|
|
|
|
q, |
7414
|
|
|
|
|
|
|
|
7415
|
|
|
|
|
|
|
$variable, # 1 |
7416
|
|
|
|
|
|
|
($delimiter1 eq "'") ? # 2 |
7417
|
|
|
|
|
|
|
e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # : |
7418
|
|
|
|
|
|
|
e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # : |
7419
|
|
|
|
|
|
|
$s_matched, # 3 |
7420
|
|
|
|
|
|
|
$e_replacement, # 4 |
7421
|
|
|
|
|
|
|
'$Eeucjp::re_r=CORE::eval $Eeucjp::re_r; ' x $e_modifier, # 5 |
7422
|
|
|
|
|
|
|
); |
7423
|
|
|
|
|
|
|
} |
7424
|
|
|
|
|
|
|
|
7425
|
|
|
|
|
|
|
# s///r |
7426
|
0
|
|
|
|
|
0
|
else { |
7427
|
4
|
|
|
|
|
7
|
|
7428
|
|
|
|
|
|
|
my $prematch = q{$`}; |
7429
|
4
|
50
|
|
|
|
8
|
$prematch = q{${1}}; |
7430
|
|
|
|
|
|
|
|
7431
|
|
|
|
|
|
|
$sub = sprintf( |
7432
|
|
|
|
|
|
|
# 1 2 3 4 5 6 7 |
7433
|
|
|
|
|
|
|
q<(%s =~ %s) ? CORE::eval{%s local $^W=0; local $Eeucjp::re_r=%s; %s"%s$Eeucjp::re_r$'" } : %s>, |
7434
|
|
|
|
|
|
|
|
7435
|
|
|
|
|
|
|
$variable, # 1 |
7436
|
|
|
|
|
|
|
($delimiter1 eq "'") ? # 2 |
7437
|
|
|
|
|
|
|
e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # : |
7438
|
|
|
|
|
|
|
e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # : |
7439
|
|
|
|
|
|
|
$s_matched, # 3 |
7440
|
|
|
|
|
|
|
$e_replacement, # 4 |
7441
|
|
|
|
|
|
|
'$Eeucjp::re_r=CORE::eval $Eeucjp::re_r; ' x $e_modifier, # 5 |
7442
|
|
|
|
|
|
|
$prematch, # 6 |
7443
|
|
|
|
|
|
|
$variable, # 7 |
7444
|
|
|
|
|
|
|
); |
7445
|
|
|
|
|
|
|
} |
7446
|
4
|
50
|
|
|
|
13
|
|
7447
|
8
|
|
|
|
|
28
|
# $var !~ s///r doesn't make sense |
7448
|
|
|
|
|
|
|
if ($bind_operator =~ / !~ /oxms) { |
7449
|
|
|
|
|
|
|
$sub = q{die("$0: Using !~ with s///r doesn't make sense"), } . $sub; |
7450
|
|
|
|
|
|
|
} |
7451
|
|
|
|
|
|
|
} |
7452
|
|
|
|
|
|
|
|
7453
|
0
|
100
|
|
|
|
0
|
# without /r |
|
|
50
|
|
|
|
|
|
7454
|
|
|
|
|
|
|
else { |
7455
|
|
|
|
|
|
|
if (0) { |
7456
|
|
|
|
|
|
|
} |
7457
|
148
|
|
|
|
|
485
|
|
7458
|
0
|
100
|
|
|
|
0
|
# s///g with multibyte anchoring |
|
|
100
|
|
|
|
|
|
7459
|
|
|
|
|
|
|
elsif ($modifier =~ /g/oxms) { |
7460
|
|
|
|
|
|
|
$sub = sprintf( |
7461
|
|
|
|
|
|
|
# 1 2 3 4 5 6 7 8 9 10 |
7462
|
|
|
|
|
|
|
q, |
7463
|
|
|
|
|
|
|
|
7464
|
|
|
|
|
|
|
$variable, # 1 |
7465
|
|
|
|
|
|
|
($delimiter1 eq "'") ? # 2 |
7466
|
|
|
|
|
|
|
e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # : |
7467
|
|
|
|
|
|
|
e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # : |
7468
|
|
|
|
|
|
|
$s_matched, # 3 |
7469
|
|
|
|
|
|
|
$e_replacement, # 4 |
7470
|
|
|
|
|
|
|
'$Eeucjp::re_r=CORE::eval $Eeucjp::re_r; ' x $e_modifier, # 5 |
7471
|
|
|
|
|
|
|
$variable, # 6 |
7472
|
|
|
|
|
|
|
$variable, # 7 |
7473
|
|
|
|
|
|
|
$variable, # 8 |
7474
|
|
|
|
|
|
|
$variable, # 9 |
7475
|
|
|
|
|
|
|
|
7476
|
|
|
|
|
|
|
# Binary "!~" is just like "=~" except the return value is negated in the logical sense. |
7477
|
|
|
|
|
|
|
# It returns false if the match succeeds, and true if it fails. |
7478
|
|
|
|
|
|
|
# (and so on) |
7479
|
|
|
|
|
|
|
|
7480
|
|
|
|
|
|
|
($bind_operator =~ / !~ /oxms) ? '!' : '', # 10 |
7481
|
|
|
|
|
|
|
); |
7482
|
|
|
|
|
|
|
} |
7483
|
|
|
|
|
|
|
|
7484
|
29
|
0
|
|
|
|
161
|
# s///g without multibyte anchoring |
|
|
0
|
|
|
|
|
|
7485
|
|
|
|
|
|
|
elsif ($modifier =~ /g/oxms) { |
7486
|
|
|
|
|
|
|
$sub = sprintf( |
7487
|
|
|
|
|
|
|
# 1 2 3 4 5 6 7 8 |
7488
|
|
|
|
|
|
|
q, |
7489
|
|
|
|
|
|
|
|
7490
|
|
|
|
|
|
|
$variable, # 1 |
7491
|
|
|
|
|
|
|
($delimiter1 eq "'") ? # 2 |
7492
|
|
|
|
|
|
|
e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # : |
7493
|
|
|
|
|
|
|
e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # : |
7494
|
|
|
|
|
|
|
$s_matched, # 3 |
7495
|
|
|
|
|
|
|
$e_replacement, # 4 |
7496
|
|
|
|
|
|
|
'$Eeucjp::re_r=CORE::eval $Eeucjp::re_r; ' x $e_modifier, # 5 |
7497
|
|
|
|
|
|
|
$variable, # 6 |
7498
|
|
|
|
|
|
|
$variable, # 7 |
7499
|
|
|
|
|
|
|
($bind_operator =~ / !~ /oxms) ? '!' : '', # 8 |
7500
|
|
|
|
|
|
|
); |
7501
|
|
|
|
|
|
|
} |
7502
|
|
|
|
|
|
|
|
7503
|
|
|
|
|
|
|
# s/// |
7504
|
0
|
|
|
|
|
0
|
else { |
7505
|
119
|
|
|
|
|
241
|
|
7506
|
|
|
|
|
|
|
my $prematch = q{$`}; |
7507
|
119
|
100
|
|
|
|
185
|
$prematch = q{${1}}; |
|
|
100
|
|
|
|
|
|
7508
|
|
|
|
|
|
|
|
7509
|
|
|
|
|
|
|
$sub = sprintf( |
7510
|
|
|
|
|
|
|
|
7511
|
|
|
|
|
|
|
($bind_operator =~ / =~ /oxms) ? |
7512
|
|
|
|
|
|
|
|
7513
|
|
|
|
|
|
|
# 1 2 3 4 5 6 7 8 |
7514
|
|
|
|
|
|
|
q<(%s%s%s) ? CORE::eval{%s local $^W=0; local $Eeucjp::re_r=%s; %s%s="%s$Eeucjp::re_r$'"; 1 } : undef> : |
7515
|
|
|
|
|
|
|
|
7516
|
|
|
|
|
|
|
# 1 2 3 4 5 6 7 8 |
7517
|
|
|
|
|
|
|
q<(%s%s%s) ? 1 : CORE::eval{%s local $^W=0; local $Eeucjp::re_r=%s; %s%s="%s$Eeucjp::re_r$'"; undef }>, |
7518
|
|
|
|
|
|
|
|
7519
|
|
|
|
|
|
|
$variable, # 1 |
7520
|
|
|
|
|
|
|
$bind_operator, # 2 |
7521
|
|
|
|
|
|
|
($delimiter1 eq "'") ? # 3 |
7522
|
|
|
|
|
|
|
e_s1_q('m', $delimiter1, $end_delimiter1, $pattern, $modifier) : # : |
7523
|
|
|
|
|
|
|
e_s1 ('m', $delimiter1, $end_delimiter1, $pattern, $modifier), # : |
7524
|
|
|
|
|
|
|
$s_matched, # 4 |
7525
|
|
|
|
|
|
|
$e_replacement, # 5 |
7526
|
|
|
|
|
|
|
'$Eeucjp::re_r=CORE::eval $Eeucjp::re_r; ' x $e_modifier, # 6 |
7527
|
|
|
|
|
|
|
$variable, # 7 |
7528
|
|
|
|
|
|
|
$prematch, # 8 |
7529
|
|
|
|
|
|
|
); |
7530
|
|
|
|
|
|
|
} |
7531
|
|
|
|
|
|
|
} |
7532
|
119
|
50
|
|
|
|
699
|
|
7533
|
156
|
|
|
|
|
483
|
# (my $foo = $bar) =~ s/// --> (my $foo = $bar, CORE::eval { ... })[1] |
7534
|
|
|
|
|
|
|
if ($my ne '') { |
7535
|
|
|
|
|
|
|
$sub = "($my, $sub)[1]"; |
7536
|
|
|
|
|
|
|
} |
7537
|
0
|
|
|
|
|
0
|
|
7538
|
156
|
|
|
|
|
271
|
# clear s/// variable |
7539
|
|
|
|
|
|
|
$sub_variable = ''; |
7540
|
156
|
|
|
|
|
236
|
$bind_operator = ''; |
7541
|
|
|
|
|
|
|
|
7542
|
|
|
|
|
|
|
return $sub; |
7543
|
|
|
|
|
|
|
} |
7544
|
|
|
|
|
|
|
|
7545
|
|
|
|
|
|
|
# |
7546
|
|
|
|
|
|
|
# escape regexp of split qr// |
7547
|
156
|
|
|
137
|
0
|
1605
|
# |
7548
|
137
|
|
100
|
|
|
662
|
sub e_split { |
7549
|
|
|
|
|
|
|
my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_; |
7550
|
137
|
|
|
|
|
583
|
$modifier ||= ''; |
7551
|
137
|
50
|
|
|
|
232
|
|
7552
|
137
|
|
|
|
|
352
|
$modifier =~ tr/p//d; |
7553
|
0
|
|
|
|
|
0
|
if ($modifier =~ /([adlu])/oxms) { |
7554
|
0
|
0
|
|
|
|
0
|
my $line = 0; |
7555
|
0
|
|
|
|
|
0
|
for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) { |
7556
|
0
|
|
|
|
|
0
|
if ($filename ne __FILE__) { |
7557
|
|
|
|
|
|
|
$line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1; |
7558
|
|
|
|
|
|
|
last; |
7559
|
0
|
|
|
|
|
0
|
} |
7560
|
|
|
|
|
|
|
} |
7561
|
|
|
|
|
|
|
die qq{Unsupported modifier "$1" used at line $line.\n}; |
7562
|
0
|
|
|
|
|
0
|
} |
7563
|
|
|
|
|
|
|
|
7564
|
|
|
|
|
|
|
$slash = 'div'; |
7565
|
137
|
100
|
|
|
|
218
|
|
7566
|
137
|
|
|
|
|
310
|
# /b /B modifier |
7567
|
|
|
|
|
|
|
if ($modifier =~ tr/bB//d) { |
7568
|
|
|
|
|
|
|
return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier; |
7569
|
18
|
100
|
|
|
|
83
|
} |
7570
|
119
|
|
|
|
|
347
|
|
7571
|
|
|
|
|
|
|
my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0; |
7572
|
|
|
|
|
|
|
my $metachar = qr/[\@\\|[\]{^]/oxms; |
7573
|
119
|
|
|
|
|
417
|
|
7574
|
|
|
|
|
|
|
# split regexp |
7575
|
|
|
|
|
|
|
my @char = $string =~ /\G((?> |
7576
|
|
|
|
|
|
|
[^\x8E\x8F\xA1-\xFE\\\$\@\[\(]|[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
7577
|
|
|
|
|
|
|
\\x (?>[0-9A-Fa-f]{1,2}) | |
7578
|
|
|
|
|
|
|
\\ (?>[0-7]{2,3}) | |
7579
|
|
|
|
|
|
|
\\c [\x40-\x5F] | |
7580
|
|
|
|
|
|
|
\\x\{ (?>[0-9A-Fa-f]+) \} | |
7581
|
|
|
|
|
|
|
\\o\{ (?>[0-7]+) \} | |
7582
|
|
|
|
|
|
|
\\[bBNpP]\{ (?>[^\x8E\x8F\xA1-\xFE0-9\}][^\x8E\x8F\xA1-\xFE\}]*) \} | |
7583
|
|
|
|
|
|
|
\\ $q_char | |
7584
|
|
|
|
|
|
|
\$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} | |
7585
|
|
|
|
|
|
|
\$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} | |
7586
|
|
|
|
|
|
|
\$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} | |
7587
|
|
|
|
|
|
|
[\$\@] $qq_variable | |
7588
|
|
|
|
|
|
|
\$ (?>\s* [0-9]+) | |
7589
|
|
|
|
|
|
|
\$ (?>\s*) \{ (?>\s* [0-9]+ \s*) \} | |
7590
|
|
|
|
|
|
|
\$ \$ (?![\w\{]) | |
7591
|
|
|
|
|
|
|
\$ (?>\s*) \$ (?>\s*) $qq_variable | |
7592
|
|
|
|
|
|
|
\[\^ | |
7593
|
|
|
|
|
|
|
\[\: (?>[a-z]+) :\] | |
7594
|
|
|
|
|
|
|
\[\:\^ (?>[a-z]+) :\] | |
7595
|
|
|
|
|
|
|
\(\? | |
7596
|
|
|
|
|
|
|
$q_char |
7597
|
119
|
|
|
|
|
18452
|
))/oxmsg; |
7598
|
119
|
|
|
|
|
509
|
|
7599
|
119
|
|
|
|
|
177
|
my $left_e = 0; |
7600
|
|
|
|
|
|
|
my $right_e = 0; |
7601
|
|
|
|
|
|
|
for (my $i=0; $i <= $#char; $i++) { |
7602
|
119
|
50
|
33
|
|
|
373
|
|
|
|
50
|
33
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
7603
|
302
|
|
|
|
|
1856
|
# "\L\u" --> "\u\L" |
7604
|
|
|
|
|
|
|
if (($char[$i] eq '\L') and ($char[$i+1] eq '\u')) { |
7605
|
|
|
|
|
|
|
@char[$i,$i+1] = @char[$i+1,$i]; |
7606
|
|
|
|
|
|
|
} |
7607
|
|
|
|
|
|
|
|
7608
|
0
|
|
|
|
|
0
|
# "\U\l" --> "\l\U" |
7609
|
|
|
|
|
|
|
elsif (($char[$i] eq '\U') and ($char[$i+1] eq '\l')) { |
7610
|
|
|
|
|
|
|
@char[$i,$i+1] = @char[$i+1,$i]; |
7611
|
|
|
|
|
|
|
} |
7612
|
|
|
|
|
|
|
|
7613
|
0
|
|
|
|
|
0
|
# octal escape sequence |
7614
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\o \{ ([0-7]+) \} \z/oxms) { |
7615
|
|
|
|
|
|
|
$char[$i] = Eeucjp::octchr($1); |
7616
|
|
|
|
|
|
|
} |
7617
|
|
|
|
|
|
|
|
7618
|
1
|
|
|
|
|
3
|
# hexadecimal escape sequence |
7619
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\x \{ ([0-9A-Fa-f]+) \} \z/oxms) { |
7620
|
|
|
|
|
|
|
$char[$i] = Eeucjp::hexchr($1); |
7621
|
|
|
|
|
|
|
} |
7622
|
|
|
|
|
|
|
|
7623
|
|
|
|
|
|
|
# \b{...} --> b\{...} |
7624
|
|
|
|
|
|
|
# \B{...} --> B\{...} |
7625
|
|
|
|
|
|
|
# \N{CHARNAME} --> N\{CHARNAME} |
7626
|
|
|
|
|
|
|
# \p{PROPERTY} --> p\{PROPERTY} |
7627
|
1
|
|
|
|
|
4
|
# \P{PROPERTY} --> P\{PROPERTY} |
7628
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\ ([bBNpP]) ( \{ ([^\x8E\x8F\xA1-\xFE0-9\}][^\x8E\x8F\xA1-\xFE\}]*) \} ) \z/oxms) { |
7629
|
|
|
|
|
|
|
$char[$i] = $1 . '\\' . $2; |
7630
|
|
|
|
|
|
|
} |
7631
|
|
|
|
|
|
|
|
7632
|
0
|
|
|
|
|
0
|
# \p, \P, \X --> p, P, X |
7633
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \\ ( [pPX] ) \z/oxms) { |
7634
|
|
|
|
|
|
|
$char[$i] = $1; |
7635
|
0
|
50
|
100
|
|
|
0
|
} |
|
|
100
|
100
|
|
|
|
|
|
|
100
|
66
|
|
|
|
|
|
|
100
|
100
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
7636
|
|
|
|
|
|
|
|
7637
|
|
|
|
|
|
|
if (0) { |
7638
|
|
|
|
|
|
|
} |
7639
|
302
|
|
|
|
|
1040
|
|
7640
|
0
|
0
|
0
|
|
|
0
|
# join separated multiple-octet |
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
7641
|
0
|
|
|
|
|
0
|
elsif ($char[$i] =~ /\A (?: \\ [0-7]{2,3} | \\x [0-9A-Fa-f]{1,2}) \z/oxms) { |
7642
|
|
|
|
|
|
|
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)) { |
7643
|
|
|
|
|
|
|
$char[$i] .= join '', splice @char, $i+1, 3; |
7644
|
0
|
|
|
|
|
0
|
} |
7645
|
|
|
|
|
|
|
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)) { |
7646
|
|
|
|
|
|
|
$char[$i] .= join '', splice @char, $i+1, 2; |
7647
|
0
|
|
|
|
|
0
|
} |
7648
|
|
|
|
|
|
|
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)) { |
7649
|
|
|
|
|
|
|
$char[$i] .= join '', splice @char, $i+1, 1; |
7650
|
|
|
|
|
|
|
} |
7651
|
|
|
|
|
|
|
} |
7652
|
|
|
|
|
|
|
|
7653
|
0
|
|
|
|
|
0
|
# open character class [...] |
7654
|
3
|
50
|
|
|
|
5
|
elsif ($char[$i] eq '[') { |
7655
|
3
|
|
|
|
|
9
|
my $left = $i; |
7656
|
|
|
|
|
|
|
if ($char[$i+1] eq ']') { |
7657
|
0
|
|
|
|
|
0
|
$i++; |
7658
|
3
|
50
|
|
|
|
3
|
} |
7659
|
7
|
|
|
|
|
13
|
while (1) { |
7660
|
|
|
|
|
|
|
if (++$i > $#char) { |
7661
|
0
|
100
|
|
|
|
0
|
die __FILE__, ": Unmatched [] in regexp\n"; |
7662
|
7
|
|
|
|
|
14
|
} |
7663
|
|
|
|
|
|
|
if ($char[$i] eq ']') { |
7664
|
|
|
|
|
|
|
my $right = $i; |
7665
|
3
|
50
|
|
|
|
5
|
|
7666
|
3
|
|
|
|
|
16
|
# [...] |
|
0
|
|
|
|
|
0
|
|
7667
|
|
|
|
|
|
|
if (grep(/\A [\$\@]/oxms,@char[$left+1..$right-1]) >= 1) { |
7668
|
|
|
|
|
|
|
splice @char, $left, $right-$left+1, sprintf(q{@{[Eeucjp::charlist_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier); |
7669
|
0
|
|
|
|
|
0
|
} |
7670
|
|
|
|
|
|
|
else { |
7671
|
|
|
|
|
|
|
splice @char, $left, $right-$left+1, Eeucjp::charlist_qr(@char[$left+1..$right-1], $modifier); |
7672
|
3
|
|
|
|
|
15
|
} |
7673
|
3
|
|
|
|
|
6
|
|
7674
|
|
|
|
|
|
|
$i = $left; |
7675
|
|
|
|
|
|
|
last; |
7676
|
|
|
|
|
|
|
} |
7677
|
|
|
|
|
|
|
} |
7678
|
|
|
|
|
|
|
} |
7679
|
|
|
|
|
|
|
|
7680
|
3
|
|
|
|
|
7
|
# open character class [^...] |
7681
|
1
|
50
|
|
|
|
2
|
elsif ($char[$i] eq '[^') { |
7682
|
1
|
|
|
|
|
4
|
my $left = $i; |
7683
|
|
|
|
|
|
|
if ($char[$i+1] eq ']') { |
7684
|
0
|
|
|
|
|
0
|
$i++; |
7685
|
1
|
50
|
|
|
|
2
|
} |
7686
|
2
|
|
|
|
|
4
|
while (1) { |
7687
|
|
|
|
|
|
|
if (++$i > $#char) { |
7688
|
0
|
100
|
|
|
|
0
|
die __FILE__, ": Unmatched [] in regexp\n"; |
7689
|
2
|
|
|
|
|
6
|
} |
7690
|
|
|
|
|
|
|
if ($char[$i] eq ']') { |
7691
|
|
|
|
|
|
|
my $right = $i; |
7692
|
1
|
50
|
|
|
|
1
|
|
7693
|
1
|
|
|
|
|
7
|
# [^...] |
|
0
|
|
|
|
|
0
|
|
7694
|
|
|
|
|
|
|
if (grep(/\A [\$\@]/oxms,@char[$left+1..$right-1]) >= 1) { |
7695
|
|
|
|
|
|
|
splice @char, $left, $right-$left+1, sprintf(q{@{[Eeucjp::charlist_not_qr(%s,'%s')]}}, join(',', map {qq_stuff($delimiter,$end_delimiter,$_)} @char[$left+1..$right-1]), $modifier); |
7696
|
0
|
|
|
|
|
0
|
} |
7697
|
|
|
|
|
|
|
else { |
7698
|
|
|
|
|
|
|
splice @char, $left, $right-$left+1, Eeucjp::charlist_not_qr(@char[$left+1..$right-1], $modifier); |
7699
|
1
|
|
|
|
|
7
|
} |
7700
|
1
|
|
|
|
|
2
|
|
7701
|
|
|
|
|
|
|
$i = $left; |
7702
|
|
|
|
|
|
|
last; |
7703
|
|
|
|
|
|
|
} |
7704
|
|
|
|
|
|
|
} |
7705
|
|
|
|
|
|
|
} |
7706
|
|
|
|
|
|
|
|
7707
|
1
|
|
|
|
|
3
|
# rewrite character class or escape character |
7708
|
|
|
|
|
|
|
elsif (my $char = character_class($char[$i],$modifier)) { |
7709
|
|
|
|
|
|
|
$char[$i] = $char; |
7710
|
|
|
|
|
|
|
} |
7711
|
|
|
|
|
|
|
|
7712
|
|
|
|
|
|
|
# P.794 29.2.161. split |
7713
|
|
|
|
|
|
|
# in Chapter 29: Functions |
7714
|
|
|
|
|
|
|
# of ISBN 0-596-00027-8 Programming Perl Third Edition. |
7715
|
|
|
|
|
|
|
|
7716
|
|
|
|
|
|
|
# P.951 split |
7717
|
|
|
|
|
|
|
# in Chapter 27: Functions |
7718
|
|
|
|
|
|
|
# of ISBN 978-0-596-00492-7 Programming Perl 4th Edition. |
7719
|
|
|
|
|
|
|
|
7720
|
|
|
|
|
|
|
# said "The //m modifier is assumed when you split on the pattern /^/", |
7721
|
|
|
|
|
|
|
# but perl5.008 is not so. Therefore, this software adds //m. |
7722
|
|
|
|
|
|
|
# (and so on) |
7723
|
|
|
|
|
|
|
|
7724
|
5
|
|
|
|
|
17
|
# split(m/^/) --> split(m/^/m) |
7725
|
|
|
|
|
|
|
elsif (($char[$i] eq '^') and ($modifier !~ /m/oxms)) { |
7726
|
|
|
|
|
|
|
$modifier .= 'm'; |
7727
|
|
|
|
|
|
|
} |
7728
|
|
|
|
|
|
|
|
7729
|
11
|
50
|
|
|
|
50
|
# /i modifier |
7730
|
6
|
|
|
|
|
15
|
elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Eeucjp::uc($char[$i]) ne Eeucjp::fc($char[$i]))) { |
7731
|
|
|
|
|
|
|
if (CORE::length(Eeucjp::fc($char[$i])) == 1) { |
7732
|
|
|
|
|
|
|
$char[$i] = '[' . Eeucjp::uc($char[$i]) . Eeucjp::fc($char[$i]) . ']'; |
7733
|
6
|
|
|
|
|
16
|
} |
7734
|
|
|
|
|
|
|
else { |
7735
|
|
|
|
|
|
|
$char[$i] = '(?:' . Eeucjp::uc($char[$i]) . '|' . Eeucjp::fc($char[$i]) . ')'; |
7736
|
|
|
|
|
|
|
} |
7737
|
|
|
|
|
|
|
} |
7738
|
|
|
|
|
|
|
|
7739
|
0
|
50
|
|
|
|
0
|
# \u \l \U \L \F \Q \E |
7740
|
2
|
|
|
|
|
9
|
elsif ($char[$i] =~ /\A ([<>]) \z/oxms) { |
7741
|
|
|
|
|
|
|
if ($right_e < $left_e) { |
7742
|
|
|
|
|
|
|
$char[$i] = '\\' . $char[$i]; |
7743
|
|
|
|
|
|
|
} |
7744
|
0
|
|
|
|
|
0
|
} |
7745
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\u') { |
7746
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ucfirst qq<'; |
7747
|
|
|
|
|
|
|
$left_e++; |
7748
|
0
|
|
|
|
|
0
|
} |
7749
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\l') { |
7750
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::lcfirst qq<'; |
7751
|
|
|
|
|
|
|
$left_e++; |
7752
|
0
|
|
|
|
|
0
|
} |
7753
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\U') { |
7754
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::uc qq<'; |
7755
|
|
|
|
|
|
|
$left_e++; |
7756
|
0
|
|
|
|
|
0
|
} |
7757
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\L') { |
7758
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::lc qq<'; |
7759
|
|
|
|
|
|
|
$left_e++; |
7760
|
0
|
|
|
|
|
0
|
} |
7761
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\F') { |
7762
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::fc qq<'; |
7763
|
|
|
|
|
|
|
$left_e++; |
7764
|
0
|
|
|
|
|
0
|
} |
7765
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\Q') { |
7766
|
|
|
|
|
|
|
$char[$i] = '@{[CORE::quotemeta qq<'; |
7767
|
|
|
|
|
|
|
$left_e++; |
7768
|
0
|
0
|
|
|
|
0
|
} |
7769
|
0
|
|
|
|
|
0
|
elsif ($char[$i] eq '\E') { |
7770
|
0
|
|
|
|
|
0
|
if ($right_e < $left_e) { |
7771
|
|
|
|
|
|
|
$char[$i] = '>]}'; |
7772
|
|
|
|
|
|
|
$right_e++; |
7773
|
0
|
|
|
|
|
0
|
} |
7774
|
|
|
|
|
|
|
else { |
7775
|
|
|
|
|
|
|
$char[$i] = ''; |
7776
|
|
|
|
|
|
|
} |
7777
|
0
|
|
|
|
|
0
|
} |
7778
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] eq '\Q') { |
7779
|
0
|
|
|
|
|
0
|
while (1) { |
7780
|
|
|
|
|
|
|
if (++$i > $#char) { |
7781
|
0
|
0
|
|
|
|
0
|
last; |
7782
|
0
|
|
|
|
|
0
|
} |
7783
|
|
|
|
|
|
|
if ($char[$i] eq '\E') { |
7784
|
|
|
|
|
|
|
last; |
7785
|
|
|
|
|
|
|
} |
7786
|
|
|
|
|
|
|
} |
7787
|
|
|
|
|
|
|
} |
7788
|
|
|
|
|
|
|
elsif ($char[$i] eq '\E') { |
7789
|
|
|
|
|
|
|
} |
7790
|
|
|
|
|
|
|
|
7791
|
0
|
0
|
|
|
|
0
|
# $0 --> $0 |
7792
|
0
|
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ 0 \z/oxms) { |
7793
|
|
|
|
|
|
|
if ($ignorecase) { |
7794
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
7795
|
|
|
|
|
|
|
} |
7796
|
0
|
0
|
|
|
|
0
|
} |
7797
|
0
|
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) 0 (?>\s*) \} \z/oxms) { |
7798
|
|
|
|
|
|
|
if ($ignorecase) { |
7799
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
7800
|
|
|
|
|
|
|
} |
7801
|
|
|
|
|
|
|
} |
7802
|
|
|
|
|
|
|
|
7803
|
|
|
|
|
|
|
# $$ --> $$ |
7804
|
|
|
|
|
|
|
elsif ($char[$i] =~ /\A \$\$ \z/oxms) { |
7805
|
|
|
|
|
|
|
} |
7806
|
|
|
|
|
|
|
|
7807
|
|
|
|
|
|
|
# $1, $2, $3 --> $2, $3, $4 after s/// with multibyte anchoring |
7808
|
0
|
|
|
|
|
0
|
# $1, $2, $3 --> $1, $2, $3 otherwise |
7809
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ ((?>[1-9][0-9]*)) \z/oxms) { |
7810
|
0
|
|
|
|
|
0
|
$char[$i] = e_capture($1); |
7811
|
|
|
|
|
|
|
if ($ignorecase) { |
7812
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
7813
|
|
|
|
|
|
|
} |
7814
|
0
|
|
|
|
|
0
|
} |
7815
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ \{ (?>\s*) ((?>[1-9][0-9]*)) (?>\s*) \} \z/oxms) { |
7816
|
0
|
|
|
|
|
0
|
$char[$i] = e_capture($1); |
7817
|
|
|
|
|
|
|
if ($ignorecase) { |
7818
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
7819
|
|
|
|
|
|
|
} |
7820
|
|
|
|
|
|
|
} |
7821
|
|
|
|
|
|
|
|
7822
|
0
|
|
|
|
|
0
|
# $$foo[ ... ] --> $ $foo->[ ... ] |
7823
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \[ (?:$qq_bracket)*? \] ) \z/oxms) { |
7824
|
0
|
|
|
|
|
0
|
$char[$i] = e_capture($1.'->'.$2); |
7825
|
|
|
|
|
|
|
if ($ignorecase) { |
7826
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
7827
|
|
|
|
|
|
|
} |
7828
|
|
|
|
|
|
|
} |
7829
|
|
|
|
|
|
|
|
7830
|
0
|
|
|
|
|
0
|
# $$foo{ ... } --> $ $foo->{ ... } |
7831
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) ( \{ (?:$qq_brace)*? \} ) \z/oxms) { |
7832
|
0
|
|
|
|
|
0
|
$char[$i] = e_capture($1.'->'.$2); |
7833
|
|
|
|
|
|
|
if ($ignorecase) { |
7834
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
7835
|
|
|
|
|
|
|
} |
7836
|
|
|
|
|
|
|
} |
7837
|
|
|
|
|
|
|
|
7838
|
0
|
|
|
|
|
0
|
# $$foo |
7839
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ ((?> \$ [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* )) \z/oxms) { |
7840
|
0
|
|
|
|
|
0
|
$char[$i] = e_capture($1); |
7841
|
|
|
|
|
|
|
if ($ignorecase) { |
7842
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
7843
|
|
|
|
|
|
|
} |
7844
|
|
|
|
|
|
|
} |
7845
|
|
|
|
|
|
|
|
7846
|
0
|
50
|
|
|
|
0
|
# $`, ${`}, $PREMATCH, ${PREMATCH}, ${^PREMATCH} --> Eeucjp::PREMATCH() |
7847
|
12
|
|
|
|
|
37
|
elsif ($char[$i] =~ /\A ( \$` | \$\{`\} | \$ (?>\s*) PREMATCH | \$ (?>\s*) \{ (?>\s*) PREMATCH (?>\s*) \} | \$ (?>\s*) \{\^PREMATCH\} ) \z/oxmsgc) { |
7848
|
|
|
|
|
|
|
if ($ignorecase) { |
7849
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(Eeucjp::PREMATCH())]}'; |
7850
|
0
|
|
|
|
|
0
|
} |
7851
|
|
|
|
|
|
|
else { |
7852
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::PREMATCH()]}'; |
7853
|
|
|
|
|
|
|
} |
7854
|
|
|
|
|
|
|
} |
7855
|
|
|
|
|
|
|
|
7856
|
12
|
50
|
|
|
|
68
|
# $&, ${&}, $MATCH, ${MATCH}, ${^MATCH} --> Eeucjp::MATCH() |
7857
|
12
|
|
|
|
|
41
|
elsif ($char[$i] =~ /\A ( \$& | \$\{&\} | \$ (?>\s*) MATCH | \$ (?>\s*) \{ (?>\s*) MATCH (?>\s*) \} | \$ (?>\s*) \{\^MATCH\} ) \z/oxmsgc) { |
7858
|
|
|
|
|
|
|
if ($ignorecase) { |
7859
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(Eeucjp::MATCH())]}'; |
7860
|
0
|
|
|
|
|
0
|
} |
7861
|
|
|
|
|
|
|
else { |
7862
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::MATCH()]}'; |
7863
|
|
|
|
|
|
|
} |
7864
|
|
|
|
|
|
|
} |
7865
|
|
|
|
|
|
|
|
7866
|
12
|
50
|
|
|
|
56
|
# $POSTMATCH, ${POSTMATCH}, ${^POSTMATCH} --> Eeucjp::POSTMATCH() |
7867
|
9
|
|
|
|
|
25
|
elsif ($char[$i] =~ /\A ( \$ (?>\s*) POSTMATCH | \$ (?>\s*) \{ (?>\s*) POSTMATCH (?>\s*) \} | \$ (?>\s*) \{\^POSTMATCH\} ) \z/oxmsgc) { |
7868
|
|
|
|
|
|
|
if ($ignorecase) { |
7869
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(Eeucjp::POSTMATCH())]}'; |
7870
|
0
|
|
|
|
|
0
|
} |
7871
|
|
|
|
|
|
|
else { |
7872
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::POSTMATCH()]}'; |
7873
|
|
|
|
|
|
|
} |
7874
|
|
|
|
|
|
|
} |
7875
|
|
|
|
|
|
|
|
7876
|
9
|
0
|
|
|
|
40
|
# ${ foo } |
7877
|
0
|
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ((?> \s* [A-Za-z_][A-Za-z0-9_]*(?: ::[A-Za-z_][A-Za-z0-9_]*)* \s* )) \} \z/oxms) { |
7878
|
|
|
|
|
|
|
if ($ignorecase) { |
7879
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $1 . ')]}'; |
7880
|
|
|
|
|
|
|
} |
7881
|
|
|
|
|
|
|
} |
7882
|
|
|
|
|
|
|
|
7883
|
0
|
|
|
|
|
0
|
# ${ ... } |
7884
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] =~ /\A \$ (?>\s*) \{ ( .+ ) \} \z/oxms) { |
7885
|
0
|
|
|
|
|
0
|
$char[$i] = e_capture($1); |
7886
|
|
|
|
|
|
|
if ($ignorecase) { |
7887
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
7888
|
|
|
|
|
|
|
} |
7889
|
|
|
|
|
|
|
} |
7890
|
|
|
|
|
|
|
|
7891
|
0
|
|
|
|
|
0
|
# $scalar or @array |
7892
|
3
|
50
|
|
|
|
14
|
elsif ($char[$i] =~ /\A [\$\@].+ /oxms) { |
7893
|
3
|
|
|
|
|
19
|
$char[$i] = e_string($char[$i]); |
7894
|
|
|
|
|
|
|
if ($ignorecase) { |
7895
|
|
|
|
|
|
|
$char[$i] = '@{[Eeucjp::ignorecase(' . $char[$i] . ')]}'; |
7896
|
|
|
|
|
|
|
} |
7897
|
|
|
|
|
|
|
} |
7898
|
|
|
|
|
|
|
|
7899
|
0
|
100
|
|
|
|
0
|
# quote character before ? + * { |
7900
|
|
|
|
|
|
|
elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) { |
7901
|
|
|
|
|
|
|
if ($char[$i-1] =~ /\A (?:[\x00-\xFF]|\\[0-7]{2,3}|\\x[0-9-A-Fa-f]{1,2}) \z/oxms) { |
7902
|
7
|
|
|
|
|
40
|
} |
7903
|
|
|
|
|
|
|
else { |
7904
|
|
|
|
|
|
|
$char[$i-1] = '(?:' . $char[$i-1] . ')'; |
7905
|
|
|
|
|
|
|
} |
7906
|
|
|
|
|
|
|
} |
7907
|
|
|
|
|
|
|
} |
7908
|
4
|
|
|
|
|
23
|
|
7909
|
119
|
50
|
|
|
|
258
|
# make regexp string |
7910
|
119
|
|
|
|
|
313
|
$modifier =~ tr/i//d; |
7911
|
|
|
|
|
|
|
if ($left_e > $right_e) { |
7912
|
0
|
|
|
|
|
0
|
return join '', 'Eeucjp::split', $ope, $delimiter, @char, '>]}' x ($left_e - $right_e), $end_delimiter, $modifier; |
7913
|
|
|
|
|
|
|
} |
7914
|
|
|
|
|
|
|
return join '', 'Eeucjp::split', $ope, $delimiter, @char, $end_delimiter, $modifier; |
7915
|
|
|
|
|
|
|
} |
7916
|
|
|
|
|
|
|
|
7917
|
|
|
|
|
|
|
# |
7918
|
|
|
|
|
|
|
# escape regexp of split qr'' |
7919
|
119
|
|
|
24
|
0
|
1252
|
# |
7920
|
24
|
|
100
|
|
|
90
|
sub e_split_q { |
7921
|
|
|
|
|
|
|
my($ope,$delimiter,$end_delimiter,$string,$modifier) = @_; |
7922
|
24
|
|
|
|
|
65
|
$modifier ||= ''; |
7923
|
24
|
50
|
|
|
|
37
|
|
7924
|
24
|
|
|
|
|
54
|
$modifier =~ tr/p//d; |
7925
|
0
|
|
|
|
|
0
|
if ($modifier =~ /([adlu])/oxms) { |
7926
|
0
|
0
|
|
|
|
0
|
my $line = 0; |
7927
|
0
|
|
|
|
|
0
|
for (my $i=0; my($package,$filename,$use_line,$subroutine) = caller($i); $i++) { |
7928
|
0
|
|
|
|
|
0
|
if ($filename ne __FILE__) { |
7929
|
|
|
|
|
|
|
$line = $use_line + (CORE::substr($_,0,pos($_)) =~ tr/\n//) + 1; |
7930
|
|
|
|
|
|
|
last; |
7931
|
0
|
|
|
|
|
0
|
} |
7932
|
|
|
|
|
|
|
} |
7933
|
|
|
|
|
|
|
die qq{Unsupported modifier "$1" used at line $line.\n}; |
7934
|
0
|
|
|
|
|
0
|
} |
7935
|
|
|
|
|
|
|
|
7936
|
|
|
|
|
|
|
$slash = 'div'; |
7937
|
24
|
100
|
|
|
|
36
|
|
7938
|
24
|
|
|
|
|
43
|
# /b /B modifier |
7939
|
|
|
|
|
|
|
if ($modifier =~ tr/bB//d) { |
7940
|
|
|
|
|
|
|
return join '', 'split', $ope, $delimiter, $string, $end_delimiter, $modifier; |
7941
|
12
|
100
|
|
|
|
52
|
} |
7942
|
|
|
|
|
|
|
|
7943
|
|
|
|
|
|
|
my $ignorecase = ($modifier =~ /i/oxms) ? 1 : 0; |
7944
|
12
|
|
|
|
|
29
|
|
7945
|
|
|
|
|
|
|
# split regexp |
7946
|
|
|
|
|
|
|
my @char = $string =~ /\G((?> |
7947
|
|
|
|
|
|
|
[^\x8E\x8F\xA1-\xFE\\\[] | |
7948
|
|
|
|
|
|
|
[\x8E\xA1-\xFE][\xA1-\xFE]|\x8F[\xA1-\xFE][\x00-\xFF] | |
7949
|
|
|
|
|
|
|
\[\^ | |
7950
|
|
|
|
|
|
|
\[\: (?>[a-z]+) \:\] | |
7951
|
|
|
|
|
|
|
\[\:\^ (?>[a-z]+) \:\] | |
7952
|
|
|
|
|
|
|
\\ (?:$q_char) | |
7953
|
|
|
|
|
|
|
(?:$q_char) |
7954
|
|
|
|
|
|
|
))/oxmsg; |
7955
|
12
|
|
|
|
|
180
|
|
7956
|
12
|
50
|
33
|
|
|
34
|
# unescape character |
|
|
50
|
100
|
|
|
|
|
|
|
50
|
66
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
7957
|
|
|
|
|
|
|
for (my $i=0; $i <= $#char; $i++) { |
7958
|
|
|
|
|
|
|
if (0) { |
7959
|
|
|
|
|
|
|
} |
7960
|
12
|
|
|
|
|
47
|
|
7961
|
0
|
|
|
|
|
0
|
# open character class [...] |
7962
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] eq '[') { |
7963
|
0
|
|
|
|
|
0
|
my $left = $i; |
7964
|
|
|
|
|
|
|
if ($char[$i+1] eq ']') { |
7965
|
0
|
|
|
|
|
0
|
$i++; |
7966
|
0
|
0
|
|
|
|
0
|
} |
7967
|
0
|
|
|
|
|
0
|
while (1) { |
7968
|
|
|
|
|
|
|
if (++$i > $#char) { |
7969
|
0
|
0
|
|
|
|
0
|
die __FILE__, ": Unmatched [] in regexp\n"; |
7970
|
0
|
|
|
|
|
0
|
} |
7971
|
|
|
|
|
|
|
if ($char[$i] eq ']') { |
7972
|
|
|
|
|
|
|
my $right = $i; |
7973
|
0
|
|
|
|
|
0
|
|
7974
|
|
|
|
|
|
|
# [...] |
7975
|
0
|
|
|
|
|
0
|
splice @char, $left, $right-$left+1, Eeucjp::charlist_qr(@char[$left+1..$right-1], $modifier); |
7976
|
0
|
|
|
|
|
0
|
|
7977
|
|
|
|
|
|
|
$i = $left; |
7978
|
|
|
|
|
|
|
last; |
7979
|
|
|
|
|
|
|
} |
7980
|
|
|
|
|
|
|
} |
7981
|
|
|
|
|
|
|
} |
7982
|
|
|
|
|
|
|
|
7983
|
0
|
|
|
|
|
0
|
# open character class [^...] |
7984
|
0
|
0
|
|
|
|
0
|
elsif ($char[$i] eq '[^') { |
7985
|
0
|
|
|
|
|
0
|
my $left = $i; |
7986
|
|
|
|
|
|
|
if ($char[$i+1] eq ']') { |
7987
|
0
|
|
|
|
|
0
|
$i++; |
7988
|
0
|
0
|
|
|
|
0
|
} |
7989
|
0
|
|
|
|
|
0
|
while (1) { |
7990
|
|
|
|
|
|
|
if (++$i > $#char) { |
7991
|
0
|
0
|
|
|
|
0
|
die __FILE__, ": Unmatched [] in regexp\n"; |
7992
|
0
|
|
|
|
|
0
|
} |
7993
|
|
|
|
|
|
|
if ($char[$i] eq ']') { |
7994
|
|
|
|
|
|
|
my $right = $i; |
7995
|
0
|
|
|
|
|
0
|
|
7996
|
|
|
|
|
|
|
# [^...] |
7997
|
0
|
|
|
|
|
0
|
splice @char, $left, $right-$left+1, Eeucjp::charlist_not_qr(@char[$left+1..$right-1], $modifier); |
7998
|
0
|
|
|
|
|
0
|
|
7999
|
|
|
|
|
|
|
$i = $left; |
8000
|
|
|
|
|
|
|
last; |
8001
|
|
|
|
|
|
|
} |
8002
|
|
|
|
|
|
|
} |
8003
|
|
|
|
|
|
|
} |
8004
|
|
|
|
|
|
|
|
8005
|
0
|
|
|
|
|
0
|
# rewrite character class or escape character |
8006
|
|
|
|
|
|
|
elsif (my $char = character_class($char[$i],$modifier)) { |
8007
|
|
|
|
|
|
|
$char[$i] = $char; |
8008
|
|
|
|
|
|
|
} |
8009
|
|
|
|
|
|
|
|
8010
|
0
|
|
|
|
|
0
|
# split(m/^/) --> split(m/^/m) |
8011
|
|
|
|
|
|
|
elsif (($char[$i] eq '^') and ($modifier !~ /m/oxms)) { |
8012
|
|
|
|
|
|
|
$modifier .= 'm'; |
8013
|
|
|
|
|
|
|
} |
8014
|
|
|
|
|
|
|
|
8015
|
0
|
50
|
|
|
|
0
|
# /i modifier |
8016
|
4
|
|
|
|
|
17
|
elsif ($ignorecase and ($char[$i] =~ /\A [\x00-\xFF] \z/oxms) and (Eeucjp::uc($char[$i]) ne Eeucjp::fc($char[$i]))) { |
8017
|
|
|
|
|
|
|
if (CORE::length(Eeucjp::fc($char[$i])) == 1) { |
8018
|
|
|
|
|
|
|
$char[$i] = '[' . Eeucjp::uc($char[$i]) . Eeucjp::fc($char[$i]) . ']'; |
8019
|
4
|
|
|
|
|
10
|
} |
8020
|
|
|
|
|
|
|
else { |
8021
|
|
|
|
|
|
|
$char[$i] = '(?:' . Eeucjp::uc($char[$i]) . '|' . Eeucjp::fc($char[$i]) . ')'; |
8022
|
|
|
|
|
|
|
} |
8023
|
|
|
|
|
|
|
} |
8024
|
|
|
|
|
|
|
|
8025
|
0
|
0
|
|
|
|
0
|
# quote character before ? + * { |
8026
|
|
|
|
|
|
|
elsif (($i >= 1) and ($char[$i] =~ /\A [\?\+\*\{] \z/oxms)) { |
8027
|
|
|
|
|
|
|
if ($char[$i-1] =~ /\A [\x00-\xFF] \z/oxms) { |
8028
|
0
|
|
|
|
|
0
|
} |
8029
|
|
|
|
|
|
|
else { |
8030
|
|
|
|
|
|
|
$char[$i-1] = '(?:' . $char[$i-1] . ')'; |
8031
|
|
|
|
|
|
|
} |
8032
|
|
|
|
|
|
|
} |
8033
|
0
|
|
|
|
|
0
|
} |
8034
|
12
|
|
|
|
|
21
|
|
8035
|
|
|
|
|
|
|
$modifier =~ tr/i//d; |
8036
|
|
|
|
|
|
|
return join '', 'Eeucjp::split', $ope, $delimiter, @char, $end_delimiter, $modifier; |
8037
|
|
|
|
|
|
|
} |
8038
|
|
|
|
|
|
|
|
8039
|
|
|
|
|
|
|
# |
8040
|
|
|
|
|
|
|
# instead of Carp::carp |
8041
|
12
|
|
|
0
|
0
|
81
|
# |
8042
|
0
|
|
|
|
|
|
sub carp { |
8043
|
|
|
|
|
|
|
my($package,$filename,$line) = caller(1); |
8044
|
|
|
|
|
|
|
print STDERR "@_ at $filename line $line.\n"; |
8045
|
|
|
|
|
|
|
} |
8046
|
|
|
|
|
|
|
|
8047
|
|
|
|
|
|
|
# |
8048
|
|
|
|
|
|
|
# instead of Carp::croak |
8049
|
0
|
|
|
0
|
0
|
|
# |
8050
|
0
|
|
|
|
|
|
sub croak { |
8051
|
0
|
|
|
|
|
|
my($package,$filename,$line) = caller(1); |
8052
|
|
|
|
|
|
|
print STDERR "@_ at $filename line $line.\n"; |
8053
|
|
|
|
|
|
|
die "\n"; |
8054
|
|
|
|
|
|
|
} |
8055
|
|
|
|
|
|
|
|
8056
|
|
|
|
|
|
|
# |
8057
|
|
|
|
|
|
|
# instead of Carp::cluck |
8058
|
0
|
|
|
0
|
0
|
|
# |
8059
|
0
|
|
|
|
|
|
sub cluck { |
8060
|
0
|
|
|
|
|
|
my $i = 0; |
8061
|
0
|
|
|
|
|
|
my @cluck = (); |
8062
|
0
|
|
|
|
|
|
while (my($package,$filename,$line,$subroutine) = caller($i)) { |
8063
|
|
|
|
|
|
|
push @cluck, "[$i] $filename($line) $package::$subroutine\n"; |
8064
|
0
|
|
|
|
|
|
$i++; |
8065
|
0
|
|
|
|
|
|
} |
8066
|
0
|
|
|
|
|
|
print STDERR CORE::reverse @cluck; |
8067
|
|
|
|
|
|
|
print STDERR "\n"; |
8068
|
|
|
|
|
|
|
print STDERR @_; |
8069
|
|
|
|
|
|
|
} |
8070
|
|
|
|
|
|
|
|
8071
|
|
|
|
|
|
|
# |
8072
|
|
|
|
|
|
|
# instead of Carp::confess |
8073
|
0
|
|
|
0
|
0
|
|
# |
8074
|
0
|
|
|
|
|
|
sub confess { |
8075
|
0
|
|
|
|
|
|
my $i = 0; |
8076
|
0
|
|
|
|
|
|
my @confess = (); |
8077
|
0
|
|
|
|
|
|
while (my($package,$filename,$line,$subroutine) = caller($i)) { |
8078
|
|
|
|
|
|
|
push @confess, "[$i] $filename($line) $package::$subroutine\n"; |
8079
|
0
|
|
|
|
|
|
$i++; |
8080
|
0
|
|
|
|
|
|
} |
8081
|
0
|
|
|
|
|
|
print STDERR CORE::reverse @confess; |
8082
|
0
|
|
|
|
|
|
print STDERR "\n"; |
8083
|
|
|
|
|
|
|
print STDERR @_; |
8084
|
|
|
|
|
|
|
die "\n"; |
8085
|
|
|
|
|
|
|
} |
8086
|
|
|
|
|
|
|
|
8087
|
|
|
|
|
|
|
1; |
8088
|
|
|
|
|
|
|
|
8089
|
|
|
|
|
|
|
__END__ |