source: trip-planner-front/node_modules/acorn/dist/acorn.d.ts

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 5.3 KB
Line 
1export as namespace acorn
2export = acorn
3
4declare 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 interface Options {
15 ecmaVersion: 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 'latest'
16 sourceType?: 'script' | 'module'
17 onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
18 onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: Position) => void
19 allowReserved?: boolean | 'never'
20 allowReturnOutsideFunction?: boolean
21 allowImportExportEverywhere?: boolean
22 allowAwaitOutsideFunction?: boolean
23 allowSuperOutsideMethod?: boolean
24 allowHashBang?: boolean
25 locations?: boolean
26 onToken?: ((token: Token) => any) | Token[]
27 onComment?: ((
28 isBlock: boolean, text: string, start: number, end: number, startLoc?: Position,
29 endLoc?: Position
30 ) => void) | Comment[]
31 ranges?: boolean
32 program?: Node
33 sourceFile?: string
34 directSourceFile?: string
35 preserveParens?: boolean
36 }
37
38 class Parser {
39 constructor(options: Options, input: string, startPos?: number)
40 parse(this: Parser): Node
41 static parse(this: typeof Parser, input: string, options: Options): Node
42 static parseExpressionAt(this: typeof Parser, input: string, pos: number, options: Options): Node
43 static tokenizer(this: typeof Parser, input: string, options: Options): {
44 getToken(): Token
45 [Symbol.iterator](): Iterator<Token>
46 }
47 static extend(this: typeof Parser, ...plugins: ((BaseParser: typeof Parser) => typeof Parser)[]): typeof Parser
48 }
49
50 interface Position { line: number; column: number; offset: number }
51
52 const defaultOptions: Options
53
54 function getLineInfo(input: string, offset: number): Position
55
56 class SourceLocation {
57 start: Position
58 end: Position
59 source?: string | null
60 constructor(p: Parser, start: Position, end: Position)
61 }
62
63 class Node {
64 type: string
65 start: number
66 end: number
67 loc?: SourceLocation
68 sourceFile?: string
69 range?: [number, number]
70 constructor(parser: Parser, pos: number, loc?: SourceLocation)
71 }
72
73 class TokenType {
74 label: string
75 keyword: string
76 beforeExpr: boolean
77 startsExpr: boolean
78 isLoop: boolean
79 isAssign: boolean
80 prefix: boolean
81 postfix: boolean
82 binop: number
83 updateContext?: (prevType: TokenType) => void
84 constructor(label: string, conf?: any)
85 }
86
87 const tokTypes: {
88 num: TokenType
89 regexp: TokenType
90 string: TokenType
91 name: TokenType
92 privateId: TokenType
93 eof: TokenType
94 bracketL: TokenType
95 bracketR: TokenType
96 braceL: TokenType
97 braceR: TokenType
98 parenL: TokenType
99 parenR: TokenType
100 comma: TokenType
101 semi: TokenType
102 colon: TokenType
103 dot: TokenType
104 question: TokenType
105 arrow: TokenType
106 template: TokenType
107 ellipsis: TokenType
108 backQuote: TokenType
109 dollarBraceL: TokenType
110 eq: TokenType
111 assign: TokenType
112 incDec: TokenType
113 prefix: TokenType
114 logicalOR: TokenType
115 logicalAND: TokenType
116 bitwiseOR: TokenType
117 bitwiseXOR: TokenType
118 bitwiseAND: TokenType
119 equality: TokenType
120 relational: TokenType
121 bitShift: TokenType
122 plusMin: TokenType
123 modulo: TokenType
124 star: TokenType
125 slash: TokenType
126 starstar: TokenType
127 _break: TokenType
128 _case: TokenType
129 _catch: TokenType
130 _continue: TokenType
131 _debugger: TokenType
132 _default: TokenType
133 _do: TokenType
134 _else: TokenType
135 _finally: TokenType
136 _for: TokenType
137 _function: TokenType
138 _if: TokenType
139 _return: TokenType
140 _switch: TokenType
141 _throw: TokenType
142 _try: TokenType
143 _var: TokenType
144 _const: TokenType
145 _while: TokenType
146 _with: TokenType
147 _new: TokenType
148 _this: TokenType
149 _super: TokenType
150 _class: TokenType
151 _extends: TokenType
152 _export: TokenType
153 _import: TokenType
154 _null: TokenType
155 _true: TokenType
156 _false: TokenType
157 _in: TokenType
158 _instanceof: TokenType
159 _typeof: TokenType
160 _void: TokenType
161 _delete: TokenType
162 }
163
164 class TokContext {
165 constructor(token: string, isExpr: boolean, preserveSpace: boolean, override?: (p: Parser) => void)
166 }
167
168 const tokContexts: {
169 b_stat: TokContext
170 b_expr: TokContext
171 b_tmpl: TokContext
172 p_stat: TokContext
173 p_expr: TokContext
174 q_tmpl: TokContext
175 f_expr: TokContext
176 f_stat: TokContext
177 f_expr_gen: TokContext
178 f_gen: TokContext
179 }
180
181 function isIdentifierStart(code: number, astral?: boolean): boolean
182
183 function isIdentifierChar(code: number, astral?: boolean): boolean
184
185 interface AbstractToken {
186 }
187
188 interface Comment extends AbstractToken {
189 type: string
190 value: string
191 start: number
192 end: number
193 loc?: SourceLocation
194 range?: [number, number]
195 }
196
197 class Token {
198 type: TokenType
199 value: any
200 start: number
201 end: number
202 loc?: SourceLocation
203 range?: [number, number]
204 constructor(p: Parser)
205 }
206
207 function isNewLine(code: number): boolean
208
209 const lineBreak: RegExp
210
211 const lineBreakG: RegExp
212
213 const version: string
214}
Note: See TracBrowser for help on using the repository browser.