UNPKG

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