source: imaps-frontend/node_modules/@eslint-community/regexpp/index.d.ts@ 0c6b92a

main
Last change on this file since 0c6b92a was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago

Pred finalna verzija

  • Property mode set to 100644
File size: 36.9 KB
RevLine 
[d565449]1// Generated by dts-bundle v0.7.3
2
3declare module "@eslint-community/regexpp" {
4 import * as AST from "@eslint-community/regexpp/ast";
5 import { RegExpParser } from "@eslint-community/regexpp/parser";
6 import { RegExpValidator } from "@eslint-community/regexpp/validator";
7 import { RegExpVisitor } from "@eslint-community/regexpp/visitor";
8 export { RegExpSyntaxError } from "@eslint-community/regexpp/regexp-syntax-error";
9 export { AST, RegExpParser, RegExpValidator };
10 /**
11 * Parse a given regular expression literal then make AST object.
12 * @param source The source code to parse.
13 * @param options The options to parse.
14 * @returns The AST of the regular expression.
15 */
16 export function parseRegExpLiteral(
17 source: RegExp | string,
18 options?: RegExpParser.Options
19 ): AST.RegExpLiteral;
20 /**
21 * Validate a given regular expression literal.
22 * @param source The source code to validate.
23 * @param options The options to validate.
24 */
25 export function validateRegExpLiteral(
26 source: string,
27 options?: RegExpValidator.Options
28 ): void;
29 export function visitRegExpAST(
30 node: AST.Node,
31 handlers: RegExpVisitor.Handlers
32 ): void;
33}
34
35declare module "@eslint-community/regexpp/ast" {
36 /**
37 * The type which includes all nodes.
38 */
39 export type Node = BranchNode | LeafNode;
40 /**
41 * The type which includes all branch nodes.
42 */
43 export type BranchNode =
44 | Alternative
45 | CapturingGroup
46 | CharacterClass
47 | CharacterClassRange
48 | ClassIntersection
49 | ClassStringDisjunction
50 | ClassSubtraction
51 | ExpressionCharacterClass
52 | Group
53 | LookaroundAssertion
[0c6b92a]54 | Modifiers
[d565449]55 | Pattern
56 | Quantifier
57 | RegExpLiteral
58 | StringAlternative;
59 /**
60 * The type which includes all leaf nodes.
61 */
62 export type LeafNode =
63 | Backreference
64 | BoundaryAssertion
65 | Character
66 | CharacterSet
[0c6b92a]67 | Flags
68 | ModifierFlags;
[d565449]69 /**
70 * The type which includes all atom nodes.
71 */
72 export type Element = Assertion | QuantifiableElement | Quantifier;
73 /**
74 * The type which includes all atom nodes that Quantifier node can have as children.
75 */
76 export type QuantifiableElement =
77 | Backreference
78 | CapturingGroup
79 | Character
80 | CharacterClass
81 | CharacterSet
82 | ExpressionCharacterClass
83 | Group
84 | LookaheadAssertion;
85 /**
86 * The type which includes all character class atom nodes.
87 */
88 export type CharacterClassElement =
89 | ClassRangesCharacterClassElement
90 | UnicodeSetsCharacterClassElement;
91 export type ClassRangesCharacterClassElement =
92 | Character
93 | CharacterClassRange
94 | CharacterUnicodePropertyCharacterSet
95 | EscapeCharacterSet;
96 export type UnicodeSetsCharacterClassElement =
97 | Character
98 | CharacterClassRange
99 | ClassStringDisjunction
100 | EscapeCharacterSet
101 | ExpressionCharacterClass
102 | UnicodePropertyCharacterSet
103 | UnicodeSetsCharacterClass;
104 /**
105 * The type which defines common properties for all node types.
106 */
107 export interface NodeBase {
108 /** The node type. */
109 type: Node["type"];
110 /** The parent node. */
111 parent: Node["parent"];
112 /** The 0-based index that this node starts. */
113 start: number;
114 /** The 0-based index that this node ends. */
115 end: number;
116 /** The raw text of this node. */
117 raw: string;
118 }
119 /**
120 * The root node.
121 */
122 export interface RegExpLiteral extends NodeBase {
123 type: "RegExpLiteral";
124 parent: null;
125 pattern: Pattern;
126 flags: Flags;
127 }
128 /**
129 * The pattern.
130 */
131 export interface Pattern extends NodeBase {
132 type: "Pattern";
133 parent: RegExpLiteral | null;
134 alternatives: Alternative[];
135 }
136 /**
137 * The alternative.
138 * E.g. `a|b`
139 */
140 export interface Alternative extends NodeBase {
141 type: "Alternative";
142 parent: CapturingGroup | Group | LookaroundAssertion | Pattern;
143 elements: Element[];
144 }
145 /**
146 * The uncapturing group.
147 * E.g. `(?:ab)`
148 */
149 export interface Group extends NodeBase {
150 type: "Group";
151 parent: Alternative | Quantifier;
[0c6b92a]152 modifiers: Modifiers | null;
[d565449]153 alternatives: Alternative[];
154 }
155 /**
156 * The capturing group.
157 * E.g. `(ab)`, `(?<name>ab)`
158 */
159 export interface CapturingGroup extends NodeBase {
160 type: "CapturingGroup";
161 parent: Alternative | Quantifier;
162 name: string | null;
163 alternatives: Alternative[];
164 references: Backreference[];
165 }
166 /**
167 * The lookaround assertion.
168 */
169 export type LookaroundAssertion = LookaheadAssertion | LookbehindAssertion;
170 /**
171 * The lookahead assertion.
172 * E.g. `(?=ab)`, `(?!ab)`
173 */
174 export interface LookaheadAssertion extends NodeBase {
175 type: "Assertion";
176 parent: Alternative | Quantifier;
177 kind: "lookahead";
178 negate: boolean;
179 alternatives: Alternative[];
180 }
181 /**
182 * The lookbehind assertion.
183 * E.g. `(?<=ab)`, `(?<!ab)`
184 */
185 export interface LookbehindAssertion extends NodeBase {
186 type: "Assertion";
187 parent: Alternative;
188 kind: "lookbehind";
189 negate: boolean;
190 alternatives: Alternative[];
191 }
192 /**
193 * The quantifier.
194 * E.g. `a?`, `a*`, `a+`, `a{1,2}`, `a??`, `a*?`, `a+?`, `a{1,2}?`
195 */
196 export interface Quantifier extends NodeBase {
197 type: "Quantifier";
198 parent: Alternative;
199 min: number;
200 max: number;
201 greedy: boolean;
202 element: QuantifiableElement;
203 }
204 /**
205 * The character class.
206 * E.g. `[ab]`, `[^ab]`
207 */
208 export type CharacterClass =
209 | ClassRangesCharacterClass
210 | UnicodeSetsCharacterClass;
211 interface BaseCharacterClass extends NodeBase {
212 type: "CharacterClass";
213 parent:
214 | Alternative
215 | ClassIntersection
216 | ClassSubtraction
217 | Quantifier
218 | UnicodeSetsCharacterClass;
219 unicodeSets: boolean;
220 negate: boolean;
221 elements: CharacterClassElement[];
222 }
223 /**
224 * The character class used in legacy (neither `u` nor `v` flag) and Unicode mode (`u` flag).
225 *
226 * This character class is guaranteed to **not** contain strings.
227 *
228 * In Unicode sets mode (`v` flag), {@link UnicodeSetsCharacterClass} is used.
229 */
230 export interface ClassRangesCharacterClass extends BaseCharacterClass {
231 parent: Alternative | Quantifier;
232 unicodeSets: false;
233 elements: ClassRangesCharacterClassElement[];
234 }
235 /**
236 * The character class used in Unicode sets mode (`v` flag).
237 *
238 * This character class may contain strings.
239 */
240 export interface UnicodeSetsCharacterClass extends BaseCharacterClass {
241 parent:
242 | Alternative
243 | ClassIntersection
244 | ClassSubtraction
245 | Quantifier
246 | UnicodeSetsCharacterClass;
247 unicodeSets: true;
248 elements: UnicodeSetsCharacterClassElement[];
249 }
250 /**
251 * The character class.
252 * E.g. `[a-b]`
253 */
254 export interface CharacterClassRange extends NodeBase {
255 type: "CharacterClassRange";
256 parent: CharacterClass;
257 min: Character;
258 max: Character;
259 }
260 /**
261 * The assertion.
262 */
263 export type Assertion = BoundaryAssertion | LookaroundAssertion;
264 /**
265 * The boundary assertion.
266 */
267 export type BoundaryAssertion = EdgeAssertion | WordBoundaryAssertion;
268 /**
269 * The edge boundary assertion.
270 * E.g. `^`, `$`
271 */
272 export interface EdgeAssertion extends NodeBase {
273 type: "Assertion";
274 parent: Alternative | Quantifier;
275 kind: "end" | "start";
276 }
277 /**
278 * The word bondary assertion.
279 * E.g. `\b`, `\B`
280 */
281 export interface WordBoundaryAssertion extends NodeBase {
282 type: "Assertion";
283 parent: Alternative | Quantifier;
284 kind: "word";
285 negate: boolean;
286 }
287 /**
288 * The character set.
289 */
290 export type CharacterSet =
291 | AnyCharacterSet
292 | EscapeCharacterSet
293 | UnicodePropertyCharacterSet;
294 /**
295 * The dot.
296 * E.g. `.`
297 */
298 export interface AnyCharacterSet extends NodeBase {
299 type: "CharacterSet";
300 parent: Alternative | Quantifier;
301 kind: "any";
302 }
303 /**
304 * The character class escape.
305 * E.g. `\d`, `\s`, `\w`, `\D`, `\S`, `\W`
306 */
307 export interface EscapeCharacterSet extends NodeBase {
308 type: "CharacterSet";
309 parent:
310 | Alternative
311 | CharacterClass
312 | ClassIntersection
313 | ClassSubtraction
314 | Quantifier;
315 kind: "digit" | "space" | "word";
316 negate: boolean;
317 }
318 /**
319 * The unicode property escape.
320 * E.g. `\p{ASCII}`, `\P{ASCII}`, `\p{Script=Hiragana}`
321 */
322 export type UnicodePropertyCharacterSet =
323 | CharacterUnicodePropertyCharacterSet
324 | StringsUnicodePropertyCharacterSet;
325 interface BaseUnicodePropertyCharacterSet extends NodeBase {
326 type: "CharacterSet";
327 parent:
328 | Alternative
329 | CharacterClass
330 | ClassIntersection
331 | ClassSubtraction
332 | Quantifier;
333 kind: "property";
334 strings: boolean;
335 key: string;
336 value: string | null;
337 negate: boolean;
338 }
339 export interface CharacterUnicodePropertyCharacterSet
340 extends BaseUnicodePropertyCharacterSet {
341 strings: false;
342 value: string | null;
343 negate: boolean;
344 }
345 /** StringsUnicodePropertyCharacterSet is Unicode property escape with property of strings. */
346 export interface StringsUnicodePropertyCharacterSet
347 extends BaseUnicodePropertyCharacterSet {
348 parent:
349 | Alternative
350 | ClassIntersection
351 | ClassSubtraction
352 | Quantifier
353 | UnicodeSetsCharacterClass;
354 strings: true;
355 value: null;
356 negate: false;
357 }
358 /**
359 * The expression character class.
360 * E.g. `[a--b]`, `[a&&b]`,`[^a--b]`, `[^a&&b]`
361 */
362 export interface ExpressionCharacterClass extends NodeBase {
363 type: "ExpressionCharacterClass";
364 parent:
365 | Alternative
366 | ClassIntersection
367 | ClassSubtraction
368 | Quantifier
369 | UnicodeSetsCharacterClass;
370 negate: boolean;
371 expression: ClassIntersection | ClassSubtraction;
372 }
373 export type ClassSetOperand =
374 | Character
375 | ClassStringDisjunction
376 | EscapeCharacterSet
377 | ExpressionCharacterClass
378 | UnicodePropertyCharacterSet
379 | UnicodeSetsCharacterClass;
380 /**
381 * The character class intersection.
382 * E.g. `a&&b`
383 */
384 export interface ClassIntersection extends NodeBase {
385 type: "ClassIntersection";
386 parent: ClassIntersection | ExpressionCharacterClass;
387 left: ClassIntersection | ClassSetOperand;
388 right: ClassSetOperand;
389 }
390 /**
391 * The character class subtraction.
392 * E.g. `a--b`
393 */
394 export interface ClassSubtraction extends NodeBase {
395 type: "ClassSubtraction";
396 parent: ClassSubtraction | ExpressionCharacterClass;
397 left: ClassSetOperand | ClassSubtraction;
398 right: ClassSetOperand;
399 }
400 /**
401 * The character class string disjunction.
402 * E.g. `\q{a|b}`
403 */
404 export interface ClassStringDisjunction extends NodeBase {
405 type: "ClassStringDisjunction";
406 parent: ClassIntersection | ClassSubtraction | UnicodeSetsCharacterClass;
407 alternatives: StringAlternative[];
408 }
409 /** StringAlternative is only used for `\q{alt}`({@link ClassStringDisjunction}). */
410 export interface StringAlternative extends NodeBase {
411 type: "StringAlternative";
412 parent: ClassStringDisjunction;
413 elements: Character[];
414 }
415 /**
416 * The character.
417 * This includes escape sequences which mean a character.
418 * E.g. `a`, `あ`, `✿`, `\x65`, `\u0065`, `\u{65}`, `\/`
419 */
420 export interface Character extends NodeBase {
421 type: "Character";
422 parent:
423 | Alternative
424 | CharacterClass
425 | CharacterClassRange
426 | ClassIntersection
427 | ClassSubtraction
428 | Quantifier
429 | StringAlternative;
430 value: number;
431 }
432 /**
433 * The backreference.
434 * E.g. `\1`, `\k<name>`
435 */
436 export type Backreference = AmbiguousBackreference | UnambiguousBackreference;
437 interface BaseBackreference extends NodeBase {
438 type: "Backreference";
439 parent: Alternative | Quantifier;
440 ref: number | string;
441 ambiguous: boolean;
442 resolved: CapturingGroup | CapturingGroup[];
443 }
444 export interface AmbiguousBackreference extends BaseBackreference {
445 ref: string;
446 ambiguous: true;
447 resolved: CapturingGroup[];
448 }
449 export interface UnambiguousBackreference extends BaseBackreference {
450 ambiguous: false;
451 resolved: CapturingGroup;
452 }
[0c6b92a]453 /**
454 * The modifiers.
455 */
456 export interface Modifiers extends NodeBase {
457 type: "Modifiers";
458 parent: Group;
459 /**
460 * The add modifier flags.
461 */
462 add: ModifierFlags;
463 /**
464 * The remove modifier flags.
465 *
466 * `null` means no remove modifier flags. e.g. `(?ims:x)`
467 * The reason for `null` is that there is no position where the remove modifier flags appears. Must be behind the minus mark.
468 */
469 remove: ModifierFlags | null;
470 }
471 /**
472 * The modifier flags.
473 */
474 export interface ModifierFlags extends NodeBase {
475 type: "ModifierFlags";
476 parent: Modifiers;
477 dotAll: boolean;
478 ignoreCase: boolean;
479 multiline: boolean;
480 }
[d565449]481 /**
482 * The flags.
483 */
484 export interface Flags extends NodeBase {
485 type: "Flags";
486 parent: RegExpLiteral | null;
487 dotAll: boolean;
488 global: boolean;
489 hasIndices: boolean;
490 ignoreCase: boolean;
491 multiline: boolean;
492 sticky: boolean;
493 unicode: boolean;
494 unicodeSets: boolean;
495 }
496 export {};
497}
498
499declare module "@eslint-community/regexpp/parser" {
500 import type {
501 Flags,
502 RegExpLiteral,
503 Pattern,
504 } from "@eslint-community/regexpp/ast";
505 import type { EcmaVersion } from "@eslint-community/regexpp/ecma-versions";
506 export namespace RegExpParser {
507 /**
508 * The options for RegExpParser construction.
509 */
510 interface Options {
511 /**
512 * The flag to disable Annex B syntax. Default is `false`.
513 */
514 strict?: boolean;
515 /**
516 * ECMAScript version. Default is `2025`.
517 * - `2015` added `u` and `y` flags.
518 * - `2018` added `s` flag, Named Capturing Group, Lookbehind Assertion,
519 * and Unicode Property Escape.
520 * - `2019`, `2020`, and `2021` added more valid Unicode Property Escapes.
521 * - `2022` added `d` flag.
522 * - `2023` added more valid Unicode Property Escapes.
523 * - `2024` added `v` flag.
[0c6b92a]524 * - `2025` added duplicate named capturing groups, modifiers.
[d565449]525 */
526 ecmaVersion?: EcmaVersion;
527 }
528 }
529 export class RegExpParser {
530 /**
531 * Initialize this parser.
532 * @param options The options of parser.
533 */
534 constructor(options?: RegExpParser.Options);
535 /**
536 * Parse a regular expression literal. E.g. "/abc/g"
537 * @param source The source code to parse.
538 * @param start The start index in the source code.
539 * @param end The end index in the source code.
540 * @returns The AST of the given regular expression.
541 */
542 parseLiteral(source: string, start?: number, end?: number): RegExpLiteral;
543 /**
544 * Parse a regular expression flags. E.g. "gim"
545 * @param source The source code to parse.
546 * @param start The start index in the source code.
547 * @param end The end index in the source code.
548 * @returns The AST of the given flags.
549 */
550 parseFlags(source: string, start?: number, end?: number): Flags;
551 /**
552 * Parse a regular expression pattern. E.g. "abc"
553 * @param source The source code to parse.
554 * @param start The start index in the source code.
555 * @param end The end index in the source code.
556 * @param flags The flags.
557 * @returns The AST of the given pattern.
558 */
559 parsePattern(
560 source: string,
561 start?: number,
562 end?: number,
563 flags?: {
564 unicode?: boolean;
565 unicodeSets?: boolean;
566 }
567 ): Pattern;
568 /**
569 * @deprecated Backward compatibility
570 * Use object `flags` instead of boolean `uFlag`.
571 *
572 * @param source The source code to parse.
573 * @param start The start index in the source code.
574 * @param end The end index in the source code.
575 * @param uFlag The flag to set unicode mode.
576 * @returns The AST of the given pattern.
577 */
578 parsePattern(
579 source: string,
580 start?: number,
581 end?: number,
582 uFlag?: boolean
583 ): Pattern;
584 }
585}
586
587declare module "@eslint-community/regexpp/validator" {
588 import type { EcmaVersion } from "@eslint-community/regexpp/ecma-versions";
589 export type RegExpValidatorSourceContext = {
590 readonly source: string;
591 readonly start: number;
592 readonly end: number;
593 readonly kind: "flags" | "literal" | "pattern";
594 };
595 export namespace RegExpValidator {
596 /**
597 * The options for RegExpValidator construction.
598 */
599 interface Options {
600 /**
601 * The flag to disable Annex B syntax. Default is `false`.
602 */
603 strict?: boolean;
604 /**
605 * ECMAScript version. Default is `2025`.
606 * - `2015` added `u` and `y` flags.
607 * - `2018` added `s` flag, Named Capturing Group, Lookbehind Assertion,
608 * and Unicode Property Escape.
609 * - `2019`, `2020`, and `2021` added more valid Unicode Property Escapes.
610 * - `2022` added `d` flag.
611 * - `2023` added more valid Unicode Property Escapes.
612 * - `2024` added `v` flag.
[0c6b92a]613 * - `2025` added duplicate named capturing groups, modifiers.
[d565449]614 */
615 ecmaVersion?: EcmaVersion;
616 /**
617 * A function that is called when the validator entered a RegExp literal.
618 * @param start The 0-based index of the first character.
619 */
620 onLiteralEnter?: (start: number) => void;
621 /**
622 * A function that is called when the validator left a RegExp literal.
623 * @param start The 0-based index of the first character.
624 * @param end The next 0-based index of the last character.
625 */
626 onLiteralLeave?: (start: number, end: number) => void;
627 /**
628 * A function that is called when the validator found flags.
629 * @param start The 0-based index of the first character.
630 * @param end The next 0-based index of the last character.
631 * @param flags.global `g` flag.
632 * @param flags.ignoreCase `i` flag.
633 * @param flags.multiline `m` flag.
634 * @param flags.unicode `u` flag.
635 * @param flags.sticky `y` flag.
636 * @param flags.dotAll `s` flag.
637 * @param flags.hasIndices `d` flag.
638 * @param flags.unicodeSets `v` flag.
639 */
640 onRegExpFlags?: (
641 start: number,
642 end: number,
643 flags: {
644 global: boolean;
645 ignoreCase: boolean;
646 multiline: boolean;
647 unicode: boolean;
648 sticky: boolean;
649 dotAll: boolean;
650 hasIndices: boolean;
651 unicodeSets: boolean;
652 }
653 ) => void;
654 /**
655 * A function that is called when the validator found flags.
656 * @param start The 0-based index of the first character.
657 * @param end The next 0-based index of the last character.
658 * @param global `g` flag.
659 * @param ignoreCase `i` flag.
660 * @param multiline `m` flag.
661 * @param unicode `u` flag.
662 * @param sticky `y` flag.
663 * @param dotAll `s` flag.
664 * @param hasIndices `d` flag.
665 *
666 * @deprecated Use `onRegExpFlags` instead.
667 */
668 onFlags?: (
669 start: number,
670 end: number,
671 global: boolean,
672 ignoreCase: boolean,
673 multiline: boolean,
674 unicode: boolean,
675 sticky: boolean,
676 dotAll: boolean,
677 hasIndices: boolean
678 ) => void;
679 /**
680 * A function that is called when the validator entered a pattern.
681 * @param start The 0-based index of the first character.
682 */
683 onPatternEnter?: (start: number) => void;
684 /**
685 * A function that is called when the validator left a pattern.
686 * @param start The 0-based index of the first character.
687 * @param end The next 0-based index of the last character.
688 */
689 onPatternLeave?: (start: number, end: number) => void;
690 /**
691 * A function that is called when the validator entered a disjunction.
692 * @param start The 0-based index of the first character.
693 */
694 onDisjunctionEnter?: (start: number) => void;
695 /**
696 * A function that is called when the validator left a disjunction.
697 * @param start The 0-based index of the first character.
698 * @param end The next 0-based index of the last character.
699 */
700 onDisjunctionLeave?: (start: number, end: number) => void;
701 /**
702 * A function that is called when the validator entered an alternative.
703 * @param start The 0-based index of the first character.
704 * @param index The 0-based index of alternatives in a disjunction.
705 */
706 onAlternativeEnter?: (start: number, index: number) => void;
707 /**
708 * A function that is called when the validator left an alternative.
709 * @param start The 0-based index of the first character.
710 * @param end The next 0-based index of the last character.
711 * @param index The 0-based index of alternatives in a disjunction.
712 */
713 onAlternativeLeave?: (start: number, end: number, index: number) => void;
714 /**
715 * A function that is called when the validator entered an uncapturing group.
716 * @param start The 0-based index of the first character.
717 */
718 onGroupEnter?: (start: number) => void;
719 /**
720 * A function that is called when the validator left an uncapturing group.
721 * @param start The 0-based index of the first character.
722 * @param end The next 0-based index of the last character.
723 */
724 onGroupLeave?: (start: number, end: number) => void;
[0c6b92a]725 /**
726 * A function that is called when the validator entered a modifiers.
727 * @param start The 0-based index of the first character.
728 */
729 onModifiersEnter?: (start: number) => void;
730 /**
731 * A function that is called when the validator left a modifiers.
732 * @param start The 0-based index of the first character.
733 * @param end The next 0-based index of the last character.
734 */
735 onModifiersLeave?: (start: number, end: number) => void;
736 /**
737 * A function that is called when the validator found an add modifiers.
738 * @param start The 0-based index of the first character.
739 * @param end The next 0-based index of the last character.
740 * @param flags flags.
741 * @param flags.ignoreCase `i` flag.
742 * @param flags.multiline `m` flag.
743 * @param flags.dotAll `s` flag.
744 */
745 onAddModifiers?: (
746 start: number,
747 end: number,
748 flags: {
749 ignoreCase: boolean;
750 multiline: boolean;
751 dotAll: boolean;
752 }
753 ) => void;
754 /**
755 * A function that is called when the validator found a remove modifiers.
756 * @param start The 0-based index of the first character.
757 * @param end The next 0-based index of the last character.
758 * @param flags flags.
759 * @param flags.ignoreCase `i` flag.
760 * @param flags.multiline `m` flag.
761 * @param flags.dotAll `s` flag.
762 */
763 onRemoveModifiers?: (
764 start: number,
765 end: number,
766 flags: {
767 ignoreCase: boolean;
768 multiline: boolean;
769 dotAll: boolean;
770 }
771 ) => void;
[d565449]772 /**
773 * A function that is called when the validator entered a capturing group.
774 * @param start The 0-based index of the first character.
775 * @param name The group name.
776 */
777 onCapturingGroupEnter?: (start: number, name: string | null) => void;
778 /**
779 * A function that is called when the validator left a capturing group.
780 * @param start The 0-based index of the first character.
781 * @param end The next 0-based index of the last character.
782 * @param name The group name.
783 */
784 onCapturingGroupLeave?: (
785 start: number,
786 end: number,
787 name: string | null
788 ) => void;
789 /**
790 * A function that is called when the validator found a quantifier.
791 * @param start The 0-based index of the first character.
792 * @param end The next 0-based index of the last character.
793 * @param min The minimum number of repeating.
794 * @param max The maximum number of repeating.
795 * @param greedy The flag to choose the longest matching.
796 */
797 onQuantifier?: (
798 start: number,
799 end: number,
800 min: number,
801 max: number,
802 greedy: boolean
803 ) => void;
804 /**
805 * A function that is called when the validator entered a lookahead/lookbehind assertion.
806 * @param start The 0-based index of the first character.
807 * @param kind The kind of the assertion.
808 * @param negate The flag which represents that the assertion is negative.
809 */
810 onLookaroundAssertionEnter?: (
811 start: number,
812 kind: "lookahead" | "lookbehind",
813 negate: boolean
814 ) => void;
815 /**
816 * A function that is called when the validator left a lookahead/lookbehind assertion.
817 * @param start The 0-based index of the first character.
818 * @param end The next 0-based index of the last character.
819 * @param kind The kind of the assertion.
820 * @param negate The flag which represents that the assertion is negative.
821 */
822 onLookaroundAssertionLeave?: (
823 start: number,
824 end: number,
825 kind: "lookahead" | "lookbehind",
826 negate: boolean
827 ) => void;
828 /**
829 * A function that is called when the validator found an edge boundary assertion.
830 * @param start The 0-based index of the first character.
831 * @param end The next 0-based index of the last character.
832 * @param kind The kind of the assertion.
833 */
834 onEdgeAssertion?: (
835 start: number,
836 end: number,
837 kind: "end" | "start"
838 ) => void;
839 /**
840 * A function that is called when the validator found a word boundary assertion.
841 * @param start The 0-based index of the first character.
842 * @param end The next 0-based index of the last character.
843 * @param kind The kind of the assertion.
844 * @param negate The flag which represents that the assertion is negative.
845 */
846 onWordBoundaryAssertion?: (
847 start: number,
848 end: number,
849 kind: "word",
850 negate: boolean
851 ) => void;
852 /**
853 * A function that is called when the validator found a dot.
854 * @param start The 0-based index of the first character.
855 * @param end The next 0-based index of the last character.
856 * @param kind The kind of the character set.
857 */
858 onAnyCharacterSet?: (start: number, end: number, kind: "any") => void;
859 /**
860 * A function that is called when the validator found a character set escape.
861 * @param start The 0-based index of the first character.
862 * @param end The next 0-based index of the last character.
863 * @param kind The kind of the character set.
864 * @param negate The flag which represents that the character set is negative.
865 */
866 onEscapeCharacterSet?: (
867 start: number,
868 end: number,
869 kind: "digit" | "space" | "word",
870 negate: boolean
871 ) => void;
872 /**
873 * A function that is called when the validator found a Unicode proerty escape.
874 * @param start The 0-based index of the first character.
875 * @param end The next 0-based index of the last character.
876 * @param kind The kind of the character set.
877 * @param key The property name.
878 * @param value The property value.
879 * @param negate The flag which represents that the character set is negative.
880 * @param strings If true, the given property is property of strings.
881 */
882 onUnicodePropertyCharacterSet?: (
883 start: number,
884 end: number,
885 kind: "property",
886 key: string,
887 value: string | null,
888 negate: boolean,
889 strings: boolean
890 ) => void;
891 /**
892 * A function that is called when the validator found a character.
893 * @param start The 0-based index of the first character.
894 * @param end The next 0-based index of the last character.
895 * @param value The code point of the character.
896 */
897 onCharacter?: (start: number, end: number, value: number) => void;
898 /**
899 * A function that is called when the validator found a backreference.
900 * @param start The 0-based index of the first character.
901 * @param end The next 0-based index of the last character.
902 * @param ref The key of the referred capturing group.
903 */
904 onBackreference?: (
905 start: number,
906 end: number,
907 ref: number | string
908 ) => void;
909 /**
910 * A function that is called when the validator entered a character class.
911 * @param start The 0-based index of the first character.
912 * @param negate The flag which represents that the character class is negative.
913 * @param unicodeSets `true` if unicodeSets mode.
914 */
915 onCharacterClassEnter?: (
916 start: number,
917 negate: boolean,
918 unicodeSets: boolean
919 ) => void;
920 /**
921 * A function that is called when the validator left a character class.
922 * @param start The 0-based index of the first character.
923 * @param end The next 0-based index of the last character.
924 * @param negate The flag which represents that the character class is negative.
925 */
926 onCharacterClassLeave?: (
927 start: number,
928 end: number,
929 negate: boolean
930 ) => void;
931 /**
932 * A function that is called when the validator found a character class range.
933 * @param start The 0-based index of the first character.
934 * @param end The next 0-based index of the last character.
935 * @param min The minimum code point of the range.
936 * @param max The maximum code point of the range.
937 */
938 onCharacterClassRange?: (
939 start: number,
940 end: number,
941 min: number,
942 max: number
943 ) => void;
944 /**
945 * A function that is called when the validator found a class intersection.
946 * @param start The 0-based index of the first character.
947 * @param end The next 0-based index of the last character.
948 */
949 onClassIntersection?: (start: number, end: number) => void;
950 /**
951 * A function that is called when the validator found a class subtraction.
952 * @param start The 0-based index of the first character.
953 * @param end The next 0-based index of the last character.
954 */
955 onClassSubtraction?: (start: number, end: number) => void;
956 /**
957 * A function that is called when the validator entered a class string disjunction.
958 * @param start The 0-based index of the first character.
959 */
960 onClassStringDisjunctionEnter?: (start: number) => void;
961 /**
962 * A function that is called when the validator left a class string disjunction.
963 * @param start The 0-based index of the first character.
964 * @param end The next 0-based index of the last character.
965 */
966 onClassStringDisjunctionLeave?: (start: number, end: number) => void;
967 /**
968 * A function that is called when the validator entered a string alternative.
969 * @param start The 0-based index of the first character.
970 * @param index The 0-based index of alternatives in a disjunction.
971 */
972 onStringAlternativeEnter?: (start: number, index: number) => void;
973 /**
974 * A function that is called when the validator left a string alternative.
975 * @param start The 0-based index of the first character.
976 * @param end The next 0-based index of the last character.
977 * @param index The 0-based index of alternatives in a disjunction.
978 */
979 onStringAlternativeLeave?: (
980 start: number,
981 end: number,
982 index: number
983 ) => void;
984 }
985 }
986 /**
987 * The regular expression validator.
988 */
989 export class RegExpValidator {
990 /**
991 * Initialize this validator.
992 * @param options The options of validator.
993 */
994 constructor(options?: RegExpValidator.Options);
995 /**
996 * Validate a regular expression literal. E.g. "/abc/g"
997 * @param source The source code to validate.
998 * @param start The start index in the source code.
999 * @param end The end index in the source code.
1000 */
1001 validateLiteral(source: string, start?: number, end?: number): void;
1002 /**
1003 * Validate a regular expression flags. E.g. "gim"
1004 * @param source The source code to validate.
1005 * @param start The start index in the source code.
1006 * @param end The end index in the source code.
1007 */
1008 validateFlags(source: string, start?: number, end?: number): void;
1009 /**
1010 * Validate a regular expression pattern. E.g. "abc"
1011 * @param source The source code to validate.
1012 * @param start The start index in the source code.
1013 * @param end The end index in the source code.
1014 * @param flags The flags.
1015 */
1016 validatePattern(
1017 source: string,
1018 start?: number,
1019 end?: number,
1020 flags?: {
1021 unicode?: boolean;
1022 unicodeSets?: boolean;
1023 }
1024 ): void;
1025 /**
1026 * @deprecated Backward compatibility
1027 * Use object `flags` instead of boolean `uFlag`.
1028 * @param source The source code to validate.
1029 * @param start The start index in the source code.
1030 * @param end The end index in the source code.
1031 * @param uFlag The flag to set unicode mode.
1032 */
1033 validatePattern(
1034 source: string,
1035 start?: number,
1036 end?: number,
1037 uFlag?: boolean
1038 ): void;
1039 }
1040}
1041
1042declare module "@eslint-community/regexpp/visitor" {
1043 import type {
1044 Alternative,
1045 Assertion,
1046 Backreference,
1047 CapturingGroup,
1048 Character,
1049 CharacterClass,
1050 CharacterClassRange,
1051 CharacterSet,
1052 ClassIntersection,
1053 ClassStringDisjunction,
1054 ClassSubtraction,
1055 ExpressionCharacterClass,
1056 Flags,
1057 Group,
[0c6b92a]1058 ModifierFlags,
1059 Modifiers,
[d565449]1060 Node,
1061 Pattern,
1062 Quantifier,
1063 RegExpLiteral,
1064 StringAlternative,
1065 } from "@eslint-community/regexpp/ast";
1066 /**
1067 * The visitor to walk on AST.
1068 */
1069 export class RegExpVisitor {
1070 /**
1071 * Initialize this visitor.
1072 * @param handlers Callbacks for each node.
1073 */
1074 constructor(handlers: RegExpVisitor.Handlers);
1075 /**
1076 * Visit a given node and descendant nodes.
1077 * @param node The root node to visit tree.
1078 */
1079 visit(node: Node): void;
1080 }
1081 export namespace RegExpVisitor {
1082 interface Handlers {
1083 onAlternativeEnter?: (node: Alternative) => void;
1084 onAlternativeLeave?: (node: Alternative) => void;
1085 onAssertionEnter?: (node: Assertion) => void;
1086 onAssertionLeave?: (node: Assertion) => void;
1087 onBackreferenceEnter?: (node: Backreference) => void;
1088 onBackreferenceLeave?: (node: Backreference) => void;
1089 onCapturingGroupEnter?: (node: CapturingGroup) => void;
1090 onCapturingGroupLeave?: (node: CapturingGroup) => void;
1091 onCharacterEnter?: (node: Character) => void;
1092 onCharacterLeave?: (node: Character) => void;
1093 onCharacterClassEnter?: (node: CharacterClass) => void;
1094 onCharacterClassLeave?: (node: CharacterClass) => void;
1095 onCharacterClassRangeEnter?: (node: CharacterClassRange) => void;
1096 onCharacterClassRangeLeave?: (node: CharacterClassRange) => void;
1097 onCharacterSetEnter?: (node: CharacterSet) => void;
1098 onCharacterSetLeave?: (node: CharacterSet) => void;
1099 onClassIntersectionEnter?: (node: ClassIntersection) => void;
1100 onClassIntersectionLeave?: (node: ClassIntersection) => void;
1101 onClassStringDisjunctionEnter?: (node: ClassStringDisjunction) => void;
1102 onClassStringDisjunctionLeave?: (node: ClassStringDisjunction) => void;
1103 onClassSubtractionEnter?: (node: ClassSubtraction) => void;
1104 onClassSubtractionLeave?: (node: ClassSubtraction) => void;
1105 onExpressionCharacterClassEnter?: (
1106 node: ExpressionCharacterClass
1107 ) => void;
1108 onExpressionCharacterClassLeave?: (
1109 node: ExpressionCharacterClass
1110 ) => void;
1111 onFlagsEnter?: (node: Flags) => void;
1112 onFlagsLeave?: (node: Flags) => void;
1113 onGroupEnter?: (node: Group) => void;
1114 onGroupLeave?: (node: Group) => void;
[0c6b92a]1115 onModifierFlagsEnter?: (node: ModifierFlags) => void;
1116 onModifierFlagsLeave?: (node: ModifierFlags) => void;
1117 onModifiersEnter?: (node: Modifiers) => void;
1118 onModifiersLeave?: (node: Modifiers) => void;
[d565449]1119 onPatternEnter?: (node: Pattern) => void;
1120 onPatternLeave?: (node: Pattern) => void;
1121 onQuantifierEnter?: (node: Quantifier) => void;
1122 onQuantifierLeave?: (node: Quantifier) => void;
1123 onRegExpLiteralEnter?: (node: RegExpLiteral) => void;
1124 onRegExpLiteralLeave?: (node: RegExpLiteral) => void;
1125 onStringAlternativeEnter?: (node: StringAlternative) => void;
1126 onStringAlternativeLeave?: (node: StringAlternative) => void;
1127 }
1128 }
1129}
1130
1131declare module "@eslint-community/regexpp/regexp-syntax-error" {
1132 import type { RegExpValidatorSourceContext } from "@eslint-community/regexpp/validator";
1133 export class RegExpSyntaxError extends SyntaxError {
1134 index: number;
1135 constructor(message: string, index: number);
1136 }
1137 export function newRegExpSyntaxError(
1138 srcCtx: RegExpValidatorSourceContext,
1139 flags: {
1140 unicode: boolean;
1141 unicodeSets: boolean;
1142 },
1143 index: number,
1144 message: string
1145 ): RegExpSyntaxError;
1146}
1147
1148declare module "@eslint-community/regexpp/ecma-versions" {
1149 export type EcmaVersion =
1150 | 5
1151 | 2015
1152 | 2016
1153 | 2017
1154 | 2018
1155 | 2019
1156 | 2020
1157 | 2021
1158 | 2022
1159 | 2023
1160 | 2024
1161 | 2025;
1162 export const latestEcmaVersion = 2025;
1163}
Note: See TracBrowser for help on using the repository browser.