rregex 1.1.3 → 1.1.5

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/lib/esm.d.ts ADDED
@@ -0,0 +1,456 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export function escape(text: string): string;
4
+
5
+ export type Hir = {
6
+ '@type': 'struct'
7
+ '@name': 'regex_syntax::hir::Hir'
8
+ kind: HirKind
9
+ }
10
+
11
+
12
+
13
+ export type Literal =
14
+ | LiteralUnicodeVariant
15
+ | LiteralByteVariant
16
+
17
+ export type LiteralUnicodeVariant = {
18
+ '@type': 'struct'
19
+ '@name': 'regex_syntax::hir::Literal'
20
+ '@variant': 'Unicode'
21
+ '@values': [string]
22
+ }
23
+
24
+ export type LiteralByteVariant = {
25
+ '@type': 'struct'
26
+ '@name': 'regex_syntax::hir::Literal'
27
+ '@variant': 'Byte'
28
+ '@values': [number]
29
+ }
30
+
31
+
32
+
33
+ export type Class =
34
+ | ClassUnicodeVariant
35
+ | ClassByteVariant
36
+
37
+ export type ClassUnicodeVariant = {
38
+ '@type': 'struct'
39
+ '@name': 'regex_syntax::hir::Class'
40
+ '@variant': 'Unicode'
41
+ '@values': [ClassUnicode]
42
+ }
43
+
44
+ export type ClassByteVariant = {
45
+ '@type': 'struct'
46
+ '@name': 'regex_syntax::hir::Class'
47
+ '@variant': 'Bytes'
48
+ '@values': [ClassBytes]
49
+ }
50
+
51
+
52
+
53
+ export type ClassUnicode = {
54
+ '@type': 'struct'
55
+ '@name': 'regex_syntax::hir::ClassUnicode'
56
+ 'ranges': ClassUnicodeRange[]
57
+ }
58
+
59
+
60
+
61
+ export type ClassUnicodeRange = {
62
+ '@type': 'struct'
63
+ '@name': 'regex_syntax::hir::ClassUnicodeRange'
64
+ start: string
65
+ end: string
66
+ }
67
+
68
+
69
+
70
+ export type ClassBytes = {
71
+ '@type': 'struct'
72
+ '@name': 'regex_syntax::hir::ClassBytes'
73
+ ranges: ClassBytesRange[]
74
+ }
75
+
76
+
77
+
78
+ export type ClassBytesRange = {
79
+ '@type': 'struct'
80
+ '@name': 'regex_syntax::hir::ClassBytesRange'
81
+ start: number
82
+ end: number
83
+ }
84
+
85
+
86
+
87
+ export type Anchor =
88
+ | AnchorStartLineVariant
89
+ | AnchorEndLineVariant
90
+ | AnchorStartTextVariant
91
+ | AnchorEndTextVariant
92
+
93
+ export type AnchorStartLineVariant = {
94
+ '@type': 'struct'
95
+ '@name': 'regex_syntax::hir::Anchor'
96
+ '@variant': 'StartLine'
97
+ }
98
+
99
+ export type AnchorEndLineVariant = {
100
+ '@type': 'struct'
101
+ '@name': 'regex_syntax::hir::Anchor'
102
+ '@variant': 'EndLine'
103
+ }
104
+
105
+ export type AnchorStartTextVariant = {
106
+ '@type': 'struct'
107
+ '@name': 'regex_syntax::hir::Anchor'
108
+ '@variant': 'StartText'
109
+ }
110
+
111
+ export type AnchorEndTextVariant = {
112
+ '@type': 'struct'
113
+ '@name': 'regex_syntax::hir::Anchor'
114
+ '@variant': 'EndText'
115
+ }
116
+
117
+
118
+
119
+ export type WordBoundary =
120
+ | WordBoundaryAsciiVariant
121
+ | WordBoundaryAsciiNegateVariant
122
+ | WordBoundaryUnicodeVariant
123
+ | WordBoundaryUnicodeNegateVariant
124
+
125
+ export type WordBoundaryAsciiVariant = {
126
+ '@type': 'struct'
127
+ '@name': 'regex_syntax::hir::WordBoundary'
128
+ '@variant': 'Ascii'
129
+ }
130
+
131
+ export type WordBoundaryAsciiNegateVariant = {
132
+ '@type': 'struct'
133
+ '@name': 'regex_syntax::hir::WordBoundary'
134
+ '@variant': 'AsciiNegate'
135
+ }
136
+
137
+ export type WordBoundaryUnicodeVariant = {
138
+ '@type': 'struct'
139
+ '@name': 'regex_syntax::hir::WordBoundary'
140
+ '@variant': 'Unicode'
141
+ }
142
+
143
+ export type WordBoundaryUnicodeNegateVariant = {
144
+ '@type': 'struct'
145
+ '@name': 'regex_syntax::hir::WordBoundary'
146
+ '@variant': 'UnicodeNegate'
147
+ }
148
+
149
+
150
+
151
+ export type Repetition = {
152
+ '@type': 'struct'
153
+ '@name': 'regex_syntax::hir::Repetition'
154
+ greedy: boolean
155
+ kind: RepetitionKind
156
+ hir: Hir
157
+ }
158
+
159
+
160
+
161
+ export type RepetitionKind =
162
+ | RepetitionKindZeroOrOneVariant
163
+ | RepetitionKindZeroOrMoreVariant
164
+ | RepetitionKindOneOrMoreVariant
165
+ | RepetitionKindRangeVariant
166
+
167
+ export type RepetitionKindZeroOrOneVariant = {
168
+ '@type': 'struct'
169
+ '@name': 'regex_syntax::hir::Repetition'
170
+ '@variant': 'ZeroOrOne'
171
+ }
172
+
173
+ export type RepetitionKindZeroOrMoreVariant = {
174
+ '@type': 'struct'
175
+ '@name': 'regex_syntax::hir::Repetition'
176
+ '@variant': 'ZeroOrMore'
177
+ }
178
+
179
+ export type RepetitionKindOneOrMoreVariant = {
180
+ '@type': 'struct'
181
+ '@name': 'regex_syntax::hir::Repetition'
182
+ '@variant': 'OneOrMore'
183
+ }
184
+
185
+ export type RepetitionKindRangeVariant = {
186
+ '@type': 'struct'
187
+ '@name': 'regex_syntax::hir::Repetition'
188
+ '@variant': 'Range'
189
+ '@values': [RepetitionRange]
190
+ }
191
+
192
+
193
+
194
+ export type HirKind =
195
+ | HirKindEmptyVariant
196
+ | HirKindLiteralVariant
197
+ | HirKindClassVariant
198
+ | HirKindAnchorVariant
199
+ | HirKindWordBoundaryVariant
200
+ | HirKindRepetitionVariant
201
+ | HirKindGroupVariant
202
+ | HirKindConcatVariant
203
+ | HirKindAlternationVariant
204
+
205
+ export type HirKindEmptyVariant = {
206
+ '@type': 'struct'
207
+ '@name': 'regex_syntax::hir::HirKind'
208
+ '@variant': 'Empty'
209
+ }
210
+
211
+ export type HirKindLiteralVariant = {
212
+ '@type': 'struct'
213
+ '@name': 'regex_syntax::hir::HirKind'
214
+ '@variant': 'Literal'
215
+ '@values': [Literal]
216
+ }
217
+
218
+ export type HirKindClassVariant = {
219
+ '@type': 'struct'
220
+ '@name': 'regex_syntax::hir::HirKind'
221
+ '@variant': 'Class'
222
+ '@values': [Class]
223
+ }
224
+
225
+ export type HirKindAnchorVariant = {
226
+ '@type': 'struct'
227
+ '@name': 'regex_syntax::hir::HirKind'
228
+ '@variant': 'Anchor'
229
+ '@values': [Anchor]
230
+ }
231
+
232
+ export type HirKindWordBoundaryVariant = {
233
+ '@type': 'struct'
234
+ '@name': 'regex_syntax::hir::HirKind'
235
+ '@variant': 'WordBoundary'
236
+ '@values': [WordBoundary]
237
+ }
238
+
239
+ export type HirKindRepetitionVariant = {
240
+ '@type': 'struct'
241
+ '@name': 'regex_syntax::hir::HirKind'
242
+ '@variant': 'Repetition'
243
+ '@values': [Repetition]
244
+ }
245
+
246
+ export type HirKindGroupVariant = {
247
+ '@type': 'struct'
248
+ '@name': 'regex_syntax::hir::HirKind'
249
+ '@variant': 'Group'
250
+ '@values': [Group]
251
+ }
252
+
253
+ export type HirKindConcatVariant = {
254
+ '@type': 'struct'
255
+ '@name': 'regex_syntax::hir::HirKind'
256
+ '@variant': 'Concat'
257
+ '@values': [Hir[]]
258
+ }
259
+
260
+ export type HirKindAlternationVariant = {
261
+ '@type': 'struct'
262
+ '@name': 'regex_syntax::hir::HirKind'
263
+ '@variant': 'Alternation'
264
+ '@values': [Hir[]]
265
+ }
266
+
267
+
268
+
269
+ export type RepetitionRange =
270
+ | RepetitionRangeExactlyVariant
271
+ | RepetitionRangeAtLeastVariant
272
+ | RepetitionRangeBoundedVariant
273
+
274
+ export type RepetitionRangeExactlyVariant = {
275
+ '@type': 'struct'
276
+ '@name': 'regex_syntax::hir::RepetitionRange'
277
+ '@variant': 'Exactly'
278
+ '@values': [number]
279
+ }
280
+
281
+ export type RepetitionRangeAtLeastVariant = {
282
+ '@type': 'struct'
283
+ '@name': 'regex_syntax::hir::RepetitionRange'
284
+ '@variant': 'AtLeast'
285
+ '@values': [number]
286
+ }
287
+
288
+ export type RepetitionRangeBoundedVariant = {
289
+ '@type': 'struct'
290
+ '@name': 'regex_syntax::hir::RepetitionRange'
291
+ '@variant': 'Bounded'
292
+ '@values': [number, number]
293
+ }
294
+
295
+
296
+
297
+ export type Group = {
298
+ '@type': 'struct'
299
+ '@name': 'regex_syntax::hir::Group'
300
+ kind: GroupKind
301
+ hir: Hir
302
+ }
303
+
304
+
305
+
306
+ export type GroupKind =
307
+ | GroupKindCaptureIndexVariant
308
+ | GroupKindCaptureNameVariant
309
+ | GroupKindNonCapturingVariant
310
+
311
+ export type GroupKindCaptureIndexVariant = {
312
+ '@type': 'struct'
313
+ '@name': 'regex_syntax::hir::GroupKind'
314
+ '@variant': 'CaptureIndex'
315
+ index: number
316
+ }
317
+
318
+ export type GroupKindCaptureNameVariant = {
319
+ '@type': 'struct'
320
+ '@name': 'regex_syntax::hir::GroupKind'
321
+ '@variant': 'CaptureName'
322
+ index: number
323
+ name: string
324
+ }
325
+
326
+ export type GroupKindNonCapturingVariant = {
327
+ '@type': 'struct'
328
+ '@name': 'regex_syntax::hir::GroupKind'
329
+ '@variant': 'NonCapturing'
330
+ }
331
+
332
+
333
+
334
+ export type Match = {
335
+ start: number
336
+ end: number
337
+ value: string
338
+ }
339
+
340
+
341
+ /**
342
+ * A compiled regular expression for matching Unicode strings.
343
+ * @see https://docs.rs/regex/latest/regex/
344
+ */
345
+ export class RRegex {
346
+ free(): void;
347
+ /**
348
+ * Returns the same as is_match, but starts the search at the given offset.
349
+ * The significance of the starting point is that it takes the surrounding context into consideration. For example, the `\A` anchor can only match when `start == 0`.
350
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match_at
351
+ */
352
+ isMatchAt(text: string, start: number): boolean;
353
+ /**
354
+ * Replaces all non-overlapping matches in `text` with the replacement provided. This is the same as calling `replacen` with `limit` set to `0`.
355
+ * See the documentation for `replace` for details on how to access capturing group matches in the replacement string.
356
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace_all
357
+ */
358
+ replaceAll(text: string, rep: string): string;
359
+ /**
360
+ * Returns the end location of a match in the text given.
361
+ * This method may have the same performance characteristics as `is_match`, except it provides an end location for a match. In particular, the location returned may be shorter than the proper end of the leftmost-first match.
362
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match
363
+ */
364
+ shortestMatch(text: string): number | undefined;
365
+ /**
366
+ * Returns the same as shortest_match, but starts the search at the given offset.
367
+ * The significance of the starting point is that it takes the surrounding context into consideration. For example, the \A anchor can only match when `start == 0`.
368
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.shortest_match_at
369
+ */
370
+ shortestMatchAt(text: string, limit: number): number | undefined;
371
+ /**
372
+ * Compiles a regular expression. Once compiled, it can be used repeatedly to search, split or replace text in a string.
373
+ * If an invalid expression is given, then an error is returned.
374
+ */
375
+ constructor(re: string);
376
+ /**
377
+ * Returns the start and end byte range of the leftmost-first match in `text`. If no match exists, then `undefined` is returned.
378
+ * Note that this should only be used if you want to discover the position of the match. Testing the existence of a match is faster if you use `is_match`.
379
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find
380
+ */
381
+ find(text: string): Match | undefined;
382
+ /**
383
+ * Returns an iterator of substrings of `text` delimited by a match of the regular expression. Namely, each element of the iterator corresponds to text that isn’t matched by the regular expression.
384
+ * This method will not copy the text given.
385
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.split
386
+ */
387
+ split(text: string): string[];
388
+ /**
389
+ * Returns an iterator of at most `limit` substrings of `text` delimited by a match of the regular expression. (A limit of 0 will return no substrings.) Namely, each element of the iterator corresponds to text that isn’t matched by the regular expression. The remainder of the string that is not split will be the last element in the iterator.
390
+ * This method will not copy the text given.
391
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.splitn
392
+ */
393
+ splitn(text: string, limit: number): string[];
394
+ /**
395
+ * Return the Regex syntax object
396
+ */
397
+ syntax(): Hir;
398
+ /**
399
+ * Returns the same as find, but starts the search at the given offset.
400
+ * The significance of the starting point is that it takes the surrounding context into consideration. For example, the \A anchor can only match when `start == 0`.
401
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_at
402
+ */
403
+ findAt(text: string, start: number): Match | undefined;
404
+ /**
405
+ * Replaces the leftmost-first match with the replacement provided.
406
+ * The replacement can be a regular string (where `$N` and `$name` are expanded to match capture groups) or a function that takes the matches’ `Captures` and returns the replaced string.
407
+ * If no match is found, then a copy of the string is returned unchanged.
408
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replace
409
+ */
410
+ replace(text: string, rep: string): string;
411
+ /**
412
+ * Returns an array for each successive non-overlapping match in text, returning the start and end byte indices with respect to text.
413
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.find_iter
414
+ */
415
+ findAll(text: string): Match[];
416
+ /**
417
+ * Returns true if and only if there is a match for the regex in the string given.
418
+ * It is recommended to use this method if all you need to do is test a match, since the underlying matching engine may be able to do less work.
419
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.is_match
420
+ */
421
+ isMatch(text: string): boolean;
422
+ /**
423
+ * Replaces at most `limit` non-overlapping matches in `text` with the replacement provided. If `limit` is 0, then all non-overlapping matches are replaced.
424
+ * See the documentation for `replace` for details on how to access capturing group matches in the replacement string.
425
+ * @see https://docs.rs/regex/latest/regex/struct.Regex.html#method.replacen
426
+ */
427
+ replacen(text: string, limit: number, rep: string): string;
428
+ /**
429
+ * Returns a string representing the regular expression
430
+ */
431
+ toString(): string;
432
+ }
433
+ /**
434
+ * Match multiple (possibly overlapping) regular expressions in a single scan.
435
+ * A regex set corresponds to the union of two or more regular expressions. That is, a regex set will match text where at least one of its constituent regular expressions matches. A regex set as its formulated here provides a touch more power: it will also report which regular expressions in the set match. Indeed, this is the key difference between regex sets and a single `Regex` with many alternates, since only one alternate can match at a time.
436
+ * @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.empty
437
+ */
438
+ export class RRegexSet {
439
+ free(): void;
440
+ /**
441
+ * Create a new regex set with the given regular expressions.
442
+ */
443
+ constructor(list: Array<any>);
444
+ /**
445
+ * Returns the set of regular expressions that match in the given text.
446
+ * The set returned contains the index of each regular expression that matches in the given text. The index is in correspondence with the order of regular expressions given to RegexSet’s constructor.
447
+ * the set can also be used to iterate over the matched indices.
448
+ */
449
+ matches(text: string): any;
450
+ /**
451
+ * Returns true if and only if one of the regexes in this set matches the text given.
452
+ * This method should be preferred if you only need to test whether any of the regexes in the set should match, but don’t care about which regexes matched. This is because the underlying matching engine will quit immediately after seeing the first match instead of continuing to find all matches.
453
+ * @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.is_match
454
+ */
455
+ isMatch(text: string): boolean;
456
+ }