@doki-land/dejavu-engine 0.0.0 → 0.0.9
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/dist/index.d.ts +5 -1443
- package/dist/index.js +7 -3465
- package/dist/runtime/escape.d.ts +7 -0
- package/dist/runtime/escape.js +14 -0
- package/dist/runtime/expr.d.ts +27 -0
- package/dist/runtime/expr.js +104 -0
- package/dist/runtime/filter.d.ts +9 -0
- package/dist/runtime/filter.js +87 -0
- package/dist/runtime/index.d.ts +10 -0
- package/dist/runtime/index.js +10 -0
- package/dist/runtime/value.d.ts +24 -0
- package/dist/runtime/value.js +60 -0
- package/package.json +31 -25
- package/bin/dejavu.mjs +0 -379
- package/readme.md +0 -112
package/dist/index.d.ts
CHANGED
|
@@ -1,1445 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* @doki-land/dejavu-engine —— 纯 TypeScript AOT 运行时库入口。
|
|
3
|
+
*
|
|
4
|
+
* 只包含 runtime helpers,供 dejavu-codegen AOT 产物 import。
|
|
5
|
+
* 不含 parser、模板编译器、loader、resolver 或 Node 文件系统依赖。
|
|
3
6
|
*/
|
|
4
|
-
|
|
5
|
-
* AST 节点类型枚举
|
|
6
|
-
*/
|
|
7
|
-
declare enum NodeType {
|
|
8
|
-
/** 程序节点 */
|
|
9
|
-
Program = "Program",
|
|
10
|
-
/** 表达式语句节点 */
|
|
11
|
-
ExpressionStatement = "ExpressionStatement",
|
|
12
|
-
/** 赋值语句节点 */
|
|
13
|
-
AssignmentStatement = "AssignmentStatement",
|
|
14
|
-
/** 变量声明节点 */
|
|
15
|
-
VariableDeclaration = "VariableDeclaration",
|
|
16
|
-
/** 函数声明节点 */
|
|
17
|
-
FunctionDeclaration = "FunctionDeclaration",
|
|
18
|
-
/** If 语句节点 */
|
|
19
|
-
IfStatement = "IfStatement",
|
|
20
|
-
/** Else If 分支节点 */
|
|
21
|
-
ElseIfClause = "ElseIfClause",
|
|
22
|
-
/** For 循环语句节点 */
|
|
23
|
-
ForStatement = "ForStatement",
|
|
24
|
-
/** For-In 遍历循环语句节点 */
|
|
25
|
-
ForInStatement = "ForInStatement",
|
|
26
|
-
/** While 循环语句节点 */
|
|
27
|
-
WhileStatement = "WhileStatement",
|
|
28
|
-
/** 匹配语句节点 */
|
|
29
|
-
MatchStatement = "MatchStatement",
|
|
30
|
-
/** 匹配分支节点 */
|
|
31
|
-
MatchCase = "MatchCase",
|
|
32
|
-
/** 命名空间声明节点 */
|
|
33
|
-
NamespaceDeclaration = "NamespaceDeclaration",
|
|
34
|
-
/** 导入声明节点 */
|
|
35
|
-
UsingDeclaration = "UsingDeclaration",
|
|
36
|
-
/** 块语句节点 */
|
|
37
|
-
BlockStatement = "BlockStatement",
|
|
38
|
-
/** 标识符节点 */
|
|
39
|
-
Identifier = "Identifier",
|
|
40
|
-
/** 字面量节点 */
|
|
41
|
-
Literal = "Literal",
|
|
42
|
-
/** 二元表达式节点 */
|
|
43
|
-
BinaryExpression = "BinaryExpression",
|
|
44
|
-
/** 一元表达式节点 */
|
|
45
|
-
UnaryExpression = "UnaryExpression",
|
|
46
|
-
/** 函数调用表达式节点 */
|
|
47
|
-
CallExpression = "CallExpression",
|
|
48
|
-
/** 成员访问表达式节点 */
|
|
49
|
-
MemberExpression = "MemberExpression",
|
|
50
|
-
/** 数组表达式节点 */
|
|
51
|
-
ArrayExpression = "ArrayExpression",
|
|
52
|
-
/** 对象表达式节点 */
|
|
53
|
-
ObjectExpression = "ObjectExpression",
|
|
54
|
-
/** 对象属性节点 */
|
|
55
|
-
ObjectProperty = "ObjectProperty",
|
|
56
|
-
/** 范围表达式节点 */
|
|
57
|
-
RangeExpression = "RangeExpression",
|
|
58
|
-
/** 带类型注解的参数节点 */
|
|
59
|
-
TypedParameter = "TypedParameter",
|
|
60
|
-
/** 模板字符串节点 */
|
|
61
|
-
TemplateLiteral = "TemplateLiteral",
|
|
62
|
-
/** 模板字符串表达式节点 */
|
|
63
|
-
TemplateExpression = "TemplateExpression",
|
|
64
|
-
/** 注释节点 */
|
|
65
|
-
Comment = "Comment",
|
|
66
|
-
/** 文本节点 */
|
|
67
|
-
Text = "Text"
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* AST 节点基础接口
|
|
71
|
-
*/
|
|
72
|
-
interface Node {
|
|
73
|
-
/** 节点类型 */
|
|
74
|
-
type: NodeType;
|
|
75
|
-
/** 节点位置信息 */
|
|
76
|
-
loc?: {
|
|
77
|
-
/** 开始位置 */
|
|
78
|
-
start: {
|
|
79
|
-
line: number;
|
|
80
|
-
column: number;
|
|
81
|
-
};
|
|
82
|
-
/** 结束位置 */
|
|
83
|
-
end: {
|
|
84
|
-
line: number;
|
|
85
|
-
column: number;
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* 表达式节点接口
|
|
91
|
-
*/
|
|
92
|
-
interface Expression extends Node {
|
|
93
|
-
/** 表达式类型 */
|
|
94
|
-
type: NodeType.Identifier | NodeType.Literal | NodeType.BinaryExpression | NodeType.UnaryExpression | NodeType.CallExpression | NodeType.MemberExpression | NodeType.ArrayExpression | NodeType.ObjectExpression | NodeType.RangeExpression | NodeType.TemplateLiteral | NodeType.TemplateExpression;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* 语句节点接口
|
|
98
|
-
*/
|
|
99
|
-
interface Statement extends Node {
|
|
100
|
-
/** 语句类型 */
|
|
101
|
-
type: NodeType.ExpressionStatement | NodeType.AssignmentStatement | NodeType.VariableDeclaration | NodeType.FunctionDeclaration | NodeType.IfStatement | NodeType.ElseIfClause | NodeType.ForStatement | NodeType.ForInStatement | NodeType.WhileStatement | NodeType.MatchStatement | NodeType.MatchCase | NodeType.NamespaceDeclaration | NodeType.UsingDeclaration | NodeType.BlockStatement;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* 程序节点
|
|
105
|
-
* 表示整个模板的根节点
|
|
106
|
-
*/
|
|
107
|
-
interface Program extends Node {
|
|
108
|
-
type: NodeType.Program;
|
|
109
|
-
/** 程序体,包含所有语句 */
|
|
110
|
-
body: (Statement | Expression | Text | Comment)[];
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* 表达式语句节点
|
|
114
|
-
* 表示一个作为语句的表达式
|
|
115
|
-
*/
|
|
116
|
-
interface ExpressionStatement extends Statement {
|
|
117
|
-
type: NodeType.ExpressionStatement;
|
|
118
|
-
/** 表达式 */
|
|
119
|
-
expression: Expression;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* 赋值语句节点
|
|
123
|
-
* 表示变量赋值操作
|
|
124
|
-
*/
|
|
125
|
-
interface AssignmentStatement extends Statement {
|
|
126
|
-
type: NodeType.AssignmentStatement;
|
|
127
|
-
/** 左值表达式 */
|
|
128
|
-
left: Expression;
|
|
129
|
-
/** 右值表达式 */
|
|
130
|
-
right: Expression;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* 变量声明节点
|
|
134
|
-
* 表示变量声明语句
|
|
135
|
-
*/
|
|
136
|
-
interface VariableDeclaration extends Statement {
|
|
137
|
-
type: NodeType.VariableDeclaration;
|
|
138
|
-
/** 变量名称 */
|
|
139
|
-
name: Identifier;
|
|
140
|
-
/** 变量初始化值 */
|
|
141
|
-
init?: Expression;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* 函数声明节点
|
|
145
|
-
* 表示函数声明语句
|
|
146
|
-
*/
|
|
147
|
-
interface FunctionDeclaration extends Statement {
|
|
148
|
-
type: NodeType.FunctionDeclaration;
|
|
149
|
-
/** 函数名称 */
|
|
150
|
-
name: Identifier;
|
|
151
|
-
/** 函数参数 */
|
|
152
|
-
params: Identifier[];
|
|
153
|
-
/** 函数体 */
|
|
154
|
-
body: BlockStatement;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* If 语句节点
|
|
158
|
-
* 表示条件语句
|
|
159
|
-
*/
|
|
160
|
-
interface IfStatement extends Statement {
|
|
161
|
-
type: NodeType.IfStatement;
|
|
162
|
-
/** 条件表达式 */
|
|
163
|
-
test: Expression;
|
|
164
|
-
/** 当条件为真时执行的语句 */
|
|
165
|
-
consequent: Statement;
|
|
166
|
-
/** else if 分支列表 */
|
|
167
|
-
elseIfs?: ElseIfClause[];
|
|
168
|
-
/** 当所有条件都为假时执行的语句 */
|
|
169
|
-
alternate?: Statement;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Else If 分支节点
|
|
173
|
-
* 表示 else if 分支
|
|
174
|
-
*/
|
|
175
|
-
interface ElseIfClause extends Statement {
|
|
176
|
-
type: NodeType.ElseIfClause;
|
|
177
|
-
/** 条件表达式 */
|
|
178
|
-
test: Expression;
|
|
179
|
-
/** 当条件为真时执行的语句 */
|
|
180
|
-
consequent: Statement;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* For 循环语句节点
|
|
184
|
-
* 表示 for 循环
|
|
185
|
-
*/
|
|
186
|
-
interface ForStatement extends Statement {
|
|
187
|
-
type: NodeType.ForStatement;
|
|
188
|
-
/** 初始化表达式 */
|
|
189
|
-
init: VariableDeclaration | AssignmentStatement | Expression | null;
|
|
190
|
-
/** 条件表达式 */
|
|
191
|
-
test: Expression | null;
|
|
192
|
-
/** 增量表达式 */
|
|
193
|
-
update: Expression | null;
|
|
194
|
-
/** 循环体 */
|
|
195
|
-
body: Statement;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* For-In 遍历循环语句节点
|
|
199
|
-
* 表示 loop item in list 遍历循环
|
|
200
|
-
*/
|
|
201
|
-
interface ForInStatement extends Statement {
|
|
202
|
-
type: NodeType.ForInStatement;
|
|
203
|
-
/** 循环变量(单个变量或索引+元素元组) */
|
|
204
|
-
left: Identifier | [Identifier, Identifier];
|
|
205
|
-
/** 被遍历的表达式(数组或范围) */
|
|
206
|
-
right: Expression;
|
|
207
|
-
/** 循环体 */
|
|
208
|
-
body: Statement;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* While 循环语句节点
|
|
212
|
-
* 表示 while 循环
|
|
213
|
-
*/
|
|
214
|
-
interface WhileStatement extends Statement {
|
|
215
|
-
type: NodeType.WhileStatement;
|
|
216
|
-
/** 条件表达式 */
|
|
217
|
-
test: Expression;
|
|
218
|
-
/** 循环体 */
|
|
219
|
-
body: Statement;
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* 匹配语句节点
|
|
223
|
-
* 表示 match 匹配语句
|
|
224
|
-
*/
|
|
225
|
-
interface MatchStatement extends Statement {
|
|
226
|
-
type: NodeType.MatchStatement;
|
|
227
|
-
/** 被匹配的表达式 */
|
|
228
|
-
discriminant: Expression;
|
|
229
|
-
/** 匹配分支列表 */
|
|
230
|
-
cases: MatchCase[];
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* 匹配分支节点
|
|
234
|
-
* 表示 match 语句中的 case 分支
|
|
235
|
-
*/
|
|
236
|
-
interface MatchCase extends Statement {
|
|
237
|
-
type: NodeType.MatchCase;
|
|
238
|
-
/** 匹配模式(表达式或通配符 _) */
|
|
239
|
-
pattern: Expression | null;
|
|
240
|
-
/** 匹配成功时执行的语句 */
|
|
241
|
-
consequent: Statement;
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* 命名空间声明节点
|
|
245
|
-
* 表示 namespace 声明
|
|
246
|
-
*/
|
|
247
|
-
interface NamespaceDeclaration extends Statement {
|
|
248
|
-
type: NodeType.NamespaceDeclaration;
|
|
249
|
-
/** 命名空间名称 */
|
|
250
|
-
name: Identifier;
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* 导入声明节点
|
|
254
|
-
* 表示 using 导入声明
|
|
255
|
-
*/
|
|
256
|
-
interface UsingDeclaration extends Statement {
|
|
257
|
-
type: NodeType.UsingDeclaration;
|
|
258
|
-
/** 模块路径(如 header::render_header) */
|
|
259
|
-
modulePath: Identifier[];
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* 块语句节点
|
|
263
|
-
* 表示一组语句的集合
|
|
264
|
-
*/
|
|
265
|
-
interface BlockStatement extends Statement {
|
|
266
|
-
type: NodeType.BlockStatement;
|
|
267
|
-
/** 块内的语句 */
|
|
268
|
-
body: (Statement | Expression | Comment)[];
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* 标识符节点
|
|
272
|
-
* 表示变量名、函数名等标识符
|
|
273
|
-
*/
|
|
274
|
-
interface Identifier extends Expression {
|
|
275
|
-
type: NodeType.Identifier;
|
|
276
|
-
/** 标识符名称 */
|
|
277
|
-
name: string;
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* 字面量节点
|
|
281
|
-
* 表示字符串、数字、布尔值等字面量
|
|
282
|
-
*/
|
|
283
|
-
interface Literal extends Expression {
|
|
284
|
-
type: NodeType.Literal;
|
|
285
|
-
/** 字面量值 */
|
|
286
|
-
value: string | number | boolean | null | undefined;
|
|
287
|
-
/** 原始字符串表示 */
|
|
288
|
-
raw?: string;
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* 二元表达式节点
|
|
292
|
-
* 表示二元运算表达式
|
|
293
|
-
*/
|
|
294
|
-
interface BinaryExpression extends Expression {
|
|
295
|
-
type: NodeType.BinaryExpression;
|
|
296
|
-
/** 运算符 */
|
|
297
|
-
operator: string;
|
|
298
|
-
/** 左操作数 */
|
|
299
|
-
left: Expression;
|
|
300
|
-
/** 右操作数 */
|
|
301
|
-
right: Expression;
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* 一元表达式节点
|
|
305
|
-
* 表示一元运算表达式
|
|
306
|
-
*/
|
|
307
|
-
interface UnaryExpression extends Expression {
|
|
308
|
-
type: NodeType.UnaryExpression;
|
|
309
|
-
/** 运算符 */
|
|
310
|
-
operator: string;
|
|
311
|
-
/** 操作数 */
|
|
312
|
-
argument: Expression;
|
|
313
|
-
/** 是否为前缀运算符 */
|
|
314
|
-
prefix: boolean;
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* 函数调用表达式节点
|
|
318
|
-
* 表示函数调用
|
|
319
|
-
*/
|
|
320
|
-
interface CallExpression extends Expression {
|
|
321
|
-
type: NodeType.CallExpression;
|
|
322
|
-
/** 被调用的函数表达式 */
|
|
323
|
-
callee: Expression;
|
|
324
|
-
/** 函数参数 */
|
|
325
|
-
arguments: Expression[];
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* 成员访问表达式节点
|
|
329
|
-
* 表示对象成员访问
|
|
330
|
-
*/
|
|
331
|
-
interface MemberExpression extends Expression {
|
|
332
|
-
type: NodeType.MemberExpression;
|
|
333
|
-
/** 对象表达式 */
|
|
334
|
-
object: Expression;
|
|
335
|
-
/** 成员表达式 */
|
|
336
|
-
property: Expression;
|
|
337
|
-
/** 是否使用点号访问 */
|
|
338
|
-
computed: boolean;
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* 数组表达式节点
|
|
342
|
-
* 表示数组字面量
|
|
343
|
-
*/
|
|
344
|
-
interface ArrayExpression extends Expression {
|
|
345
|
-
type: NodeType.ArrayExpression;
|
|
346
|
-
/** 数组元素 */
|
|
347
|
-
elements: Expression[];
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* 对象表达式节点
|
|
351
|
-
* 表示对象字面量
|
|
352
|
-
*/
|
|
353
|
-
interface ObjectExpression extends Expression {
|
|
354
|
-
type: NodeType.ObjectExpression;
|
|
355
|
-
/** 对象属性 */
|
|
356
|
-
properties: ObjectProperty[];
|
|
357
|
-
}
|
|
358
|
-
/**
|
|
359
|
-
* 对象属性节点
|
|
360
|
-
* 表示对象的属性
|
|
361
|
-
*/
|
|
362
|
-
interface ObjectProperty extends Node {
|
|
363
|
-
type: NodeType.ObjectProperty;
|
|
364
|
-
/** 属性键 */
|
|
365
|
-
key: Identifier | Literal;
|
|
366
|
-
/** 属性值 */
|
|
367
|
-
value: Expression;
|
|
368
|
-
/** 是否为简写属性 */
|
|
369
|
-
shorthand: boolean;
|
|
370
|
-
}
|
|
371
|
-
/**
|
|
372
|
-
* 范围表达式节点
|
|
373
|
-
* 表示 start..end 范围表达式
|
|
374
|
-
*/
|
|
375
|
-
interface RangeExpression extends Expression {
|
|
376
|
-
type: NodeType.RangeExpression;
|
|
377
|
-
/** 范围起始值 */
|
|
378
|
-
start: Expression;
|
|
379
|
-
/** 范围结束值 */
|
|
380
|
-
end: Expression;
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* 带类型注解的参数节点
|
|
384
|
-
* 表示函数参数带类型注解
|
|
385
|
-
*/
|
|
386
|
-
interface TypedParameter extends Node {
|
|
387
|
-
type: NodeType.TypedParameter;
|
|
388
|
-
/** 参数名称 */
|
|
389
|
-
name: Identifier;
|
|
390
|
-
/** 参数类型 */
|
|
391
|
-
typeAnnotation?: Identifier;
|
|
392
|
-
}
|
|
393
|
-
/**
|
|
394
|
-
* 模板字符串节点
|
|
395
|
-
* 表示模板字符串
|
|
396
|
-
*/
|
|
397
|
-
interface TemplateLiteral extends Expression {
|
|
398
|
-
type: NodeType.TemplateLiteral;
|
|
399
|
-
/** 模板字符串片段 */
|
|
400
|
-
quasis: {
|
|
401
|
-
value: {
|
|
402
|
-
raw: string;
|
|
403
|
-
cooked: string;
|
|
404
|
-
};
|
|
405
|
-
}[];
|
|
406
|
-
/** 模板字符串中的表达式 */
|
|
407
|
-
expressions: Expression[];
|
|
408
|
-
}
|
|
409
|
-
/**
|
|
410
|
-
* 模板表达式节点
|
|
411
|
-
* 表示 DejaVu 模板表达式
|
|
412
|
-
*/
|
|
413
|
-
interface TemplateExpression extends Expression {
|
|
414
|
-
type: NodeType.TemplateExpression;
|
|
415
|
-
/** 模板内容 */
|
|
416
|
-
content: string;
|
|
417
|
-
}
|
|
418
|
-
/**
|
|
419
|
-
* 注释节点
|
|
420
|
-
* 表示注释
|
|
421
|
-
*/
|
|
422
|
-
interface Comment extends Node {
|
|
423
|
-
type: NodeType.Comment;
|
|
424
|
-
/** 注释内容 */
|
|
425
|
-
value: string;
|
|
426
|
-
/** 是否为块注释 */
|
|
427
|
-
block: boolean;
|
|
428
|
-
}
|
|
429
|
-
/**
|
|
430
|
-
* 文本节点
|
|
431
|
-
* 表示模板中的普通文本
|
|
432
|
-
*/
|
|
433
|
-
interface Text extends Node {
|
|
434
|
-
type: NodeType.Text;
|
|
435
|
-
/** 文本内容 */
|
|
436
|
-
value: string;
|
|
437
|
-
}
|
|
438
|
-
/**
|
|
439
|
-
* 创建标识符节点
|
|
440
|
-
* @param name 标识符名称
|
|
441
|
-
* @param loc 位置信息
|
|
442
|
-
* @returns 标识符节点
|
|
443
|
-
*/
|
|
444
|
-
declare function createIdentifier(name: string, loc?: Node['loc']): Identifier;
|
|
445
|
-
/**
|
|
446
|
-
* 创建字面量节点
|
|
447
|
-
* @param value 字面量值
|
|
448
|
-
* @param raw 原始字符串表示
|
|
449
|
-
* @param loc 位置信息
|
|
450
|
-
* @returns 字面量节点
|
|
451
|
-
*/
|
|
452
|
-
declare function createLiteral(value: Literal['value'], raw?: string, loc?: Node['loc']): Literal;
|
|
453
|
-
/**
|
|
454
|
-
* 创建程序节点
|
|
455
|
-
* @param body 程序体
|
|
456
|
-
* @param loc 位置信息
|
|
457
|
-
* @returns 程序节点
|
|
458
|
-
*/
|
|
459
|
-
declare function createProgram(body: Program['body'], loc?: Node['loc']): Program;
|
|
460
|
-
/**
|
|
461
|
-
* 创建表达式语句节点
|
|
462
|
-
* @param expression 表达式
|
|
463
|
-
* @param loc 位置信息
|
|
464
|
-
* @returns 表达式语句节点
|
|
465
|
-
*/
|
|
466
|
-
declare function createExpressionStatement(expression: Expression, loc?: Node['loc']): ExpressionStatement;
|
|
467
|
-
/**
|
|
468
|
-
* 创建变量声明节点
|
|
469
|
-
* @param name 变量名称
|
|
470
|
-
* @param init 初始化值
|
|
471
|
-
* @param loc 位置信息
|
|
472
|
-
* @returns 变量声明节点
|
|
473
|
-
*/
|
|
474
|
-
declare function createVariableDeclaration(name: Identifier, init?: Expression, loc?: Node['loc']): VariableDeclaration;
|
|
475
|
-
/**
|
|
476
|
-
* 创建块语句节点
|
|
477
|
-
* @param body 块内语句
|
|
478
|
-
* @param loc 位置信息
|
|
479
|
-
* @returns 块语句节点
|
|
480
|
-
*/
|
|
481
|
-
declare function createBlockStatement(body: BlockStatement['body'], loc?: Node['loc']): BlockStatement;
|
|
482
|
-
/**
|
|
483
|
-
* 创建二元表达式节点
|
|
484
|
-
* @param operator 运算符
|
|
485
|
-
* @param left 左操作数
|
|
486
|
-
* @param right 右操作数
|
|
487
|
-
* @param loc 位置信息
|
|
488
|
-
* @returns 二元表达式节点
|
|
489
|
-
*/
|
|
490
|
-
declare function createBinaryExpression(operator: string, left: Expression, right: Expression, loc?: Node['loc']): BinaryExpression;
|
|
491
|
-
/**
|
|
492
|
-
* 创建函数调用表达式节点
|
|
493
|
-
* @param callee 被调用的函数
|
|
494
|
-
* @param args 函数参数
|
|
495
|
-
* @param loc 位置信息
|
|
496
|
-
* @returns 函数调用表达式节点
|
|
497
|
-
*/
|
|
498
|
-
declare function createCallExpression(callee: Expression, args: Expression[], loc?: Node['loc']): CallExpression;
|
|
499
|
-
/**
|
|
500
|
-
* 创建文本节点
|
|
501
|
-
* @param value 文本内容
|
|
502
|
-
* @param loc 位置信息
|
|
503
|
-
* @returns 文本节点
|
|
504
|
-
*/
|
|
505
|
-
declare function createText(value: string, loc?: Node['loc']): Text;
|
|
506
|
-
/**
|
|
507
|
-
* 创建模板表达式节点
|
|
508
|
-
* @param content 模板内容
|
|
509
|
-
* @param loc 位置信息
|
|
510
|
-
* @returns 模板表达式节点
|
|
511
|
-
*/
|
|
512
|
-
declare function createTemplateExpression(content: string, loc?: Node['loc']): TemplateExpression;
|
|
513
|
-
/**
|
|
514
|
-
* 创建一元表达式节点
|
|
515
|
-
* @param operator 运算符
|
|
516
|
-
* @param argument 操作数
|
|
517
|
-
* @param prefix 是否为前缀运算符
|
|
518
|
-
* @param loc 位置信息
|
|
519
|
-
* @returns 一元表达式节点
|
|
520
|
-
*/
|
|
521
|
-
declare function createUnaryExpression(operator: string, argument: Expression, prefix: boolean, loc?: Node['loc']): UnaryExpression;
|
|
522
|
-
/**
|
|
523
|
-
* 创建成员访问表达式节点
|
|
524
|
-
* @param object 对象表达式
|
|
525
|
-
* @param property 成员表达式
|
|
526
|
-
* @param computed 是否使用计算访问
|
|
527
|
-
* @param loc 位置信息
|
|
528
|
-
* @returns 成员访问表达式节点
|
|
529
|
-
*/
|
|
530
|
-
declare function createMemberExpression(object: Expression, property: Expression, computed: boolean, loc?: Node['loc']): MemberExpression;
|
|
531
|
-
/**
|
|
532
|
-
* 创建数组表达式节点
|
|
533
|
-
* @param elements 数组元素
|
|
534
|
-
* @param loc 位置信息
|
|
535
|
-
* @returns 数组表达式节点
|
|
536
|
-
*/
|
|
537
|
-
declare function createArrayExpression(elements: Expression[], loc?: Node['loc']): ArrayExpression;
|
|
538
|
-
/**
|
|
539
|
-
* 创建对象表达式节点
|
|
540
|
-
* @param properties 对象属性
|
|
541
|
-
* @param loc 位置信息
|
|
542
|
-
* @returns 对象表达式节点
|
|
543
|
-
*/
|
|
544
|
-
declare function createObjectExpression(properties: ObjectProperty[], loc?: Node['loc']): ObjectExpression;
|
|
545
|
-
/**
|
|
546
|
-
* 创建对象属性节点
|
|
547
|
-
* @param key 属性键
|
|
548
|
-
* @param value 属性值
|
|
549
|
-
* @param shorthand 是否为简写属性
|
|
550
|
-
* @param loc 位置信息
|
|
551
|
-
* @returns 对象属性节点
|
|
552
|
-
*/
|
|
553
|
-
declare function createObjectProperty(key: Identifier | Literal, value: Expression, shorthand: boolean, loc?: Node['loc']): ObjectProperty;
|
|
554
|
-
/**
|
|
555
|
-
* 创建If语句节点
|
|
556
|
-
* @param test 条件表达式
|
|
557
|
-
* @param consequent 当条件为真时执行的语句
|
|
558
|
-
* @param elseIfs else if 分支列表
|
|
559
|
-
* @param alternate 当所有条件都为假时执行的语句
|
|
560
|
-
* @param loc 位置信息
|
|
561
|
-
* @returns If语句节点
|
|
562
|
-
*/
|
|
563
|
-
declare function createIfStatement(test: Expression, consequent: Statement, elseIfs?: ElseIfClause[], alternate?: Statement, loc?: Node['loc']): IfStatement;
|
|
564
|
-
/**
|
|
565
|
-
* 创建Else If分支节点
|
|
566
|
-
* @param test 条件表达式
|
|
567
|
-
* @param consequent 当条件为真时执行的语句
|
|
568
|
-
* @param loc 位置信息
|
|
569
|
-
* @returns Else If分支节点
|
|
570
|
-
*/
|
|
571
|
-
declare function createElseIfClause(test: Expression, consequent: Statement, loc?: Node['loc']): ElseIfClause;
|
|
572
|
-
/**
|
|
573
|
-
* 创建For循环语句节点
|
|
574
|
-
* @param init 初始化表达式
|
|
575
|
-
* @param test 条件表达式
|
|
576
|
-
* @param update 增量表达式
|
|
577
|
-
* @param body 循环体
|
|
578
|
-
* @param loc 位置信息
|
|
579
|
-
* @returns For循环语句节点
|
|
580
|
-
*/
|
|
581
|
-
declare function createForStatement(init: VariableDeclaration | AssignmentStatement | Expression | null, test: Expression | null, update: Expression | null, body: Statement, loc?: Node['loc']): ForStatement;
|
|
582
|
-
/**
|
|
583
|
-
* 创建While循环语句节点
|
|
584
|
-
* @param test 条件表达式
|
|
585
|
-
* @param body 循环体
|
|
586
|
-
* @param loc 位置信息
|
|
587
|
-
* @returns While循环语句节点
|
|
588
|
-
*/
|
|
589
|
-
declare function createWhileStatement(test: Expression, body: Statement, loc?: Node['loc']): WhileStatement;
|
|
590
|
-
/**
|
|
591
|
-
* 创建For-In遍历循环语句节点
|
|
592
|
-
* @param left 循环变量
|
|
593
|
-
* @param right 被遍历的表达式
|
|
594
|
-
* @param body 循环体
|
|
595
|
-
* @param loc 位置信息
|
|
596
|
-
* @returns For-In遍历循环语句节点
|
|
597
|
-
*/
|
|
598
|
-
declare function createForInStatement(left: Identifier | [Identifier, Identifier], right: Expression, body: Statement, loc?: Node['loc']): ForInStatement;
|
|
599
|
-
/**
|
|
600
|
-
* 创建匹配语句节点
|
|
601
|
-
* @param discriminant 被匹配的表达式
|
|
602
|
-
* @param cases 匹配分支列表
|
|
603
|
-
* @param loc 位置信息
|
|
604
|
-
* @returns 匹配语句节点
|
|
605
|
-
*/
|
|
606
|
-
declare function createMatchStatement(discriminant: Expression, cases: MatchCase[], loc?: Node['loc']): MatchStatement;
|
|
607
|
-
/**
|
|
608
|
-
* 创建匹配分支节点
|
|
609
|
-
* @param pattern 匹配模式
|
|
610
|
-
* @param consequent 匹配成功时执行的语句
|
|
611
|
-
* @param loc 位置信息
|
|
612
|
-
* @returns 匹配分支节点
|
|
613
|
-
*/
|
|
614
|
-
declare function createMatchCase(pattern: Expression | null, consequent: Statement, loc?: Node['loc']): MatchCase;
|
|
615
|
-
/**
|
|
616
|
-
* 创建命名空间声明节点
|
|
617
|
-
* @param name 命名空间名称
|
|
618
|
-
* @param loc 位置信息
|
|
619
|
-
* @returns 命名空间声明节点
|
|
620
|
-
*/
|
|
621
|
-
declare function createNamespaceDeclaration(name: Identifier, loc?: Node['loc']): NamespaceDeclaration;
|
|
622
|
-
/**
|
|
623
|
-
* 创建导入声明节点
|
|
624
|
-
* @param modulePath 模块路径
|
|
625
|
-
* @param loc 位置信息
|
|
626
|
-
* @returns 导入声明节点
|
|
627
|
-
*/
|
|
628
|
-
declare function createUsingDeclaration(modulePath: Identifier[], loc?: Node['loc']): UsingDeclaration;
|
|
629
|
-
/**
|
|
630
|
-
* 创建范围表达式节点
|
|
631
|
-
* @param start 范围起始值
|
|
632
|
-
* @param end 范围结束值
|
|
633
|
-
* @param loc 位置信息
|
|
634
|
-
* @returns 范围表达式节点
|
|
635
|
-
*/
|
|
636
|
-
declare function createRangeExpression(start: Expression, end: Expression, loc?: Node['loc']): RangeExpression;
|
|
637
|
-
/**
|
|
638
|
-
* 创建带类型注解的参数节点
|
|
639
|
-
* @param name 参数名称
|
|
640
|
-
* @param typeAnnotation 参数类型
|
|
641
|
-
* @param loc 位置信息
|
|
642
|
-
* @returns 带类型注解的参数节点
|
|
643
|
-
*/
|
|
644
|
-
declare function createTypedParameter(name: Identifier, typeAnnotation?: Identifier, loc?: Node['loc']): TypedParameter;
|
|
645
|
-
/**
|
|
646
|
-
* 创建函数声明节点
|
|
647
|
-
* @param name 函数名称
|
|
648
|
-
* @param params 函数参数
|
|
649
|
-
* @param body 函数体
|
|
650
|
-
* @param loc 位置信息
|
|
651
|
-
* @returns 函数声明节点
|
|
652
|
-
*/
|
|
653
|
-
declare function createFunctionDeclaration(name: Identifier, params: Identifier[], body: BlockStatement, loc?: Node['loc']): FunctionDeclaration;
|
|
654
|
-
/**
|
|
655
|
-
* 创建赋值语句节点
|
|
656
|
-
* @param left 左值表达式
|
|
657
|
-
* @param right 右值表达式
|
|
658
|
-
* @param loc 位置信息
|
|
659
|
-
* @returns 赋值语句节点
|
|
660
|
-
*/
|
|
661
|
-
declare function createAssignmentStatement(left: Expression, right: Expression, loc?: Node['loc']): AssignmentStatement;
|
|
662
|
-
/**
|
|
663
|
-
* 创建注释节点
|
|
664
|
-
* @param value 注释内容
|
|
665
|
-
* @param block 是否为块注释
|
|
666
|
-
* @param loc 位置信息
|
|
667
|
-
* @returns 注释节点
|
|
668
|
-
*/
|
|
669
|
-
declare function createComment(value: string, block: boolean, loc?: Node['loc']): Comment;
|
|
670
|
-
|
|
671
|
-
/**
|
|
672
|
-
* DejaVu 模板引擎语言配置
|
|
673
|
-
*/
|
|
674
|
-
/**
|
|
675
|
-
* 语法模式枚举
|
|
676
|
-
*/
|
|
677
|
-
declare enum SyntaxMode {
|
|
678
|
-
/** 编程模式(纯代码) */
|
|
679
|
-
Programming = "Programming",
|
|
680
|
-
/** 模板模式(带插值的文本) */
|
|
681
|
-
Template = "Template"
|
|
682
|
-
}
|
|
683
|
-
/**
|
|
684
|
-
* 模板配置接口
|
|
685
|
-
*/
|
|
686
|
-
interface TemplateConfig {
|
|
687
|
-
/** 代码开始定界符 */
|
|
688
|
-
codeStart: string;
|
|
689
|
-
/** 代码结束定界符 */
|
|
690
|
-
codeEnd: string;
|
|
691
|
-
/** 注释开始定界符 */
|
|
692
|
-
commentStart: string;
|
|
693
|
-
/** 注释结束定界符 */
|
|
694
|
-
commentEnd: string;
|
|
695
|
-
/** 是否支持过滤器管道语法 `a |> b |> c` */
|
|
696
|
-
supportFilterPipe: boolean;
|
|
697
|
-
/** 是否支持遗留的 `for` 语法(否则只允许 `loop`) */
|
|
698
|
-
legacyFor: boolean;
|
|
699
|
-
}
|
|
700
|
-
/**
|
|
701
|
-
* 默认模板配置
|
|
702
|
-
*/
|
|
703
|
-
declare const DEFAULT_TEMPLATE_CONFIG: TemplateConfig;
|
|
704
|
-
/**
|
|
705
|
-
* DejaVu 语言配置类
|
|
706
|
-
*/
|
|
707
|
-
declare class DejavuLanguage {
|
|
708
|
-
/** 语法模式 */
|
|
709
|
-
syntaxMode: SyntaxMode;
|
|
710
|
-
/** 模板配置 */
|
|
711
|
-
template: TemplateConfig;
|
|
712
|
-
/**
|
|
713
|
-
* 创建新的 DejaVu 语言配置
|
|
714
|
-
*/
|
|
715
|
-
constructor();
|
|
716
|
-
/**
|
|
717
|
-
* 设置语法模式
|
|
718
|
-
* @param mode 语法模式
|
|
719
|
-
* @returns 当前实例
|
|
720
|
-
*/
|
|
721
|
-
withMode(mode: SyntaxMode): this;
|
|
722
|
-
/**
|
|
723
|
-
* 设置模板配置
|
|
724
|
-
* @param template 模板配置
|
|
725
|
-
* @returns 当前实例
|
|
726
|
-
*/
|
|
727
|
-
withTemplate(template: Partial<TemplateConfig>): this;
|
|
728
|
-
}
|
|
729
|
-
/**
|
|
730
|
-
* 默认 DejaVu 语言配置
|
|
731
|
-
*/
|
|
732
|
-
declare const language: DejavuLanguage;
|
|
733
|
-
|
|
734
|
-
declare class DejavuEngine {
|
|
735
|
-
private readonly templates;
|
|
736
|
-
/**
|
|
737
|
-
* 注册模板
|
|
738
|
-
* @param name 模板名称
|
|
739
|
-
* @param source 模板源代码
|
|
740
|
-
* @param language 语言配置
|
|
741
|
-
*/
|
|
742
|
-
registerTemplate(name: string, source: string, language?: DejavuLanguage): void;
|
|
743
|
-
/**
|
|
744
|
-
* 渲染已注册的模板
|
|
745
|
-
* @param name 模板名称
|
|
746
|
-
* @param context 模板上下文参数
|
|
747
|
-
* @returns 渲染结果
|
|
748
|
-
*/
|
|
749
|
-
renderTemplate(name: string, context?: Record<string, any>): string;
|
|
750
|
-
/**
|
|
751
|
-
* 检查模板
|
|
752
|
-
* @param source 源代码路径
|
|
753
|
-
*/
|
|
754
|
-
checkTemplate(source: string, language?: DejavuLanguage): Program;
|
|
755
|
-
}
|
|
756
|
-
/**
|
|
757
|
-
* 引擎单例实例
|
|
758
|
-
*/
|
|
759
|
-
declare const engine: DejavuEngine;
|
|
760
|
-
|
|
761
|
-
/** 注册模板 */
|
|
762
|
-
declare function registerTemplate(name: string, source: string, language?: DejavuLanguage): void;
|
|
763
|
-
/** 渲染模板 */
|
|
764
|
-
declare function renderTemplate(name: string, context?: Record<string, unknown>): string;
|
|
765
|
-
/** 检查模板 */
|
|
766
|
-
declare function checkTemplate(source: string, language?: DejavuLanguage): void;
|
|
767
|
-
|
|
768
|
-
/**
|
|
769
|
-
* DejaVu 模板引擎渲染器
|
|
770
|
-
* 负责将 AST 转换为最终输出
|
|
771
|
-
*/
|
|
772
|
-
|
|
773
|
-
/**
|
|
774
|
-
* 渲染上下文接口
|
|
775
|
-
*/
|
|
776
|
-
interface RenderContext {
|
|
777
|
-
/** 变量作用域 */
|
|
778
|
-
scope: Record<string, any>;
|
|
779
|
-
/** 父上下文 */
|
|
780
|
-
parent?: RenderContext;
|
|
781
|
-
}
|
|
782
|
-
/**
|
|
783
|
-
* DejaVu 渲染器类
|
|
784
|
-
*/
|
|
785
|
-
declare class DejavuRenderer {
|
|
786
|
-
/**
|
|
787
|
-
* 创建渲染上下文
|
|
788
|
-
* @param initialScope 初始作用域
|
|
789
|
-
* @returns 渲染上下文
|
|
790
|
-
*/
|
|
791
|
-
private createContext;
|
|
792
|
-
/**
|
|
793
|
-
* 查找变量
|
|
794
|
-
* @param context 渲染上下文
|
|
795
|
-
* @param name 变量名
|
|
796
|
-
* @returns 变量值
|
|
797
|
-
*/
|
|
798
|
-
private findVariable;
|
|
799
|
-
/**
|
|
800
|
-
* 设置变量
|
|
801
|
-
* @param context 渲染上下文
|
|
802
|
-
* @param name 变量名
|
|
803
|
-
* @param value 变量值
|
|
804
|
-
*/
|
|
805
|
-
private setVariable;
|
|
806
|
-
/**
|
|
807
|
-
* 执行二元运算
|
|
808
|
-
* @param left 左操作数
|
|
809
|
-
* @param operator 运算符
|
|
810
|
-
* @param right 右操作数
|
|
811
|
-
* @returns 运算结果
|
|
812
|
-
*/
|
|
813
|
-
private executeBinaryOperation;
|
|
814
|
-
/**
|
|
815
|
-
* 执行一元运算
|
|
816
|
-
* @param operator 运算符
|
|
817
|
-
* @param argument 操作数
|
|
818
|
-
* @returns 运算结果
|
|
819
|
-
*/
|
|
820
|
-
private executeUnaryOperation;
|
|
821
|
-
/**
|
|
822
|
-
* 评估表达式
|
|
823
|
-
* @param node 表达式节点
|
|
824
|
-
* @param context 渲染上下文
|
|
825
|
-
* @returns 表达式结果
|
|
826
|
-
*/
|
|
827
|
-
private evaluateExpression;
|
|
828
|
-
/**
|
|
829
|
-
* 渲染语句
|
|
830
|
-
* @param node 语句节点
|
|
831
|
-
* @param context 渲染上下文
|
|
832
|
-
* @returns 渲染结果
|
|
833
|
-
*/
|
|
834
|
-
private renderStatement;
|
|
835
|
-
/**
|
|
836
|
-
* 渲染块语句
|
|
837
|
-
* @param node 块语句节点
|
|
838
|
-
* @param context 渲染上下文
|
|
839
|
-
* @returns 渲染结果
|
|
840
|
-
*/
|
|
841
|
-
private renderBlockStatement;
|
|
842
|
-
/**
|
|
843
|
-
* 渲染程序
|
|
844
|
-
* @param node 程序节点
|
|
845
|
-
* @param context 渲染上下文
|
|
846
|
-
* @returns 渲染结果
|
|
847
|
-
*/
|
|
848
|
-
private renderProgram;
|
|
849
|
-
/**
|
|
850
|
-
* 渲染 AST
|
|
851
|
-
* @param ast 抽象语法树
|
|
852
|
-
* @param initialScope 初始作用域
|
|
853
|
-
* @returns 渲染结果
|
|
854
|
-
*/
|
|
855
|
-
render(ast: Program, initialScope?: Record<string, any>): string;
|
|
856
|
-
}
|
|
857
|
-
/**
|
|
858
|
-
* 渲染器实例
|
|
859
|
-
*/
|
|
860
|
-
declare const renderer: DejavuRenderer;
|
|
861
|
-
|
|
862
|
-
/**
|
|
863
|
-
* DejaVu 模板引擎词法单元定义
|
|
864
|
-
*/
|
|
865
|
-
/**
|
|
866
|
-
* 词法单元类型枚举
|
|
867
|
-
*/
|
|
868
|
-
declare enum TokenType {
|
|
869
|
-
/** 插值开始定界符 */
|
|
870
|
-
DELIMITER_START = "DELIMITER_START",
|
|
871
|
-
/** 插值结束定界符 */
|
|
872
|
-
DELIMITER_END = "DELIMITER_END",
|
|
873
|
-
/** 注释开始定界符 */
|
|
874
|
-
COMMENT_START = "COMMENT_START",
|
|
875
|
-
/** 注释结束定界符 */
|
|
876
|
-
COMMENT_END = "COMMENT_END",
|
|
877
|
-
/** 变量声明关键字 */
|
|
878
|
-
LET = "LET",
|
|
879
|
-
/** 微函数关键字 */
|
|
880
|
-
MICRO = "MICRO",
|
|
881
|
-
/** 命名空间关键字 */
|
|
882
|
-
NAMESPACE = "NAMESPACE",
|
|
883
|
-
/** 导入关键字 */
|
|
884
|
-
USING = "USING",
|
|
885
|
-
/** 条件语句关键字 */
|
|
886
|
-
IF = "IF",
|
|
887
|
-
/** 条件语句关键字 */
|
|
888
|
-
ELSE = "ELSE",
|
|
889
|
-
/** 循环语句关键字 */
|
|
890
|
-
LOOP = "LOOP",
|
|
891
|
-
/** 遍历关键字 */
|
|
892
|
-
IN = "IN",
|
|
893
|
-
/** 跳出循环关键字 */
|
|
894
|
-
BREAK = "BREAK",
|
|
895
|
-
/** 继续循环关键字 */
|
|
896
|
-
CONTINUE = "CONTINUE",
|
|
897
|
-
/** 匹配语句关键字 */
|
|
898
|
-
MATCH = "MATCH",
|
|
899
|
-
/** 匹配分支关键字 */
|
|
900
|
-
CASE = "CASE",
|
|
901
|
-
/** 结束语句关键字 */
|
|
902
|
-
END = "END",
|
|
903
|
-
/** 标识符 */
|
|
904
|
-
IDENTIFIER = "IDENTIFIER",
|
|
905
|
-
/** 布尔字面量 */
|
|
906
|
-
BOOLEAN_LITERAL = "BOOLEAN_LITERAL",
|
|
907
|
-
/** 数字字面量 */
|
|
908
|
-
NUMBER_LITERAL = "NUMBER_LITERAL",
|
|
909
|
-
/** 字符字面量 */
|
|
910
|
-
CHARACTER_LITERAL = "CHARACTER_LITERAL",
|
|
911
|
-
/** 字符串字面量 */
|
|
912
|
-
STRING_LITERAL = "STRING_LITERAL",
|
|
913
|
-
/** 原始标识符字面量 */
|
|
914
|
-
RAW_IDENTIFIER = "RAW_IDENTIFIER",
|
|
915
|
-
/** 赋值运算符 */
|
|
916
|
-
ASSIGN = "ASSIGN",
|
|
917
|
-
/** 加法运算符 */
|
|
918
|
-
PLUS = "PLUS",
|
|
919
|
-
/** 减法运算符 */
|
|
920
|
-
MINUS = "MINUS",
|
|
921
|
-
/** 乘法运算符 */
|
|
922
|
-
MULTIPLY = "MULTIPLY",
|
|
923
|
-
/** 除法运算符 */
|
|
924
|
-
DIVIDE = "DIVIDE",
|
|
925
|
-
/** 取模运算符 */
|
|
926
|
-
MODULO = "MODULO",
|
|
927
|
-
/** 逻辑与运算符 */
|
|
928
|
-
LOGICAL_AND = "LOGICAL_AND",
|
|
929
|
-
/** 逻辑或运算符 */
|
|
930
|
-
LOGICAL_OR = "LOGICAL_OR",
|
|
931
|
-
/** 逻辑非运算符 */
|
|
932
|
-
LOGICAL_NOT = "LOGICAL_NOT",
|
|
933
|
-
/** 等于运算符 */
|
|
934
|
-
EQUAL = "EQUAL",
|
|
935
|
-
/** 不等于运算符 */
|
|
936
|
-
NOT_EQUAL = "NOT_EQUAL",
|
|
937
|
-
/** 小于运算符 */
|
|
938
|
-
LESS_THAN = "LESS_THAN",
|
|
939
|
-
/** 大于运算符 */
|
|
940
|
-
GREATER_THAN = "GREATER_THAN",
|
|
941
|
-
/** 小于等于运算符 */
|
|
942
|
-
LESS_THAN_OR_EQUAL = "LESS_THAN_OR_EQUAL",
|
|
943
|
-
/** 大于等于运算符 */
|
|
944
|
-
GREATER_THAN_OR_EQUAL = "GREATER_THAN_OR_EQUAL",
|
|
945
|
-
/** 左括号 */
|
|
946
|
-
LEFT_PAREN = "LEFT_PAREN",
|
|
947
|
-
/** 右括号 */
|
|
948
|
-
RIGHT_PAREN = "RIGHT_PAREN",
|
|
949
|
-
/** 左方括号 */
|
|
950
|
-
LEFT_BRACKET = "LEFT_BRACKET",
|
|
951
|
-
/** 右方括号 */
|
|
952
|
-
RIGHT_BRACKET = "RIGHT_BRACKET",
|
|
953
|
-
/** 左花括号 */
|
|
954
|
-
LEFT_BRACE = "LEFT_BRACE",
|
|
955
|
-
/** 右花括号 */
|
|
956
|
-
RIGHT_BRACE = "RIGHT_BRACE",
|
|
957
|
-
/** 分号 */
|
|
958
|
-
SEMICOLON = "SEMICOLON",
|
|
959
|
-
/** 逗号 */
|
|
960
|
-
COMMA = "COMMA",
|
|
961
|
-
/** 点号 */
|
|
962
|
-
DOT = "DOT",
|
|
963
|
-
/** 冒号 */
|
|
964
|
-
COLON = "COLON",
|
|
965
|
-
/** 双冒号 */
|
|
966
|
-
DOUBLE_COLON = "DOUBLE_COLON",
|
|
967
|
-
/** 范围运算符 */
|
|
968
|
-
RANGE = "RANGE",
|
|
969
|
-
/** 文本 */
|
|
970
|
-
TEXT = "TEXT",
|
|
971
|
-
/** 注释 */
|
|
972
|
-
COMMENT = "COMMENT",
|
|
973
|
-
/** 结束标记 */
|
|
974
|
-
EOF = "EOF"
|
|
975
|
-
}
|
|
976
|
-
/**
|
|
977
|
-
* 词法单元接口
|
|
978
|
-
*/
|
|
979
|
-
interface Token {
|
|
980
|
-
/** 词法单元类型 */
|
|
981
|
-
type: TokenType;
|
|
982
|
-
/** 词法单元值 */
|
|
983
|
-
value: string;
|
|
984
|
-
/** 位置信息 */
|
|
985
|
-
loc: {
|
|
986
|
-
/** 开始位置 */
|
|
987
|
-
start: {
|
|
988
|
-
line: number;
|
|
989
|
-
column: number;
|
|
990
|
-
};
|
|
991
|
-
/** 结束位置 */
|
|
992
|
-
end: {
|
|
993
|
-
line: number;
|
|
994
|
-
column: number;
|
|
995
|
-
};
|
|
996
|
-
};
|
|
997
|
-
}
|
|
998
|
-
/**
|
|
999
|
-
* 创建词法单元
|
|
1000
|
-
* @param type 词法单元类型
|
|
1001
|
-
* @param value 词法单元值
|
|
1002
|
-
* @param startLine 开始行号
|
|
1003
|
-
* @param startColumn 开始列号
|
|
1004
|
-
* @param endLine 结束行号
|
|
1005
|
-
* @param endColumn 结束列号
|
|
1006
|
-
* @returns 词法单元
|
|
1007
|
-
*/
|
|
1008
|
-
declare function createToken(type: TokenType, value: string, startLine: number, startColumn: number, endLine: number, endColumn: number): Token;
|
|
1009
|
-
|
|
1010
|
-
/**
|
|
1011
|
-
* DejaVu 模板引擎词法分析器
|
|
1012
|
-
*/
|
|
1013
|
-
|
|
1014
|
-
/**
|
|
1015
|
-
* 词法分析器类
|
|
1016
|
-
*/
|
|
1017
|
-
declare class Lexer {
|
|
1018
|
-
/** 模板源代码 */
|
|
1019
|
-
readonly source: string;
|
|
1020
|
-
/** 当前位置 */
|
|
1021
|
-
private position;
|
|
1022
|
-
/** 当前行号 */
|
|
1023
|
-
private line;
|
|
1024
|
-
/** 当前列号 */
|
|
1025
|
-
private column;
|
|
1026
|
-
/** 定界符配置 */
|
|
1027
|
-
private delimiters;
|
|
1028
|
-
/**
|
|
1029
|
-
* 构造函数
|
|
1030
|
-
* @param source 模板源代码
|
|
1031
|
-
* @param language 语言配置
|
|
1032
|
-
*/
|
|
1033
|
-
constructor(source: string, language?: DejavuLanguage);
|
|
1034
|
-
/**
|
|
1035
|
-
* 获取下一个词法单元
|
|
1036
|
-
* @returns 词法单元
|
|
1037
|
-
*/
|
|
1038
|
-
nextToken(): Token;
|
|
1039
|
-
/**
|
|
1040
|
-
* 跳过空白字符
|
|
1041
|
-
*/
|
|
1042
|
-
private skipWhitespace;
|
|
1043
|
-
/**
|
|
1044
|
-
* 检查定界符
|
|
1045
|
-
* @returns 词法单元,如果不是定界符则返回null
|
|
1046
|
-
*/
|
|
1047
|
-
private checkDelimiters;
|
|
1048
|
-
/**
|
|
1049
|
-
* 检查注释
|
|
1050
|
-
* @returns 词法单元,如果不是注释则返回null
|
|
1051
|
-
*/
|
|
1052
|
-
private checkComment;
|
|
1053
|
-
/**
|
|
1054
|
-
* 检查标识符和关键字
|
|
1055
|
-
* @returns 词法单元,如果不是标识符或关键字则返回null
|
|
1056
|
-
*/
|
|
1057
|
-
private checkIdentifier;
|
|
1058
|
-
/**
|
|
1059
|
-
* 检查是否为标识符的开始字符
|
|
1060
|
-
* @param char 字符
|
|
1061
|
-
* @returns 是否为标识符的开始字符
|
|
1062
|
-
*/
|
|
1063
|
-
private isIdentifierStart;
|
|
1064
|
-
/**
|
|
1065
|
-
* 检查是否为标识符的组成字符
|
|
1066
|
-
* @param char 字符
|
|
1067
|
-
* @returns 是否为标识符的组成字符
|
|
1068
|
-
*/
|
|
1069
|
-
private isIdentifierPart;
|
|
1070
|
-
/**
|
|
1071
|
-
* 检查是否为关键字
|
|
1072
|
-
* @param identifier 标识符
|
|
1073
|
-
* @param startLine 开始行号
|
|
1074
|
-
* @param startColumn 开始列号
|
|
1075
|
-
* @returns 词法单元,如果不是关键字则返回null
|
|
1076
|
-
*/
|
|
1077
|
-
private checkKeyword;
|
|
1078
|
-
/**
|
|
1079
|
-
* 检查字面量
|
|
1080
|
-
* @returns 词法单元,如果不是字面量则返回null
|
|
1081
|
-
*/
|
|
1082
|
-
private checkLiteral;
|
|
1083
|
-
/**
|
|
1084
|
-
* 检查数字字面量
|
|
1085
|
-
* @returns 词法单元,如果不是数字字面量则返回null
|
|
1086
|
-
*/
|
|
1087
|
-
private checkNumberLiteral;
|
|
1088
|
-
/**
|
|
1089
|
-
* 检查字符是否为数字
|
|
1090
|
-
* @param char 字符
|
|
1091
|
-
* @returns 是否为数字
|
|
1092
|
-
*/
|
|
1093
|
-
private isDigit;
|
|
1094
|
-
/**
|
|
1095
|
-
* 检查字符字面量
|
|
1096
|
-
* @returns 词法单元,如果不是字符字面量则返回null
|
|
1097
|
-
*/
|
|
1098
|
-
private checkCharacterLiteral;
|
|
1099
|
-
/**
|
|
1100
|
-
* 检查字符串字面量
|
|
1101
|
-
* @returns 词法单元,如果不是字符串字面量则返回null
|
|
1102
|
-
*/
|
|
1103
|
-
private checkStringLiteral;
|
|
1104
|
-
/**
|
|
1105
|
-
* 检查原始标识符字面量
|
|
1106
|
-
* @returns 词法单元,如果不是原始标识符字面量则返回null
|
|
1107
|
-
*/
|
|
1108
|
-
private checkRawIdentifier;
|
|
1109
|
-
/**
|
|
1110
|
-
* 检查运算符和标点符号
|
|
1111
|
-
* @returns 词法单元,如果不是运算符或标点符号则返回null
|
|
1112
|
-
*/
|
|
1113
|
-
private checkOperator;
|
|
1114
|
-
/**
|
|
1115
|
-
* 检查文本
|
|
1116
|
-
* @returns 词法单元,如果不是文本则返回null
|
|
1117
|
-
*/
|
|
1118
|
-
private checkText;
|
|
1119
|
-
/**
|
|
1120
|
-
* 创建词法单元
|
|
1121
|
-
* @param type 词法单元类型
|
|
1122
|
-
* @param value 词法单元值
|
|
1123
|
-
* @param startLine 开始行号
|
|
1124
|
-
* @param startColumn 开始列号
|
|
1125
|
-
* @param endLine 结束行号
|
|
1126
|
-
* @param endColumn 结束列号
|
|
1127
|
-
* @returns 词法单元
|
|
1128
|
-
*/
|
|
1129
|
-
private createToken;
|
|
1130
|
-
}
|
|
1131
|
-
/**
|
|
1132
|
-
* 创建词法分析器
|
|
1133
|
-
* @param source 模板源代码
|
|
1134
|
-
* @param language 语言配置
|
|
1135
|
-
* @returns 词法分析器实例
|
|
1136
|
-
*/
|
|
1137
|
-
declare function createLexer(source: string, language?: DejavuLanguage): Lexer;
|
|
1138
|
-
|
|
1139
|
-
/**
|
|
1140
|
-
* DejaVu 模板引擎语法分析器
|
|
1141
|
-
*/
|
|
1142
|
-
|
|
1143
|
-
/**
|
|
1144
|
-
* 语法分析器类
|
|
1145
|
-
*/
|
|
1146
|
-
declare class Parser {
|
|
1147
|
-
/** 词法分析器 */
|
|
1148
|
-
private lexer;
|
|
1149
|
-
/** 当前词法单元 */
|
|
1150
|
-
private currentToken;
|
|
1151
|
-
/** 是否在模板模式 */
|
|
1152
|
-
private inTemplateMode;
|
|
1153
|
-
/**
|
|
1154
|
-
* 构造函数
|
|
1155
|
-
* @param source 模板源代码
|
|
1156
|
-
* @param language 语言配置
|
|
1157
|
-
*/
|
|
1158
|
-
constructor(source: string, language?: DejavuLanguage);
|
|
1159
|
-
/**
|
|
1160
|
-
* 解析模板,生成AST
|
|
1161
|
-
* @returns 程序节点
|
|
1162
|
-
*/
|
|
1163
|
-
parse(): Program;
|
|
1164
|
-
/**
|
|
1165
|
-
* 解析文本节点
|
|
1166
|
-
* @returns 文本节点
|
|
1167
|
-
*/
|
|
1168
|
-
private parseText;
|
|
1169
|
-
/**
|
|
1170
|
-
* 解析注释节点
|
|
1171
|
-
* @returns 注释节点
|
|
1172
|
-
*/
|
|
1173
|
-
private parseComment;
|
|
1174
|
-
/**
|
|
1175
|
-
* 解析模板表达式
|
|
1176
|
-
* @returns 语句或表达式节点,如果遇到结束标记则返回null
|
|
1177
|
-
*/
|
|
1178
|
-
private parseTemplateExpression;
|
|
1179
|
-
/**
|
|
1180
|
-
* 解析模板内的语句
|
|
1181
|
-
* @returns 语句或表达式节点
|
|
1182
|
-
*/
|
|
1183
|
-
private parseTemplateStatement;
|
|
1184
|
-
/**
|
|
1185
|
-
* 解析模板内的表达式或赋值语句
|
|
1186
|
-
* @returns 表达式或赋值语句节点
|
|
1187
|
-
*/
|
|
1188
|
-
private parseTemplateExpressionOrAssignment;
|
|
1189
|
-
/**
|
|
1190
|
-
* 解析模板内的if语句(支持else if和end if)
|
|
1191
|
-
* @returns if语句节点
|
|
1192
|
-
*/
|
|
1193
|
-
private parseTemplateIfStatement;
|
|
1194
|
-
/**
|
|
1195
|
-
* 解析模板内的循环语句(支持loop item in list和end loop)
|
|
1196
|
-
* @returns 循环语句节点
|
|
1197
|
-
*/
|
|
1198
|
-
private parseTemplateLoopStatement;
|
|
1199
|
-
/**
|
|
1200
|
-
* 解析传统for循环
|
|
1201
|
-
* @param startLoc 起始位置
|
|
1202
|
-
* @returns for循环语句节点
|
|
1203
|
-
*/
|
|
1204
|
-
private parseTraditionalForLoop;
|
|
1205
|
-
/**
|
|
1206
|
-
* 解析for-in遍历循环
|
|
1207
|
-
* @param startLoc 起始位置
|
|
1208
|
-
* @returns for-in循环语句节点
|
|
1209
|
-
*/
|
|
1210
|
-
private parseForInLoop;
|
|
1211
|
-
/**
|
|
1212
|
-
* 解析模板内的match语句
|
|
1213
|
-
* @returns match语句节点
|
|
1214
|
-
*/
|
|
1215
|
-
private parseTemplateMatchStatement;
|
|
1216
|
-
/**
|
|
1217
|
-
* 解析微函数声明(支持end micro)
|
|
1218
|
-
* @returns 函数声明节点
|
|
1219
|
-
*/
|
|
1220
|
-
private parseMicroDeclaration;
|
|
1221
|
-
/**
|
|
1222
|
-
* 解析带类型注解的参数
|
|
1223
|
-
* @returns 带类型注解的参数节点
|
|
1224
|
-
*/
|
|
1225
|
-
private parseTypedParameter;
|
|
1226
|
-
/**
|
|
1227
|
-
* 解析命名空间声明
|
|
1228
|
-
* @returns 命名空间声明节点
|
|
1229
|
-
*/
|
|
1230
|
-
private parseNamespaceDeclaration;
|
|
1231
|
-
/**
|
|
1232
|
-
* 解析using导入声明
|
|
1233
|
-
* @returns using声明节点
|
|
1234
|
-
*/
|
|
1235
|
-
private parseUsingDeclaration;
|
|
1236
|
-
/**
|
|
1237
|
-
* 解析模板块(直到遇到指定的结束关键字)
|
|
1238
|
-
* @param endKeywords 结束关键字列表
|
|
1239
|
-
* @returns 块语句节点
|
|
1240
|
-
*/
|
|
1241
|
-
private parseTemplateBlock;
|
|
1242
|
-
/**
|
|
1243
|
-
* 将文本节点转换为注释节点(用于模板块内)
|
|
1244
|
-
*/
|
|
1245
|
-
private parseTextAsComment;
|
|
1246
|
-
/**
|
|
1247
|
-
* 跳过结束标记
|
|
1248
|
-
* @param keyword 关键字名称
|
|
1249
|
-
*/
|
|
1250
|
-
private skipEndMarker;
|
|
1251
|
-
/**
|
|
1252
|
-
* 解析break语句
|
|
1253
|
-
* @returns 表达式语句节点
|
|
1254
|
-
*/
|
|
1255
|
-
private parseBreakStatement;
|
|
1256
|
-
/**
|
|
1257
|
-
* 解析continue语句
|
|
1258
|
-
* @returns 表达式语句节点
|
|
1259
|
-
*/
|
|
1260
|
-
private parseContinueStatement;
|
|
1261
|
-
/**
|
|
1262
|
-
* 解析语句
|
|
1263
|
-
* @returns 语句节点
|
|
1264
|
-
*/
|
|
1265
|
-
private parseStatement;
|
|
1266
|
-
/**
|
|
1267
|
-
* 解析变量声明
|
|
1268
|
-
* @returns 变量声明节点
|
|
1269
|
-
*/
|
|
1270
|
-
private parseVariableDeclaration;
|
|
1271
|
-
/**
|
|
1272
|
-
* 解析函数声明(传统模式)
|
|
1273
|
-
* @returns 函数声明节点
|
|
1274
|
-
*/
|
|
1275
|
-
private parseFunctionDeclaration;
|
|
1276
|
-
/**
|
|
1277
|
-
* 解析if语句(传统模式)
|
|
1278
|
-
* @returns if语句节点
|
|
1279
|
-
*/
|
|
1280
|
-
private parseIfStatement;
|
|
1281
|
-
/**
|
|
1282
|
-
* 解析循环语句(传统模式)
|
|
1283
|
-
* @returns 循环语句节点
|
|
1284
|
-
*/
|
|
1285
|
-
private parseLoopStatement;
|
|
1286
|
-
/**
|
|
1287
|
-
* 解析块语句
|
|
1288
|
-
* @returns 块语句节点
|
|
1289
|
-
*/
|
|
1290
|
-
private parseBlockStatement;
|
|
1291
|
-
/**
|
|
1292
|
-
* 解析赋值语句
|
|
1293
|
-
* @returns 赋值语句节点
|
|
1294
|
-
*/
|
|
1295
|
-
private parseAssignmentStatement;
|
|
1296
|
-
/**
|
|
1297
|
-
* 解析表达式语句
|
|
1298
|
-
* @returns 表达式语句节点
|
|
1299
|
-
*/
|
|
1300
|
-
private parseExpressionStatement;
|
|
1301
|
-
/**
|
|
1302
|
-
* 解析表达式
|
|
1303
|
-
* @returns 表达式节点
|
|
1304
|
-
*/
|
|
1305
|
-
private parseExpression;
|
|
1306
|
-
/**
|
|
1307
|
-
* 解析逻辑或表达式
|
|
1308
|
-
* @returns 表达式节点
|
|
1309
|
-
*/
|
|
1310
|
-
private parseLogicalOrExpression;
|
|
1311
|
-
/**
|
|
1312
|
-
* 解析逻辑与表达式
|
|
1313
|
-
* @returns 表达式节点
|
|
1314
|
-
*/
|
|
1315
|
-
private parseLogicalAndExpression;
|
|
1316
|
-
/**
|
|
1317
|
-
* 解析比较表达式
|
|
1318
|
-
* @returns 表达式节点
|
|
1319
|
-
*/
|
|
1320
|
-
private parseComparisonExpression;
|
|
1321
|
-
/**
|
|
1322
|
-
* 检查是否为比较运算符
|
|
1323
|
-
*/
|
|
1324
|
-
private isComparisonOperator;
|
|
1325
|
-
/**
|
|
1326
|
-
* 解析加法表达式
|
|
1327
|
-
* @returns 表达式节点
|
|
1328
|
-
*/
|
|
1329
|
-
private parseAdditiveExpression;
|
|
1330
|
-
/**
|
|
1331
|
-
* 解析乘法表达式
|
|
1332
|
-
* @returns 表达式节点
|
|
1333
|
-
*/
|
|
1334
|
-
private parseMultiplicativeExpression;
|
|
1335
|
-
/**
|
|
1336
|
-
* 解析范围表达式
|
|
1337
|
-
* @returns 表达式节点
|
|
1338
|
-
*/
|
|
1339
|
-
private parseRangeExpression;
|
|
1340
|
-
/**
|
|
1341
|
-
* 解析一元表达式
|
|
1342
|
-
* @returns 表达式节点
|
|
1343
|
-
*/
|
|
1344
|
-
private parseUnaryExpression;
|
|
1345
|
-
/**
|
|
1346
|
-
* 解析 primary 表达式
|
|
1347
|
-
* @returns 表达式节点
|
|
1348
|
-
*/
|
|
1349
|
-
private parsePrimaryExpression;
|
|
1350
|
-
/**
|
|
1351
|
-
* 解析标识符节点(仅返回Identifier,不处理调用或成员访问)
|
|
1352
|
-
*/
|
|
1353
|
-
private parseIdentifierNode;
|
|
1354
|
-
/**
|
|
1355
|
-
* 解析标识符表达式(可能包含调用或成员访问)
|
|
1356
|
-
*/
|
|
1357
|
-
private parseIdentifierExpression;
|
|
1358
|
-
/**
|
|
1359
|
-
* 解析数字字面量
|
|
1360
|
-
* @returns 字面量节点
|
|
1361
|
-
*/
|
|
1362
|
-
private parseNumberLiteral;
|
|
1363
|
-
/**
|
|
1364
|
-
* 解析字符串字面量
|
|
1365
|
-
* @returns 字面量节点
|
|
1366
|
-
*/
|
|
1367
|
-
private parseStringLiteral;
|
|
1368
|
-
/**
|
|
1369
|
-
* 解析布尔字面量
|
|
1370
|
-
* @returns 字面量节点
|
|
1371
|
-
*/
|
|
1372
|
-
private parseBooleanLiteral;
|
|
1373
|
-
/**
|
|
1374
|
-
* 解析字符字面量
|
|
1375
|
-
* @returns 字面量节点
|
|
1376
|
-
*/
|
|
1377
|
-
private parseCharacterLiteral;
|
|
1378
|
-
/**
|
|
1379
|
-
* 解析括号表达式
|
|
1380
|
-
* @returns 表达式节点
|
|
1381
|
-
*/
|
|
1382
|
-
private parseParenthesizedExpression;
|
|
1383
|
-
/**
|
|
1384
|
-
* 解析数组表达式
|
|
1385
|
-
* @returns 数组表达式节点
|
|
1386
|
-
*/
|
|
1387
|
-
private parseArrayExpression;
|
|
1388
|
-
/**
|
|
1389
|
-
* 解析对象表达式
|
|
1390
|
-
* @returns 对象表达式节点
|
|
1391
|
-
*/
|
|
1392
|
-
private parseObjectExpression;
|
|
1393
|
-
/**
|
|
1394
|
-
* 解析函数调用表达式
|
|
1395
|
-
* @param callee 被调用的函数
|
|
1396
|
-
* @returns 函数调用表达式节点
|
|
1397
|
-
*/
|
|
1398
|
-
private parseCallExpression;
|
|
1399
|
-
/**
|
|
1400
|
-
* 解析成员访问表达式
|
|
1401
|
-
* @param object 对象表达式
|
|
1402
|
-
* @returns 成员访问表达式节点
|
|
1403
|
-
*/
|
|
1404
|
-
private parseMemberExpression;
|
|
1405
|
-
/**
|
|
1406
|
-
* 解析后缀表达式(处理成员访问和链式调用)
|
|
1407
|
-
*/
|
|
1408
|
-
private parsePostfixExpression;
|
|
1409
|
-
/**
|
|
1410
|
-
* 检查当前token是否为指定类型
|
|
1411
|
-
*/
|
|
1412
|
-
private isToken;
|
|
1413
|
-
/**
|
|
1414
|
-
* 期望并消费指定类型的token
|
|
1415
|
-
*/
|
|
1416
|
-
private expectAndConsume;
|
|
1417
|
-
/**
|
|
1418
|
-
* 消费可选的分号
|
|
1419
|
-
*/
|
|
1420
|
-
private consumeOptionalSemicolon;
|
|
1421
|
-
/**
|
|
1422
|
-
* 创建位置信息
|
|
1423
|
-
*/
|
|
1424
|
-
private createLoc;
|
|
1425
|
-
/**
|
|
1426
|
-
* 前进到下一个词法单元
|
|
1427
|
-
*/
|
|
1428
|
-
private advance;
|
|
1429
|
-
}
|
|
1430
|
-
/**
|
|
1431
|
-
* 创建解析器
|
|
1432
|
-
* @param source 模板源代码
|
|
1433
|
-
* @param language 语言配置
|
|
1434
|
-
* @returns 解析器实例
|
|
1435
|
-
*/
|
|
1436
|
-
declare function createParser(source: string, language?: DejavuLanguage): Parser;
|
|
1437
|
-
/**
|
|
1438
|
-
* 解析模板,生成AST
|
|
1439
|
-
* @param source 模板源代码
|
|
1440
|
-
* @param language 语言配置
|
|
1441
|
-
* @returns 程序节点
|
|
1442
|
-
*/
|
|
1443
|
-
declare function parse(source: string, language?: DejavuLanguage): Program;
|
|
1444
|
-
|
|
1445
|
-
export { type ArrayExpression, type AssignmentStatement, type BinaryExpression, type BlockStatement, type CallExpression, type Comment, DEFAULT_TEMPLATE_CONFIG, DejavuEngine, DejavuLanguage, DejavuRenderer, type ElseIfClause, type Expression, type ExpressionStatement, type ForInStatement, type ForStatement, type FunctionDeclaration, type Identifier, type IfStatement, Lexer, type Literal, type MatchCase, type MatchStatement, type MemberExpression, type NamespaceDeclaration, type Node, NodeType, type ObjectExpression, type ObjectProperty, Parser, type Program, type RangeExpression, type RenderContext, type Statement, SyntaxMode, type TemplateConfig, type TemplateExpression, type TemplateLiteral, type Text, type Token, TokenType, type TypedParameter, type UnaryExpression, type UsingDeclaration, type VariableDeclaration, type WhileStatement, checkTemplate, createArrayExpression, createAssignmentStatement, createBinaryExpression, createBlockStatement, createCallExpression, createComment, createElseIfClause, createExpressionStatement, createForInStatement, createForStatement, createFunctionDeclaration, createIdentifier, createIfStatement, createLexer, createLiteral, createMatchCase, createMatchStatement, createMemberExpression, createNamespaceDeclaration, createObjectExpression, createObjectProperty, createParser, createProgram, createRangeExpression, createTemplateExpression, createText, createToken, createTypedParameter, createUnaryExpression, createUsingDeclaration, createVariableDeclaration, createWhileStatement, engine, language, parse, registerTemplate, renderTemplate, renderer };
|
|
7
|
+
export { htmlEscape, valueToString, isTruthy, applyFilter, binary, unary, exprMember, exprIndex, } from "./runtime/index.js";
|