rregex 1.13.2 → 2.0.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.
@@ -1,3 +1,4 @@
1
+
1
2
  /* tslint:disable */
2
3
  /* eslint-disable */
3
4
  /**
@@ -6,7 +7,7 @@
6
7
  * The string returned may be safely used as a literal in a regular
7
8
  * expression.
8
9
  */
9
- export function escape(text: string): string;
10
+ export declare function escape(text: string): string;
10
11
  /**
11
12
  * Represents a single match of a regex in a haystack.
12
13
  *
@@ -55,20 +56,18 @@ export function escape(text: string): string;
55
56
  * @see @see https://docs.rs/regex/latest/regex/
56
57
  */
57
58
  export type Match = {
58
- start: number
59
- end: number
60
- value: string
61
- }
62
-
59
+ start: number;
60
+ end: number;
61
+ value: string;
62
+ };
63
63
  /**
64
64
  * A high-level intermediate representation (HIR) for a regular expression.
65
65
  */
66
66
  export type Hir = {
67
- '@type': 'struct'
68
- '@name': 'regex_syntax::hir::Hir'
69
- kind: HirKind
70
- }
71
-
67
+ '@type': 'struct';
68
+ '@name': 'regex_syntax::hir::Hir';
69
+ kind: HirKind;
70
+ };
72
71
  /**
73
72
  * The underlying kind of an arbitrary `Hir` expression.
74
73
  *
@@ -78,35 +77,24 @@ export type Hir = {
78
77
  * new `Hir` values. The API intentionally does not expose any way of building an
79
78
  * `Hir` directly from an `HirKind`.
80
79
  */
81
- export type HirKind =
82
- | HirKindEmptyVariant
83
- | HirKindLiteralVariant
84
- | HirKindClassVariant
85
- | HirKindLookVariant
86
- | HirKindRepetitionVariant
87
- | HirKindCaptureVariant
88
- | HirKindConcatVariant
89
- | HirKindAlternationVariant
90
-
80
+ export type HirKind = HirKindEmptyVariant | HirKindLiteralVariant | HirKindClassVariant | HirKindLookVariant | HirKindRepetitionVariant | HirKindCaptureVariant | HirKindConcatVariant | HirKindAlternationVariant;
91
81
  /**
92
82
  * The empty regular expression, which matches everything, including the empty string.
93
83
  */
94
84
  export type HirKindEmptyVariant = {
95
- '@type': 'enum'
96
- '@name': 'regex_syntax::hir::HirKind'
97
- '@variant': 'Empty'
98
- }
99
-
85
+ '@type': 'enum';
86
+ '@name': 'regex_syntax::hir::HirKind';
87
+ '@variant': 'Empty';
88
+ };
100
89
  /**
101
90
  * A literal string that matches exactly these bytes.
102
91
  */
103
92
  export type HirKindLiteralVariant = {
104
- '@type': 'enum'
105
- '@name': 'regex_syntax::hir::HirKind'
106
- '@variant': 'Literal'
107
- '@values': [Literal]
108
- }
109
-
93
+ '@type': 'enum';
94
+ '@name': 'regex_syntax::hir::HirKind';
95
+ '@variant': 'Literal';
96
+ '@values': [Literal];
97
+ };
110
98
  /**
111
99
  * A single character class that matches any of the characters in the class.
112
100
  * A class can either consist of Unicode scalar values as characters, or it can
@@ -115,42 +103,38 @@ export type HirKindLiteralVariant = {
115
103
  * A class may be empty. In which case, it matches nothing.
116
104
  */
117
105
  export type HirKindClassVariant = {
118
- '@type': 'enum'
119
- '@name': 'regex_syntax::hir::HirKind'
120
- '@variant': 'Class'
121
- '@values': [Class]
122
- }
123
-
106
+ '@type': 'enum';
107
+ '@name': 'regex_syntax::hir::HirKind';
108
+ '@variant': 'Class';
109
+ '@values': [Class];
110
+ };
124
111
  /**
125
112
  * A look-around assertion. A look-around match always has zero length.
126
113
  */
127
114
  export type HirKindLookVariant = {
128
- '@type': 'enum'
129
- '@name': 'regex_syntax::hir::HirKind'
130
- '@variant': 'Look'
131
- '@values': [Look]
132
- }
133
-
115
+ '@type': 'enum';
116
+ '@name': 'regex_syntax::hir::HirKind';
117
+ '@variant': 'Look';
118
+ '@values': [Look];
119
+ };
134
120
  /**
135
121
  * A repetition operation applied to a sub-expression.
136
122
  */
137
123
  export type HirKindRepetitionVariant = {
138
- '@type': 'enum'
139
- '@name': 'regex_syntax::hir::HirKind'
140
- '@variant': 'Repetition'
141
- '@values': [Repetition]
142
- }
143
-
124
+ '@type': 'enum';
125
+ '@name': 'regex_syntax::hir::HirKind';
126
+ '@variant': 'Repetition';
127
+ '@values': [Repetition];
128
+ };
144
129
  /**
145
130
  * A capturing group, which contains a sub-expression.
146
131
  */
147
132
  export type HirKindCaptureVariant = {
148
- '@type': 'enum'
149
- '@name': 'regex_syntax::hir::HirKind'
150
- '@variant': 'Capture'
151
- '@values': [Capture]
152
- }
153
-
133
+ '@type': 'enum';
134
+ '@name': 'regex_syntax::hir::HirKind';
135
+ '@variant': 'Capture';
136
+ '@values': [Capture];
137
+ };
154
138
  /**
155
139
  * A concatenation of expressions.
156
140
  *
@@ -161,12 +145,11 @@ export type HirKindCaptureVariant = {
161
145
  * least two sub-expressions.
162
146
  */
163
147
  export type HirKindConcatVariant = {
164
- '@type': 'enum'
165
- '@name': 'regex_syntax::hir::HirKind'
166
- '@variant': 'Concat'
167
- '@values': [Hir[]]
168
- }
169
-
148
+ '@type': 'enum';
149
+ '@name': 'regex_syntax::hir::HirKind';
150
+ '@variant': 'Concat';
151
+ '@values': [Hir[]];
152
+ };
170
153
  /**
171
154
  * An alternation of expressions.
172
155
  *
@@ -177,12 +160,11 @@ export type HirKindConcatVariant = {
177
160
  * least two sub-expressions.
178
161
  */
179
162
  export type HirKindAlternationVariant = {
180
- '@type': 'enum'
181
- '@name': 'regex_syntax::hir::HirKind'
182
- '@variant': 'Alternation'
183
- '@values': [Hir[]]
184
- }
185
-
163
+ '@type': 'enum';
164
+ '@name': 'regex_syntax::hir::HirKind';
165
+ '@variant': 'Alternation';
166
+ '@values': [Hir[]];
167
+ };
186
168
  /**
187
169
  * The high-level intermediate representation of a literal.
188
170
  *
@@ -192,11 +174,10 @@ export type HirKindAlternationVariant = {
192
174
  * with `HirKind::Empty`.
193
175
  */
194
176
  export type Literal = {
195
- '@type': 'struct'
196
- '@name': 'regex_syntax::hir::Literal'
197
- '@values': [Uint8Array]
198
- }
199
-
177
+ '@type': 'struct';
178
+ '@name': 'regex_syntax::hir::Literal';
179
+ '@values': [Uint8Array];
180
+ };
200
181
  /**
201
182
  * The high-level intermediate representation of a character class.
202
183
  *
@@ -213,41 +194,34 @@ export type Literal = {
213
194
  * impacts the semantics of case insensitive matching. For example, `(?i)k` and
214
195
  * `(?i-u)k` will not match the same set of strings.
215
196
  */
216
- export type Class =
217
- | ClassUnicodeVariant
218
- | ClassByteVariant
219
-
197
+ export type Class = ClassUnicodeVariant | ClassByteVariant;
220
198
  /**
221
199
  * A set of characters represented by Unicode scalar values.
222
200
  */
223
201
  export type ClassUnicodeVariant = {
224
- '@type': 'enum'
225
- '@name': 'regex_syntax::hir::Class'
226
- '@variant': 'Unicode'
227
- '@values': [ClassUnicode]
228
- }
229
-
202
+ '@type': 'enum';
203
+ '@name': 'regex_syntax::hir::Class';
204
+ '@variant': 'Unicode';
205
+ '@values': [ClassUnicode];
206
+ };
230
207
  /**
231
208
  * A set of characters represented by arbitrary bytes (one byte per character).
232
209
  */
233
210
  export type ClassByteVariant = {
234
- '@type': 'enum'
235
- '@name': 'regex_syntax::hir::Class'
236
- '@variant': 'Bytes'
237
- '@values': [ClassBytes]
238
- }
239
-
211
+ '@type': 'enum';
212
+ '@name': 'regex_syntax::hir::Class';
213
+ '@variant': 'Bytes';
214
+ '@values': [ClassBytes];
215
+ };
240
216
  /**
241
217
  * A set of characters represented by Unicode scalar values.
242
218
  */
243
219
  export type ClassUnicode = {
244
- '@type': 'struct'
245
- '@name': 'regex_syntax::hir::ClassUnicode'
246
-
220
+ '@type': 'struct';
221
+ '@name': 'regex_syntax::hir::ClassUnicode';
247
222
  /** The underlying ranges as a slice. */
248
- ranges: ClassUnicodeRange[]
249
- }
250
-
223
+ ranges: ClassUnicodeRange[];
224
+ };
251
225
  /**
252
226
  * A single range of characters represented by Unicode scalar values.
253
227
  *
@@ -255,41 +229,35 @@ export type ClassUnicode = {
255
229
  * the range.
256
230
  */
257
231
  export type ClassUnicodeRange = {
258
- '@type': 'struct'
259
- '@name': 'regex_syntax::hir::ClassUnicodeRange'
260
-
232
+ '@type': 'struct';
233
+ '@name': 'regex_syntax::hir::ClassUnicodeRange';
261
234
  /**
262
235
  * Return the start of this range.
263
236
  *
264
237
  * The start of a range is always less than or equal to the end of the range.
265
238
  */
266
- start: string
267
-
239
+ start: string;
268
240
  /**
269
241
  * Return the end of this range.
270
242
  *
271
243
  * The end of a range is always greater than or equal to the start of the range.
272
244
  */
273
- end: string
274
-
245
+ end: string;
275
246
  /**
276
247
  * The number of codepoints in this range.
277
248
  */
278
- len: number
279
- }
280
-
249
+ len: number;
250
+ };
281
251
  /**
282
252
  * A set of characters represented by arbitrary bytes (where one byte corresponds
283
253
  * to one character).
284
254
  */
285
255
  export type ClassBytes = {
286
- '@type': 'struct'
287
- '@name': 'regex_syntax::hir::ClassBytes'
288
-
256
+ '@type': 'struct';
257
+ '@name': 'regex_syntax::hir::ClassBytes';
289
258
  /** The underlying ranges as a slice. */
290
- ranges: ClassBytesRange[]
291
- }
292
-
259
+ ranges: ClassBytesRange[];
260
+ };
293
261
  /**
294
262
  * A single range of characters represented by arbitrary bytes.
295
263
  *
@@ -297,96 +265,69 @@ export type ClassBytes = {
297
265
  * the range.
298
266
  */
299
267
  export type ClassBytesRange = {
300
- '@type': 'struct'
301
- '@name': 'regex_syntax::hir::ClassBytesRange'
302
-
268
+ '@type': 'struct';
269
+ '@name': 'regex_syntax::hir::ClassBytesRange';
303
270
  /**
304
271
  * The start of this range.
305
272
  *
306
273
  * The start of a range is always less than or equal to the end of the range.
307
274
  */
308
- start: number
309
-
275
+ start: number;
310
276
  /**
311
277
  * The end of this range.
312
278
  *
313
279
  * The end of a range is always greater than or equal to the start of the range.
314
280
  */
315
- end: number
316
-
281
+ end: number;
317
282
  /**
318
283
  * The number of bytes in this range.
319
284
  */
320
- len: number
321
- }
322
-
323
- /**
285
+ len: number;
286
+ };
287
+ /**
324
288
  * The high-level intermediate representation for a look-around assertion.
325
289
  *
326
290
  * An assertion match is always zero-length. Also called an “empty match.”
327
291
  */
328
- export type Look =
329
- | LookStartVariant
330
- | LookEndVariant
331
- | LookStartLFVariant
332
- | LookEndLFVariant
333
- | LookStartCRLFVariant
334
- | LookEndCRLFVariant
335
- | LookWordAsciiVariant
336
- | LookWordAsciiNegateVariant
337
- | LookWordUnicodeVariant
338
- | LookWordUnicodeNegateVariant
339
- | LookWordStartAsciiVariant
340
- | LookWordEndAsciiVariant
341
- | LookWordStartUnicodeVariant
342
- | LookWordEndUnicodeVariant
343
- | LookWordStartHalfAsciiVariant
344
- | LookWordEndHalfAsciiVariant
345
- | LookWordStartHalfUnicodeVariant
346
- | LookWordEndHalfUnicodeVariant
347
-
292
+ export type Look = LookStartVariant | LookEndVariant | LookStartLFVariant | LookEndLFVariant | LookStartCRLFVariant | LookEndCRLFVariant | LookWordAsciiVariant | LookWordAsciiNegateVariant | LookWordUnicodeVariant | LookWordUnicodeNegateVariant | LookWordStartAsciiVariant | LookWordEndAsciiVariant | LookWordStartUnicodeVariant | LookWordEndUnicodeVariant | LookWordStartHalfAsciiVariant | LookWordEndHalfAsciiVariant | LookWordStartHalfUnicodeVariant | LookWordEndHalfUnicodeVariant;
348
293
  /**
349
294
  * Match the beginning of text. Specifically, this matches at the starting
350
295
  * position of the input.
351
296
  */
352
297
  export type LookStartVariant = {
353
- '@type': 'enum'
354
- '@name': 'regex_syntax::hir:Look'
355
- '@variant': 'Start'
356
- }
357
-
298
+ '@type': 'enum';
299
+ '@name': 'regex_syntax::hir:Look';
300
+ '@variant': 'Start';
301
+ };
358
302
  /**
359
303
  * Match the end of text. Specifically, this matches at the ending position of
360
304
  * the input.
361
305
  */
362
306
  export type LookEndVariant = {
363
- '@type': 'enum'
364
- '@name': 'regex_syntax::hir:Look'
365
- '@variant': 'End'
366
- }
367
-
307
+ '@type': 'enum';
308
+ '@name': 'regex_syntax::hir:Look';
309
+ '@variant': 'End';
310
+ };
368
311
  /**
369
312
  * Match the beginning of a line or the beginning of text. Specifically, this
370
313
  * matches at the starting position of the input, or at the position immediately
371
314
  * following a `\n` character.
372
315
  */
373
316
  export type LookStartLFVariant = {
374
- '@type': 'enum'
375
- '@name': 'regex_syntax::hir:Look'
376
- '@variant': 'StartLF'
377
- }
378
-
317
+ '@type': 'enum';
318
+ '@name': 'regex_syntax::hir:Look';
319
+ '@variant': 'StartLF';
320
+ };
379
321
  /**
380
322
  * Match the end of a line or the end of text. Specifically, this matches at the
381
323
  * end position of the input, or at the position immediately preceding a `\n`
382
324
  * character.
383
325
  */
384
326
  export type LookEndLFVariant = {
385
- '@type': 'enum'
386
- '@name': 'regex_syntax::hir:Look'
387
- '@variant': 'EndLF'
388
- }
389
-
327
+ '@type': 'enum';
328
+ '@name': 'regex_syntax::hir:Look';
329
+ '@variant': 'EndLF';
330
+ };
390
331
  /**
391
332
  * Match the beginning of a line or the beginning of text. Specifically, this
392
333
  * matches at the starting position of the input, or at the position immediately
@@ -394,62 +335,56 @@ export type LookEndLFVariant = {
394
335
  * follows.
395
336
  */
396
337
  export type LookStartCRLFVariant = {
397
- '@type': 'enum'
398
- '@name': 'regex_syntax::hir:Look'
399
- '@variant': 'StartCRLF'
400
- }
401
-
338
+ '@type': 'enum';
339
+ '@name': 'regex_syntax::hir:Look';
340
+ '@variant': 'StartCRLF';
341
+ };
402
342
  /**
403
343
  * Match the end of a line or the end of text. Specifically, this matches at the
404
344
  * end position of the input, or at the position immediately preceding a `\r` or
405
345
  * `\n` character, but never before a `\n` when a `\r` precedes it.
406
346
  */
407
347
  export type LookEndCRLFVariant = {
408
- '@type': 'enum'
409
- '@name': 'regex_syntax::hir:Look'
410
- '@variant': 'EndCRLF'
411
- }
412
-
348
+ '@type': 'enum';
349
+ '@name': 'regex_syntax::hir:Look';
350
+ '@variant': 'EndCRLF';
351
+ };
413
352
  /**
414
353
  * Match an ASCII-only word boundary. That is, this matches a position where the
415
354
  * left adjacent character and right adjacent character correspond to a word and
416
355
  * non-word or a non-word and word character.
417
356
  */
418
357
  export type LookWordAsciiVariant = {
419
- '@type': 'enum'
420
- '@name': 'regex_syntax::hir:Look'
421
- '@variant': 'WordAscii'
422
- }
423
-
358
+ '@type': 'enum';
359
+ '@name': 'regex_syntax::hir:Look';
360
+ '@variant': 'WordAscii';
361
+ };
424
362
  /**
425
363
  * Match an ASCII-only negation of a word boundary.
426
364
  */
427
365
  export type LookWordAsciiNegateVariant = {
428
- '@type': 'enum'
429
- '@name': 'regex_syntax::hir:Look'
430
- '@variant': 'WordAsciiNegate'
431
- }
432
-
366
+ '@type': 'enum';
367
+ '@name': 'regex_syntax::hir:Look';
368
+ '@variant': 'WordAsciiNegate';
369
+ };
433
370
  /**
434
371
  * Match a Unicode-aware word boundary. That is, this matches a position where
435
372
  * the left adjacent character and right adjacent character correspond to a word
436
373
  * and non-word or a non-word and word character.
437
374
  */
438
375
  export type LookWordUnicodeVariant = {
439
- '@type': 'enum'
440
- '@name': 'regex_syntax::hir:Look'
441
- '@variant': 'WordUnicode'
442
- }
443
-
376
+ '@type': 'enum';
377
+ '@name': 'regex_syntax::hir:Look';
378
+ '@variant': 'WordUnicode';
379
+ };
444
380
  /**
445
381
  * Match a Unicode-aware negation of a word boundary.
446
382
  */
447
383
  export type LookWordUnicodeNegateVariant = {
448
- '@type': 'enum'
449
- '@name': 'regex_syntax::hir:Look'
450
- '@variant': 'WordUnicodeNegate'
451
- }
452
-
384
+ '@type': 'enum';
385
+ '@name': 'regex_syntax::hir:Look';
386
+ '@variant': 'WordUnicodeNegate';
387
+ };
453
388
  /**
454
389
  * Match the start of an ASCII-only word boundary. That is, this matches a
455
390
  * position at either the beginning of the haystack or where the previous
@@ -457,97 +392,88 @@ export type LookWordUnicodeNegateVariant = {
457
392
  * character.
458
393
  */
459
394
  export type LookWordStartAsciiVariant = {
460
- '@type': 'enum'
461
- '@name': 'regex_syntax::hir:Look'
462
- '@variant': 'WordStartAscii'
463
- }
464
-
395
+ '@type': 'enum';
396
+ '@name': 'regex_syntax::hir:Look';
397
+ '@variant': 'WordStartAscii';
398
+ };
465
399
  /**
466
400
  * Match the end of an ASCII-only word boundary. That is, this matches a
467
401
  * position at either the end of the haystack orwhere the previous character is
468
402
  * a word character and the following character is not a word character.
469
403
  */
470
404
  export type LookWordEndAsciiVariant = {
471
- '@type': 'enum'
472
- '@name': 'regex_syntax::hir:Look'
473
- '@variant': 'WordEndAscii'
474
- }
475
-
405
+ '@type': 'enum';
406
+ '@name': 'regex_syntax::hir:Look';
407
+ '@variant': 'WordEndAscii';
408
+ };
476
409
  /**
477
410
  * Match the start of a Unicode word boundary. That is, this matches a position
478
411
  * at either the beginning of the haystack or where the previous character is
479
412
  * not a word character and the following character is a word character.
480
413
  */
481
414
  export type LookWordStartUnicodeVariant = {
482
- '@type': 'enum'
483
- '@name': 'regex_syntax::hir:Look'
484
- '@variant': 'WordStartUnicode'
485
- }
486
-
415
+ '@type': 'enum';
416
+ '@name': 'regex_syntax::hir:Look';
417
+ '@variant': 'WordStartUnicode';
418
+ };
487
419
  /**
488
420
  * Match the end of a Unicode word boundary. That is, this matches a position at
489
421
  * either the end of the haystack or where the previous character is a word
490
422
  * character and the following character is not a word character.
491
423
  */
492
424
  export type LookWordEndUnicodeVariant = {
493
- '@type': 'enum'
494
- '@name': 'regex_syntax::hir:Look'
495
- '@variant': 'WordEndUnicode'
496
- }
497
-
425
+ '@type': 'enum';
426
+ '@name': 'regex_syntax::hir:Look';
427
+ '@variant': 'WordEndUnicode';
428
+ };
498
429
  /**
499
430
  * Match the start half of an ASCII-only word boundary. That is, this matches a
500
431
  * position at either the beginning of the haystack or where the previous
501
432
  * character is not a word character.
502
433
  */
503
434
  export type LookWordStartHalfAsciiVariant = {
504
- '@type': 'enum'
505
- '@name': 'regex_syntax::hir::Look',
506
- '@variant': 'WordStartHalfAscii'
507
- }
508
-
435
+ '@type': 'enum';
436
+ '@name': 'regex_syntax::hir::Look';
437
+ '@variant': 'WordStartHalfAscii';
438
+ };
509
439
  /**
510
440
  * Match the end half of an ASCII-only word boundary. That is, this matches a
511
441
  * position at either the end of the haystack or where the following character
512
442
  * is not a word character.
513
443
  */
514
444
  export type LookWordEndHalfAsciiVariant = {
515
- '@type': 'enum'
516
- '@name': 'regex_syntax::hir::Look',
517
- '@variant': 'WordEndHalfAscii'
518
- }
519
-
445
+ '@type': 'enum';
446
+ '@name': 'regex_syntax::hir::Look';
447
+ '@variant': 'WordEndHalfAscii';
448
+ };
520
449
  /**
521
450
  * Match the start half of a Unicode word boundary. That is, this matches a
522
451
  * position at either the beginning of the haystack or where the previous
523
452
  * character is not a word character.
524
453
  */
525
454
  export type LookWordStartHalfUnicodeVariant = {
526
- '@type': 'enum'
527
- '@name': 'regex_syntax::hir::Look',
528
- '@variant': 'WordStartHalfUnicode'
529
- }
530
-
455
+ '@type': 'enum';
456
+ '@name': 'regex_syntax::hir::Look';
457
+ '@variant': 'WordStartHalfUnicode';
458
+ };
531
459
  /**
532
460
  * Match the end half of a Unicode word boundary. That is, this matches a
533
461
  * position at either the end of the haystack or where the following character
534
462
  * is not a word character.
535
463
  */
536
464
  export type LookWordEndHalfUnicodeVariant = {
537
- '@type': 'enum'
538
- '@name': 'regex_syntax::hir::Look',
539
- '@variant': 'WordEndHalfUnicode'
540
- }
541
-
465
+ '@type': 'enum';
466
+ '@name': 'regex_syntax::hir::Look';
467
+ '@variant': 'WordEndHalfUnicode';
468
+ };
542
469
  /**
543
470
  * The high-level intermediate representation of a repetition operator.
544
471
  *
545
472
  * A repetition operator permits the repetition of an arbitrary sub-expression
546
473
  */
547
474
  export type Repetition = {
548
- '@type': 'struct'
549
- '@name': 'regex_syntax::hir::Repetition'
550
-
475
+ '@type': 'struct';
476
+ '@name': 'regex_syntax::hir::Repetition';
551
477
  /**
552
478
  * The minimum range of the repetition.
553
479
  *
@@ -557,8 +483,7 @@ export type Repetition = {
557
483
  * When `min` is zero, this expression can match the empty string regardless
558
484
  * of what its sub-expression is.
559
485
  */
560
- min: number
561
-
486
+ min: number;
562
487
  /**
563
488
  * The maximum range of the repetition.
564
489
  *
@@ -566,8 +491,7 @@ export type Repetition = {
566
491
  * there is no upper bound. For something like `x{5}` where the min and max
567
492
  * are equivalent, `min` will be set to `5` and `max` will be set to `5`.
568
493
  */
569
- max?: number
570
-
494
+ max?: number;
571
495
  /**
572
496
  * Whether this repetition operator is greedy or not. A greedy operator will
573
497
  * match as much as it can. A non-greedy operator will match as little as it
@@ -577,14 +501,12 @@ export type Repetition = {
577
501
  * `?` suffix is used, e.g., `(expr)*` is greedy while `(expr)*?` is not.
578
502
  * However, this can be inverted via the `U` “ungreedy” flag.
579
503
  */
580
- greedy: boolean
581
-
504
+ greedy: boolean;
582
505
  /**
583
506
  * The expression being repeated.
584
507
  */
585
- sub: Hir
586
- }
587
-
508
+ sub: Hir;
509
+ };
588
510
  /**
589
511
  * Represents the capture groups for a single match.
590
512
  *
@@ -629,10 +551,9 @@ export type Repetition = {
629
551
  * ```
630
552
  */
631
553
  export type Captures = {
632
- get: Match[]
633
- name: Record<string, Match>
634
- }
635
-
554
+ get: Match[];
555
+ name: Record<string, Match>;
556
+ };
636
557
  /**
637
558
  * The high-level intermediate representation for a capturing group.
638
559
  *
@@ -644,19 +565,61 @@ export type Captures = {
644
565
  * recursive structure of the `Hir` itself.
645
566
  */
646
567
  export type Capture = {
647
- '@type': 'struct'
648
- '@name': 'regex_syntax::hir::Capture'
649
-
568
+ '@type': 'struct';
569
+ '@name': 'regex_syntax::hir::Capture';
650
570
  /** The capture index of the capture. */
651
- index: number
652
-
571
+ index: number;
653
572
  /** The name of the capture, if it exists. */
654
- name?: String
655
-
573
+ name?: String;
656
574
  /** The expression inside the capturing group, which may be empty. */
657
- sub: Hir
658
- }
659
-
575
+ sub: Hir;
576
+ };
577
+ /**
578
+ * Options to compile a `RRegex` or a `RRegexSet`. Every option is optional
579
+ * and only applies to the instance that receives it.
580
+ *
581
+ * # Example
582
+ *
583
+ * ```typescript
584
+ * import { RRegex } from "rregex"
585
+ *
586
+ * // Unicode classes make this pattern exceed the default 10 MiB size limit
587
+ * const re = new RRegex("\\w{200}\\s\\w{200}", { sizeLimit: 200 * 1024 * 1024 })
588
+ * ```
589
+ *
590
+ * @see https://docs.rs/regex/latest/regex/struct.RegexBuilder.html
591
+ */
592
+ export type RRegexOptions = {
593
+ /**
594
+ * The approximate size limit, in bytes, of the compiled regular expression.
595
+ * If the compiled regular expression is bigger, the constructor throws.
596
+ *
597
+ * Increase it only for patterns that need it: the compiled program uses
598
+ * WebAssembly memory, which does not shrink after the instance is freed.
599
+ *
600
+ * @default 10485760 (10 MiB)
601
+ * @see https://docs.rs/regex/latest/regex/struct.RegexBuilder.html#method.size_limit
602
+ */
603
+ sizeLimit?: number;
604
+ /**
605
+ * The approximate capacity, in bytes, of the cache of transitions used by
606
+ * the lazy DFA. A bigger cache can make searches on big patterns faster.
607
+ * If the cache is too small, the search uses a slower engine, it does not
608
+ * throw.
609
+ *
610
+ * @default 2097152 (2 MiB)
611
+ * @see https://docs.rs/regex/latest/regex/struct.RegexBuilder.html#method.dfa_size_limit
612
+ */
613
+ dfaSizeLimit?: number;
614
+ /**
615
+ * The nesting limit of the parser. If the pattern has more nested groups,
616
+ * classes or repetitions, the constructor throws.
617
+ *
618
+ * @default 250
619
+ * @see https://docs.rs/regex/latest/regex/struct.RegexBuilder.html#method.nest_limit
620
+ */
621
+ nestLimit?: number;
622
+ };
660
623
  /**
661
624
  * A compiled regular expression for matching Unicode strings.
662
625
  *
@@ -698,7 +661,7 @@ export type Capture = {
698
661
  *
699
662
  * @see https://docs.rs/regex/latest/regex/
700
663
  */
701
- export class RRegex {
664
+ export declare class RRegex {
702
665
  free(): void;
703
666
  /**
704
667
  * Returns the same as is_match, but starts the search at the given offset.
@@ -850,8 +813,9 @@ export class RRegex {
850
813
  * to search, split or replace text in a string.
851
814
  *
852
815
  * If an invalid expression is given, then an error is returned.
816
+ * Options only apply to this instance, see `RRegexOptions`.
853
817
  */
854
- constructor(re: string);
818
+ constructor(re: string, options?: RRegexOptions | null);
855
819
  /**
856
820
  * Returns the start and end byte range of the leftmost-first match in
857
821
  * `text`. If no match exists, then `undefined` is returned.
@@ -1150,13 +1114,14 @@ export class RRegex {
1150
1114
  *
1151
1115
  * @see https://docs.rs/regex/latest/regex/struct.RegexSet.html#method.empty
1152
1116
  */
1153
- export class RRegexSet {
1117
+ export declare class RRegexSet {
1154
1118
  free(): void;
1155
1119
  /**
1156
1120
  * Create a new regex set with the given regular expressions.
1157
1121
  *
1158
- * This takes an of strings, if any item in the list is not a valid regular
1159
- * expressions, then an error is returned.
1122
+ * This takes an array of strings, if any item in the list is not a valid regular
1123
+ * expression, then an error is returned. Options only apply to this
1124
+ * instance, see `RRegexOptions`.
1160
1125
  *
1161
1126
  * # Example
1162
1127
  *
@@ -1169,7 +1134,7 @@ export class RRegexSet {
1169
1134
  * expect(set.is_match("foo")).toBe(true)
1170
1135
  * ```
1171
1136
  */
1172
- constructor(list: Array<any>);
1137
+ constructor(list: string[], options?: RRegexOptions | null);
1173
1138
  /**
1174
1139
  * Returns the set of regular expressions that match in the given text.
1175
1140
  *
@@ -1242,9 +1207,7 @@ export class RRegexSet {
1242
1207
  */
1243
1208
  isMatch(text: string): boolean;
1244
1209
  }
1245
-
1246
1210
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
1247
-
1248
1211
  export interface InitOutput {
1249
1212
  readonly memory: WebAssembly.Memory;
1250
1213
  readonly __wbg_rregex_free: (a: number, b: number) => void;
@@ -1257,7 +1220,7 @@ export interface InitOutput {
1257
1220
  readonly rregex_findAt: (a: number, b: number, c: number, d: number) => [number, number, number];
1258
1221
  readonly rregex_isMatch: (a: number, b: number, c: number) => number;
1259
1222
  readonly rregex_isMatchAt: (a: number, b: number, c: number, d: number) => number;
1260
- readonly rregex_new: (a: number, b: number) => [number, number, number];
1223
+ readonly rregex_new: (a: number, b: number, c: number) => [number, number, number];
1261
1224
  readonly rregex_replace: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1262
1225
  readonly rregex_replaceAll: (a: number, b: number, c: number, d: number, e: number) => [number, number];
1263
1226
  readonly rregex_replacen: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
@@ -1270,7 +1233,7 @@ export interface InitOutput {
1270
1233
  readonly __wbg_rregexset_free: (a: number, b: number) => void;
1271
1234
  readonly rregexset_isMatch: (a: number, b: number, c: number) => number;
1272
1235
  readonly rregexset_matches: (a: number, b: number, c: number) => [number, number];
1273
- readonly rregexset_new: (a: any) => [number, number, number];
1236
+ readonly rregexset_new: (a: any, b: number) => [number, number, number];
1274
1237
  readonly escape: (a: number, b: number) => [number, number];
1275
1238
  readonly __wbindgen_exn_store: (a: number) => void;
1276
1239
  readonly __externref_table_alloc: () => number;
@@ -1282,37 +1245,44 @@ export interface InitOutput {
1282
1245
  readonly __externref_drop_slice: (a: number, b: number) => void;
1283
1246
  readonly __wbindgen_start: () => void;
1284
1247
  }
1285
-
1286
1248
  export type SyncInitInput = BufferSource | WebAssembly.Module;
1287
- /**
1288
- * Instantiates the given `module`, which can either be bytes or
1289
- * a precompiled `WebAssembly.Module`.
1290
- *
1291
- * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
1292
- *
1293
- * @returns {InitOutput}
1294
- */
1295
- export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
1296
-
1297
- /**
1298
- * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
1299
- * for everything else, calls `WebAssembly.instantiate` directly.
1300
- *
1301
- * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
1302
- *
1303
- * @returns {Promise<InitOutput>}
1304
- */
1305
- export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
1306
-
1307
1249
  /** Build metadata */
1308
- export const metadata: {
1309
- "name": "rregex",
1310
- "description": "Rust Regex binding for Javascript",
1311
- "authors": [
1312
- "Fede Ramirez <i@2fd.me>"
1313
- ],
1314
- "homepage": "http://rregex.dev",
1315
- "repository": "https://github.com/2fd/rregex",
1316
- "regex": "1.13.1",
1317
- "regex-syntax": "0.8.11"
1250
+ export declare const metadata: {
1251
+ readonly name: "rregex";
1252
+ readonly description: "Rust Regex binding for Javascript";
1253
+ readonly authors: readonly ["Fede Ramirez <i@2fd.me>"];
1254
+ readonly homepage: "http://rregex.dev";
1255
+ readonly repository: "https://github.com/2fd/rregex";
1256
+ readonly regex: "1.13.1";
1257
+ readonly "regex-syntax": "0.8.11";
1258
+ };
1259
+ export interface InitOptions {
1260
+ /** Bytes, a compiled `WebAssembly.Module`, or a `Response`, URL or path to fetch. */
1261
+ module_or_path: InitInput | Promise<InitInput>;
1262
+ }
1263
+ export interface InitSyncOptions {
1264
+ /** Bytes or a compiled `WebAssembly.Module`. */
1265
+ module: SyncInitInput;
1318
1266
  }
1267
+ /**
1268
+ * The raw exports of the WebAssembly instance (`memory`, allocator, bindings),
1269
+ * set by {@link init} and {@link initSync}. For tests and debugging only: it
1270
+ * is not part of the public API and can change in any release.
1271
+ *
1272
+ * @internal
1273
+ */
1274
+ export declare let __wasm: InitOutput | undefined;
1275
+ /** Returns `true` after the WebAssembly module has been instantiated. */
1276
+ export declare function isInitialized(): boolean;
1277
+ /**
1278
+ * Instantiates the WebAssembly module synchronously. Calls after the first
1279
+ * successful call have no effect.
1280
+ *
1281
+ * @param options - The module, or (deprecated) the module passed directly.
1282
+ */
1283
+ export declare function initSync(options: InitSyncOptions | SyncInitInput): void;
1284
+ /**
1285
+ * Instantiates the WebAssembly module asynchronously. Calls after the first
1286
+ * successful call have no effect.
1287
+ */
1288
+ export declare function init(options: InitOptions): Promise<void>;