pythonlib 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +183 -0
- package/dist/chunk-3CSEXTA7.js +376 -0
- package/dist/chunk-3CSEXTA7.js.map +1 -0
- package/dist/chunk-HA5Y7PKO.js +680 -0
- package/dist/chunk-HA5Y7PKO.js.map +1 -0
- package/dist/chunk-IVYYI2VR.js +261 -0
- package/dist/chunk-IVYYI2VR.js.map +1 -0
- package/dist/chunk-OMQNGE6T.js +245 -0
- package/dist/chunk-OMQNGE6T.js.map +1 -0
- package/dist/chunk-P3SGIF72.js +107 -0
- package/dist/chunk-P3SGIF72.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-TJFGYXBJ.js +310 -0
- package/dist/chunk-TJFGYXBJ.js.map +1 -0
- package/dist/chunk-TOI6IG3T.js +337 -0
- package/dist/chunk-TOI6IG3T.js.map +1 -0
- package/dist/chunk-UFMTN4T4.js +215 -0
- package/dist/chunk-UFMTN4T4.js.map +1 -0
- package/dist/chunk-V63LKSA3.js +423 -0
- package/dist/chunk-V63LKSA3.js.map +1 -0
- package/dist/chunk-WAONBJE5.js +236 -0
- package/dist/chunk-WAONBJE5.js.map +1 -0
- package/dist/collections-xN9Gi0TA.d.ts +113 -0
- package/dist/collections.d.ts +1 -0
- package/dist/collections.js +12 -0
- package/dist/collections.js.map +1 -0
- package/dist/datetime-DRwFAiGV.d.ts +139 -0
- package/dist/datetime.d.ts +1 -0
- package/dist/datetime.js +22 -0
- package/dist/datetime.js.map +1 -0
- package/dist/functools-St5GqpKG.d.ts +125 -0
- package/dist/functools.d.ts +1 -0
- package/dist/functools.js +32 -0
- package/dist/functools.js.map +1 -0
- package/dist/index.d.ts +624 -0
- package/dist/index.js +1332 -0
- package/dist/index.js.map +1 -0
- package/dist/itertools-Bj8XivI6.d.ts +138 -0
- package/dist/itertools.d.ts +1 -0
- package/dist/itertools.js +44 -0
- package/dist/itertools.js.map +1 -0
- package/dist/json-Xpk0kwSd.d.ts +77 -0
- package/dist/json.d.ts +1 -0
- package/dist/json.js +14 -0
- package/dist/json.js.map +1 -0
- package/dist/math-BrT4Aw3E.d.ts +147 -0
- package/dist/math.d.ts +1 -0
- package/dist/math.js +96 -0
- package/dist/math.js.map +1 -0
- package/dist/os-FRSJbEUH.d.ts +143 -0
- package/dist/os.d.ts +1 -0
- package/dist/os.js +58 -0
- package/dist/os.js.map +1 -0
- package/dist/random-D5S5iSV3.d.ts +72 -0
- package/dist/random.d.ts +1 -0
- package/dist/random.js +42 -0
- package/dist/random.js.map +1 -0
- package/dist/re-DSxiURqN.d.ts +148 -0
- package/dist/re.d.ts +1 -0
- package/dist/re.js +52 -0
- package/dist/re.js.map +1 -0
- package/dist/string.d.ts +166 -0
- package/dist/string.js +30 -0
- package/dist/string.js.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-PZ5AY32C.js";
|
|
4
|
+
|
|
5
|
+
// src/re.ts
|
|
6
|
+
var re_exports = {};
|
|
7
|
+
__export(re_exports, {
|
|
8
|
+
A: () => A,
|
|
9
|
+
ASCII: () => ASCII,
|
|
10
|
+
DOTALL: () => DOTALL,
|
|
11
|
+
I: () => I,
|
|
12
|
+
IGNORECASE: () => IGNORECASE,
|
|
13
|
+
M: () => M,
|
|
14
|
+
MULTILINE: () => MULTILINE,
|
|
15
|
+
Match: () => Match,
|
|
16
|
+
Pattern: () => Pattern,
|
|
17
|
+
S: () => S,
|
|
18
|
+
U: () => U,
|
|
19
|
+
UNICODE: () => UNICODE,
|
|
20
|
+
compile: () => compile,
|
|
21
|
+
escape: () => escape,
|
|
22
|
+
findall: () => findall,
|
|
23
|
+
finditer: () => finditer,
|
|
24
|
+
fullmatch: () => fullmatch,
|
|
25
|
+
match: () => match,
|
|
26
|
+
purge: () => purge,
|
|
27
|
+
search: () => search,
|
|
28
|
+
split: () => split,
|
|
29
|
+
sub: () => sub,
|
|
30
|
+
subn: () => subn
|
|
31
|
+
});
|
|
32
|
+
var IGNORECASE = 2;
|
|
33
|
+
var I = IGNORECASE;
|
|
34
|
+
var MULTILINE = 8;
|
|
35
|
+
var M = MULTILINE;
|
|
36
|
+
var DOTALL = 16;
|
|
37
|
+
var S = DOTALL;
|
|
38
|
+
var UNICODE = 32;
|
|
39
|
+
var U = UNICODE;
|
|
40
|
+
var ASCII = 256;
|
|
41
|
+
var A = ASCII;
|
|
42
|
+
var Match = class {
|
|
43
|
+
_match;
|
|
44
|
+
_string;
|
|
45
|
+
_pattern;
|
|
46
|
+
_pos;
|
|
47
|
+
_endpos;
|
|
48
|
+
constructor(match2, string, pattern, pos = 0, endpos) {
|
|
49
|
+
this._match = match2;
|
|
50
|
+
this._string = string;
|
|
51
|
+
this._pattern = pattern;
|
|
52
|
+
this._pos = pos;
|
|
53
|
+
this._endpos = endpos ?? string.length;
|
|
54
|
+
}
|
|
55
|
+
/** Return the string matched by the RE */
|
|
56
|
+
group(groupNum = 0) {
|
|
57
|
+
if (typeof groupNum === "number") {
|
|
58
|
+
return this._match[groupNum];
|
|
59
|
+
}
|
|
60
|
+
return this._match.groups?.[groupNum];
|
|
61
|
+
}
|
|
62
|
+
/** Return a tuple containing all subgroups */
|
|
63
|
+
groups(defaultValue) {
|
|
64
|
+
const result = [];
|
|
65
|
+
for (let i = 1; i < this._match.length; i++) {
|
|
66
|
+
result.push(this._match[i] ?? defaultValue);
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
/** Return a dictionary of named groups */
|
|
71
|
+
groupdict(defaultValue) {
|
|
72
|
+
const groups = this._match.groups ?? {};
|
|
73
|
+
const result = {};
|
|
74
|
+
for (const [key, value] of Object.entries(groups)) {
|
|
75
|
+
result[key] = value ?? defaultValue;
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
/** Return the start index of the match */
|
|
80
|
+
start(groupNum = 0) {
|
|
81
|
+
if (groupNum === 0) {
|
|
82
|
+
return this._match.index;
|
|
83
|
+
}
|
|
84
|
+
const fullMatch = this._match[0];
|
|
85
|
+
const subMatch = this._match[groupNum];
|
|
86
|
+
if (!fullMatch || !subMatch) return -1;
|
|
87
|
+
const offset = fullMatch.indexOf(subMatch);
|
|
88
|
+
return offset >= 0 ? this._match.index + offset : -1;
|
|
89
|
+
}
|
|
90
|
+
/** Return the end index of the match */
|
|
91
|
+
end(groupNum = 0) {
|
|
92
|
+
const s = this.start(groupNum);
|
|
93
|
+
const g = this.group(groupNum);
|
|
94
|
+
if (s < 0 || g === void 0) return -1;
|
|
95
|
+
return s + g.length;
|
|
96
|
+
}
|
|
97
|
+
/** Return a tuple (start, end) */
|
|
98
|
+
span(groupNum = 0) {
|
|
99
|
+
return [this.start(groupNum), this.end(groupNum)];
|
|
100
|
+
}
|
|
101
|
+
/** Return start position of search */
|
|
102
|
+
get pos() {
|
|
103
|
+
return this._pos;
|
|
104
|
+
}
|
|
105
|
+
/** Return end position of search */
|
|
106
|
+
get endpos() {
|
|
107
|
+
return this._endpos;
|
|
108
|
+
}
|
|
109
|
+
/** Return the last matched group index */
|
|
110
|
+
get lastindex() {
|
|
111
|
+
for (let i = this._match.length - 1; i > 0; i--) {
|
|
112
|
+
if (this._match[i] !== void 0) return i;
|
|
113
|
+
}
|
|
114
|
+
return void 0;
|
|
115
|
+
}
|
|
116
|
+
/** Return the name of the last matched group */
|
|
117
|
+
get lastgroup() {
|
|
118
|
+
if (!this._match.groups) return void 0;
|
|
119
|
+
const lastIdx = this.lastindex;
|
|
120
|
+
if (lastIdx === void 0) return void 0;
|
|
121
|
+
let idx = 1;
|
|
122
|
+
for (const name of Object.keys(this._match.groups)) {
|
|
123
|
+
if (idx === lastIdx) return name;
|
|
124
|
+
idx++;
|
|
125
|
+
}
|
|
126
|
+
return void 0;
|
|
127
|
+
}
|
|
128
|
+
/** Return the pattern object */
|
|
129
|
+
get re() {
|
|
130
|
+
return this._pattern;
|
|
131
|
+
}
|
|
132
|
+
/** Return the input string */
|
|
133
|
+
get string() {
|
|
134
|
+
return this._string;
|
|
135
|
+
}
|
|
136
|
+
/** Expand template with groups */
|
|
137
|
+
expand(template) {
|
|
138
|
+
return template.replace(/\\(\d+)|\\g<(\w+)>/g, (_, num, name) => {
|
|
139
|
+
if (num) {
|
|
140
|
+
return this.group(parseInt(num)) ?? "";
|
|
141
|
+
}
|
|
142
|
+
return this.group(name) ?? "";
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/** Return iterator of all groups */
|
|
146
|
+
*[Symbol.iterator]() {
|
|
147
|
+
for (let i = 0; i < this._match.length; i++) {
|
|
148
|
+
yield this._match[i];
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
toString() {
|
|
152
|
+
return `<re.Match object; span=(${String(this.start())}, ${String(this.end())}), match='${this.group() ?? ""}'>`;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
var Pattern = class {
|
|
156
|
+
_regex;
|
|
157
|
+
_pattern;
|
|
158
|
+
_flags;
|
|
159
|
+
constructor(pattern, flags = 0) {
|
|
160
|
+
this._pattern = pattern;
|
|
161
|
+
this._flags = flags;
|
|
162
|
+
this._regex = this._compileRegex(pattern, flags);
|
|
163
|
+
}
|
|
164
|
+
_compileRegex(pattern, flags) {
|
|
165
|
+
const jsPattern = pattern.replace(/\(\?P<(\w+)>/g, "(?<$1>").replace(/\(\?P=(\w+)\)/g, "\\k<$1>");
|
|
166
|
+
let jsFlags = "";
|
|
167
|
+
if (flags & IGNORECASE) jsFlags += "i";
|
|
168
|
+
if (flags & MULTILINE) jsFlags += "m";
|
|
169
|
+
if (flags & DOTALL) jsFlags += "s";
|
|
170
|
+
jsFlags += "u";
|
|
171
|
+
return new RegExp(jsPattern, jsFlags);
|
|
172
|
+
}
|
|
173
|
+
/** Search for pattern in string */
|
|
174
|
+
search(string, pos = 0, endpos) {
|
|
175
|
+
const searchStr = endpos !== void 0 ? string.slice(0, endpos) : string;
|
|
176
|
+
const searchFrom = searchStr.slice(pos);
|
|
177
|
+
const regex = new RegExp(this._regex.source, this._regex.flags);
|
|
178
|
+
const match2 = regex.exec(searchFrom);
|
|
179
|
+
if (match2) {
|
|
180
|
+
match2.index += pos;
|
|
181
|
+
return new Match(match2, string, this, pos, endpos);
|
|
182
|
+
}
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
/** Match pattern at start of string */
|
|
186
|
+
match(string, pos = 0, endpos) {
|
|
187
|
+
const searchStr = endpos !== void 0 ? string.slice(0, endpos) : string;
|
|
188
|
+
const searchFrom = searchStr.slice(pos);
|
|
189
|
+
const regex = new RegExp("^(?:" + this._regex.source + ")", this._regex.flags);
|
|
190
|
+
const match2 = regex.exec(searchFrom);
|
|
191
|
+
if (match2) {
|
|
192
|
+
match2.index += pos;
|
|
193
|
+
return new Match(match2, string, this, pos, endpos);
|
|
194
|
+
}
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
/** Match pattern against entire string */
|
|
198
|
+
fullmatch(string, pos = 0, endpos) {
|
|
199
|
+
const searchStr = endpos !== void 0 ? string.slice(0, endpos) : string;
|
|
200
|
+
const searchFrom = searchStr.slice(pos);
|
|
201
|
+
const regex = new RegExp("^(?:" + this._regex.source + ")$", this._regex.flags);
|
|
202
|
+
const match2 = regex.exec(searchFrom);
|
|
203
|
+
if (match2) {
|
|
204
|
+
match2.index += pos;
|
|
205
|
+
return new Match(match2, string, this, pos, endpos);
|
|
206
|
+
}
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
/** Split string by pattern */
|
|
210
|
+
split(string, maxsplit = 0) {
|
|
211
|
+
if (maxsplit === 0) {
|
|
212
|
+
return string.split(this._regex);
|
|
213
|
+
}
|
|
214
|
+
const result = [];
|
|
215
|
+
let lastIndex = 0;
|
|
216
|
+
let count = 0;
|
|
217
|
+
const regex = new RegExp(this._regex.source, this._regex.flags + "g");
|
|
218
|
+
let match2;
|
|
219
|
+
while ((match2 = regex.exec(string)) !== null && (maxsplit === 0 || count < maxsplit)) {
|
|
220
|
+
result.push(string.slice(lastIndex, match2.index));
|
|
221
|
+
for (let i = 1; i < match2.length; i++) {
|
|
222
|
+
const group = match2[i];
|
|
223
|
+
if (group !== void 0) {
|
|
224
|
+
result.push(group);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
lastIndex = regex.lastIndex;
|
|
228
|
+
count++;
|
|
229
|
+
}
|
|
230
|
+
result.push(string.slice(lastIndex));
|
|
231
|
+
return result;
|
|
232
|
+
}
|
|
233
|
+
/** Find all matches */
|
|
234
|
+
findall(string, pos = 0, endpos) {
|
|
235
|
+
const searchStr = endpos !== void 0 ? string.slice(0, endpos) : string;
|
|
236
|
+
const searchFrom = searchStr.slice(pos);
|
|
237
|
+
const regex = new RegExp(this._regex.source, this._regex.flags + "g");
|
|
238
|
+
const results = [];
|
|
239
|
+
let match2;
|
|
240
|
+
while ((match2 = regex.exec(searchFrom)) !== null) {
|
|
241
|
+
if (match2.length === 1) {
|
|
242
|
+
results.push(match2[0]);
|
|
243
|
+
} else if (match2.length === 2 && match2[1] !== void 0) {
|
|
244
|
+
results.push(match2[1]);
|
|
245
|
+
} else {
|
|
246
|
+
results.push(match2.slice(1));
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return results;
|
|
250
|
+
}
|
|
251
|
+
/** Find all matches as iterator */
|
|
252
|
+
*finditer(string, pos = 0, endpos) {
|
|
253
|
+
const searchStr = endpos !== void 0 ? string.slice(0, endpos) : string;
|
|
254
|
+
const searchFrom = searchStr.slice(pos);
|
|
255
|
+
const regex = new RegExp(this._regex.source, this._regex.flags + "g");
|
|
256
|
+
let match2;
|
|
257
|
+
while ((match2 = regex.exec(searchFrom)) !== null) {
|
|
258
|
+
match2.index += pos;
|
|
259
|
+
yield new Match(match2, string, this, pos, endpos);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
/** Replace pattern in string */
|
|
263
|
+
sub(repl, string, count = 0) {
|
|
264
|
+
if (typeof repl === "function") {
|
|
265
|
+
let n2 = 0;
|
|
266
|
+
const regex2 = new RegExp(this._regex.source, this._regex.flags + "g");
|
|
267
|
+
return string.replace(regex2, (...args) => {
|
|
268
|
+
if (count > 0 && n2 >= count) {
|
|
269
|
+
return args[0];
|
|
270
|
+
}
|
|
271
|
+
n2++;
|
|
272
|
+
const match2 = regex2.exec(string);
|
|
273
|
+
if (!match2) return args[0];
|
|
274
|
+
return repl(new Match(match2, string, this));
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
const jsRepl = repl.replace(/\\g<(\w+)>/g, "$<$1>").replace(/\\(\d+)/g, "$$$1");
|
|
278
|
+
if (count === 0) {
|
|
279
|
+
const regex2 = new RegExp(this._regex.source, this._regex.flags + "g");
|
|
280
|
+
return string.replace(regex2, jsRepl);
|
|
281
|
+
}
|
|
282
|
+
let result = string;
|
|
283
|
+
let n = 0;
|
|
284
|
+
const regex = new RegExp(this._regex.source, this._regex.flags);
|
|
285
|
+
while (n < count) {
|
|
286
|
+
const newResult = result.replace(regex, jsRepl);
|
|
287
|
+
if (newResult === result) break;
|
|
288
|
+
result = newResult;
|
|
289
|
+
n++;
|
|
290
|
+
}
|
|
291
|
+
return result;
|
|
292
|
+
}
|
|
293
|
+
/** Replace pattern and return (newstring, count) */
|
|
294
|
+
subn(repl, string, count = 0) {
|
|
295
|
+
let n = 0;
|
|
296
|
+
const result = this.sub(
|
|
297
|
+
typeof repl === "function" ? (m) => {
|
|
298
|
+
n++;
|
|
299
|
+
return repl(m);
|
|
300
|
+
} : repl,
|
|
301
|
+
string,
|
|
302
|
+
count
|
|
303
|
+
);
|
|
304
|
+
if (typeof repl === "string") {
|
|
305
|
+
const regex = new RegExp(this._regex.source, this._regex.flags + "g");
|
|
306
|
+
const matches = string.match(regex);
|
|
307
|
+
n = matches ? count > 0 ? Math.min(matches.length, count) : matches.length : 0;
|
|
308
|
+
}
|
|
309
|
+
return [result, n];
|
|
310
|
+
}
|
|
311
|
+
/** Return the pattern string */
|
|
312
|
+
get pattern() {
|
|
313
|
+
return this._pattern;
|
|
314
|
+
}
|
|
315
|
+
/** Return the flags */
|
|
316
|
+
get flags() {
|
|
317
|
+
return this._flags;
|
|
318
|
+
}
|
|
319
|
+
/** Return number of groups */
|
|
320
|
+
get groups() {
|
|
321
|
+
let count = 0;
|
|
322
|
+
for (let i = 0; i < this._pattern.length; i++) {
|
|
323
|
+
if (this._pattern[i] === "\\") {
|
|
324
|
+
i++;
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
if (this._pattern[i] === "(") {
|
|
328
|
+
if (this._pattern[i + 1] !== "?") {
|
|
329
|
+
count++;
|
|
330
|
+
} else if (this._pattern.slice(i + 1, i + 4) === "?P<" || this._pattern.slice(i + 1, i + 3) === "?<") {
|
|
331
|
+
count++;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
return count;
|
|
336
|
+
}
|
|
337
|
+
/** Return named groups mapping */
|
|
338
|
+
get groupindex() {
|
|
339
|
+
const result = {};
|
|
340
|
+
let groupNum = 0;
|
|
341
|
+
const regex = /\(\?P?<(\w+)>/g;
|
|
342
|
+
let match2;
|
|
343
|
+
while ((match2 = regex.exec(this._pattern)) !== null) {
|
|
344
|
+
groupNum++;
|
|
345
|
+
const name = match2[1];
|
|
346
|
+
if (name) {
|
|
347
|
+
result[name] = groupNum;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
return result;
|
|
351
|
+
}
|
|
352
|
+
toString() {
|
|
353
|
+
return `re.compile('${this._pattern}')`;
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
function compile(pattern, flags = 0) {
|
|
357
|
+
return new Pattern(pattern, flags);
|
|
358
|
+
}
|
|
359
|
+
function search(pattern, string, flags = 0) {
|
|
360
|
+
const p = pattern instanceof Pattern ? pattern : compile(pattern, flags);
|
|
361
|
+
return p.search(string);
|
|
362
|
+
}
|
|
363
|
+
function match(pattern, string, flags = 0) {
|
|
364
|
+
const p = pattern instanceof Pattern ? pattern : compile(pattern, flags);
|
|
365
|
+
return p.match(string);
|
|
366
|
+
}
|
|
367
|
+
function fullmatch(pattern, string, flags = 0) {
|
|
368
|
+
const p = pattern instanceof Pattern ? pattern : compile(pattern, flags);
|
|
369
|
+
return p.fullmatch(string);
|
|
370
|
+
}
|
|
371
|
+
function split(pattern, string, maxsplit = 0, flags = 0) {
|
|
372
|
+
const p = pattern instanceof Pattern ? pattern : compile(pattern, flags);
|
|
373
|
+
return p.split(string, maxsplit);
|
|
374
|
+
}
|
|
375
|
+
function findall(pattern, string, flags = 0) {
|
|
376
|
+
const p = pattern instanceof Pattern ? pattern : compile(pattern, flags);
|
|
377
|
+
return p.findall(string);
|
|
378
|
+
}
|
|
379
|
+
function finditer(pattern, string, flags = 0) {
|
|
380
|
+
const p = pattern instanceof Pattern ? pattern : compile(pattern, flags);
|
|
381
|
+
return p.finditer(string);
|
|
382
|
+
}
|
|
383
|
+
function sub(pattern, repl, string, count = 0, flags = 0) {
|
|
384
|
+
const p = pattern instanceof Pattern ? pattern : compile(pattern, flags);
|
|
385
|
+
return p.sub(repl, string, count);
|
|
386
|
+
}
|
|
387
|
+
function subn(pattern, repl, string, count = 0, flags = 0) {
|
|
388
|
+
const p = pattern instanceof Pattern ? pattern : compile(pattern, flags);
|
|
389
|
+
return p.subn(repl, string, count);
|
|
390
|
+
}
|
|
391
|
+
function escape(pattern) {
|
|
392
|
+
return pattern.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
393
|
+
}
|
|
394
|
+
function purge() {
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export {
|
|
398
|
+
IGNORECASE,
|
|
399
|
+
I,
|
|
400
|
+
MULTILINE,
|
|
401
|
+
M,
|
|
402
|
+
DOTALL,
|
|
403
|
+
S,
|
|
404
|
+
UNICODE,
|
|
405
|
+
U,
|
|
406
|
+
ASCII,
|
|
407
|
+
A,
|
|
408
|
+
Match,
|
|
409
|
+
Pattern,
|
|
410
|
+
compile,
|
|
411
|
+
search,
|
|
412
|
+
match,
|
|
413
|
+
fullmatch,
|
|
414
|
+
split,
|
|
415
|
+
findall,
|
|
416
|
+
finditer,
|
|
417
|
+
sub,
|
|
418
|
+
subn,
|
|
419
|
+
escape,
|
|
420
|
+
purge,
|
|
421
|
+
re_exports
|
|
422
|
+
};
|
|
423
|
+
//# sourceMappingURL=chunk-V63LKSA3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/re.ts"],"sourcesContent":["/**\n * Python re module for TypeScript\n *\n * Provides regular expression matching operations matching Python's re module.\n * Uses JavaScript's RegExp as the underlying engine.\n *\n * Note: Some Python regex features are not supported in JavaScript:\n * - Lookbehind assertions (limited support in modern JS)\n * - Named groups use different syntax (?P<name>...) vs (?<name>...)\n * - Verbose mode (x flag) is not supported\n */\n\n// ============================================================================\n// Flags\n// ============================================================================\n\n/** Ignore case */\nexport const IGNORECASE = 2\nexport const I = IGNORECASE\n\n/** Multi-line mode */\nexport const MULTILINE = 8\nexport const M = MULTILINE\n\n/** Dot matches all (including newline) */\nexport const DOTALL = 16\nexport const S = DOTALL\n\n/** Unicode matching (always on in JS) */\nexport const UNICODE = 32\nexport const U = UNICODE\n\n/** ASCII-only matching */\nexport const ASCII = 256\nexport const A = ASCII\n\n// ============================================================================\n// Match object\n// ============================================================================\n\nexport class Match {\n private _match: RegExpExecArray\n private _string: string\n private _pattern: Pattern\n private _pos: number\n private _endpos: number\n\n constructor(\n match: RegExpExecArray,\n string: string,\n pattern: Pattern,\n pos: number = 0,\n endpos?: number\n ) {\n this._match = match\n this._string = string\n this._pattern = pattern\n this._pos = pos\n this._endpos = endpos ?? string.length\n }\n\n /** Return the string matched by the RE */\n group(groupNum: number | string = 0): string | undefined {\n if (typeof groupNum === \"number\") {\n return this._match[groupNum]\n }\n // Named group\n return this._match.groups?.[groupNum]\n }\n\n /** Return a tuple containing all subgroups */\n groups(defaultValue?: string): (string | undefined)[] {\n const result: (string | undefined)[] = []\n for (let i = 1; i < this._match.length; i++) {\n result.push(this._match[i] ?? defaultValue)\n }\n return result\n }\n\n /** Return a dictionary of named groups */\n groupdict(defaultValue?: string): Record<string, string | undefined> {\n const groups = this._match.groups ?? {}\n const result: Record<string, string | undefined> = {}\n for (const [key, value] of Object.entries(groups)) {\n // Groups can have undefined values for non-participating groups\n result[key] = (value as string | undefined) ?? defaultValue\n }\n return result\n }\n\n /** Return the start index of the match */\n start(groupNum: number = 0): number {\n if (groupNum === 0) {\n return this._match.index\n }\n // For subgroups, we need to find the position\n const fullMatch = this._match[0]\n const subMatch = this._match[groupNum]\n if (!fullMatch || !subMatch) return -1\n const offset = fullMatch.indexOf(subMatch)\n return offset >= 0 ? this._match.index + offset : -1\n }\n\n /** Return the end index of the match */\n end(groupNum: number = 0): number {\n const s = this.start(groupNum)\n const g = this.group(groupNum)\n if (s < 0 || g === undefined) return -1\n return s + g.length\n }\n\n /** Return a tuple (start, end) */\n span(groupNum: number = 0): [number, number] {\n return [this.start(groupNum), this.end(groupNum)]\n }\n\n /** Return start position of search */\n get pos(): number {\n return this._pos\n }\n\n /** Return end position of search */\n get endpos(): number {\n return this._endpos\n }\n\n /** Return the last matched group index */\n get lastindex(): number | undefined {\n for (let i = this._match.length - 1; i > 0; i--) {\n if (this._match[i] !== undefined) return i\n }\n return undefined\n }\n\n /** Return the name of the last matched group */\n get lastgroup(): string | undefined {\n if (!this._match.groups) return undefined\n const lastIdx = this.lastindex\n if (lastIdx === undefined) return undefined\n // Find the name for this index\n let idx = 1\n for (const name of Object.keys(this._match.groups)) {\n if (idx === lastIdx) return name\n idx++\n }\n return undefined\n }\n\n /** Return the pattern object */\n get re(): Pattern {\n return this._pattern\n }\n\n /** Return the input string */\n get string(): string {\n return this._string\n }\n\n /** Expand template with groups */\n expand(template: string): string {\n return template.replace(/\\\\(\\d+)|\\\\g<(\\w+)>/g, (_, num: string | undefined, name: string) => {\n if (num) {\n return this.group(parseInt(num)) ?? \"\"\n }\n return this.group(name) ?? \"\"\n })\n }\n\n /** Return iterator of all groups */\n *[Symbol.iterator](): Generator<string | undefined> {\n for (let i = 0; i < this._match.length; i++) {\n yield this._match[i]\n }\n }\n\n toString(): string {\n return `<re.Match object; span=(${String(this.start())}, ${String(this.end())}), match='${this.group() ?? \"\"}'>`\n }\n}\n\n// ============================================================================\n// Pattern object\n// ============================================================================\n\nexport class Pattern {\n private _regex: RegExp\n private _pattern: string\n private _flags: number\n\n constructor(pattern: string, flags: number = 0) {\n this._pattern = pattern\n this._flags = flags\n this._regex = this._compileRegex(pattern, flags)\n }\n\n private _compileRegex(pattern: string, flags: number): RegExp {\n // Convert Python regex syntax to JavaScript\n const jsPattern = pattern\n // Convert Python named groups (?P<name>...) to JS (?<name>...)\n .replace(/\\(\\?P<(\\w+)>/g, \"(?<$1>\")\n // Convert Python named backreferences (?P=name) to JS \\k<name>\n .replace(/\\(\\?P=(\\w+)\\)/g, \"\\\\k<$1>\")\n\n let jsFlags = \"\"\n if (flags & IGNORECASE) jsFlags += \"i\"\n if (flags & MULTILINE) jsFlags += \"m\"\n if (flags & DOTALL) jsFlags += \"s\"\n jsFlags += \"u\" // Always use unicode\n\n return new RegExp(jsPattern, jsFlags)\n }\n\n /** Search for pattern in string */\n search(string: string, pos: number = 0, endpos?: number): Match | null {\n const searchStr = endpos !== undefined ? string.slice(0, endpos) : string\n const searchFrom = searchStr.slice(pos)\n\n const regex = new RegExp(this._regex.source, this._regex.flags)\n const match = regex.exec(searchFrom)\n\n if (match) {\n match.index += pos\n return new Match(match, string, this, pos, endpos)\n }\n return null\n }\n\n /** Match pattern at start of string */\n match(string: string, pos: number = 0, endpos?: number): Match | null {\n const searchStr = endpos !== undefined ? string.slice(0, endpos) : string\n const searchFrom = searchStr.slice(pos)\n\n // Force match at start\n const regex = new RegExp(\"^(?:\" + this._regex.source + \")\", this._regex.flags)\n const match = regex.exec(searchFrom)\n\n if (match) {\n match.index += pos\n return new Match(match, string, this, pos, endpos)\n }\n return null\n }\n\n /** Match pattern against entire string */\n fullmatch(string: string, pos: number = 0, endpos?: number): Match | null {\n const searchStr = endpos !== undefined ? string.slice(0, endpos) : string\n const searchFrom = searchStr.slice(pos)\n\n // Force match entire string\n const regex = new RegExp(\"^(?:\" + this._regex.source + \")$\", this._regex.flags)\n const match = regex.exec(searchFrom)\n\n if (match) {\n match.index += pos\n return new Match(match, string, this, pos, endpos)\n }\n return null\n }\n\n /** Split string by pattern */\n split(string: string, maxsplit: number = 0): string[] {\n if (maxsplit === 0) {\n return string.split(this._regex)\n }\n\n const result: string[] = []\n let lastIndex = 0\n let count = 0\n const regex = new RegExp(this._regex.source, this._regex.flags + \"g\")\n\n let match: RegExpExecArray | null\n while ((match = regex.exec(string)) !== null && (maxsplit === 0 || count < maxsplit)) {\n result.push(string.slice(lastIndex, match.index))\n // Add captured groups\n for (let i = 1; i < match.length; i++) {\n const group = match[i]\n if (group !== undefined) {\n result.push(group)\n }\n }\n lastIndex = regex.lastIndex\n count++\n }\n result.push(string.slice(lastIndex))\n return result\n }\n\n /** Find all matches */\n findall(string: string, pos: number = 0, endpos?: number): (string | string[])[] {\n const searchStr = endpos !== undefined ? string.slice(0, endpos) : string\n const searchFrom = searchStr.slice(pos)\n\n const regex = new RegExp(this._regex.source, this._regex.flags + \"g\")\n const results: (string | string[])[] = []\n\n let match: RegExpExecArray | null\n while ((match = regex.exec(searchFrom)) !== null) {\n if (match.length === 1) {\n results.push(match[0])\n } else if (match.length === 2 && match[1] !== undefined) {\n results.push(match[1])\n } else {\n results.push(match.slice(1))\n }\n }\n return results\n }\n\n /** Find all matches as iterator */\n *finditer(string: string, pos: number = 0, endpos?: number): Generator<Match> {\n const searchStr = endpos !== undefined ? string.slice(0, endpos) : string\n const searchFrom = searchStr.slice(pos)\n\n const regex = new RegExp(this._regex.source, this._regex.flags + \"g\")\n\n let match: RegExpExecArray | null\n while ((match = regex.exec(searchFrom)) !== null) {\n match.index += pos\n yield new Match(match, string, this, pos, endpos)\n }\n }\n\n /** Replace pattern in string */\n sub(repl: string | ((match: Match) => string), string: string, count: number = 0): string {\n if (typeof repl === \"function\") {\n let n = 0\n const regex = new RegExp(this._regex.source, this._regex.flags + \"g\")\n return string.replace(regex, (...args) => {\n if (count > 0 && n >= count) {\n return args[0]\n }\n n++\n const match = regex.exec(string)\n if (!match) return args[0]\n return repl(new Match(match, string, this))\n })\n }\n\n // Convert Python replacement syntax\n const jsRepl = repl.replace(/\\\\g<(\\w+)>/g, \"$<$1>\").replace(/\\\\(\\d+)/g, \"$$$1\")\n\n if (count === 0) {\n const regex = new RegExp(this._regex.source, this._regex.flags + \"g\")\n return string.replace(regex, jsRepl)\n }\n\n let result = string\n let n = 0\n const regex = new RegExp(this._regex.source, this._regex.flags)\n while (n < count) {\n const newResult = result.replace(regex, jsRepl)\n if (newResult === result) break\n result = newResult\n n++\n }\n return result\n }\n\n /** Replace pattern and return (newstring, count) */\n subn(\n repl: string | ((match: Match) => string),\n string: string,\n count: number = 0\n ): [string, number] {\n let n = 0\n const result = this.sub(\n typeof repl === \"function\"\n ? (m) => {\n n++\n return repl(m)\n }\n : repl,\n string,\n count\n )\n if (typeof repl === \"string\") {\n // Count replacements\n const regex = new RegExp(this._regex.source, this._regex.flags + \"g\")\n const matches = string.match(regex)\n n = matches ? (count > 0 ? Math.min(matches.length, count) : matches.length) : 0\n }\n return [result, n]\n }\n\n /** Return the pattern string */\n get pattern(): string {\n return this._pattern\n }\n\n /** Return the flags */\n get flags(): number {\n return this._flags\n }\n\n /** Return number of groups */\n get groups(): number {\n // Count groups in pattern\n let count = 0\n for (let i = 0; i < this._pattern.length; i++) {\n if (this._pattern[i] === \"\\\\\") {\n i++\n continue\n }\n if (this._pattern[i] === \"(\") {\n if (this._pattern[i + 1] !== \"?\") {\n count++\n } else if (\n this._pattern.slice(i + 1, i + 4) === \"?P<\" ||\n this._pattern.slice(i + 1, i + 3) === \"?<\"\n ) {\n count++\n }\n }\n }\n return count\n }\n\n /** Return named groups mapping */\n get groupindex(): Record<string, number> {\n const result: Record<string, number> = {}\n let groupNum = 0\n const regex = /\\(\\?P?<(\\w+)>/g\n let match: RegExpExecArray | null\n while ((match = regex.exec(this._pattern)) !== null) {\n groupNum++\n const name = match[1]\n if (name) {\n result[name] = groupNum\n }\n }\n return result\n }\n\n toString(): string {\n return `re.compile('${this._pattern}')`\n }\n}\n\n// ============================================================================\n// Module functions\n// ============================================================================\n\n/** Compile a regular expression pattern */\nexport function compile(pattern: string, flags: number = 0): Pattern {\n return new Pattern(pattern, flags)\n}\n\n/** Search for pattern in string */\nexport function search(pattern: string | Pattern, string: string, flags: number = 0): Match | null {\n const p = pattern instanceof Pattern ? pattern : compile(pattern, flags)\n return p.search(string)\n}\n\n/** Match pattern at start of string */\nexport function match(pattern: string | Pattern, string: string, flags: number = 0): Match | null {\n const p = pattern instanceof Pattern ? pattern : compile(pattern, flags)\n return p.match(string)\n}\n\n/** Match pattern against entire string */\nexport function fullmatch(\n pattern: string | Pattern,\n string: string,\n flags: number = 0\n): Match | null {\n const p = pattern instanceof Pattern ? pattern : compile(pattern, flags)\n return p.fullmatch(string)\n}\n\n/** Split string by pattern */\nexport function split(\n pattern: string | Pattern,\n string: string,\n maxsplit: number = 0,\n flags: number = 0\n): string[] {\n const p = pattern instanceof Pattern ? pattern : compile(pattern, flags)\n return p.split(string, maxsplit)\n}\n\n/** Find all matches */\nexport function findall(\n pattern: string | Pattern,\n string: string,\n flags: number = 0\n): (string | string[])[] {\n const p = pattern instanceof Pattern ? pattern : compile(pattern, flags)\n return p.findall(string)\n}\n\n/** Find all matches as iterator */\nexport function finditer(\n pattern: string | Pattern,\n string: string,\n flags: number = 0\n): Generator<Match> {\n const p = pattern instanceof Pattern ? pattern : compile(pattern, flags)\n return p.finditer(string)\n}\n\n/** Replace pattern in string */\nexport function sub(\n pattern: string | Pattern,\n repl: string | ((match: Match) => string),\n string: string,\n count: number = 0,\n flags: number = 0\n): string {\n const p = pattern instanceof Pattern ? pattern : compile(pattern, flags)\n return p.sub(repl, string, count)\n}\n\n/** Replace pattern and return (newstring, count) */\nexport function subn(\n pattern: string | Pattern,\n repl: string | ((match: Match) => string),\n string: string,\n count: number = 0,\n flags: number = 0\n): [string, number] {\n const p = pattern instanceof Pattern ? pattern : compile(pattern, flags)\n return p.subn(repl, string, count)\n}\n\n/** Escape special characters in pattern */\nexport function escape(pattern: string): string {\n return pattern.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")\n}\n\n/** Purge the regex cache (no-op in this implementation) */\nexport function purge(): void {\n // No cache to purge\n}\n"],"mappings":";;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBO,IAAM,aAAa;AACnB,IAAM,IAAI;AAGV,IAAM,YAAY;AAClB,IAAM,IAAI;AAGV,IAAM,SAAS;AACf,IAAM,IAAI;AAGV,IAAM,UAAU;AAChB,IAAM,IAAI;AAGV,IAAM,QAAQ;AACd,IAAM,IAAI;AAMV,IAAM,QAAN,MAAY;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAER,YACEA,QACA,QACA,SACA,MAAc,GACd,QACA;AACA,SAAK,SAASA;AACd,SAAK,UAAU;AACf,SAAK,WAAW;AAChB,SAAK,OAAO;AACZ,SAAK,UAAU,UAAU,OAAO;AAAA,EAClC;AAAA;AAAA,EAGA,MAAM,WAA4B,GAAuB;AACvD,QAAI,OAAO,aAAa,UAAU;AAChC,aAAO,KAAK,OAAO,QAAQ;AAAA,IAC7B;AAEA,WAAO,KAAK,OAAO,SAAS,QAAQ;AAAA,EACtC;AAAA;AAAA,EAGA,OAAO,cAA+C;AACpD,UAAM,SAAiC,CAAC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