-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
116 lines (98 loc) · 2.6 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
declare module 'regulex-cjs' {
export type Node = ExactNode | CharsetNode | GroupNode | ChoiceNode | AssertNode | DotNode | BackrefNode | EmptyNode;
interface BaseNode {
type: string;
raw: string;
indices: [ number, number ];
repeat?: {
min: number;
max: number;
nonGreedy: boolean;
}
}
interface ExactNode extends BaseNode {
type: 'exact';
chars: string;
}
interface CharsetNode extends BaseNode {
type: 'charset';
ranges: string[];
classes: string[];
chars: string;
exclude: boolean;
}
interface GroupNode extends BaseNode {
type: 'group';
nonCapture?: boolean;
num: number;
sub: Node[],
endParenIndex: number;
}
interface ChoiceNode extends BaseNode {
type: 'choice';
branches: Array<Node>[];
}
interface AssertNodeWithSub {
type: 'assert';
assertionType: 'AssertLookahead' | 'AssertNegativeLookahead';
sub: Node[];
}
interface AssertNodeWithoutSub {
type: 'assert';
assertionType: 'AssertNonWordBoundary' | 'AssertWordBoundary' | 'AssertEnd' | 'AssertBegin';
}
type AssertNode = AssertNodeWithSub | AssertNodeWithoutSub;
interface DotNode {
type: 'dot';
}
interface BackrefNode {
type: 'backref';
num: number;
}
interface EmptyNode {
type: 'empty'
}
export interface AST {
raw: string;
tree: Node[]
groupCount: number;
}
interface IVisualizeColorSet {
startPoint?: string;
endPoint?: string;
background?: string;
dotBackground?: string;
dotText?: string;
exactBackground?: string;
backrefBackground?: string;
backrefText?: string;
charsetCharBackground?: string;
charsetCharText?: string;
charsetClassBackground?: string;
charsetClassText?: string;
charsetRangeBackground?: string;
charsetRangeText?: string;
charsetBoxExcludeBackground?: string;
charsetBoxBackground?: string;
charsetLabelExclude?: string;
assertNonWordBoundaryBackground?: string;
assertNonWordBoundaryText?: string;
assertWordBoundaryBackground?: string;
assertWordBoundaryText?: string;
assertEndBackground?: string;
assertEndText?: string;
assertBeginBackground?: string;
assertBeginText?: string;
repeatPath?: string;
smoothPath?: string;
normalPath?: string;
greedySkipPath?: string;
nonGreedySkipPath?: string;
}
interface IVisualizeOption {
color?: IVisualizeColorSet;
}
export function parse(regex: string): AST;
export const Raphael: any;
export function visualize(ast: AST, flag: string, paper: any, options?: IVisualizeOption);
}