meriyah 6.1.0 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/meriyah.cjs +1015 -978
- package/dist/meriyah.min.mjs +1 -1
- package/dist/meriyah.mjs +1015 -978
- package/dist/meriyah.umd.js +1015 -978
- package/dist/meriyah.umd.min.js +1 -1
- package/dist/types/common.d.ts +32 -65
- package/dist/types/errors.d.ts +6 -5
- package/dist/types/estree.d.ts +5 -7
- package/dist/types/lexer/comments.d.ts +8 -6
- package/dist/types/lexer/common.d.ts +5 -5
- package/dist/types/lexer/identifier.d.ts +8 -7
- package/dist/types/lexer/jsx.d.ts +6 -5
- package/dist/types/lexer/numeric.d.ts +4 -3
- package/dist/types/lexer/regexp.d.ts +3 -2
- package/dist/types/lexer/scan.d.ts +4 -3
- package/dist/types/lexer/string.d.ts +5 -4
- package/dist/types/lexer/template.d.ts +4 -3
- package/dist/types/parser/parser.d.ts +51 -0
- package/dist/types/parser.d.ts +99 -99
- package/package.json +1 -1
package/dist/types/common.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Token } from './token';
|
|
2
2
|
import { Errors } from './errors';
|
|
3
|
-
import
|
|
3
|
+
import type * as ESTree from './estree';
|
|
4
|
+
import { type Parser } from './parser/parser';
|
|
4
5
|
export declare const enum Context {
|
|
5
6
|
None = 0,
|
|
6
7
|
OptionsNext = 1,
|
|
@@ -133,9 +134,9 @@ export declare const enum ScopeKind {
|
|
|
133
134
|
ArrowParams = 1024,
|
|
134
135
|
CatchIdentifier = 2048
|
|
135
136
|
}
|
|
136
|
-
export type OnComment = (type:
|
|
137
|
+
export type OnComment = (type: ESTree.CommentType, value: string, start: number, end: number, loc: ESTree.SourceLocation) => any;
|
|
137
138
|
export type OnInsertedSemicolon = (pos: number) => any;
|
|
138
|
-
export type OnToken = (token: string, start: number, end: number, loc: SourceLocation) => any;
|
|
139
|
+
export type OnToken = (token: string, start: number, end: number, loc: ESTree.SourceLocation) => any;
|
|
139
140
|
export interface ScopeState {
|
|
140
141
|
parent: ScopeState | undefined;
|
|
141
142
|
type: ScopeKind;
|
|
@@ -154,72 +155,38 @@ export interface PrivateScopeState {
|
|
|
154
155
|
export interface ScopeError {
|
|
155
156
|
type: Errors;
|
|
156
157
|
params: string[];
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
column: number;
|
|
160
|
-
tokenIndex: number;
|
|
161
|
-
tokenLine: number;
|
|
162
|
-
tokenColumn: number;
|
|
158
|
+
start: Location;
|
|
159
|
+
end: Location;
|
|
163
160
|
}
|
|
164
|
-
export
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
tokenLine: number;
|
|
174
|
-
startIndex: number;
|
|
175
|
-
startColumn: number;
|
|
176
|
-
startLine: number;
|
|
177
|
-
getToken(): Token;
|
|
178
|
-
setToken(token: Token, replaceLast?: boolean): Token;
|
|
179
|
-
onComment: OnComment | void;
|
|
180
|
-
onInsertedSemicolon: OnInsertedSemicolon | void;
|
|
181
|
-
onToken: OnToken | void;
|
|
182
|
-
tokenValue: any;
|
|
183
|
-
tokenRaw: string;
|
|
184
|
-
tokenRegExp: void | {
|
|
185
|
-
pattern: string;
|
|
186
|
-
flags: string;
|
|
187
|
-
};
|
|
188
|
-
sourceFile: string | void;
|
|
189
|
-
assignable: AssignmentKind | DestructuringKind;
|
|
190
|
-
destructible: AssignmentKind | DestructuringKind;
|
|
191
|
-
currentChar: number;
|
|
192
|
-
exportedNames: any;
|
|
193
|
-
exportedBindings: any;
|
|
194
|
-
leadingDecorators: Decorator[];
|
|
195
|
-
}
|
|
196
|
-
export declare function matchOrInsertSemicolon(parser: ParserState, context: Context): void;
|
|
197
|
-
export declare function isValidStrictMode(parser: ParserState, index: number, tokenIndex: number, tokenValue: string): 0 | 1;
|
|
198
|
-
export declare function optionalBit(parser: ParserState, context: Context, t: Token): 0 | 1;
|
|
199
|
-
export declare function consumeOpt(parser: ParserState, context: Context, t: Token): boolean;
|
|
200
|
-
export declare function consume(parser: ParserState, context: Context, t: Token): void;
|
|
201
|
-
export declare function reinterpretToPattern(state: ParserState, node: any): void;
|
|
202
|
-
export declare function validateBindingIdentifier(parser: ParserState, context: Context, kind: BindingKind, t: Token, skipEvalArgCheck: 0 | 1): void;
|
|
203
|
-
export declare function validateFunctionName(parser: ParserState, context: Context, t: Token): void;
|
|
204
|
-
export declare function isStrictReservedWord(parser: ParserState, context: Context, t: Token): boolean;
|
|
161
|
+
export declare function matchOrInsertSemicolon(parser: Parser, context: Context): void;
|
|
162
|
+
export declare function isValidStrictMode(parser: Parser, index: number, tokenIndex: number, tokenValue: string): 0 | 1;
|
|
163
|
+
export declare function optionalBit(parser: Parser, context: Context, t: Token): 0 | 1;
|
|
164
|
+
export declare function consumeOpt(parser: Parser, context: Context, t: Token): boolean;
|
|
165
|
+
export declare function consume(parser: Parser, context: Context, t: Token): void;
|
|
166
|
+
export declare function reinterpretToPattern(state: Parser, node: any): void;
|
|
167
|
+
export declare function validateBindingIdentifier(parser: Parser, context: Context, kind: BindingKind, t: Token, skipEvalArgCheck: 0 | 1): void;
|
|
168
|
+
export declare function validateFunctionName(parser: Parser, context: Context, t: Token): void;
|
|
169
|
+
export declare function isStrictReservedWord(parser: Parser, context: Context, t: Token): boolean;
|
|
205
170
|
export declare function isPropertyWithPrivateFieldKey(expr: any): boolean;
|
|
206
|
-
export declare function isValidLabel(parser:
|
|
207
|
-
export declare function validateAndDeclareLabel(parser:
|
|
208
|
-
export declare function
|
|
209
|
-
export declare function
|
|
210
|
-
export declare function recordScopeError(parser: ParserState, type: Errors, ...params: string[]): ScopeError;
|
|
171
|
+
export declare function isValidLabel(parser: Parser, labels: any, name: string, isIterationStatement: 0 | 1): 0 | 1;
|
|
172
|
+
export declare function validateAndDeclareLabel(parser: Parser, labels: any, name: string): void;
|
|
173
|
+
export declare function createArrowHeadParsingScope(parser: Parser, context: Context, value: string): ScopeState;
|
|
174
|
+
export declare function recordScopeError(parser: Parser, type: Errors, ...params: string[]): ScopeError;
|
|
211
175
|
export declare function createScope(): ScopeState;
|
|
212
176
|
export declare function addChildScope(parent: ScopeState | undefined, type: ScopeKind): ScopeState;
|
|
213
177
|
export declare function addChildPrivateScope(parent: PrivateScopeState | undefined): PrivateScopeState;
|
|
214
|
-
export declare function addVarOrBlock(parser:
|
|
215
|
-
export declare function addBlockName(parser:
|
|
216
|
-
export declare function addVarName(parser:
|
|
217
|
-
export declare function addPrivateIdentifier(parser:
|
|
218
|
-
export declare function addPrivateIdentifierRef(parser:
|
|
178
|
+
export declare function addVarOrBlock(parser: Parser, context: Context, scope: ScopeState, name: string, kind: BindingKind, origin: Origin): void;
|
|
179
|
+
export declare function addBlockName(parser: Parser, context: Context, scope: any, name: string, kind: BindingKind, origin: Origin): void;
|
|
180
|
+
export declare function addVarName(parser: Parser, context: Context, scope: ScopeState, name: string, kind: BindingKind): void;
|
|
181
|
+
export declare function addPrivateIdentifier(parser: Parser, scope: PrivateScopeState, name: string, kind: PropertyKind): void;
|
|
182
|
+
export declare function addPrivateIdentifierRef(parser: Parser, scope: PrivateScopeState, name: string): void;
|
|
219
183
|
export declare function validatePrivateIdentifierRefs(scope: PrivateScopeState): void;
|
|
220
|
-
export declare function declareUnboundVariable(parser:
|
|
221
|
-
export declare function addBindingToExports(parser:
|
|
222
|
-
export declare function pushComment(context: Context, array: any[]): OnComment;
|
|
223
|
-
export declare function pushToken(context: Context, array: any[]): OnToken;
|
|
184
|
+
export declare function declareUnboundVariable(parser: Parser, name: string): void;
|
|
185
|
+
export declare function addBindingToExports(parser: Parser, name: string): void;
|
|
224
186
|
export declare function isValidIdentifier(context: Context, t: Token): boolean;
|
|
225
|
-
export declare function classifyIdentifier(parser:
|
|
187
|
+
export declare function classifyIdentifier(parser: Parser, context: Context, t: Token): any;
|
|
188
|
+
export type Location = {
|
|
189
|
+
index: number;
|
|
190
|
+
line: number;
|
|
191
|
+
column: number;
|
|
192
|
+
};
|
package/dist/types/errors.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type _Node, type SourceLocation } from './estree';
|
|
2
|
-
import { type
|
|
2
|
+
import { type ScopeError, type Location } from './common';
|
|
3
|
+
import { type Parser } from './parser/parser';
|
|
3
4
|
export declare const enum Errors {
|
|
4
5
|
Unexpected = 0,
|
|
5
6
|
StrictOctalEscape = 1,
|
|
@@ -189,9 +190,9 @@ export declare class ParseError extends SyntaxError implements _Node {
|
|
|
189
190
|
range: [number, number];
|
|
190
191
|
loc: SourceLocation;
|
|
191
192
|
description: string;
|
|
192
|
-
constructor(start:
|
|
193
|
+
constructor(start: Location, end: Location, type: Errors, ...params: string[]);
|
|
193
194
|
}
|
|
194
|
-
export declare function report(parser:
|
|
195
|
+
export declare function report(parser: Parser, type: Errors, ...params: string[]): never;
|
|
195
196
|
export declare function reportScopeError(scope: ScopeError): never;
|
|
196
|
-
export declare function reportMessageAt(
|
|
197
|
-
export declare function reportScannerError(
|
|
197
|
+
export declare function reportMessageAt(start: Location, end: Location, type: Errors, ...params: string[]): never;
|
|
198
|
+
export declare function reportScannerError(start: Location, end: Location, type: Errors): never;
|
package/dist/types/estree.d.ts
CHANGED
|
@@ -17,12 +17,9 @@ export type Labels = any;
|
|
|
17
17
|
export type IdentifierOrExpression = Identifier | Expression | ArrowFunctionExpression;
|
|
18
18
|
export type ArgumentExpression = ArrayExpression | AssignmentExpression | ConditionalExpression | Literal | SpreadElement | BinaryExpression | LogicalExpression | SequenceExpression;
|
|
19
19
|
export type CommentType = 'SingleLine' | 'MultiLine' | 'HTMLOpen' | 'HTMLClose' | 'HashbangComment';
|
|
20
|
-
export interface Comment {
|
|
20
|
+
export interface Comment extends _Node {
|
|
21
21
|
type: CommentType;
|
|
22
22
|
value: string;
|
|
23
|
-
start?: number;
|
|
24
|
-
end?: number;
|
|
25
|
-
loc?: SourceLocation | null;
|
|
26
23
|
}
|
|
27
24
|
export type Node = ArrayExpression | ArrayPattern | ArrowFunctionExpression | AssignmentExpression | AssignmentPattern | AwaitExpression | BigIntLiteral | BinaryExpression | BlockStatement | BreakStatement | CallExpression | ChainExpression | ImportExpression | CatchClause | ClassBody | ClassDeclaration | ClassExpression | ConditionalExpression | ContinueStatement | DebuggerStatement | Decorator | DoWhileStatement | EmptyStatement | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | ExportSpecifier | ExpressionStatement | PropertyDefinition | ForInStatement | ForOfStatement | ForStatement | FunctionDeclaration | FunctionExpression | Identifier | IfStatement | Import | ImportDeclaration | ImportDefaultSpecifier | ImportAttribute | ImportNamespaceSpecifier | ImportSpecifier | JSXNamespacedName | JSXAttribute | JSXClosingElement | JSXClosingFragment | JSXElement | JSXEmptyExpression | JSXExpressionContainer | JSXFragment | JSXIdentifier | JSXOpeningElement | JSXOpeningFragment | JSXSpreadAttribute | JSXSpreadChild | JSXMemberExpression | JSXText | LabeledStatement | Literal | LogicalExpression | MemberExpression | MetaProperty | MethodDefinition | NewExpression | ObjectExpression | ObjectPattern | ParenthesizedExpression | PrivateIdentifier | Program | Property | RegExpLiteral | RestElement | ReturnStatement | SequenceExpression | SpreadElement | StaticBlock | Super | SwitchCase | SwitchStatement | TaggedTemplateExpression | TemplateElement | TemplateLiteral | ThisExpression | ThrowStatement | TryStatement | UpdateExpression | UnaryExpression | VariableDeclaration | VariableDeclarator | WhileStatement | WithStatement | YieldExpression;
|
|
28
25
|
export type BindingPattern = ArrayPattern | ObjectPattern | Identifier;
|
|
@@ -122,7 +119,7 @@ export interface CallExpression extends _Node {
|
|
|
122
119
|
type: 'CallExpression';
|
|
123
120
|
callee: any;
|
|
124
121
|
arguments: (Expression | SpreadElement)[];
|
|
125
|
-
optional
|
|
122
|
+
optional: boolean;
|
|
126
123
|
}
|
|
127
124
|
export interface CatchClause extends _Node {
|
|
128
125
|
type: 'CatchClause';
|
|
@@ -212,6 +209,7 @@ export interface ExportSpecifier extends _Node {
|
|
|
212
209
|
export interface ExpressionStatement extends _Node {
|
|
213
210
|
type: 'ExpressionStatement';
|
|
214
211
|
expression: Expression;
|
|
212
|
+
directive?: string;
|
|
215
213
|
}
|
|
216
214
|
export interface ForInStatement extends _Node {
|
|
217
215
|
type: 'ForInStatement';
|
|
@@ -364,8 +362,8 @@ export interface MemberExpression extends _Node {
|
|
|
364
362
|
type: 'MemberExpression';
|
|
365
363
|
object: Expression | Super;
|
|
366
364
|
property: Expression | PrivateIdentifier;
|
|
367
|
-
computed
|
|
368
|
-
optional
|
|
365
|
+
computed: boolean;
|
|
366
|
+
optional: boolean;
|
|
369
367
|
}
|
|
370
368
|
export type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression;
|
|
371
369
|
export interface MetaProperty extends _Node {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { LexerState } from './common';
|
|
2
|
-
import { Context
|
|
2
|
+
import { Context } from '../common';
|
|
3
|
+
import { type Parser } from '../parser/parser';
|
|
4
|
+
import type * as ESTree from '../estree';
|
|
3
5
|
export declare const enum CommentType {
|
|
4
6
|
Single = 0,
|
|
5
7
|
Multi = 1,
|
|
@@ -7,8 +9,8 @@ export declare const enum CommentType {
|
|
|
7
9
|
HTMLClose = 3,
|
|
8
10
|
HashBang = 4
|
|
9
11
|
}
|
|
10
|
-
export declare const CommentTypes:
|
|
11
|
-
export declare function skipHashBang(parser:
|
|
12
|
-
export declare function skipSingleHTMLComment(parser:
|
|
13
|
-
export declare function skipSingleLineComment(parser:
|
|
14
|
-
export declare function skipMultiLineComment(parser:
|
|
12
|
+
export declare const CommentTypes: ESTree.CommentType[];
|
|
13
|
+
export declare function skipHashBang(parser: Parser): void;
|
|
14
|
+
export declare function skipSingleHTMLComment(parser: Parser, source: string, state: LexerState, context: Context, type: CommentType, start: number, line: number, column: number): LexerState;
|
|
15
|
+
export declare function skipSingleLineComment(parser: Parser, source: string, state: LexerState, type: CommentType, start: number, line: number, column: number): LexerState;
|
|
16
|
+
export declare function skipMultiLineComment(parser: Parser, source: string, state: LexerState): LexerState | void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Token } from '../token';
|
|
2
|
-
import { type
|
|
2
|
+
import { type Parser } from '../parser/parser';
|
|
3
3
|
export declare const enum LexerState {
|
|
4
4
|
None = 0,
|
|
5
5
|
NewLine = 1,
|
|
@@ -16,10 +16,10 @@ export declare const enum NumberKind {
|
|
|
16
16
|
ValidBigIntKind = 128,
|
|
17
17
|
DecimalNumberKind = 48
|
|
18
18
|
}
|
|
19
|
-
export declare function advanceChar(parser:
|
|
20
|
-
export declare function consumePossibleSurrogatePair(parser:
|
|
21
|
-
export declare function consumeLineFeed(parser:
|
|
22
|
-
export declare function scanNewLine(parser:
|
|
19
|
+
export declare function advanceChar(parser: Parser): number;
|
|
20
|
+
export declare function consumePossibleSurrogatePair(parser: Parser): number;
|
|
21
|
+
export declare function consumeLineFeed(parser: Parser, state: LexerState): void;
|
|
22
|
+
export declare function scanNewLine(parser: Parser): void;
|
|
23
23
|
export declare function isExoticECMAScriptWhitespace(ch: number): boolean;
|
|
24
24
|
export declare function toHex(code: number): number;
|
|
25
25
|
export declare function convertTokenType(t: Token): string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from '../common';
|
|
2
|
+
import { type Parser } from '../parser/parser';
|
|
2
3
|
import { Token } from '../token';
|
|
3
|
-
export declare function scanIdentifier(parser:
|
|
4
|
-
export declare function scanUnicodeIdentifier(parser:
|
|
5
|
-
export declare function scanIdentifierSlowCase(parser:
|
|
6
|
-
export declare function scanPrivateIdentifier(parser:
|
|
7
|
-
export declare function scanIdentifierUnicodeEscape(parser:
|
|
8
|
-
export declare function scanUnicodeEscape(parser:
|
|
4
|
+
export declare function scanIdentifier(parser: Parser, context: Context, isValidAsKeyword: 0 | 1): Token;
|
|
5
|
+
export declare function scanUnicodeIdentifier(parser: Parser, context: Context): Token;
|
|
6
|
+
export declare function scanIdentifierSlowCase(parser: Parser, context: Context, hasEscape: 0 | 1, isValidAsKeyword: number): Token;
|
|
7
|
+
export declare function scanPrivateIdentifier(parser: Parser): Token;
|
|
8
|
+
export declare function scanIdentifierUnicodeEscape(parser: Parser): number;
|
|
9
|
+
export declare function scanUnicodeEscape(parser: Parser): number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Token } from '../token';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
2
|
+
import { Context } from '../common';
|
|
3
|
+
import { type Parser } from '../parser/parser';
|
|
4
|
+
export declare function scanJSXAttributeValue(parser: Parser, context: Context): Token;
|
|
5
|
+
export declare function scanJSXString(parser: Parser, context: Context): Token;
|
|
6
|
+
export declare function nextJSXToken(parser: Parser, context: Context): void;
|
|
7
|
+
export declare function rescanJSXIdentifier(parser: Parser): Token;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from '../common';
|
|
2
|
+
import { type Parser } from '../parser/parser';
|
|
2
3
|
import { Token } from '../token';
|
|
3
4
|
import { NumberKind } from './common';
|
|
4
|
-
export declare function scanNumber(parser:
|
|
5
|
-
export declare function scanDecimalDigitsOrSeparator(parser:
|
|
5
|
+
export declare function scanNumber(parser: Parser, context: Context, kind: NumberKind): Token;
|
|
6
|
+
export declare function scanDecimalDigitsOrSeparator(parser: Parser, char: number): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { Context
|
|
1
|
+
import { Context } from '../common';
|
|
2
|
+
import { type Parser } from '../parser/parser';
|
|
2
3
|
import { Token } from '../token';
|
|
3
|
-
export declare function scanRegularExpression(parser:
|
|
4
|
+
export declare function scanRegularExpression(parser: Parser, context: Context): Token;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Token } from '../token';
|
|
2
|
-
import {
|
|
2
|
+
import { Context } from '../common';
|
|
3
|
+
import { type Parser } from '../parser/parser';
|
|
3
4
|
import { LexerState } from './common';
|
|
4
5
|
export declare const TokenLookup: Token[];
|
|
5
|
-
export declare function nextToken(parser:
|
|
6
|
-
export declare function scanSingleToken(parser:
|
|
6
|
+
export declare function nextToken(parser: Parser, context: Context): void;
|
|
7
|
+
export declare function scanSingleToken(parser: Parser, context: Context, state: LexerState): Token;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from '../common';
|
|
2
|
+
import { type Parser } from '../parser/parser';
|
|
2
3
|
import { Token } from '../token';
|
|
3
4
|
export declare const enum Escape {
|
|
4
5
|
Empty = -1,
|
|
@@ -7,6 +8,6 @@ export declare const enum Escape {
|
|
|
7
8
|
InvalidHex = -4,
|
|
8
9
|
OutOfRange = -5
|
|
9
10
|
}
|
|
10
|
-
export declare function scanString(parser:
|
|
11
|
-
export declare function parseEscape(parser:
|
|
12
|
-
export declare function handleStringError(state:
|
|
11
|
+
export declare function scanString(parser: Parser, context: Context, quote: number): Token;
|
|
12
|
+
export declare function parseEscape(parser: Parser, context: Context, first: number, isTemplate?: 0 | 1): number;
|
|
13
|
+
export declare function handleStringError(state: Parser, code: Escape, isTemplate: 0 | 1): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from '../common';
|
|
2
|
+
import { type Parser } from '../parser/parser';
|
|
2
3
|
import { Token } from '../token';
|
|
3
|
-
export declare function scanTemplate(parser:
|
|
4
|
-
export declare function scanTemplateTail(parser:
|
|
4
|
+
export declare function scanTemplate(parser: Parser, context: Context): Token;
|
|
5
|
+
export declare function scanTemplateTail(parser: Parser, context: Context): Token;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Token } from '../token';
|
|
2
|
+
import type * as ESTree from '../estree';
|
|
3
|
+
import { type Location, Flags, type OnComment, type OnInsertedSemicolon, type OnToken, type AssignmentKind, type DestructuringKind } from '../common';
|
|
4
|
+
export type ParserOptions = {
|
|
5
|
+
shouldAddLoc?: boolean;
|
|
6
|
+
shouldAddRanges?: boolean;
|
|
7
|
+
sourceFile?: string;
|
|
8
|
+
onComment?: OnComment;
|
|
9
|
+
onInsertedSemicolon?: OnInsertedSemicolon;
|
|
10
|
+
onToken?: OnToken;
|
|
11
|
+
};
|
|
12
|
+
export declare class Parser {
|
|
13
|
+
readonly source: string;
|
|
14
|
+
readonly options: ParserOptions;
|
|
15
|
+
private lastOnToken;
|
|
16
|
+
token: Token;
|
|
17
|
+
flags: Flags;
|
|
18
|
+
index: number;
|
|
19
|
+
line: number;
|
|
20
|
+
column: number;
|
|
21
|
+
startIndex: number;
|
|
22
|
+
end: number;
|
|
23
|
+
tokenIndex: number;
|
|
24
|
+
startColumn: number;
|
|
25
|
+
tokenColumn: number;
|
|
26
|
+
tokenLine: number;
|
|
27
|
+
startLine: number;
|
|
28
|
+
tokenValue: any;
|
|
29
|
+
tokenRaw: string;
|
|
30
|
+
tokenRegExp: void | {
|
|
31
|
+
pattern: string;
|
|
32
|
+
flags: string;
|
|
33
|
+
};
|
|
34
|
+
currentChar: number;
|
|
35
|
+
exportedNames: Record<string, number>;
|
|
36
|
+
exportedBindings: Record<string, number>;
|
|
37
|
+
assignable: AssignmentKind | DestructuringKind;
|
|
38
|
+
destructible: AssignmentKind | DestructuringKind;
|
|
39
|
+
leadingDecorators: {
|
|
40
|
+
start?: Location;
|
|
41
|
+
decorators: ESTree.Decorator[];
|
|
42
|
+
};
|
|
43
|
+
constructor(source: string, options?: ParserOptions);
|
|
44
|
+
getToken(): Token;
|
|
45
|
+
setToken(value: Token, replaceLast?: boolean): Token;
|
|
46
|
+
get tokenStart(): Location;
|
|
47
|
+
get currentLocation(): Location;
|
|
48
|
+
finishNode<T extends ESTree.Node>(node: T, start: Location, end: Location | void): T;
|
|
49
|
+
}
|
|
50
|
+
export declare function pushComment(comments: ESTree.Comment[], options: ParserOptions): OnComment;
|
|
51
|
+
export declare function pushToken(tokens: any[], options: ParserOptions): OnToken;
|