re2js 1.2.1 → 1.2.3

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,202 +1,3 @@
1
- /**
2
- * A compiled representation of an RE2 regular expression
3
- *
4
- * The matching functions take {@code String} arguments instead of the more general Java
5
- * {@code CharSequence} since the latter doesn't provide UTF-16 decoding.
6
- *
7
- *
8
- * @author rsc@google.com (Russ Cox)
9
- * @class
10
- */
11
- export class RE2JS {
12
- /**
13
- * Flag: case insensitive matching.
14
- */
15
- static CASE_INSENSITIVE: number;
16
- /**
17
- * Flag: dot ({@code .}) matches all characters, including newline.
18
- */
19
- static DOTALL: number;
20
- /**
21
- * Flag: multiline matching: {@code ^} and {@code $} match at beginning and end of line, not just
22
- * beginning and end of input.
23
- */
24
- static MULTILINE: number;
25
- /**
26
- * Flag: Unicode groups (e.g. {@code \p\ Greek\} ) will be syntax errors.
27
- */
28
- static DISABLE_UNICODE_GROUPS: number;
29
- /**
30
- * Flag: matches longest possible string.
31
- */
32
- static LONGEST_MATCH: number;
33
- /**
34
- * Returns a literal pattern string for the specified string.
35
- *
36
- * This method produces a string that can be used to create a <code>RE2JS</code> that would
37
- * match the string <code>s</code> as if it were a literal pattern.
38
- *
39
- * Metacharacters or escape sequences in the input sequence will be given no special meaning.
40
- *
41
- * @param {string} str The string to be literalized
42
- * @returns {string} A literal string replacement
43
- */
44
- static quote(str: string): string;
45
- /**
46
- * Translates a given regular expression string to ensure compatibility with RE2JS.
47
- *
48
- * This function preprocesses the input regex string by applying necessary transformations,
49
- * such as escaping special characters (e.g., `/`), converting named capture groups to
50
- * RE2JS-compatible syntax, and handling Unicode sequences properly. It ensures that the
51
- * resulting regex is safe and properly formatted before compilation.
52
- *
53
- * @param {string} expr - The regular expression string to be translated.
54
- * @returns {string} - The transformed regular expression string, ready for compilation.
55
- */
56
- static translateRegExp(expr: string): string;
57
- /**
58
- * Helper: create new RE2JS with given regex and flags. Flregex is the regex with flags applied.
59
- * @param {string} regex
60
- * @param {number} [flags=0]
61
- * @returns {RE2JS}
62
- */
63
- static compile(regex: string, flags?: number): RE2JS;
64
- /**
65
- * Matches a string against a regular expression.
66
- *
67
- * @param {string} regex the regular expression
68
- * @param {string|number[]} input the input
69
- * @returns {boolean} true if the regular expression matches the entire input
70
- * @throws RE2JSSyntaxException if the regular expression is malformed
71
- */
72
- static matches(regex: string, input: string | number[]): boolean;
73
- /**
74
- * This is visible for testing.
75
- * @private
76
- */
77
- private static initTest;
78
- /**
79
- *
80
- * @param {string} pattern
81
- * @param {number} flags
82
- */
83
- constructor(pattern: string, flags: number);
84
- patternInput: string;
85
- flagsInput: number;
86
- /**
87
- * Releases memory used by internal caches associated with this pattern. Does not change the
88
- * observable behaviour. Useful for tests that detect memory leaks via allocation tracking.
89
- */
90
- reset(): void;
91
- /**
92
- * Returns the flags used in the constructor.
93
- * @returns {number}
94
- */
95
- flags(): number;
96
- /**
97
- * Returns the pattern used in the constructor.
98
- * @returns {string}
99
- */
100
- pattern(): string;
101
- re2(): any;
102
- /**
103
- * Matches a string against a regular expression.
104
- *
105
- * @param {string|number[]} input the input
106
- * @returns {boolean} true if the regular expression matches the entire input
107
- */
108
- matches(input: string | number[]): boolean;
109
- /**
110
- * Creates a new {@code Matcher} matching the pattern against the input.
111
- *
112
- * @param {string|number[]} input the input string
113
- * @returns {Matcher}
114
- */
115
- matcher(input: string | number[]): Matcher;
116
- /**
117
- * Splits input around instances of the regular expression. It returns an array giving the strings
118
- * that occur before, between, and after instances of the regular expression.
119
- *
120
- * If {@code limit <= 0}, there is no limit on the size of the returned array. If
121
- * {@code limit == 0}, empty strings that would occur at the end of the array are omitted. If
122
- * {@code limit > 0}, at most limit strings are returned. The final string contains the remainder
123
- * of the input, possibly including additional matches of the pattern.
124
- *
125
- * @param {string} input the input string to be split
126
- * @param {number} [limit=0] the limit
127
- * @returns {string[]} the split strings
128
- */
129
- split(input: string, limit?: number): string[];
130
- /**
131
- *
132
- * @returns {string}
133
- */
134
- toString(): string;
135
- /**
136
- * Returns the program size of this pattern.
137
- *
138
- * <p>
139
- * Similar to the C++ implementation, the program size is a very approximate measure of a regexp's
140
- * "cost". Larger numbers are more expensive than smaller numbers.
141
- * </p>
142
- *
143
- * @returns {number} the program size of this pattern
144
- */
145
- programSize(): number;
146
- /**
147
- * Returns the number of capturing groups in this matcher's pattern. Group zero denotes the entire
148
- * pattern and is excluded from this count.
149
- *
150
- * @returns {number} the number of capturing groups in this pattern
151
- */
152
- groupCount(): number;
153
- /**
154
- * Return a map of the capturing groups in this matcher's pattern, where key is the name and value
155
- * is the index of the group in the pattern.
156
- * @returns {*}
157
- */
158
- namedGroups(): any;
159
- /**
160
- *
161
- * @param {*} other
162
- * @returns {boolean}
163
- */
164
- equals(other: any): boolean;
165
- }
166
- /**
167
- * An exception thrown by the compiler
168
- */
169
- export class RE2JSCompileException extends RE2JSException {
170
- }
171
- export class RE2JSException extends Error {
172
- constructor(message: any);
173
- }
174
- /**
175
- * An exception thrown by flags
176
- */
177
- export class RE2JSFlagsException extends RE2JSException {
178
- }
179
- /**
180
- * An exception thrown by using groups
181
- */
182
- export class RE2JSGroupException extends RE2JSException {
183
- }
184
- /**
185
- * An exception thrown by the parser if the pattern was invalid.
186
- */
187
- export class RE2JSSyntaxException extends RE2JSException {
188
- constructor(error: any, input?: any);
189
- error: any;
190
- input: any;
191
- /**
192
- * Retrieves the description of the error.
193
- */
194
- getDescription(): any;
195
- /**
196
- * Retrieves the erroneous regular-expression pattern.
197
- */
198
- getPattern(): any;
199
- }
200
1
  /**
201
2
  * A stateful iterator that interprets a regex {@code RE2JS} on a specific input.
202
3
  *
@@ -219,7 +20,7 @@ export class RE2JSSyntaxException extends RE2JSException {
219
20
  *
220
21
  * @author rsc@google.com (Russ Cox)
221
22
  */
222
- declare class Matcher {
23
+ export class Matcher {
223
24
  /**
224
25
  * Quotes '\' and '$' in {@code s}, so that the returned string could be used in
225
26
  * {@link #appendReplacement} as a literal replacement of {@code s}.
@@ -235,10 +36,14 @@ declare class Matcher {
235
36
  */
236
37
  constructor(pattern: RE2JS, input: Utf8MatcherInput | Utf16MatcherInput | number[] | string);
237
38
  patternInput: RE2JS;
238
- patternGroupCount: any;
239
- groups: any[];
240
- namedGroups: any;
241
- numberOfInstructions: any;
39
+ /** @type {number} */
40
+ patternGroupCount: number;
41
+ /** @type {number[]} */
42
+ groups: number[];
43
+ /** @type {Record<string, number>} */
44
+ namedGroups: Record<string, number>;
45
+ /** @type {number} */
46
+ numberOfInstructions: number;
242
47
  /**
243
48
  * Returns the {@code RE2JS} associated with this {@code Matcher}.
244
49
  * @returns {RE2JS}
@@ -250,17 +55,20 @@ declare class Matcher {
250
55
  * @returns {Matcher} the {@code Matcher} itself, for chained method calls
251
56
  */
252
57
  reset(): Matcher;
253
- matcherInputLength: any;
58
+ /** @type {number} */
59
+ matcherInputLength: number;
60
+ /** @type {number} */
254
61
  appendPos: number;
255
62
  hasMatch: boolean;
256
63
  hasGroups: boolean;
257
64
  anchorFlag: number;
258
65
  /**
259
66
  * Resets the {@code Matcher} and changes the input.
67
+ * @param {Utf8MatcherInput|Utf16MatcherInput} input
260
68
  * @returns {Matcher} the {@code Matcher} itself, for chained method calls
261
69
  */
262
- resetMatcherInput(input: any): Matcher;
263
- matcherInput: any;
70
+ resetMatcherInput(input: Utf8MatcherInput | Utf16MatcherInput): Matcher;
71
+ matcherInput: Utf8MatcherInput | Utf16MatcherInput;
264
72
  /**
265
73
  * Returns the start of the named group of the most recent match, or -1 if the group was not
266
74
  * matched.
@@ -322,11 +130,11 @@ declare class Matcher {
322
130
  * Matches the input against the pattern (unanchored), starting at a specified position. If there
323
131
  * is a match, {@code find} sets the match state to describe it.
324
132
  *
325
- * @param {string|number} [start=null] the input position where the search begins
133
+ * @param {number} [start=null] the input position where the search begins
326
134
  * @returns {boolean} if it finds a match
327
135
  * @throws IndexOutOfBoundsException if start is not a valid input position
328
136
  */
329
- find(start?: string | number): boolean;
137
+ find(start?: number): boolean;
330
138
  /**
331
139
  * Helper: does match starting at start, with RE2 anchor flag.
332
140
  * @param {number} startByte
@@ -417,6 +225,214 @@ declare class Matcher {
417
225
  */
418
226
  private replace;
419
227
  }
228
+ /**
229
+ * A compiled representation of an RE2 regular expression
230
+ *
231
+ * The matching functions take {@code String} arguments instead of the more general Java
232
+ * {@code CharSequence} since the latter doesn't provide UTF-16 decoding.
233
+ *
234
+ *
235
+ * @author rsc@google.com (Russ Cox)
236
+ * @class
237
+ */
238
+ export class RE2JS {
239
+ /**
240
+ * Flag: case insensitive matching.
241
+ */
242
+ static CASE_INSENSITIVE: number;
243
+ /**
244
+ * Flag: dot ({@code .}) matches all characters, including newline.
245
+ */
246
+ static DOTALL: number;
247
+ /**
248
+ * Flag: multiline matching: {@code ^} and {@code $} match at beginning and end of line, not just
249
+ * beginning and end of input.
250
+ */
251
+ static MULTILINE: number;
252
+ /**
253
+ * Flag: Unicode groups (e.g. {@code \p\ Greek\} ) will be syntax errors.
254
+ */
255
+ static DISABLE_UNICODE_GROUPS: number;
256
+ /**
257
+ * Flag: matches longest possible string.
258
+ */
259
+ static LONGEST_MATCH: number;
260
+ /**
261
+ * Returns a literal pattern string for the specified string.
262
+ *
263
+ * This method produces a string that can be used to create a <code>RE2JS</code> that would
264
+ * match the string <code>s</code> as if it were a literal pattern.
265
+ *
266
+ * Metacharacters or escape sequences in the input sequence will be given no special meaning.
267
+ *
268
+ * @param {string} str The string to be literalized
269
+ * @returns {string} A literal string replacement
270
+ */
271
+ static quote(str: string): string;
272
+ /**
273
+ * Translates a given regular expression string to ensure compatibility with RE2JS.
274
+ *
275
+ * This function preprocesses the input regex string by applying necessary transformations,
276
+ * such as escaping special characters (e.g., `/`), converting named capture groups to
277
+ * RE2JS-compatible syntax, and handling Unicode sequences properly. It ensures that the
278
+ * resulting regex is safe and properly formatted before compilation.
279
+ *
280
+ * @param {string} expr - The regular expression string to be translated.
281
+ * @returns {string} - The transformed regular expression string, ready for compilation.
282
+ */
283
+ static translateRegExp(expr: string): string;
284
+ /**
285
+ * Helper: create new RE2JS with given regex and flags. Flregex is the regex with flags applied.
286
+ * @param {string} regex
287
+ * @param {number} [flags=0]
288
+ * @returns {RE2JS}
289
+ */
290
+ static compile(regex: string, flags?: number): RE2JS;
291
+ /**
292
+ * Matches a string against a regular expression.
293
+ *
294
+ * @param {string} regex the regular expression
295
+ * @param {string|number[]} input the input
296
+ * @returns {boolean} true if the regular expression matches the entire input
297
+ * @throws RE2JSSyntaxException if the regular expression is malformed
298
+ */
299
+ static matches(regex: string, input: string | number[]): boolean;
300
+ /**
301
+ * This is visible for testing.
302
+ * @private
303
+ */
304
+ private static initTest;
305
+ /**
306
+ *
307
+ * @param {string} pattern
308
+ * @param {number} flags
309
+ */
310
+ constructor(pattern: string, flags: number);
311
+ patternInput: string;
312
+ flagsInput: number;
313
+ /**
314
+ * Releases memory used by internal caches associated with this pattern. Does not change the
315
+ * observable behaviour. Useful for tests that detect memory leaks via allocation tracking.
316
+ */
317
+ reset(): void;
318
+ /**
319
+ * Returns the flags used in the constructor.
320
+ * @returns {number}
321
+ */
322
+ flags(): number;
323
+ /**
324
+ * Returns the pattern used in the constructor.
325
+ * @returns {string}
326
+ */
327
+ pattern(): string;
328
+ re2(): any;
329
+ /**
330
+ * Matches a string against a regular expression.
331
+ *
332
+ * @param {string|number[]} input the input
333
+ * @returns {boolean} true if the regular expression matches the entire input
334
+ */
335
+ matches(input: string | number[]): boolean;
336
+ /**
337
+ * Creates a new {@code Matcher} matching the pattern against the input.
338
+ *
339
+ * @param {string|number[]} input the input string
340
+ * @returns {Matcher}
341
+ */
342
+ matcher(input: string | number[]): Matcher;
343
+ /**
344
+ * Splits input around instances of the regular expression. It returns an array giving the strings
345
+ * that occur before, between, and after instances of the regular expression.
346
+ *
347
+ * If {@code limit <= 0}, there is no limit on the size of the returned array. If
348
+ * {@code limit == 0}, empty strings that would occur at the end of the array are omitted. If
349
+ * {@code limit > 0}, at most limit strings are returned. The final string contains the remainder
350
+ * of the input, possibly including additional matches of the pattern.
351
+ *
352
+ * @param {string} input the input string to be split
353
+ * @param {number} [limit=0] the limit
354
+ * @returns {string[]} the split strings
355
+ */
356
+ split(input: string, limit?: number): string[];
357
+ /**
358
+ *
359
+ * @returns {string}
360
+ */
361
+ toString(): string;
362
+ /**
363
+ * Returns the program size of this pattern.
364
+ *
365
+ * <p>
366
+ * Similar to the C++ implementation, the program size is a very approximate measure of a regexp's
367
+ * "cost". Larger numbers are more expensive than smaller numbers.
368
+ * </p>
369
+ *
370
+ * @returns {number} the program size of this pattern
371
+ */
372
+ programSize(): number;
373
+ /**
374
+ * Returns the number of capturing groups in this matcher's pattern. Group zero denotes the entire
375
+ * pattern and is excluded from this count.
376
+ *
377
+ * @returns {number} the number of capturing groups in this pattern
378
+ */
379
+ groupCount(): number;
380
+ /**
381
+ * Return a map of the capturing groups in this matcher's pattern, where key is the name and value
382
+ * is the index of the group in the pattern.
383
+ * @returns {Record<string, number>}
384
+ */
385
+ namedGroups(): Record<string, number>;
386
+ /**
387
+ *
388
+ * @param {*} other
389
+ * @returns {boolean}
390
+ */
391
+ equals(other: any): boolean;
392
+ }
393
+ /**
394
+ * An exception thrown by the compiler
395
+ */
396
+ export class RE2JSCompileException extends RE2JSException {
397
+ }
398
+ export class RE2JSException extends Error {
399
+ /** @param {string} message */
400
+ constructor(message: string);
401
+ }
402
+ /**
403
+ * An exception thrown by flags
404
+ */
405
+ export class RE2JSFlagsException extends RE2JSException {
406
+ }
407
+ /**
408
+ * An exception thrown by using groups
409
+ */
410
+ export class RE2JSGroupException extends RE2JSException {
411
+ }
412
+ /**
413
+ * An exception thrown by the parser if the pattern was invalid.
414
+ */
415
+ export class RE2JSSyntaxException extends RE2JSException {
416
+ /**
417
+ * @param {string} error
418
+ * @param {string|null} [input=null]
419
+ */
420
+ constructor(error: string, input?: string | null);
421
+ /** @type {string} */
422
+ error: string;
423
+ /** @type {string|null} */
424
+ input: string | null;
425
+ /**
426
+ * Retrieves the description of the error.
427
+ * @returns {string}
428
+ */
429
+ getDescription(): string;
430
+ /**
431
+ * Retrieves the erroneous regular-expression pattern.
432
+ * @returns {string|null}
433
+ */
434
+ getPattern(): string | null;
435
+ }
420
436
  declare class Utf8MatcherInput extends MatcherInputBase {
421
437
  constructor(bytes?: any);
422
438
  bytes: any;
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.d.ts","sourceRoot":"","sources":["index.esm.js"],"names":[],"mappings":"AAgyLA;;;;;;;;;GASG;AACH;IACE;;OAEG;IACH,gCAA4B;IAC5B;;OAEG;IACH,sBAAkB;IAClB;;;OAGG;IACH,yBAAqB;IACrB;;OAEG;IACH,sCAAkC;IAClC;;OAEG;IACH,6BAA0B;IAE1B;;;;;;;;;;OAUG;IACH,kBAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;;;;;;;;OAUG;IACH,6BAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;;;OAKG;IACH,sBAJW,MAAM,UACN,MAAM,GACJ,KAAK,CAwBjB;IAED;;;;;;;OAOG;IACH,sBALW,MAAM,SACN,MAAM,GAAC,MAAM,EAAE,GACb,OAAO,CAKnB;IAED;;;OAGG;IACH,wBAWC;IAED;;;;OAIG;IACH,qBAHW,MAAM,SACN,MAAM,EAOhB;IAHC,qBAA2B;IAE3B,mBAAuB;IAGzB;;;OAGG;IACH,cAEC;IAED;;;OAGG;IACH,SAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,WAFa,MAAM,CAIlB;IACD,WAEC;IAED;;;;;OAKG;IACH,eAHW,MAAM,GAAC,MAAM,EAAE,GACb,OAAO,CAInB;IAED;;;;;OAKG;IACH,eAHW,MAAM,GAAC,MAAM,EAAE,GACb,OAAO,CAOnB;IAED;;;;;;;;;;;;OAYG;IACH,aAJW,MAAM,UACN,MAAM,GACJ,MAAM,EAAE,CAgDpB;IAED;;;OAGG;IACH,YAFa,MAAM,CAIlB;IAED;;;;;;;;;OASG;IACH,eAFa,MAAM,CAIlB;IAED;;;;;OAKG;IACH,cAF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AAO,CAoBnB;IAED;;;;;;OAMG;IACH,iBAWC;IAED;;;;;OAKG;IACH,iBAJW,MAAM,OACN,MAAM,GACJ,MAAM,CAOlB;IAED;;;OAGG;IACH,eAFa,MAAM,CAIlB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,0BAUC;IAED;;;;OAIG;IACH,kCA2DC;IAED;;;;OAIG;IACH,sCAiFC;IAED;;;;OAIG;IACH,cAFa,MAAM,CAIlB;IAED;;;;;;;;OAQG;IACH,wBALW,MAAM,aACN,OAAO,GACL,MAAM,CAKlB;IAED;;;;;;;;OAQG;IACH,0BALW,MAAM,aACN,OAAO,GACL,MAAM,CAKlB;IAED;;;;;;;OAOG;IACH,gBAWC;CACF;AA7rBD;IACE,yBAGC;IADC,WAAkB;IAEpB,mBAEC;IACD;;;OAGG;IACH,kBAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,WAFa,MAAM,EAAE,CAIpB;IAED;;;OAGG;IACH,UAFa,MAAM,CAIlB;CACF;AACD;IACE,gCAGC;IADC,kBAAgC;IAElC,mBAEC;IAED;;;OAGG;IACH,kBAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,WAFa,MAAM,EAAE,CAIpB;IAED;;;OAGG;IACH,UAFa,MAAM,CAIlB;CACF;AAzFD;;GAEG;AACH;IACE,8BAAkD;IAClD,oBAEC;IAED;;;OAGG;IACH,kBAFa,OAAO,CAInB;IAED;;;OAGG;IACH,mBAFa,OAAO,CAInB;CACF"}
1
+ {"version":3,"file":"index.esm.d.ts","sourceRoot":"","sources":["index.esm.js"],"names":[],"mappings":"AA25BA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IACE;;;;;;OAMG;IACH,6BAHW,MAAM,GACJ,MAAM,CAalB;IACD;;;;OAIG;IACH,qBAHW,KAAK,SACL,gBAAgB,GAAC,iBAAiB,GAAC,MAAM,EAAE,GAAC,MAAM,EA0B5D;IAnBC,oBAA2B;IAG3B,qBAAqB;IACrB,mBADW,MAAM,CACqC;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ADY,MAAM,EAIjB;CACF;AA+DD;;GAEG;AACH;CAMC;AApBD;;GAEG;AACH;CAMC;AA3DD;;GAEG;AACH;IACE;;;OAGG;IACH,mBAHW,MAAM,UACN,MAAM,GAAC,IAAI,EAcrB;IAJC,qBAAqB;IACrB,OADW,MAAM,CACC;IAClB,0BAA0B;IAC1B,OADW,MAAM,GAAC,IAAI,CACJ;IAGpB;;;OAGG;IACH,kBAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,cAFa,MAAM,GAAC,IAAI,CAIvB;CACF;AAnID;IACE,yBAGC;IADC,WAAkB;IAEpB,mBAEC;IACD;;;OAGG;IACH,kBAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,WAFa,MAAM,EAAE,CAIpB;IAED;;;OAGG;IACH,UAFa,MAAM,CAIlB;CACF;AACD;IACE,gCAGC;IADC,kBAAgC;IAElC,mBAEC;IAED;;;OAGG;IACH,kBAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,WAFa,MAAM,EAAE,CAIpB;IAED;;;OAGG;IACH,UAFa,MAAM,CAIlB;CACF;AAzFD;;GAEG;AACH;IACE,8BAAkD;IAClD,oBAEC;IAED;;;OAGG;IACH,kBAFa,OAAO,CAInB;IAED;;;OAGG;IACH,mBAFa,OAAO,CAInB;CACF"}
@@ -2,7 +2,7 @@
2
2
  * re2js
3
3
  * RE2JS is the JavaScript port of RE2, a regular expression engine that provides linear time matching
4
4
  *
5
- * @version v1.2.1
5
+ * @version v1.2.3
6
6
  * @author Alexey Vasiliev
7
7
  * @homepage https://github.com/le0pard/re2js#readme
8
8
  * @repository github:le0pard/re2js
@@ -842,6 +842,7 @@ class MatcherInput {
842
842
  }
843
843
 
844
844
  class RE2JSException extends Error {
845
+ /** @param {string} message */
845
846
  constructor(message) {
846
847
  super(message);
847
848
  this.name = 'RE2JSException';
@@ -852,6 +853,10 @@ class RE2JSException extends Error {
852
853
  * An exception thrown by the parser if the pattern was invalid.
853
854
  */
854
855
  class RE2JSSyntaxException extends RE2JSException {
856
+ /**
857
+ * @param {string} error
858
+ * @param {string|null} [input=null]
859
+ */
855
860
  constructor(error, input = null) {
856
861
  let message = `error parsing regexp: ${error}`;
857
862
  if (input) {
@@ -860,12 +865,15 @@ class RE2JSSyntaxException extends RE2JSException {
860
865
  super(message);
861
866
  this.name = 'RE2JSSyntaxException';
862
867
  this.message = message;
868
+ /** @type {string} */
863
869
  this.error = error;
870
+ /** @type {string|null} */
864
871
  this.input = input;
865
872
  }
866
873
 
867
874
  /**
868
875
  * Retrieves the description of the error.
876
+ * @returns {string}
869
877
  */
870
878
  getDescription() {
871
879
  return this.error;
@@ -873,6 +881,7 @@ class RE2JSSyntaxException extends RE2JSException {
873
881
 
874
882
  /**
875
883
  * Retrieves the erroneous regular-expression pattern.
884
+ * @returns {string|null}
876
885
  */
877
886
  getPattern() {
878
887
  return this.input;
@@ -883,6 +892,7 @@ class RE2JSSyntaxException extends RE2JSException {
883
892
  * An exception thrown by the compiler
884
893
  */
885
894
  class RE2JSCompileException extends RE2JSException {
895
+ /** @param {string} message */
886
896
  constructor(message) {
887
897
  super(message);
888
898
  this.name = 'RE2JSCompileException';
@@ -893,6 +903,7 @@ class RE2JSCompileException extends RE2JSException {
893
903
  * An exception thrown by using groups
894
904
  */
895
905
  class RE2JSGroupException extends RE2JSException {
906
+ /** @param {string} message */
896
907
  constructor(message) {
897
908
  super(message);
898
909
  this.name = 'RE2JSGroupException';
@@ -903,6 +914,7 @@ class RE2JSGroupException extends RE2JSException {
903
914
  * An exception thrown by flags
904
915
  */
905
916
  class RE2JSFlagsException extends RE2JSException {
917
+ /** @param {string} message */
906
918
  constructor(message) {
907
919
  super(message);
908
920
  this.name = 'RE2JSFlagsException';
@@ -964,10 +976,14 @@ class Matcher {
964
976
  this.patternInput = pattern;
965
977
  const re2 = this.patternInput.re2();
966
978
  // The number of submatches (groups) in the pattern.
979
+ /** @type {number} */
967
980
  this.patternGroupCount = re2.numberOfCapturingGroups();
968
981
  // The group indexes, in [start, end) pairs. Zeroth pair is overall match.
982
+ /** @type {number[]} */
969
983
  this.groups = [];
984
+ /** @type {Record<string, number>} */
970
985
  this.namedGroups = re2.namedGroups;
986
+ /** @type {number} */
971
987
  this.numberOfInstructions = re2.numberOfInstructions();
972
988
  if (input instanceof MatcherInputBase) {
973
989
  this.resetMatcherInput(input);
@@ -993,8 +1009,10 @@ class Matcher {
993
1009
  */
994
1010
  reset() {
995
1011
  // The input length in UTF16 codes.
1012
+ /** @type {number} */
996
1013
  this.matcherInputLength = this.matcherInput.length();
997
1014
  // The append position: where the next append should start.
1015
+ /** @type {number} */
998
1016
  this.appendPos = 0;
999
1017
  // Is there a current match?
1000
1018
  this.hasMatch = false;
@@ -1008,6 +1026,7 @@ class Matcher {
1008
1026
 
1009
1027
  /**
1010
1028
  * Resets the {@code Matcher} and changes the input.
1029
+ * @param {Utf8MatcherInput|Utf16MatcherInput} input
1011
1030
  * @returns {Matcher} the {@code Matcher} itself, for chained method calls
1012
1031
  */
1013
1032
  resetMatcherInput(input) {
@@ -1150,7 +1169,7 @@ class Matcher {
1150
1169
  * Matches the input against the pattern (unanchored), starting at a specified position. If there
1151
1170
  * is a match, {@code find} sets the match state to describe it.
1152
1171
  *
1153
- * @param {string|number} [start=null] the input position where the search begins
1172
+ * @param {number} [start=null] the input position where the search begins
1154
1173
  * @returns {boolean} if it finds a match
1155
1174
  * @throws IndexOutOfBoundsException if start is not a valid input position
1156
1175
  */
@@ -6198,7 +6217,7 @@ class RE2JS {
6198
6217
  /**
6199
6218
  * Return a map of the capturing groups in this matcher's pattern, where key is the name and value
6200
6219
  * is the index of the group in the pattern.
6201
- * @returns {*}
6220
+ * @returns {Record<string, number>}
6202
6221
  */
6203
6222
  namedGroups() {
6204
6223
  return this.re2Input.namedGroups;
@@ -6220,5 +6239,5 @@ class RE2JS {
6220
6239
  }
6221
6240
  }
6222
6241
 
6223
- export { RE2JS, RE2JSCompileException, RE2JSException, RE2JSFlagsException, RE2JSGroupException, RE2JSSyntaxException };
6242
+ export { Matcher, RE2JS, RE2JSCompileException, RE2JSException, RE2JSFlagsException, RE2JSGroupException, RE2JSSyntaxException };
6224
6243
  //# sourceMappingURL=index.esm.js.map