-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathmain.d.ts
176 lines (167 loc) · 3.92 KB
/
main.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/*---------------------------------------------------------
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/
export interface WebAssemblyInstantiator {
(importObject: Record<string, Record<string, WebAssembly.ImportValue>> | undefined): Promise<WebAssembly.WebAssemblyInstantiatedSource>;
}
interface ICommonOptions {
print?(str: string): void;
}
interface IInstantiatorOptions extends ICommonOptions {
instantiator: WebAssemblyInstantiator;
}
interface IDataOptions extends ICommonOptions {
data: ArrayBufferView | ArrayBuffer | Response;
}
export type IOptions = IInstantiatorOptions | IDataOptions;
export function loadWASM(options: IOptions): Promise<void>;
export function loadWASM(data: ArrayBufferView | ArrayBuffer | Response): Promise<void>;
export function createOnigString(str: string): OnigString;
export function createOnigScanner(patterns: string[]): OnigScanner;
export function setDefaultDebugCall(defaultDebugCall: boolean): void;
export class OnigString {
readonly content: string;
constructor(content: string);
public dispose(): void;
}
export const enum FindOption {
/**
* equivalent of ONIG_OPTION_DEFAULT
*/
Default,
/**
* equivalent of ONIG_OPTION_NONE
*/
None,
/**
* equivalent of ONIG_OPTION_IGNORECASE
*/
Ignorecase,
/**
* equivalent of ONIG_OPTION_EXTEND
*/
Extend,
/**
* equivalent of ONIG_OPTION_MULTILINE
*/
Multiline,
/**
* equivalent of ONIG_OPTION_SINGLELINE
*/
Singleline,
/**
* equivalent of ONIG_OPTION_FIND_LONGEST
*/
FindLongest,
/**
* equivalent of ONIG_OPTION_FIND_NOT_EMPTY
*/
FindNotEmpty,
/**
* equivalent of ONIG_OPTION_NEGATE_SINGLELINE
*/
NegateSingleline,
/**
* equivalent of ONIG_OPTION_DONT_CAPTURE_GROUP
*/
DontCaptureGroup,
/**
* equivalent of ONIG_OPTION_CAPTURE_GROUP
*/
CaptureGroup,
/**
* equivalent of ONIG_OPTION_NOTBOL
*/
Notbol,
/**
* equivalent of ONIG_OPTION_NOTEOL
*/
Noteol,
/**
* equivalent of ONIG_OPTION_CHECK_VALIDITY_OF_STRING
*/
CheckValidityOfString,
/**
* equivalent of ONIG_OPTION_IGNORECASE_IS_ASCII
*/
IgnorecaseIsAscii,
/**
* equivalent of ONIG_OPTION_WORD_IS_ASCII
*/
WordIsAscii,
/**
* equivalent of ONIG_OPTION_DIGIT_IS_ASCII
*/
DigitIsAscii,
/**
* equivalent of ONIG_OPTION_SPACE_IS_ASCII
*/
SpaceIsAscii,
/**
* equivalent of ONIG_OPTION_POSIX_IS_ASCII
*/
PosixIsAscii,
/**
* equivalent of ONIG_OPTION_TEXT_SEGMENT_EXTENDED_GRAPHEME_CLUSTER
*/
TextSegmentExtendedGraphemeCluster,
/**
* equivalent of ONIG_OPTION_TEXT_SEGMENT_WORD
*/
TextSegmentWord,
/**
* equivalent of ONIG_OPTION_NOT_BEGIN_STRING: (str) isn't considered as begin of string (* fail \A)
*/
NotBeginString,
/**
* equivalent of ONIG_OPTION_NOT_END_STRING: (end) isn't considered as end of string (* fail \z, \Z)
*/
NotEndString,
/**
* equivalent of ONIG_OPTION_NOT_BEGIN_POSITION: (start) isn't considered as start position of search (* fail \G)
*/
NotBeginPosition,
/**
* equivalent of ONIG_OPTION_
*/
CallbackEachMatch,
/**
* used for debugging purposes.
*/
DebugCall
}
export const enum Syntax {
Default,
Asis,
PosixBasic,
PosixExtended,
Emacs,
Grep,
GnuRegex,
Java,
Perl,
PerlNg,
Ruby,
Python,
Oniguruma
}
export interface IOnigScannerConfig {
options?: FindOption[],
syntax?: Syntax
}
export class OnigScanner {
constructor(patterns: string[], config?: IOnigScannerConfig);
public dispose(): void;
public findNextMatchSync(string: string | OnigString, startPosition: number, options: FindOption[]): IOnigMatch | null;
public findNextMatchSync(string: string | OnigString, startPosition: number, debugCall: boolean): IOnigMatch | null;
public findNextMatchSync(string: string | OnigString, startPosition: number): IOnigMatch | null;
}
export interface IOnigCaptureIndex {
start: number
end: number
length: number
}
export interface IOnigMatch {
index: number
captureIndices: IOnigCaptureIndex[]
}