1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | import * as ESTree from 'estree';
|
7 |
|
8 | export const version: string;
|
9 |
|
10 | export function parseScript(input: string, config?: ParseOptions, delegate?: (node: ESTree.Node, meta: any) => void): Program;
|
11 | export function parseModule(input: string, config?: ParseOptions, delegate?: (node: ESTree.Node, meta: any) => void): Program;
|
12 | export function tokenize(input: string, config?: TokenizeOptions): Token[];
|
13 |
|
14 | export interface Program extends ESTree.Program {
|
15 | tokens?: Token[];
|
16 | }
|
17 |
|
18 | export interface Token {
|
19 | type: string;
|
20 | value: string;
|
21 | }
|
22 |
|
23 | export interface ParseOptions {
|
24 | jsx?: boolean;
|
25 | range?: boolean;
|
26 | loc?: boolean;
|
27 | tolerant?: boolean;
|
28 | tokens?: boolean;
|
29 | comment?: boolean;
|
30 | }
|
31 |
|
32 | export interface TokenizeOptions {
|
33 | tolerant?: boolean;
|
34 | range?: boolean;
|
35 | loc?: boolean;
|
36 | comment?: boolean;
|
37 | }
|
38 |
|
39 | export const Syntax: {
|
40 | ArrayExpression: 'ArrayExpression',
|
41 | ArrayPattern: 'ArrayPattern',
|
42 | ArrowFunctionExpression: 'ArrowFunctionExpression',
|
43 | AssignmentExpression: 'AssignmentExpression',
|
44 | AssignmentPattern: 'AssignmentPattern',
|
45 | AwaitExpression: 'AwaitExpression',
|
46 | BinaryExpression: 'BinaryExpression',
|
47 | BlockStatement: 'BlockStatement',
|
48 | BreakStatement: 'BreakStatement',
|
49 | CallExpression: 'CallExpression',
|
50 | CatchClause: 'CatchClause',
|
51 | ClassBody: 'ClassBody',
|
52 | ClassDeclaration: 'ClassDeclaration',
|
53 | ClassExpression: 'ClassExpression',
|
54 | ConditionalExpression: 'ConditionalExpression',
|
55 | ContinueStatement: 'ContinueStatement',
|
56 | DebuggerStatement: 'DebuggerStatement',
|
57 | DoWhileStatement: 'DoWhileStatement',
|
58 | EmptyStatement: 'EmptyStatement',
|
59 | ExportAllDeclaration: 'ExportAllDeclaration',
|
60 | ExportDefaultDeclaration: 'ExportDefaultDeclaration',
|
61 | ExportNamedDeclaration: 'ExportNamedDeclaration',
|
62 | ExportSpecifier: 'ExportSpecifier',
|
63 | ExpressionStatement: 'ExpressionStatement',
|
64 | ForInStatement: 'ForInStatement',
|
65 | ForOfStatement: 'ForOfStatement',
|
66 | ForStatement: 'ForStatement',
|
67 | FunctionDeclaration: 'FunctionDeclaration',
|
68 | FunctionExpression: 'FunctionExpression',
|
69 | Identifier: 'Identifier',
|
70 | IfStatement: 'IfStatement',
|
71 | Import: 'Import',
|
72 | ImportDeclaration: 'ImportDeclaration',
|
73 | ImportDefaultSpecifier: 'ImportDefaultSpecifier',
|
74 | ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
|
75 | ImportSpecifier: 'ImportSpecifier',
|
76 | LabeledStatement: 'LabeledStatement',
|
77 | Literal: 'Literal',
|
78 | LogicalExpression: 'LogicalExpression',
|
79 | MemberExpression: 'MemberExpression',
|
80 | MetaProperty: 'MetaProperty',
|
81 | MethodDefinition: 'MethodDefinition',
|
82 | NewExpression: 'NewExpression',
|
83 | ObjectExpression: 'ObjectExpression',
|
84 | ObjectPattern: 'ObjectPattern',
|
85 | Program: 'Program',
|
86 | Property: 'Property',
|
87 | RestElement: 'RestElement',
|
88 | ReturnStatement: 'ReturnStatement',
|
89 | SequenceExpression: 'SequenceExpression',
|
90 | SpreadElement: 'SpreadElement',
|
91 | Super: 'Super',
|
92 | SwitchCase: 'SwitchCase',
|
93 | SwitchStatement: 'SwitchStatement',
|
94 | TaggedTemplateExpression: 'TaggedTemplateExpression',
|
95 | TemplateElement: 'TemplateElement',
|
96 | TemplateLiteral: 'TemplateLiteral',
|
97 | ThisExpression: 'ThisExpression',
|
98 | ThrowStatement: 'ThrowStatement',
|
99 | TryStatement: 'TryStatement',
|
100 | UnaryExpression: 'UnaryExpression',
|
101 | UpdateExpression: 'UpdateExpression',
|
102 | VariableDeclaration: 'VariableDeclaration',
|
103 | VariableDeclarator: 'VariableDeclarator',
|
104 | WhileStatement: 'WhileStatement',
|
105 | WithStatement: 'WithStatement',
|
106 | YieldExpression: 'YieldExpression'
|
107 | };
|