Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/acorn/dist/acorn.d.ts
1126 views
1
export as namespace acorn
2
export = acorn
3
4
declare namespace acorn {
5
function parse(input: string, options: Options): Node
6
7
function parseExpressionAt(input: string, pos: number, options: Options): Node
8
9
function tokenizer(input: string, options: Options): {
10
getToken(): Token
11
[Symbol.iterator](): Iterator<Token>
12
}
13
14
type ecmaVersion = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 'latest'
15
16
interface Options {
17
ecmaVersion: ecmaVersion
18
sourceType?: 'script' | 'module'
19
onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
20
onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
21
allowReserved?: boolean | 'never'
22
allowReturnOutsideFunction?: boolean
23
allowImportExportEverywhere?: boolean
24
allowAwaitOutsideFunction?: boolean
25
allowSuperOutsideMethod?: boolean
26
allowHashBang?: boolean
27
locations?: boolean
28
onToken?: ((token: Token) => any) | Token[]
29
onComment?: ((
30
isBlock: boolean, text: string, start: number, end: number, startLoc?: Position,
31
endLoc?: Position
32
) => void) | Comment[]
33
ranges?: boolean
34
program?: Node
35
sourceFile?: string
36
directSourceFile?: string
37
preserveParens?: boolean
38
}
39
40
class Parser {
41
// state.js
42
lineStart: number;
43
options: Options;
44
curLine: number;
45
start: number;
46
end: number;
47
input: string;
48
type: TokenType;
49
50
// state.js
51
constructor(options: Options, input: string, startPos?: number)
52
parse(this: Parser): Node
53
54
// tokenize.js
55
next(): void;
56
nextToken(): void;
57
58
// statement.js
59
parseTopLevel(node: Node): Node;
60
61
// node.js
62
finishNode(node: Node, type: string): Node;
63
finishNodeAt(node: Node, type: string, pos: number, loc: Position): Node;
64
65
// location.js
66
raise(pos: number, message: string) : void;
67
raiseRecoverable?(pos: number, message: string) : void;
68
69
// parseutils.js
70
unexpected(pos: number) : void;
71
72
// index.js
73
static acorn: typeof acorn;
74
75
// state.js
76
static parse(this: typeof Parser, input: string, options: Options): Node
77
static parseExpressionAt(this: typeof Parser, input: string, pos: number, options: Options): Node
78
static tokenizer(this: typeof Parser, input: string, options: Options): {
79
getToken(): Token
80
[Symbol.iterator](): Iterator<Token>
81
}
82
static extend(this: typeof Parser, ...plugins: ((BaseParser: typeof Parser) => typeof Parser)[]): typeof Parser
83
}
84
85
interface Position { line: number; column: number; offset: number }
86
87
const defaultOptions: Options
88
89
function getLineInfo(input: string, offset: number): Position
90
91
class SourceLocation {
92
start: Position
93
end: Position
94
source?: string | null
95
constructor(p: Parser, start: Position, end: Position)
96
}
97
98
class Node {
99
type: string
100
start: number
101
end: number
102
loc?: SourceLocation
103
sourceFile?: string
104
range?: [number, number]
105
constructor(parser: Parser, pos: number, loc?: SourceLocation)
106
}
107
108
class TokenType {
109
label: string
110
keyword: string
111
beforeExpr: boolean
112
startsExpr: boolean
113
isLoop: boolean
114
isAssign: boolean
115
prefix: boolean
116
postfix: boolean
117
binop: number
118
updateContext?: (prevType: TokenType) => void
119
constructor(label: string, conf?: any)
120
}
121
122
const tokTypes: {
123
num: TokenType
124
regexp: TokenType
125
string: TokenType
126
name: TokenType
127
privateId: TokenType
128
eof: TokenType
129
bracketL: TokenType
130
bracketR: TokenType
131
braceL: TokenType
132
braceR: TokenType
133
parenL: TokenType
134
parenR: TokenType
135
comma: TokenType
136
semi: TokenType
137
colon: TokenType
138
dot: TokenType
139
question: TokenType
140
questionDot: TokenType
141
arrow: TokenType
142
template: TokenType
143
invalidTemplate: TokenType
144
ellipsis: TokenType
145
backQuote: TokenType
146
dollarBraceL: TokenType
147
eq: TokenType
148
assign: TokenType
149
incDec: TokenType
150
prefix: TokenType
151
logicalOR: TokenType
152
logicalAND: TokenType
153
bitwiseOR: TokenType
154
bitwiseXOR: TokenType
155
bitwiseAND: TokenType
156
equality: TokenType
157
relational: TokenType
158
bitShift: TokenType
159
plusMin: TokenType
160
modulo: TokenType
161
star: TokenType
162
slash: TokenType
163
starstar: TokenType
164
coalesce: TokenType
165
_break: TokenType
166
_case: TokenType
167
_catch: TokenType
168
_continue: TokenType
169
_debugger: TokenType
170
_default: TokenType
171
_do: TokenType
172
_else: TokenType
173
_finally: TokenType
174
_for: TokenType
175
_function: TokenType
176
_if: TokenType
177
_return: TokenType
178
_switch: TokenType
179
_throw: TokenType
180
_try: TokenType
181
_var: TokenType
182
_const: TokenType
183
_while: TokenType
184
_with: TokenType
185
_new: TokenType
186
_this: TokenType
187
_super: TokenType
188
_class: TokenType
189
_extends: TokenType
190
_export: TokenType
191
_import: TokenType
192
_null: TokenType
193
_true: TokenType
194
_false: TokenType
195
_in: TokenType
196
_instanceof: TokenType
197
_typeof: TokenType
198
_void: TokenType
199
_delete: TokenType
200
}
201
202
class TokContext {
203
constructor(token: string, isExpr: boolean, preserveSpace: boolean, override?: (p: Parser) => void)
204
}
205
206
const tokContexts: {
207
b_stat: TokContext
208
b_expr: TokContext
209
b_tmpl: TokContext
210
p_stat: TokContext
211
p_expr: TokContext
212
q_tmpl: TokContext
213
f_expr: TokContext
214
f_stat: TokContext
215
f_expr_gen: TokContext
216
f_gen: TokContext
217
}
218
219
function isIdentifierStart(code: number, astral?: boolean): boolean
220
221
function isIdentifierChar(code: number, astral?: boolean): boolean
222
223
interface AbstractToken {
224
}
225
226
interface Comment extends AbstractToken {
227
type: string
228
value: string
229
start: number
230
end: number
231
loc?: SourceLocation
232
range?: [number, number]
233
}
234
235
class Token {
236
type: TokenType
237
value: any
238
start: number
239
end: number
240
loc?: SourceLocation
241
range?: [number, number]
242
constructor(p: Parser)
243
}
244
245
function isNewLine(code: number): boolean
246
247
const lineBreak: RegExp
248
249
const lineBreakG: RegExp
250
251
const version: string
252
}
253
254