meriyah 6.0.6 → 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.
Files changed (59) hide show
  1. package/CHANGELOG.md +49 -11
  2. package/README.md +7 -10
  3. package/dist/meriyah.cjs +1211 -1197
  4. package/dist/meriyah.min.mjs +1 -1
  5. package/dist/meriyah.mjs +1212 -1197
  6. package/dist/meriyah.umd.js +1211 -1197
  7. package/dist/meriyah.umd.min.js +1 -1
  8. package/dist/{src → types}/chars.d.ts +0 -1
  9. package/dist/{src → types}/common.d.ts +33 -67
  10. package/dist/{src → types}/errors.d.ts +9 -9
  11. package/dist/{src → types}/estree.d.ts +21 -25
  12. package/dist/{src → types}/lexer/charClassifier.d.ts +0 -1
  13. package/dist/types/lexer/comments.d.ts +16 -0
  14. package/dist/{src → types}/lexer/common.d.ts +5 -6
  15. package/dist/{src → types}/lexer/decodeHTML.d.ts +0 -1
  16. package/dist/types/lexer/identifier.d.ts +9 -0
  17. package/dist/{src → types}/lexer/index.d.ts +3 -4
  18. package/dist/types/lexer/jsx.d.ts +7 -0
  19. package/dist/types/lexer/numeric.d.ts +6 -0
  20. package/dist/types/lexer/regexp.d.ts +4 -0
  21. package/dist/types/lexer/scan.d.ts +7 -0
  22. package/dist/types/lexer/string.d.ts +13 -0
  23. package/dist/types/lexer/template.d.ts +5 -0
  24. package/dist/{src → types}/meriyah.d.ts +6 -6
  25. package/dist/types/parser/parser.d.ts +51 -0
  26. package/dist/types/parser.d.ts +119 -0
  27. package/dist/{src → types}/token.d.ts +4 -5
  28. package/dist/types/unicode.d.ts +3 -0
  29. package/package.json +31 -30
  30. package/dist/src/chars.d.ts.map +0 -1
  31. package/dist/src/common.d.ts.map +0 -1
  32. package/dist/src/errors.d.ts.map +0 -1
  33. package/dist/src/estree.d.ts.map +0 -1
  34. package/dist/src/lexer/charClassifier.d.ts.map +0 -1
  35. package/dist/src/lexer/comments.d.ts +0 -15
  36. package/dist/src/lexer/comments.d.ts.map +0 -1
  37. package/dist/src/lexer/common.d.ts.map +0 -1
  38. package/dist/src/lexer/decodeHTML.d.ts.map +0 -1
  39. package/dist/src/lexer/identifier.d.ts +0 -9
  40. package/dist/src/lexer/identifier.d.ts.map +0 -1
  41. package/dist/src/lexer/index.d.ts.map +0 -1
  42. package/dist/src/lexer/jsx.d.ts +0 -7
  43. package/dist/src/lexer/jsx.d.ts.map +0 -1
  44. package/dist/src/lexer/numeric.d.ts +0 -6
  45. package/dist/src/lexer/numeric.d.ts.map +0 -1
  46. package/dist/src/lexer/regexp.d.ts +0 -4
  47. package/dist/src/lexer/regexp.d.ts.map +0 -1
  48. package/dist/src/lexer/scan.d.ts +0 -7
  49. package/dist/src/lexer/scan.d.ts.map +0 -1
  50. package/dist/src/lexer/string.d.ts +0 -13
  51. package/dist/src/lexer/string.d.ts.map +0 -1
  52. package/dist/src/lexer/template.d.ts +0 -5
  53. package/dist/src/lexer/template.d.ts.map +0 -1
  54. package/dist/src/meriyah.d.ts.map +0 -1
  55. package/dist/src/parser.d.ts +0 -120
  56. package/dist/src/parser.d.ts.map +0 -1
  57. package/dist/src/token.d.ts.map +0 -1
  58. package/dist/src/unicode.d.ts +0 -6
  59. package/dist/src/unicode.d.ts.map +0 -1
@@ -133,4 +133,3 @@ export declare const enum Chars {
133
133
  UTF16Max = 65535,
134
134
  NonBMPMin = 65536
135
135
  }
136
- //# sourceMappingURL=chars.d.ts.map
@@ -1,6 +1,7 @@
1
1
  import { Token } from './token';
2
2
  import { Errors } from './errors';
3
- import { Node, Decorator, SourceLocation } from './estree';
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,
@@ -100,7 +101,7 @@ export declare const enum Flags {
100
101
  None = 0,
101
102
  NewLine = 1,
102
103
  HasConstructor = 32,
103
- Octals = 64,
104
+ Octal = 64,
104
105
  NonSimpleParameterList = 128,
105
106
  HasStrictReserved = 256,
106
107
  StrictEvalArguments = 512,
@@ -133,9 +134,9 @@ export declare const enum ScopeKind {
133
134
  ArrowParams = 1024,
134
135
  CatchIdentifier = 2048
135
136
  }
136
- export type OnComment = (type: string, value: string, start: number, end: number, loc: SourceLocation) => any;
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,73 +155,38 @@ export interface PrivateScopeState {
154
155
  export interface ScopeError {
155
156
  type: Errors;
156
157
  params: string[];
157
- index: number;
158
- line: number;
159
- column: number;
160
- tokenIndex: number;
161
- tokenLine: number;
162
- tokenColumn: number;
158
+ start: Location;
159
+ end: Location;
163
160
  }
164
- export interface ParserState {
165
- source: string;
166
- end: number;
167
- flags: Flags;
168
- index: number;
169
- line: number;
170
- column: number;
171
- tokenIndex: number;
172
- tokenColumn: number;
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: ParserState, labels: any, name: string, isIterationStatement: 0 | 1): 0 | 1;
207
- export declare function validateAndDeclareLabel(parser: ParserState, labels: any, name: string): void;
208
- export declare function finishNode<T extends Node>(parser: ParserState, context: Context, start: number, line: number, column: number, node: T): T;
209
- export declare function createArrowHeadParsingScope(parser: ParserState, context: Context, value: string): ScopeState;
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: ParserState, context: Context, scope: ScopeState, name: string, kind: BindingKind, origin: Origin): void;
215
- export declare function addBlockName(parser: ParserState, context: Context, scope: any, name: string, kind: BindingKind, origin: Origin): void;
216
- export declare function addVarName(parser: ParserState, context: Context, scope: ScopeState, name: string, kind: BindingKind): void;
217
- export declare function addPrivateIdentifier(parser: ParserState, scope: PrivateScopeState, name: string, kind: PropertyKind): void;
218
- export declare function addPrivateIdentifierRef(parser: ParserState, scope: PrivateScopeState, name: string): void;
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: ParserState, name: string): void;
221
- export declare function addBindingToExports(parser: ParserState, name: string): void;
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: ParserState, context: Context, t: Token): any;
226
- //# sourceMappingURL=common.d.ts.map
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
+ };
@@ -1,5 +1,6 @@
1
- import { _Node, SourceLocation } from './estree';
2
- import { ParserState, ScopeError } from './common';
1
+ import { type _Node, type SourceLocation } from './estree';
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,
@@ -23,7 +24,7 @@ export declare const enum Errors {
23
24
  InvalidDynamicUnicode = 19,
24
25
  IllegalCharacter = 20,
25
26
  MissingHexDigits = 21,
26
- InvalidImplicitOctals = 22,
27
+ InvalidImplicitOctal = 22,
27
28
  InvalidStringLT = 23,
28
29
  InvalidEscapeIdentifier = 24,
29
30
  ExpectedToken = 25,
@@ -145,7 +146,7 @@ export declare const enum Errors {
145
146
  ImportNotOneArg = 141,
146
147
  InvalidImportNew = 142,
147
148
  InvalidSpreadInImport = 143,
148
- UncompleteArrow = 144,
149
+ IncompleteArrow = 144,
149
150
  DuplicateBinding = 145,
150
151
  DuplicatePrivateIdentifier = 146,
151
152
  DuplicateExportBinding = 147,
@@ -189,10 +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: number, startLine: number, startColumn: number, end: number, endLine: number, endColumn: number, type: Errors, ...params: string[]);
193
+ constructor(start: Location, end: Location, type: Errors, ...params: string[]);
193
194
  }
194
- export declare function report(parser: ParserState, type: Errors, ...params: string[]): never;
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(tokenIndex: number, tokenLine: number, tokenColumn: number, index: number, line: number, column: number, type: Errors, ...params: string[]): never;
197
- export declare function reportScannerError(tokenIndex: number, tokenLine: number, tokenColumn: number, index: number, line: number, column: number, type: Errors): never;
198
- //# sourceMappingURL=errors.d.ts.map
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;
@@ -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;
@@ -31,7 +28,8 @@ export type DeclarationStatement = ClassDeclaration | ClassExpression | ExportDe
31
28
  export type EntityName = Identifier;
32
29
  export type ExportDeclaration = ClassDeclaration | ClassExpression | FunctionDeclaration | VariableDeclaration;
33
30
  export type Expression = ArrowFunctionExpression | AssignmentExpression | BinaryExpression | ConditionalExpression | MetaProperty | ChainExpression | JSXClosingElement | JSXClosingFragment | JSXExpressionContainer | JSXOpeningElement | JSXOpeningFragment | JSXSpreadChild | LogicalExpression | NewExpression | RestElement | SequenceExpression | SpreadElement | AwaitExpression | LeftHandSideExpression | UnaryExpression | UpdateExpression | YieldExpression;
34
- export type ForInitialiser = Expression | VariableDeclaration;
31
+ export type ForInitializer = Expression | VariableDeclaration;
32
+ export { ForInitializer as ForInitialiser };
35
33
  export type ImportClause = ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportSpecifier;
36
34
  export type IterationStatement = DoWhileStatement | ForInStatement | ForOfStatement | ForStatement | WhileStatement;
37
35
  export type JSXChild = JSXElement | JSXExpression | JSXFragment | JSXText;
@@ -58,14 +56,6 @@ interface FunctionDeclarationBase extends _Node {
58
56
  params: Parameter[];
59
57
  body?: BlockStatement | null;
60
58
  }
61
- interface MethodDefinitionBase extends _Node {
62
- key: Expression | PrivateIdentifier | null;
63
- value: FunctionExpression;
64
- computed: boolean;
65
- static: boolean;
66
- kind: 'method' | 'get' | 'set' | 'constructor';
67
- decorators?: Decorator[];
68
- }
69
59
  export interface BlockStatementBase extends _Node {
70
60
  body: Statement[];
71
61
  }
@@ -83,6 +73,7 @@ export interface ArrowFunctionExpression extends _Node {
83
73
  body: Expression | BlockStatement;
84
74
  async: boolean;
85
75
  expression: boolean;
76
+ generator: false;
86
77
  }
87
78
  export interface AssignmentExpression extends _Node {
88
79
  type: 'AssignmentExpression';
@@ -128,7 +119,7 @@ export interface CallExpression extends _Node {
128
119
  type: 'CallExpression';
129
120
  callee: any;
130
121
  arguments: (Expression | SpreadElement)[];
131
- optional?: boolean;
122
+ optional: boolean;
132
123
  }
133
124
  export interface CatchClause extends _Node {
134
125
  type: 'CatchClause';
@@ -197,7 +188,7 @@ export interface ExportAllDeclaration extends _Node {
197
188
  type: 'ExportAllDeclaration';
198
189
  source: Literal;
199
190
  exported: Identifier | Literal | null;
200
- attributes?: ImportAttribute[];
191
+ attributes: ImportAttribute[];
201
192
  }
202
193
  export interface ExportDefaultDeclaration extends _Node {
203
194
  type: 'ExportDefaultDeclaration';
@@ -208,7 +199,7 @@ export interface ExportNamedDeclaration extends _Node {
208
199
  declaration: ExportDeclaration | null;
209
200
  specifiers: ExportSpecifier[];
210
201
  source: Literal | null;
211
- attributes?: ImportAttribute[];
202
+ attributes: ImportAttribute[];
212
203
  }
213
204
  export interface ExportSpecifier extends _Node {
214
205
  type: 'ExportSpecifier';
@@ -218,23 +209,24 @@ export interface ExportSpecifier extends _Node {
218
209
  export interface ExpressionStatement extends _Node {
219
210
  type: 'ExpressionStatement';
220
211
  expression: Expression;
212
+ directive?: string;
221
213
  }
222
214
  export interface ForInStatement extends _Node {
223
215
  type: 'ForInStatement';
224
- left: ForInitialiser;
216
+ left: ForInitializer;
225
217
  right: Expression;
226
218
  body: Statement;
227
219
  }
228
220
  export interface ForOfStatement extends _Node {
229
221
  type: 'ForOfStatement';
230
- left: ForInitialiser;
222
+ left: ForInitializer;
231
223
  right: Expression;
232
224
  body: Statement;
233
225
  await: boolean;
234
226
  }
235
227
  export interface ForStatement extends _Node {
236
228
  type: 'ForStatement';
237
- init: Expression | ForInitialiser | null;
229
+ init: Expression | ForInitializer | null;
238
230
  test: Expression | null;
239
231
  update: Expression | null;
240
232
  body: Statement;
@@ -262,7 +254,7 @@ export interface ImportDeclaration extends _Node {
262
254
  type: 'ImportDeclaration';
263
255
  source: Literal;
264
256
  specifiers: ImportClause[];
265
- attributes?: ImportAttribute[];
257
+ attributes: ImportAttribute[];
266
258
  }
267
259
  export interface ImportAttribute extends _Node {
268
260
  type: 'ImportAttribute';
@@ -370,8 +362,8 @@ export interface MemberExpression extends _Node {
370
362
  type: 'MemberExpression';
371
363
  object: Expression | Super;
372
364
  property: Expression | PrivateIdentifier;
373
- computed?: boolean;
374
- optional?: boolean;
365
+ computed: boolean;
366
+ optional: boolean;
375
367
  }
376
368
  export type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression;
377
369
  export interface MetaProperty extends _Node {
@@ -379,8 +371,14 @@ export interface MetaProperty extends _Node {
379
371
  meta: Identifier;
380
372
  property: Identifier;
381
373
  }
382
- export interface MethodDefinition extends MethodDefinitionBase {
374
+ export interface MethodDefinition extends _Node {
383
375
  type: 'MethodDefinition';
376
+ key: Expression | PrivateIdentifier | null;
377
+ value: FunctionExpression;
378
+ computed: boolean;
379
+ static: boolean;
380
+ kind: 'method' | 'get' | 'set' | 'constructor';
381
+ decorators?: Decorator[];
384
382
  }
385
383
  export interface NewExpression extends _Node {
386
384
  type: 'NewExpression';
@@ -521,5 +519,3 @@ export interface YieldExpression extends _Node {
521
519
  delegate: boolean;
522
520
  argument?: Expression | null;
523
521
  }
524
- export {};
525
- //# sourceMappingURL=estree.d.ts.map
@@ -22,4 +22,3 @@ export declare const isIdStart: number[];
22
22
  export declare const isIdPart: number[];
23
23
  export declare function isIdentifierStart(code: number): boolean;
24
24
  export declare function isIdentifierPart(code: number): boolean;
25
- //# sourceMappingURL=charClassifier.d.ts.map
@@ -0,0 +1,16 @@
1
+ import { LexerState } from './common';
2
+ import { Context } from '../common';
3
+ import { type Parser } from '../parser/parser';
4
+ import type * as ESTree from '../estree';
5
+ export declare const enum CommentType {
6
+ Single = 0,
7
+ Multi = 1,
8
+ HTMLOpen = 2,
9
+ HTMLClose = 3,
10
+ HashBang = 4
11
+ }
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 { ParserState } from '../common';
2
+ import { type Parser } from '../parser/parser';
3
3
  export declare const enum LexerState {
4
4
  None = 0,
5
5
  NewLine = 1,
@@ -16,11 +16,10 @@ export declare const enum NumberKind {
16
16
  ValidBigIntKind = 128,
17
17
  DecimalNumberKind = 48
18
18
  }
19
- export declare function advanceChar(parser: ParserState): number;
20
- export declare function consumePossibleSurrogatePair(parser: ParserState): number;
21
- export declare function consumeLineFeed(parser: ParserState, state: LexerState): void;
22
- export declare function scanNewLine(parser: ParserState): void;
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;
26
- //# sourceMappingURL=common.d.ts.map
@@ -1,2 +1 @@
1
1
  export declare function decodeHTMLStrict(text: string): string;
2
- //# sourceMappingURL=decodeHTML.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { Context } from '../common';
2
+ import { type Parser } from '../parser/parser';
3
+ import { Token } from '../token';
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,10 +1,9 @@
1
1
  export { scanSingleToken, nextToken, TokenLookup } from './scan';
2
- export { skipMultiLineComment, skipSingleLineComment, skipHashBang, skipSingleHTMLComment, CommentType } from './comments';
3
- export { advanceChar, consumePossibleSurrogatePair, isExoticECMAScriptWhitespace, toHex, consumeLineFeed, scanNewLine, LexerState, NumberKind, convertTokenType } from './common';
2
+ export { skipMultiLineComment, skipSingleLineComment, skipHashBang, skipSingleHTMLComment, CommentType, } from './comments';
3
+ export { advanceChar, consumePossibleSurrogatePair, isExoticECMAScriptWhitespace, toHex, consumeLineFeed, scanNewLine, LexerState, NumberKind, convertTokenType, } from './common';
4
4
  export { CharTypes, CharFlags, isIdentifierStart, isIdentifierPart } from './charClassifier';
5
- export { scanIdentifier, scanIdentifierSlowCase, scanUnicodeIdentifier, scanPrivateIdentifier, scanUnicodeEscape } from './identifier';
5
+ export { scanIdentifier, scanIdentifierSlowCase, scanUnicodeIdentifier, scanPrivateIdentifier, scanUnicodeEscape, } from './identifier';
6
6
  export { scanString } from './string';
7
7
  export { scanNumber } from './numeric';
8
8
  export { scanTemplate, scanTemplateTail } from './template';
9
9
  export { scanRegularExpression } from './regexp';
10
- //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { Token } from '../token';
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;
@@ -0,0 +1,6 @@
1
+ import { Context } from '../common';
2
+ import { type Parser } from '../parser/parser';
3
+ import { Token } from '../token';
4
+ import { NumberKind } from './common';
5
+ export declare function scanNumber(parser: Parser, context: Context, kind: NumberKind): Token;
6
+ export declare function scanDecimalDigitsOrSeparator(parser: Parser, char: number): string;
@@ -0,0 +1,4 @@
1
+ import { Context } from '../common';
2
+ import { type Parser } from '../parser/parser';
3
+ import { Token } from '../token';
4
+ export declare function scanRegularExpression(parser: Parser, context: Context): Token;
@@ -0,0 +1,7 @@
1
+ import { Token } from '../token';
2
+ import { Context } from '../common';
3
+ import { type Parser } from '../parser/parser';
4
+ import { LexerState } from './common';
5
+ export declare const TokenLookup: Token[];
6
+ export declare function nextToken(parser: Parser, context: Context): void;
7
+ export declare function scanSingleToken(parser: Parser, context: Context, state: LexerState): Token;
@@ -0,0 +1,13 @@
1
+ import { Context } from '../common';
2
+ import { type Parser } from '../parser/parser';
3
+ import { Token } from '../token';
4
+ export declare const enum Escape {
5
+ Empty = -1,
6
+ StrictOctal = -2,
7
+ EightOrNine = -3,
8
+ InvalidHex = -4,
9
+ OutOfRange = -5
10
+ }
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;
@@ -0,0 +1,5 @@
1
+ import { Context } from '../common';
2
+ import { type Parser } from '../parser/parser';
3
+ import { Token } from '../token';
4
+ export declare function scanTemplate(parser: Parser, context: Context): Token;
5
+ export declare function scanTemplateTail(parser: Parser, context: Context): Token;
@@ -1,8 +1,8 @@
1
1
  import { Options } from './parser';
2
- import * as ESTree from './estree';
2
+ import { type Program } from './estree';
3
3
  declare const version: string;
4
- export declare function parseScript(source: string, options?: Options): ESTree.Program;
5
- export declare function parseModule(source: string, options?: Options): ESTree.Program;
6
- export declare function parse(source: string, options?: Options): ESTree.Program;
7
- export { Options, ESTree, version };
8
- //# sourceMappingURL=meriyah.d.ts.map
4
+ export declare function parseScript(source: string, options?: Options): Program;
5
+ export declare function parseModule(source: string, options?: Options): Program;
6
+ export declare function parse(source: string, options?: Options): Program;
7
+ export { Options, version };
8
+ export type * as ESTree from './estree';
@@ -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;