xmlui 0.9.0 → 0.9.2

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 (45) hide show
  1. package/dist/{apiInterceptorWorker-B1u6prJM.mjs → apiInterceptorWorker-DJ_oGB-F.mjs} +1 -1
  2. package/dist/{index-CVvazA5D.mjs → index-2qtmUAFJ.mjs} +37 -21
  3. package/dist/index.css +12 -14
  4. package/dist/scripts/bin/vite-xmlui-plugin.js +1 -1
  5. package/dist/scripts/src/abstractions/scripting/ScriptingSourceTree.js +48 -0
  6. package/dist/scripts/src/components/Markdown/MarkdownNative.js +2 -2
  7. package/dist/scripts/src/components-core/RestApiProxy.js +2 -2
  8. package/dist/scripts/src/components-core/rendering/Container.js +3 -3
  9. package/dist/scripts/src/components-core/rendering/StateContainer.js +3 -3
  10. package/dist/scripts/src/components-core/script-runner/ParameterParser.js +1 -1
  11. package/dist/scripts/src/components-core/script-runner/eval-tree-async.js +66 -47
  12. package/dist/scripts/src/components-core/script-runner/eval-tree-common.js +8 -8
  13. package/dist/scripts/src/components-core/script-runner/eval-tree-sync.js +37 -37
  14. package/dist/scripts/src/components-core/script-runner/process-statement-async.js +29 -29
  15. package/dist/scripts/src/components-core/script-runner/process-statement-common.js +5 -5
  16. package/dist/scripts/src/components-core/script-runner/process-statement-sync.js +29 -29
  17. package/dist/scripts/src/components-core/script-runner/visitors.js +47 -47
  18. package/dist/scripts/src/components-core/theming/ThemeProvider.js +2 -2
  19. package/dist/scripts/src/components-core/theming/themes/root.js +1 -1
  20. package/dist/scripts/src/components-core/utils/statementUtils.js +32 -32
  21. package/dist/scripts/src/parsers/scripting/Lexer.js +166 -178
  22. package/dist/scripts/src/parsers/scripting/Parser.js +555 -701
  23. package/dist/scripts/src/parsers/scripting/ParserError.js +3 -3
  24. package/dist/scripts/src/parsers/scripting/TokenTrait.js +103 -105
  25. package/dist/scripts/src/parsers/{scripting-exp → scripting}/code-behind-collect.js +4 -4
  26. package/dist/scripts/src/parsers/{scripting-exp → scripting}/modules.js +2 -2
  27. package/dist/scripts/src/parsers/{scripting-exp → scripting}/tree-visitor.js +45 -45
  28. package/dist/scripts/src/parsers/xmlui-parser/transform.js +2 -2
  29. package/dist/style.css +12 -14
  30. package/dist/xmlui-metadata.mjs +1 -1
  31. package/dist/xmlui-metadata.umd.js +1 -1
  32. package/dist/xmlui-parser.d.ts +1 -11
  33. package/dist/xmlui-standalone.umd.js +51 -37
  34. package/dist/xmlui.d.ts +2 -75
  35. package/dist/xmlui.mjs +1 -1
  36. package/package.json +3 -3
  37. package/dist/scripts/src/abstractions/scripting/ScriptingSourceTreeExp.js +0 -50
  38. package/dist/scripts/src/abstractions/scripting/Token.js +0 -112
  39. package/dist/scripts/src/components-core/theming/abstractions.js +0 -11
  40. package/dist/scripts/src/parsers/scripting-exp/Lexer.js +0 -1092
  41. package/dist/scripts/src/parsers/scripting-exp/Parser.js +0 -2635
  42. package/dist/scripts/src/parsers/scripting-exp/ParserError.js +0 -47
  43. package/dist/scripts/src/parsers/scripting-exp/TokenTrait.js +0 -109
  44. /package/dist/scripts/src/abstractions/scripting/{LogicalThreadExp.js → LogicalThread.js} +0 -0
  45. /package/dist/scripts/src/parsers/{scripting-exp → scripting}/TokenType.js +0 -0
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Parser = void 0;
4
- const Token_1 = require("../../abstractions/scripting/Token");
4
+ exports.createXmlUiTreeNodeId = createXmlUiTreeNodeId;
5
+ const ScriptingSourceTree_1 = require("../../abstractions/scripting/ScriptingSourceTree");
5
6
  const InputStream_1 = require("../common/InputStream");
6
- const TokenTrait_1 = require("./TokenTrait");
7
7
  const Lexer_1 = require("./Lexer");
8
8
  const ParserError_1 = require("./ParserError");
9
+ const TokenTrait_1 = require("./TokenTrait");
10
+ const TokenType_1 = require("./TokenType");
9
11
  /**
10
12
  * States of the string parsing
11
13
  */
@@ -27,6 +29,10 @@ var StrParseState;
27
29
  StrParseState[StrParseState["Ucp6"] = 13] = "Ucp6";
28
30
  StrParseState[StrParseState["UcpTail"] = 14] = "UcpTail";
29
31
  })(StrParseState || (StrParseState = {}));
32
+ let lastNodeId = 0;
33
+ function createXmlUiTreeNodeId() {
34
+ return ++lastNodeId;
35
+ }
30
36
  /**
31
37
  * This class parses a binding expression and transforms it into an evaluable expression tree
32
38
  */
@@ -36,11 +42,17 @@ class Parser {
36
42
  * @param source Source code to parse
37
43
  */
38
44
  constructor(source) {
39
- this.source = source;
40
45
  // --- Keep track of error messages
41
46
  this._parseErrors = [];
42
47
  // --- Indicates the parsing level
43
48
  this._statementLevel = 0;
49
+ this._lexer = new Lexer_1.Lexer(new InputStream_1.InputStream(source !== null && source !== void 0 ? source : ""));
50
+ }
51
+ /**
52
+ * Sets the source code to parse
53
+ * @param source Source code to parse
54
+ */
55
+ setSource(source) {
44
56
  this._lexer = new Lexer_1.Lexer(new InputStream_1.InputStream(source));
45
57
  }
46
58
  /**
@@ -59,7 +71,7 @@ class Parser {
59
71
  * Checks if we're at the end of the expression
60
72
  */
61
73
  get isEof() {
62
- return this._lexer.peek().type === Token_1.TokenType.Eof;
74
+ return this._lexer.peek().type === TokenType_1.TokenType.Eof;
63
75
  }
64
76
  /**
65
77
  * Gets the characters remaining after parsing
@@ -91,8 +103,8 @@ class Parser {
91
103
  if (!statement)
92
104
  return null;
93
105
  statements.push(statement);
94
- if (statement.type !== "EmptyS") {
95
- this.skipToken(Token_1.TokenType.Semicolon);
106
+ if (statement.type !== ScriptingSourceTree_1.T_EMPTY_STATEMENT) {
107
+ this.skipToken(TokenType_1.TokenType.Semicolon);
96
108
  }
97
109
  }
98
110
  return statements;
@@ -105,54 +117,44 @@ class Parser {
105
117
  try {
106
118
  const startToken = this._lexer.peek();
107
119
  switch (startToken.type) {
108
- case Token_1.TokenType.Semicolon:
120
+ case TokenType_1.TokenType.Semicolon:
109
121
  return this.parseEmptyStatement();
110
- case Token_1.TokenType.Let:
122
+ case TokenType_1.TokenType.Let:
111
123
  return this.parseLetStatement();
112
- case Token_1.TokenType.Const:
124
+ case TokenType_1.TokenType.Const:
113
125
  return this.parseConstStatement();
114
- case Token_1.TokenType.Var:
126
+ case TokenType_1.TokenType.Var:
115
127
  return this.parseVarStatement();
116
- case Token_1.TokenType.LBrace:
128
+ case TokenType_1.TokenType.LBrace:
117
129
  return this.parseBlockStatement();
118
- case Token_1.TokenType.If:
130
+ case TokenType_1.TokenType.If:
119
131
  return this.parseIfStatement();
120
- case Token_1.TokenType.Do:
132
+ case TokenType_1.TokenType.Do:
121
133
  return this.parseDoWhileStatement();
122
- case Token_1.TokenType.While:
134
+ case TokenType_1.TokenType.While:
123
135
  return this.parseWhileStatement();
124
- case Token_1.TokenType.Return:
136
+ case TokenType_1.TokenType.Return:
125
137
  return this.parseReturnStatement();
126
- case Token_1.TokenType.Break:
138
+ case TokenType_1.TokenType.Break:
127
139
  this._lexer.get();
128
- return this.createStatementNode("BrkS", {}, startToken, startToken);
129
- case Token_1.TokenType.Continue:
140
+ return this.createStatementNode(ScriptingSourceTree_1.T_BREAK_STATEMENT, {}, startToken, startToken);
141
+ case TokenType_1.TokenType.Continue:
130
142
  this._lexer.get();
131
- return this.createStatementNode("ContS", {}, startToken, startToken);
132
- case Token_1.TokenType.For:
143
+ return this.createStatementNode(ScriptingSourceTree_1.T_CONTINUE_STATEMENT, {}, startToken, startToken);
144
+ case TokenType_1.TokenType.For:
133
145
  return this.parseForStatement();
134
- case Token_1.TokenType.Throw:
146
+ case TokenType_1.TokenType.Throw:
135
147
  return this.parseThrowStatement();
136
- case Token_1.TokenType.Try:
148
+ case TokenType_1.TokenType.Try:
137
149
  return this.parseTryStatement();
138
- case Token_1.TokenType.Switch:
150
+ case TokenType_1.TokenType.Switch:
139
151
  return this.parseSwitchStatement();
140
- case Token_1.TokenType.Function:
152
+ case TokenType_1.TokenType.Function:
141
153
  return this.parseFunctionDeclaration();
142
- case Token_1.TokenType.Export:
143
- return this.parseExport();
144
- case Token_1.TokenType.Import:
145
- return this.parseImport();
146
154
  default:
147
- if (startToken.type === Token_1.TokenType.Eof) {
148
- this.reportError("W002", startToken, "EOF");
149
- return null;
150
- }
151
- if (this.isExpressionStart(startToken)) {
152
- return this.parseExpressionStatement(allowSequence);
153
- }
154
- this.reportError("W002", startToken, startToken.text);
155
- return null;
155
+ return this.isExpressionStart(startToken)
156
+ ? this.parseExpressionStatement(allowSequence)
157
+ : null;
156
158
  }
157
159
  }
158
160
  finally {
@@ -168,7 +170,7 @@ class Parser {
168
170
  */
169
171
  parseEmptyStatement() {
170
172
  const startToken = this._lexer.get();
171
- return this.createStatementNode("EmptyS", {}, startToken, startToken);
173
+ return this.createStatementNode(ScriptingSourceTree_1.T_EMPTY_STATEMENT, {}, startToken, startToken);
172
174
  }
173
175
  /**
174
176
  * Parses an expression statement
@@ -179,11 +181,11 @@ class Parser {
179
181
  */
180
182
  parseExpressionStatement(allowSequence = true) {
181
183
  const startToken = this._lexer.peek();
182
- const expression = this.getExpression(allowSequence);
183
- return expression
184
- ? this.createStatementNode("ExprS", {
185
- expression,
186
- }, startToken, expression.endToken)
184
+ const expr = this.getExpression(allowSequence);
185
+ return expr
186
+ ? this.createStatementNode(ScriptingSourceTree_1.T_EXPRESSION_STATEMENT, {
187
+ expr,
188
+ }, startToken, expr.endToken)
187
189
  : null;
188
190
  }
189
191
  /**
@@ -196,35 +198,33 @@ class Parser {
196
198
  parseLetStatement() {
197
199
  const startToken = this._lexer.get();
198
200
  let endToken = startToken;
199
- const declarations = [];
201
+ const decls = [];
200
202
  while (true) {
201
203
  const declStart = this._lexer.peek();
202
204
  let declarationProps = {};
203
- if (declStart.type === Token_1.TokenType.LBrace) {
205
+ if (declStart.type === TokenType_1.TokenType.LBrace) {
204
206
  // --- This is object destructure
205
207
  endToken = this._lexer.ahead(1);
206
- const objectDestruct = this.parseObjectDestructure();
207
- if (objectDestruct === null)
208
+ const oDestr = this.parseObjectDestructure();
209
+ if (oDestr === null)
208
210
  return null;
209
211
  declarationProps = {
210
- objectDestruct,
212
+ oDestr,
211
213
  };
212
- endToken =
213
- objectDestruct.length > 0 ? objectDestruct[objectDestruct.length - 1].endToken : endToken;
214
+ endToken = oDestr.length > 0 ? oDestr[oDestr.length - 1].endToken : endToken;
214
215
  }
215
- else if (declStart.type === Token_1.TokenType.LSquare) {
216
+ else if (declStart.type === TokenType_1.TokenType.LSquare) {
216
217
  // --- This is array destructure
217
218
  endToken = this._lexer.ahead(1);
218
- const arrayDestruct = this.parseArrayDestructure();
219
- if (arrayDestruct === null)
219
+ const aDestr = this.parseArrayDestructure();
220
+ if (aDestr === null)
220
221
  return null;
221
222
  declarationProps = {
222
- arrayDestruct,
223
+ aDestr,
223
224
  };
224
- endToken =
225
- arrayDestruct.length > 0 ? arrayDestruct[arrayDestruct.length - 1].endToken : endToken;
225
+ endToken = aDestr.length > 0 ? aDestr[aDestr.length - 1].endToken : endToken;
226
226
  }
227
- else if (declStart.type === Token_1.TokenType.Identifier) {
227
+ else if (declStart.type === TokenType_1.TokenType.Identifier) {
228
228
  if (declStart.text.startsWith("$")) {
229
229
  this.reportError("W031");
230
230
  return null;
@@ -240,29 +240,29 @@ class Parser {
240
240
  }
241
241
  // --- Optional initialization
242
242
  const initToken = this._lexer.peek();
243
- let expression = null;
244
- if (initToken.type === Token_1.TokenType.Assignment) {
243
+ let expr = null;
244
+ if (initToken.type === TokenType_1.TokenType.Assignment) {
245
245
  this._lexer.get();
246
- expression = this.getExpression(false);
247
- if (expression === null)
246
+ expr = this.getExpression(false);
247
+ if (expr === null)
248
248
  return null;
249
- declarationProps.expression = expression;
250
- endToken = expression.endToken;
249
+ declarationProps.expr = expr;
250
+ endToken = expr.endToken;
251
251
  }
252
- else if (declarationProps.arrayDestruct || declarationProps.objectDestruct) {
252
+ else if (declarationProps.aDestr || declarationProps.oDestr) {
253
253
  this.reportError("W009", initToken);
254
254
  return null;
255
255
  }
256
256
  // --- New declaration reached
257
- declarations.push(this.createExpressionNode("VarD", declarationProps, declStart, endToken));
257
+ decls.push(this.createExpressionNode(ScriptingSourceTree_1.T_VAR_DECLARATION, declarationProps, declStart, endToken));
258
258
  // --- Check for more declarations
259
- if (this._lexer.peek().type !== Token_1.TokenType.Comma)
259
+ if (this._lexer.peek().type !== TokenType_1.TokenType.Comma)
260
260
  break;
261
261
  this._lexer.get();
262
262
  }
263
263
  // --- Done
264
- return this.createStatementNode("LetS", {
265
- declarations,
264
+ return this.createStatementNode(ScriptingSourceTree_1.T_LET_STATEMENT, {
265
+ decls,
266
266
  }, startToken, endToken);
267
267
  }
268
268
  /**
@@ -275,35 +275,33 @@ class Parser {
275
275
  parseConstStatement() {
276
276
  const startToken = this._lexer.get();
277
277
  let endToken = startToken;
278
- const declarations = [];
278
+ const decls = [];
279
279
  while (true) {
280
280
  const declStart = this._lexer.peek();
281
281
  let declarationProps = {};
282
- if (declStart.type === Token_1.TokenType.LBrace) {
282
+ if (declStart.type === TokenType_1.TokenType.LBrace) {
283
283
  // --- This is object destructure
284
284
  endToken = this._lexer.ahead(1);
285
- const objectDestruct = this.parseObjectDestructure();
286
- if (objectDestruct === null)
285
+ const oDestr = this.parseObjectDestructure();
286
+ if (oDestr === null)
287
287
  return null;
288
288
  declarationProps = {
289
- objectDestruct,
289
+ oDestr,
290
290
  };
291
- endToken =
292
- objectDestruct.length > 0 ? objectDestruct[objectDestruct.length - 1].endToken : endToken;
291
+ endToken = oDestr.length > 0 ? oDestr[oDestr.length - 1].endToken : endToken;
293
292
  }
294
- else if (declStart.type === Token_1.TokenType.LSquare) {
293
+ else if (declStart.type === TokenType_1.TokenType.LSquare) {
295
294
  // --- This is array destructure
296
295
  endToken = this._lexer.ahead(1);
297
- const arrayDestruct = this.parseArrayDestructure();
298
- if (arrayDestruct === null)
296
+ const aDestr = this.parseArrayDestructure();
297
+ if (aDestr === null)
299
298
  return null;
300
299
  declarationProps = {
301
- arrayDestruct,
300
+ aDestr,
302
301
  };
303
- endToken =
304
- arrayDestruct.length > 0 ? arrayDestruct[arrayDestruct.length - 1].endToken : endToken;
302
+ endToken = aDestr.length > 0 ? aDestr[aDestr.length - 1].endToken : endToken;
305
303
  }
306
- else if (declStart.type === Token_1.TokenType.Identifier) {
304
+ else if (declStart.type === TokenType_1.TokenType.Identifier) {
307
305
  if (declStart.text.startsWith("$")) {
308
306
  this.reportError("W031");
309
307
  return null;
@@ -317,26 +315,26 @@ class Parser {
317
315
  this.reportError("W003");
318
316
  return null;
319
317
  }
320
- this.expectToken(Token_1.TokenType.Assignment);
321
- const expression = this.getExpression(false);
322
- if (expression === null)
318
+ this.expectToken(TokenType_1.TokenType.Assignment);
319
+ const expr = this.getExpression(false);
320
+ if (expr === null)
323
321
  return null;
324
- declarationProps.expression = expression;
325
- endToken = expression.endToken;
322
+ declarationProps.expr = expr;
323
+ endToken = expr.endToken;
326
324
  // --- New declaration reached
327
- declarations.push(this.createExpressionNode("VarD", declarationProps, declStart, endToken));
325
+ decls.push(this.createExpressionNode(ScriptingSourceTree_1.T_VAR_DECLARATION, declarationProps, declStart, endToken));
328
326
  // --- Check for more declarations
329
- if (this._lexer.peek().type !== Token_1.TokenType.Comma)
327
+ if (this._lexer.peek().type !== TokenType_1.TokenType.Comma)
330
328
  break;
331
329
  this._lexer.get();
332
330
  }
333
331
  // --- Done
334
- return this.createStatementNode("ConstS", {
335
- declarations,
332
+ return this.createStatementNode(ScriptingSourceTree_1.T_CONST_STATEMENT, {
333
+ decls,
336
334
  }, startToken, endToken);
337
335
  }
338
336
  /**
339
- * Parses a const statement
337
+ * Parses a var statement
340
338
  *
341
339
  * constStatement
342
340
  * : "var" id "=" expression
@@ -345,18 +343,23 @@ class Parser {
345
343
  parseVarStatement() {
346
344
  const startToken = this._lexer.get();
347
345
  let endToken = startToken;
348
- const declarations = [];
346
+ const decls = [];
349
347
  while (true) {
350
348
  const declStart = this._lexer.peek();
351
349
  let declarationProps = {};
352
- if (declStart.type === Token_1.TokenType.Identifier) {
350
+ if (declStart.type === TokenType_1.TokenType.Identifier) {
353
351
  if (declStart.text.startsWith("$")) {
354
352
  this.reportError("W031");
355
353
  return null;
356
354
  }
357
355
  endToken = this._lexer.get();
358
356
  declarationProps = {
359
- id: declStart.text,
357
+ id: {
358
+ type: ScriptingSourceTree_1.T_IDENTIFIER,
359
+ name: declStart.text,
360
+ startToken: declStart,
361
+ endToken,
362
+ },
360
363
  };
361
364
  }
362
365
  else {
@@ -364,22 +367,22 @@ class Parser {
364
367
  return null;
365
368
  }
366
369
  // --- Mandatory initialization
367
- this.expectToken(Token_1.TokenType.Assignment);
368
- const expression = this.getExpression(false);
369
- if (expression === null)
370
+ this.expectToken(TokenType_1.TokenType.Assignment);
371
+ const expr = this.getExpression(false);
372
+ if (expr === null)
370
373
  return null;
371
- declarationProps.expression = expression;
372
- endToken = expression.endToken;
374
+ declarationProps.expr = expr;
375
+ endToken = expr.endToken;
373
376
  // --- New declaration reached
374
- declarations.push(this.createExpressionNode("RVarD", declarationProps, declStart, endToken));
377
+ decls.push(this.createExpressionNode(ScriptingSourceTree_1.T_REACTIVE_VAR_DECLARATION, declarationProps, declStart, endToken));
375
378
  // --- Check for more declarations
376
- if (this._lexer.peek().type !== Token_1.TokenType.Comma)
379
+ if (this._lexer.peek().type !== TokenType_1.TokenType.Comma)
377
380
  break;
378
381
  this._lexer.get();
379
382
  }
380
383
  // --- Done
381
- return this.createStatementNode("VarS", {
382
- declarations,
384
+ return this.createStatementNode(ScriptingSourceTree_1.T_VAR_STATEMENT, {
385
+ decls,
383
386
  }, startToken, endToken);
384
387
  }
385
388
  /**
@@ -391,7 +394,7 @@ class Parser {
391
394
  const startToken = this._lexer.get();
392
395
  let endToken = startToken;
393
396
  let nextToken = this._lexer.peek();
394
- while (nextToken.type === Token_1.TokenType.Identifier) {
397
+ while (nextToken.type === TokenType_1.TokenType.Identifier) {
395
398
  // --- Obtain the ID
396
399
  const id = nextToken.text;
397
400
  if (id.startsWith("$")) {
@@ -399,37 +402,37 @@ class Parser {
399
402
  return null;
400
403
  }
401
404
  let alias;
402
- let arrayDestruct;
403
- let objectDestruct;
405
+ let aDestr;
406
+ let oDestr;
404
407
  this._lexer.get();
405
408
  nextToken = this._lexer.peek();
406
- if (nextToken.type === Token_1.TokenType.Colon) {
409
+ if (nextToken.type === TokenType_1.TokenType.Colon) {
407
410
  // --- Check the available cases
408
411
  this._lexer.get();
409
412
  nextToken = this._lexer.peek();
410
- if (nextToken.type === Token_1.TokenType.Identifier) {
413
+ if (nextToken.type === TokenType_1.TokenType.Identifier) {
411
414
  alias = nextToken.text;
412
415
  endToken = nextToken;
413
416
  this._lexer.get();
414
417
  }
415
- else if (nextToken.type === Token_1.TokenType.LSquare) {
416
- arrayDestruct = this.parseArrayDestructure();
417
- if (arrayDestruct === null)
418
+ else if (nextToken.type === TokenType_1.TokenType.LSquare) {
419
+ aDestr = this.parseArrayDestructure();
420
+ if (aDestr === null)
418
421
  return null;
419
- endToken = arrayDestruct[arrayDestruct.length - 1].endToken;
422
+ endToken = aDestr[aDestr.length - 1].endToken;
420
423
  }
421
- else if (nextToken.type === Token_1.TokenType.LBrace) {
422
- objectDestruct = this.parseObjectDestructure();
423
- if (objectDestruct === null)
424
+ else if (nextToken.type === TokenType_1.TokenType.LBrace) {
425
+ oDestr = this.parseObjectDestructure();
426
+ if (oDestr === null)
424
427
  return null;
425
- endToken = objectDestruct[objectDestruct.length - 1].endToken;
428
+ endToken = oDestr[oDestr.length - 1].endToken;
426
429
  }
427
430
  }
428
431
  // --- Check for next segment
429
432
  nextToken = this._lexer.peek();
430
- if (nextToken.type === Token_1.TokenType.Comma || nextToken.type === Token_1.TokenType.RBrace) {
431
- result.push(this.createExpressionNode("ODestr", { id, alias, arrayDestruct, objectDestruct }, startToken, endToken));
432
- if (nextToken.type === Token_1.TokenType.Comma) {
433
+ if (nextToken.type === TokenType_1.TokenType.Comma || nextToken.type === TokenType_1.TokenType.RBrace) {
434
+ result.push(this.createExpressionNode(ScriptingSourceTree_1.T_OBJECT_DESTRUCTURE, { id, alias, aDestr, oDestr }, startToken, endToken));
435
+ if (nextToken.type === TokenType_1.TokenType.Comma) {
433
436
  // --- Skip the delimiter comma
434
437
  this._lexer.get();
435
438
  nextToken = this._lexer.peek();
@@ -437,7 +440,7 @@ class Parser {
437
440
  }
438
441
  }
439
442
  // --- Expect a closing right brace
440
- this.expectToken(Token_1.TokenType.RBrace, "W004");
443
+ this.expectToken(TokenType_1.TokenType.RBrace, "W004");
441
444
  return result;
442
445
  }
443
446
  parseArrayDestructure() {
@@ -448,9 +451,9 @@ class Parser {
448
451
  do {
449
452
  let nextToken = this._lexer.peek();
450
453
  let id;
451
- let arrayDestruct;
452
- let objectDestruct;
453
- if (nextToken.type === Token_1.TokenType.Identifier) {
454
+ let aDestr;
455
+ let oDestr;
456
+ if (nextToken.type === TokenType_1.TokenType.Identifier) {
454
457
  id = nextToken.text;
455
458
  if (id.startsWith("$")) {
456
459
  this.reportError("W031");
@@ -459,28 +462,28 @@ class Parser {
459
462
  endToken = nextToken;
460
463
  nextToken = this._lexer.get();
461
464
  }
462
- else if (nextToken.type === Token_1.TokenType.LSquare) {
463
- arrayDestruct = this.parseArrayDestructure();
464
- if (arrayDestruct === null)
465
+ else if (nextToken.type === TokenType_1.TokenType.LSquare) {
466
+ aDestr = this.parseArrayDestructure();
467
+ if (aDestr === null)
465
468
  return null;
466
- endToken = arrayDestruct[arrayDestruct.length - 1].endToken;
469
+ endToken = aDestr[aDestr.length - 1].endToken;
467
470
  }
468
- else if (nextToken.type === Token_1.TokenType.LBrace) {
469
- objectDestruct = this.parseObjectDestructure();
470
- if (objectDestruct === null)
471
+ else if (nextToken.type === TokenType_1.TokenType.LBrace) {
472
+ oDestr = this.parseObjectDestructure();
473
+ if (oDestr === null)
471
474
  return null;
472
- endToken = objectDestruct[objectDestruct.length - 1].endToken;
475
+ endToken = oDestr[oDestr.length - 1].endToken;
473
476
  }
474
477
  nextToken = this._lexer.peek();
475
- if (nextToken.type === Token_1.TokenType.Comma) {
478
+ if (nextToken.type === TokenType_1.TokenType.Comma) {
476
479
  // --- Store the segment
477
- result.push(this.createExpressionNode("ADestr", { id, arrayDestruct, objectDestruct }, startToken, endToken));
480
+ result.push(this.createExpressionNode(ScriptingSourceTree_1.T_ARRAY_DESTRUCTURE, { id, aDestr, oDestr }, startToken, endToken));
478
481
  this._lexer.get();
479
482
  }
480
- else if (nextToken.type === Token_1.TokenType.RSquare) {
481
- if (id || arrayDestruct || objectDestruct) {
483
+ else if (nextToken.type === TokenType_1.TokenType.RSquare) {
484
+ if (id || aDestr || oDestr) {
482
485
  // --- Store a non-empty the segment
483
- result.push(this.createExpressionNode("ADestr", { id, arrayDestruct, objectDestruct }, startToken, endToken));
486
+ result.push(this.createExpressionNode(ScriptingSourceTree_1.T_ARRAY_DESTRUCTURE, { id, aDestr, oDestr }, startToken, endToken));
484
487
  }
485
488
  break;
486
489
  }
@@ -490,7 +493,7 @@ class Parser {
490
493
  }
491
494
  } while (true);
492
495
  // --- Expect a closing right square
493
- this.expectToken(Token_1.TokenType.RSquare, "W005");
496
+ this.expectToken(TokenType_1.TokenType.RSquare, "W005");
494
497
  return result;
495
498
  }
496
499
  /**
@@ -502,18 +505,18 @@ class Parser {
502
505
  */
503
506
  parseBlockStatement() {
504
507
  const startToken = this._lexer.get();
505
- const statements = [];
506
- while (this._lexer.peek().type !== Token_1.TokenType.RBrace) {
508
+ const stmts = [];
509
+ while (this._lexer.peek().type !== TokenType_1.TokenType.RBrace) {
507
510
  const statement = this.parseStatement();
508
511
  if (!statement)
509
512
  return null;
510
- statements.push(statement);
511
- if (statement.type !== "EmptyS") {
512
- this.skipToken(Token_1.TokenType.Semicolon);
513
+ stmts.push(statement);
514
+ if (statement.type !== ScriptingSourceTree_1.T_EMPTY_STATEMENT) {
515
+ this.skipToken(TokenType_1.TokenType.Semicolon);
513
516
  }
514
517
  }
515
518
  const endToken = this._lexer.get();
516
- return this.createStatementNode("BlockS", { statements }, startToken, endToken);
519
+ return this.createStatementNode(ScriptingSourceTree_1.T_BLOCK_STATEMENT, { stmts }, startToken, endToken);
517
520
  }
518
521
  /**
519
522
  * Parses an if statement
@@ -525,37 +528,37 @@ class Parser {
525
528
  parseIfStatement() {
526
529
  const startToken = this._lexer.get();
527
530
  let endToken = startToken;
528
- this.expectToken(Token_1.TokenType.LParent, "W014");
529
- const condition = this.getExpression();
530
- if (!condition)
531
+ this.expectToken(TokenType_1.TokenType.LParent, "W014");
532
+ const cond = this.getExpression();
533
+ if (!cond)
531
534
  return null;
532
- this.expectToken(Token_1.TokenType.RParent, "W006");
533
- const thenBranch = this.parseStatement();
534
- if (!thenBranch)
535
+ this.expectToken(TokenType_1.TokenType.RParent, "W006");
536
+ const thenB = this.parseStatement();
537
+ if (!thenB)
535
538
  return null;
536
- endToken = thenBranch.endToken;
539
+ endToken = thenB.endToken;
537
540
  let elseCanFollow = true;
538
- if (thenBranch.type !== "BlockS") {
541
+ if (thenB.type !== ScriptingSourceTree_1.T_BLOCK_STATEMENT) {
539
542
  // --- We need a closing semicolon before else
540
- if (this._lexer.peek().type === Token_1.TokenType.Semicolon) {
543
+ if (this._lexer.peek().type === TokenType_1.TokenType.Semicolon) {
541
544
  this._lexer.get();
542
545
  }
543
546
  else {
544
547
  elseCanFollow = false;
545
548
  }
546
549
  }
547
- let elseBranch = null;
548
- if (elseCanFollow && this._lexer.peek().type === Token_1.TokenType.Else) {
550
+ let elseB = null;
551
+ if (elseCanFollow && this._lexer.peek().type === TokenType_1.TokenType.Else) {
549
552
  this._lexer.get();
550
- elseBranch = this.parseStatement();
551
- if (!elseBranch)
553
+ elseB = this.parseStatement();
554
+ if (!elseB)
552
555
  return null;
553
- endToken = elseBranch.endToken;
556
+ endToken = elseB.endToken;
554
557
  }
555
- return this.createStatementNode("IfS", {
556
- condition,
557
- thenBranch,
558
- elseBranch,
558
+ return this.createStatementNode(ScriptingSourceTree_1.T_IF_STATEMENT, {
559
+ cond,
560
+ thenB,
561
+ elseB,
559
562
  }, startToken, endToken);
560
563
  }
561
564
  /**
@@ -567,16 +570,16 @@ class Parser {
567
570
  */
568
571
  parseWhileStatement() {
569
572
  const startToken = this._lexer.get();
570
- this.expectToken(Token_1.TokenType.LParent, "W014");
571
- const condition = this.getExpression();
572
- if (!condition)
573
+ this.expectToken(TokenType_1.TokenType.LParent, "W014");
574
+ const cond = this.getExpression();
575
+ if (!cond)
573
576
  return null;
574
- this.expectToken(Token_1.TokenType.RParent, "W006");
577
+ this.expectToken(TokenType_1.TokenType.RParent, "W006");
575
578
  const body = this.parseStatement();
576
579
  if (!body)
577
580
  return null;
578
- return this.createStatementNode("WhileS", {
579
- condition,
581
+ return this.createStatementNode(ScriptingSourceTree_1.T_WHILE_STATEMENT, {
582
+ cond,
580
583
  body,
581
584
  }, startToken, body.endToken);
582
585
  }
@@ -592,18 +595,18 @@ class Parser {
592
595
  const body = this.parseStatement();
593
596
  if (!body)
594
597
  return null;
595
- if (body.type !== "BlockS" && body.type !== "EmptyS") {
596
- this.expectToken(Token_1.TokenType.Semicolon);
598
+ if (body.type !== ScriptingSourceTree_1.T_BLOCK_STATEMENT && body.type !== ScriptingSourceTree_1.T_EMPTY_STATEMENT) {
599
+ this.expectToken(TokenType_1.TokenType.Semicolon);
597
600
  }
598
- this.expectToken(Token_1.TokenType.While);
599
- this.expectToken(Token_1.TokenType.LParent, "W014");
600
- const condition = this.getExpression();
601
- if (!condition)
601
+ this.expectToken(TokenType_1.TokenType.While);
602
+ this.expectToken(TokenType_1.TokenType.LParent, "W014");
603
+ const cond = this.getExpression();
604
+ if (!cond)
602
605
  return null;
603
606
  const endToken = this._lexer.peek();
604
- this.expectToken(Token_1.TokenType.RParent, "W006");
605
- return this.createStatementNode("DoWS", {
606
- condition,
607
+ this.expectToken(TokenType_1.TokenType.RParent, "W006");
608
+ return this.createStatementNode(ScriptingSourceTree_1.T_DO_WHILE_STATEMENT, {
609
+ cond,
607
610
  body,
608
611
  }, startToken, endToken);
609
612
  }
@@ -617,15 +620,15 @@ class Parser {
617
620
  parseReturnStatement() {
618
621
  const startToken = this._lexer.peek();
619
622
  let endToken = this._lexer.get();
620
- let expression;
623
+ let expr;
621
624
  if (TokenTrait_1.tokenTraits[this._lexer.peek().type].expressionStart) {
622
- expression = this.getExpression();
623
- if (expression === null)
625
+ expr = this.getExpression();
626
+ if (expr === null)
624
627
  return null;
625
- endToken = expression.endToken;
628
+ endToken = expr.endToken;
626
629
  }
627
- return this.createStatementNode("RetS", {
628
- expression,
630
+ return this.createStatementNode(ScriptingSourceTree_1.T_RETURN_STATEMENT, {
631
+ expr,
629
632
  }, startToken, endToken);
630
633
  }
631
634
  /**
@@ -637,60 +640,60 @@ class Parser {
637
640
  parseForStatement() {
638
641
  const startToken = this._lexer.peek();
639
642
  this._lexer.get();
640
- this.expectToken(Token_1.TokenType.LParent, "W014");
643
+ this.expectToken(TokenType_1.TokenType.LParent, "W014");
641
644
  // --- Check for..in and for..of
642
645
  let nextToken = this._lexer.peek();
643
- if (nextToken.type === Token_1.TokenType.Identifier) {
644
- if (this._lexer.ahead(1).type === Token_1.TokenType.In) {
645
- return this.parseForInOfStatement(startToken, "none", nextToken.text, "ForInS");
646
+ if (nextToken.type === TokenType_1.TokenType.Identifier) {
647
+ if (this._lexer.ahead(1).type === TokenType_1.TokenType.In) {
648
+ return this.parseForInOfStatement(startToken, "none", nextToken, ScriptingSourceTree_1.T_FOR_IN_STATEMENT);
646
649
  }
647
- else if (this._lexer.ahead(1).type === Token_1.TokenType.Of) {
648
- return this.parseForInOfStatement(startToken, "none", nextToken.text, "ForOfS");
650
+ else if (this._lexer.ahead(1).type === TokenType_1.TokenType.Of) {
651
+ return this.parseForInOfStatement(startToken, "none", nextToken, ScriptingSourceTree_1.T_FOR_OF_STATEMENT);
649
652
  }
650
653
  }
651
- else if (nextToken.type === Token_1.TokenType.Let) {
654
+ else if (nextToken.type === TokenType_1.TokenType.Let) {
652
655
  const idToken = this._lexer.ahead(1);
653
- if (idToken.type === Token_1.TokenType.Identifier) {
656
+ if (idToken.type === TokenType_1.TokenType.Identifier) {
654
657
  const inOfToken = this._lexer.ahead(2);
655
- if (inOfToken.type === Token_1.TokenType.In) {
656
- return this.parseForInOfStatement(startToken, "let", idToken.text, "ForInS");
658
+ if (inOfToken.type === TokenType_1.TokenType.In) {
659
+ return this.parseForInOfStatement(startToken, "let", idToken, ScriptingSourceTree_1.T_FOR_IN_STATEMENT);
657
660
  }
658
- else if (inOfToken.type === Token_1.TokenType.Of) {
659
- return this.parseForInOfStatement(startToken, "let", idToken.text, "ForOfS");
661
+ else if (inOfToken.type === TokenType_1.TokenType.Of) {
662
+ return this.parseForInOfStatement(startToken, "let", idToken, ScriptingSourceTree_1.T_FOR_OF_STATEMENT);
660
663
  }
661
664
  }
662
665
  }
663
- else if (nextToken.type === Token_1.TokenType.Const) {
666
+ else if (nextToken.type === TokenType_1.TokenType.Const) {
664
667
  const idToken = this._lexer.ahead(1);
665
- if (idToken.type === Token_1.TokenType.Identifier) {
668
+ if (idToken.type === TokenType_1.TokenType.Identifier) {
666
669
  const inOfToken = this._lexer.ahead(2);
667
- if (inOfToken.type === Token_1.TokenType.In) {
668
- return this.parseForInOfStatement(startToken, "const", idToken.text, "ForInS");
670
+ if (inOfToken.type === TokenType_1.TokenType.In) {
671
+ return this.parseForInOfStatement(startToken, "const", idToken, ScriptingSourceTree_1.T_FOR_IN_STATEMENT);
669
672
  }
670
- else if (inOfToken.type === Token_1.TokenType.Of) {
671
- return this.parseForInOfStatement(startToken, "const", idToken.text, "ForOfS");
673
+ else if (inOfToken.type === TokenType_1.TokenType.Of) {
674
+ return this.parseForInOfStatement(startToken, "const", idToken, ScriptingSourceTree_1.T_FOR_OF_STATEMENT);
672
675
  }
673
676
  }
674
677
  }
675
678
  // --- We accept only let statement, empty statement, and expression
676
679
  let init;
677
680
  nextToken = this._lexer.peek();
678
- if (nextToken.type === Token_1.TokenType.Semicolon) {
681
+ if (nextToken.type === TokenType_1.TokenType.Semicolon) {
679
682
  // --- Empty statement: no init in the for loop
680
683
  this._lexer.get();
681
684
  }
682
- else if (nextToken.type === Token_1.TokenType.Let) {
685
+ else if (nextToken.type === TokenType_1.TokenType.Let) {
683
686
  // --- Let statement
684
687
  const letStmt = this.parseLetStatement();
685
688
  if (letStmt === null) {
686
689
  return null;
687
690
  }
688
691
  init = letStmt;
689
- if (init.declarations.some((d) => !d.expression)) {
692
+ if (init.decls.some((d) => !d.expr)) {
690
693
  this.reportError("W011");
691
694
  return null;
692
695
  }
693
- this.expectToken(Token_1.TokenType.Semicolon);
696
+ this.expectToken(TokenType_1.TokenType.Semicolon);
694
697
  }
695
698
  else if (TokenTrait_1.tokenTraits[nextToken.type].expressionStart) {
696
699
  // --- Expression statement
@@ -699,41 +702,41 @@ class Parser {
699
702
  return null;
700
703
  }
701
704
  init = exprStmt;
702
- this.expectToken(Token_1.TokenType.Semicolon);
705
+ this.expectToken(TokenType_1.TokenType.Semicolon);
703
706
  }
704
707
  // --- Parse the condition
705
- let condition;
708
+ let cond;
706
709
  nextToken = this._lexer.peek();
707
- if (nextToken.type === Token_1.TokenType.Semicolon) {
710
+ if (nextToken.type === TokenType_1.TokenType.Semicolon) {
708
711
  // --- No condition
709
712
  this._lexer.get();
710
713
  }
711
714
  else {
712
- condition = this.getExpression();
713
- if (condition === null) {
715
+ cond = this.getExpression();
716
+ if (cond === null) {
714
717
  return null;
715
718
  }
716
- this.expectToken(Token_1.TokenType.Semicolon);
719
+ this.expectToken(TokenType_1.TokenType.Semicolon);
717
720
  }
718
721
  // --- Parse the update expression
719
- let update;
722
+ let upd;
720
723
  nextToken = this._lexer.peek();
721
- if (nextToken.type !== Token_1.TokenType.RParent) {
722
- update = this.getExpression();
723
- if (update === null) {
724
+ if (nextToken.type !== TokenType_1.TokenType.RParent) {
725
+ upd = this.getExpression();
726
+ if (upd === null) {
724
727
  return null;
725
728
  }
726
729
  }
727
730
  // --- Close the declaration part
728
- this.expectToken(Token_1.TokenType.RParent, "W006");
731
+ this.expectToken(TokenType_1.TokenType.RParent, "W006");
729
732
  // --- Get the body
730
733
  const body = this.parseStatement();
731
734
  if (!body)
732
735
  return null;
733
- return this.createStatementNode("ForS", {
736
+ return this.createStatementNode(ScriptingSourceTree_1.T_FOR_STATEMENT, {
734
737
  init,
735
- condition,
736
- update,
738
+ cond,
739
+ upd,
737
740
  body,
738
741
  }, startToken, body.endToken);
739
742
  }
@@ -744,41 +747,51 @@ class Parser {
744
747
  * ;
745
748
  *
746
749
  * @param startToken Statement start token
747
- * @param varBinding Variable binding of the for..in/of statement
750
+ * @param varB Variable binding of the for..in/of statement
748
751
  * @param id ID name
749
752
  * @param type Is it a for..in or a for..of?
750
753
  */
751
- parseForInOfStatement(startToken, varBinding, id, type) {
752
- if (varBinding !== "none") {
753
- if (id.startsWith("$")) {
754
+ parseForInOfStatement(startToken, varB, idToken, type) {
755
+ if (varB !== "none") {
756
+ // --- Skip variable binding type
757
+ if (idToken.text.startsWith("$")) {
754
758
  this.reportError("W031");
755
759
  return null;
756
760
  }
757
- // --- Skip variable binding type
758
761
  this._lexer.get();
759
762
  }
760
763
  // --- Skip variable name, in/of token
761
764
  this._lexer.get();
762
765
  this._lexer.get();
763
766
  // --- Get the expression
764
- const expression = this.getExpression(true);
767
+ const expr = this.getExpression(true);
765
768
  // --- Close the declaration part
766
- this.expectToken(Token_1.TokenType.RParent, "W006");
769
+ this.expectToken(TokenType_1.TokenType.RParent, "W006");
767
770
  // --- Get the body
768
771
  const body = this.parseStatement();
769
772
  if (!body)
770
773
  return null;
771
- return type === "ForInS"
772
- ? this.createStatementNode("ForInS", {
773
- varBinding,
774
- id,
775
- expression,
774
+ return type === ScriptingSourceTree_1.T_FOR_IN_STATEMENT
775
+ ? this.createStatementNode(ScriptingSourceTree_1.T_FOR_IN_STATEMENT, {
776
+ varB,
777
+ id: {
778
+ type: ScriptingSourceTree_1.T_IDENTIFIER,
779
+ name: idToken.text,
780
+ startToken: idToken,
781
+ endToken: idToken,
782
+ },
783
+ expr,
776
784
  body,
777
785
  }, startToken, body.endToken)
778
- : this.createStatementNode("ForOfS", {
779
- varBinding,
780
- id,
781
- expression,
786
+ : this.createStatementNode(ScriptingSourceTree_1.T_FOR_OF_STATEMENT, {
787
+ varB,
788
+ id: {
789
+ type: ScriptingSourceTree_1.T_IDENTIFIER,
790
+ name: idToken.text,
791
+ startToken: idToken,
792
+ endToken: idToken,
793
+ },
794
+ expr,
782
795
  body,
783
796
  }, startToken, body.endToken);
784
797
  }
@@ -792,13 +805,13 @@ class Parser {
792
805
  parseThrowStatement() {
793
806
  const startToken = this._lexer.peek();
794
807
  this._lexer.get();
795
- let expression;
796
- expression = this.getExpression();
797
- if (expression === null)
808
+ let expr;
809
+ expr = this.getExpression();
810
+ if (expr === null)
798
811
  return null;
799
- return this.createStatementNode("ThrowS", {
800
- expression,
801
- }, startToken, expression.endToken);
812
+ return this.createStatementNode(ScriptingSourceTree_1.T_THROW_STATEMENT, {
813
+ expr,
814
+ }, startToken, expr.endToken);
802
815
  }
803
816
  /**
804
817
  * Parses a try..catch..finally statement
@@ -820,56 +833,62 @@ class Parser {
820
833
  let endToken = this._lexer.get();
821
834
  const parser = this;
822
835
  // --- Get "try" block
823
- const tryBlock = getBlock();
824
- let catchBlock;
825
- let catchVariable;
826
- let finallyBlock;
836
+ const tryB = getBlock();
837
+ let catchB;
838
+ let catchV;
839
+ let finallyB;
827
840
  let nextToken = this._lexer.peek();
828
- if (nextToken.type === Token_1.TokenType.Catch) {
841
+ if (nextToken.type === TokenType_1.TokenType.Catch) {
829
842
  // --- Catch found
830
843
  this._lexer.get();
831
844
  nextToken = this._lexer.peek();
832
- if (nextToken.type === Token_1.TokenType.LParent) {
845
+ if (nextToken.type === TokenType_1.TokenType.LParent) {
833
846
  // --- Catch variable found
834
847
  this._lexer.get();
835
848
  nextToken = this._lexer.peek();
836
- if (nextToken.type !== Token_1.TokenType.Identifier) {
849
+ if (nextToken.type !== TokenType_1.TokenType.Identifier) {
837
850
  this.reportError("W003", nextToken);
838
851
  return null;
839
852
  }
840
- catchVariable = nextToken.text;
853
+ catchV = {
854
+ type: ScriptingSourceTree_1.T_IDENTIFIER,
855
+ nodeId: createXmlUiTreeNodeId(),
856
+ name: nextToken.text,
857
+ startToken: nextToken,
858
+ endToken: nextToken,
859
+ };
841
860
  this._lexer.get();
842
- this.expectToken(Token_1.TokenType.RParent, "W006");
861
+ this.expectToken(TokenType_1.TokenType.RParent, "W006");
843
862
  }
844
863
  // --- Get catch block
845
- catchBlock = getBlock();
846
- endToken = catchBlock.endToken;
847
- if (this._lexer.peek().type === Token_1.TokenType.Finally) {
864
+ catchB = getBlock();
865
+ endToken = catchB.endToken;
866
+ if (this._lexer.peek().type === TokenType_1.TokenType.Finally) {
848
867
  // --- Finally after catch
849
868
  this._lexer.get();
850
- finallyBlock = getBlock();
851
- endToken = finallyBlock.endToken;
869
+ finallyB = getBlock();
870
+ endToken = finallyB.endToken;
852
871
  }
853
872
  }
854
- else if (nextToken.type === Token_1.TokenType.Finally) {
873
+ else if (nextToken.type === TokenType_1.TokenType.Finally) {
855
874
  // --- Finally found
856
875
  this._lexer.get();
857
- finallyBlock = getBlock();
858
- endToken = finallyBlock.endToken;
876
+ finallyB = getBlock();
877
+ endToken = finallyB.endToken;
859
878
  }
860
879
  else {
861
880
  this.reportError("W013", nextToken);
862
881
  return null;
863
882
  }
864
- return this.createStatementNode("TryS", {
865
- tryBlock,
866
- catchBlock,
867
- catchVariable,
868
- finallyBlock,
883
+ return this.createStatementNode(ScriptingSourceTree_1.T_TRY_STATEMENT, {
884
+ tryB,
885
+ catchB,
886
+ catchV,
887
+ finallyB,
869
888
  }, startToken, endToken);
870
889
  function getBlock() {
871
890
  const nextToken = parser._lexer.peek();
872
- if (nextToken.type !== Token_1.TokenType.LBrace) {
891
+ if (nextToken.type !== TokenType_1.TokenType.LBrace) {
873
892
  parser.reportError("W012", nextToken);
874
893
  return null;
875
894
  }
@@ -891,26 +910,26 @@ class Parser {
891
910
  parseSwitchStatement() {
892
911
  const startToken = this._lexer.get();
893
912
  // --- Parse the switch expression
894
- this.expectToken(Token_1.TokenType.LParent, "W014");
895
- const expression = this.getExpression();
896
- if (!expression)
913
+ this.expectToken(TokenType_1.TokenType.LParent, "W014");
914
+ const expr = this.getExpression();
915
+ if (!expr)
897
916
  return null;
898
- this.expectToken(Token_1.TokenType.RParent, "W006");
917
+ this.expectToken(TokenType_1.TokenType.RParent, "W006");
899
918
  // --- Parse the case blocks
900
- this.expectToken(Token_1.TokenType.LBrace, "W012");
919
+ this.expectToken(TokenType_1.TokenType.LBrace, "W012");
901
920
  const cases = [];
902
921
  let defaultCaseFound = false;
903
922
  while (true) {
904
923
  let nextToken = this._lexer.peek();
905
- let caseExpression;
906
- if (nextToken.type === Token_1.TokenType.Case) {
924
+ let caseE;
925
+ if (nextToken.type === TokenType_1.TokenType.Case) {
907
926
  // --- Process "case"
908
927
  this._lexer.get();
909
- caseExpression = this.getExpression();
910
- if (!caseExpression)
928
+ caseE = this.getExpression();
929
+ if (!caseE)
911
930
  return null;
912
931
  }
913
- else if (nextToken.type === Token_1.TokenType.Default) {
932
+ else if (nextToken.type === TokenType_1.TokenType.Default) {
914
933
  // --- Process "default"
915
934
  if (defaultCaseFound) {
916
935
  this.reportError("W016");
@@ -919,7 +938,7 @@ class Parser {
919
938
  defaultCaseFound = true;
920
939
  this._lexer.get();
921
940
  }
922
- else if (nextToken.type === Token_1.TokenType.RBrace) {
941
+ else if (nextToken.type === TokenType_1.TokenType.RBrace) {
923
942
  break;
924
943
  }
925
944
  else {
@@ -927,15 +946,15 @@ class Parser {
927
946
  return null;
928
947
  }
929
948
  // --- Process label statements
930
- this.expectToken(Token_1.TokenType.Colon, "W008");
931
- let statements = [];
949
+ this.expectToken(TokenType_1.TokenType.Colon, "W008");
950
+ let stmts = [];
932
951
  let collected = false;
933
952
  while (!collected) {
934
953
  const stmtToken = this._lexer.peek();
935
954
  switch (stmtToken.type) {
936
- case Token_1.TokenType.Case:
937
- case Token_1.TokenType.Default:
938
- case Token_1.TokenType.RBrace:
955
+ case TokenType_1.TokenType.Case:
956
+ case TokenType_1.TokenType.Default:
957
+ case TokenType_1.TokenType.RBrace:
939
958
  // --- No more case to process
940
959
  collected = true;
941
960
  break;
@@ -946,22 +965,22 @@ class Parser {
946
965
  collected = true;
947
966
  break;
948
967
  }
949
- statements.push(stmt);
950
- if (stmt.type !== "EmptyS") {
951
- this.skipToken(Token_1.TokenType.Semicolon);
968
+ stmts.push(stmt);
969
+ if (stmt.type !== ScriptingSourceTree_1.T_EMPTY_STATEMENT) {
970
+ this.skipToken(TokenType_1.TokenType.Semicolon);
952
971
  }
953
972
  }
954
973
  }
955
- cases.push(this.createNode("SwitchC", {
956
- caseExpression,
957
- statements,
974
+ cases.push(this.createNode(ScriptingSourceTree_1.T_SWITCH_CASE, {
975
+ caseE,
976
+ stmts,
958
977
  }, startToken));
959
978
  }
960
979
  // --- Closing
961
980
  const endToken = this._lexer.peek();
962
- this.expectToken(Token_1.TokenType.RBrace, "W004");
963
- return this.createStatementNode("SwitchS", {
964
- expression,
981
+ this.expectToken(TokenType_1.TokenType.RBrace, "W004");
982
+ return this.createStatementNode(ScriptingSourceTree_1.T_SWITCH_STATEMENT, {
983
+ expr,
965
984
  cases,
966
985
  }, startToken, endToken);
967
986
  }
@@ -979,8 +998,8 @@ class Parser {
979
998
  let functionName;
980
999
  const funcId = this._lexer.peek();
981
1000
  if (allowNoName) {
982
- if (funcId.type !== Token_1.TokenType.LParent) {
983
- if (funcId.type !== Token_1.TokenType.Identifier) {
1001
+ if (funcId.type !== TokenType_1.TokenType.LParent) {
1002
+ if (funcId.type !== TokenType_1.TokenType.Identifier) {
984
1003
  this.reportError("W003", funcId);
985
1004
  return null;
986
1005
  }
@@ -989,7 +1008,7 @@ class Parser {
989
1008
  }
990
1009
  }
991
1010
  else {
992
- if (funcId.type !== Token_1.TokenType.Identifier) {
1011
+ if (funcId.type !== TokenType_1.TokenType.Identifier) {
993
1012
  this.reportError("W003", funcId);
994
1013
  return null;
995
1014
  }
@@ -998,7 +1017,7 @@ class Parser {
998
1017
  }
999
1018
  // --- Get the parameter list;
1000
1019
  const nextToken = this._lexer.peek();
1001
- if (nextToken.type !== Token_1.TokenType.LParent) {
1020
+ if (nextToken.type !== TokenType_1.TokenType.LParent) {
1002
1021
  this.reportError("W014", nextToken);
1003
1022
  return null;
1004
1023
  }
@@ -1008,29 +1027,29 @@ class Parser {
1008
1027
  let isValid;
1009
1028
  const args = [];
1010
1029
  switch (exprList.type) {
1011
- case "NoArgE":
1030
+ case ScriptingSourceTree_1.T_NO_ARG_EXPRESSION:
1012
1031
  isValid = true;
1013
1032
  break;
1014
- case "IdE":
1033
+ case ScriptingSourceTree_1.T_IDENTIFIER:
1015
1034
  isValid = ((_a = exprList.parenthesized) !== null && _a !== void 0 ? _a : 0) <= 1;
1016
1035
  args.push(exprList);
1017
1036
  break;
1018
- case "SeqE":
1037
+ case ScriptingSourceTree_1.T_SEQUENCE_EXPRESSION:
1019
1038
  isValid = exprList.parenthesized === 1;
1020
1039
  let spreadFound = false;
1021
1040
  if (isValid) {
1022
- for (const expr of exprList.expressions) {
1041
+ for (const expr of exprList.exprs) {
1023
1042
  // --- Spread operator can be used only in the last position
1024
1043
  if (spreadFound) {
1025
1044
  isValid = false;
1026
1045
  break;
1027
1046
  }
1028
1047
  switch (expr.type) {
1029
- case "IdE":
1048
+ case ScriptingSourceTree_1.T_IDENTIFIER:
1030
1049
  isValid = !expr.parenthesized;
1031
1050
  args.push(expr);
1032
1051
  break;
1033
- case "OLitE": {
1052
+ case ScriptingSourceTree_1.T_OBJECT_LITERAL: {
1034
1053
  isValid = !expr.parenthesized;
1035
1054
  if (isValid) {
1036
1055
  const des = this.convertToObjectDestructure(expr);
@@ -1039,7 +1058,7 @@ class Parser {
1039
1058
  }
1040
1059
  break;
1041
1060
  }
1042
- case "ALitE": {
1061
+ case ScriptingSourceTree_1.T_ARRAY_LITERAL: {
1043
1062
  isValid = !expr.parenthesized;
1044
1063
  if (isValid) {
1045
1064
  const des = this.convertToArrayDestructure(expr);
@@ -1048,9 +1067,9 @@ class Parser {
1048
1067
  }
1049
1068
  break;
1050
1069
  }
1051
- case "SpreadE": {
1070
+ case ScriptingSourceTree_1.T_SPREAD_EXPRESSION: {
1052
1071
  spreadFound = true;
1053
- if (expr.operand.type !== "IdE") {
1072
+ if (expr.expr.type !== ScriptingSourceTree_1.T_IDENTIFIER) {
1054
1073
  isValid = false;
1055
1074
  break;
1056
1075
  }
@@ -1064,7 +1083,7 @@ class Parser {
1064
1083
  }
1065
1084
  }
1066
1085
  break;
1067
- case "OLitE":
1086
+ case ScriptingSourceTree_1.T_OBJECT_LITERAL:
1068
1087
  isValid = exprList.parenthesized === 1;
1069
1088
  if (isValid) {
1070
1089
  const des = this.convertToObjectDestructure(exprList);
@@ -1072,7 +1091,7 @@ class Parser {
1072
1091
  args.push(des);
1073
1092
  }
1074
1093
  break;
1075
- case "ALitE":
1094
+ case ScriptingSourceTree_1.T_ARRAY_LITERAL:
1076
1095
  isValid = exprList.parenthesized === 1;
1077
1096
  if (isValid) {
1078
1097
  const des = this.convertToArrayDestructure(exprList);
@@ -1080,8 +1099,8 @@ class Parser {
1080
1099
  args.push(des);
1081
1100
  }
1082
1101
  break;
1083
- case "SpreadE":
1084
- if (exprList.operand.type !== "IdE") {
1102
+ case ScriptingSourceTree_1.T_SPREAD_EXPRESSION:
1103
+ if (exprList.expr.type !== ScriptingSourceTree_1.T_IDENTIFIER) {
1085
1104
  isValid = false;
1086
1105
  break;
1087
1106
  }
@@ -1096,117 +1115,19 @@ class Parser {
1096
1115
  return null;
1097
1116
  }
1098
1117
  // --- Get the function body (statement block)
1099
- if (this._lexer.peek().type !== Token_1.TokenType.LBrace) {
1118
+ if (this._lexer.peek().type !== TokenType_1.TokenType.LBrace) {
1100
1119
  this.reportError("W012", this._lexer.peek());
1101
1120
  return null;
1102
1121
  }
1103
- const body = this.parseBlockStatement();
1104
- if (!body)
1122
+ const stmt = this.parseBlockStatement();
1123
+ if (!stmt)
1105
1124
  return null;
1106
1125
  // --- Done.
1107
- return this.createStatementNode("FuncD", {
1108
- name: functionName,
1126
+ return this.createStatementNode(ScriptingSourceTree_1.T_FUNCTION_DECLARATION, {
1127
+ id: { type: ScriptingSourceTree_1.T_IDENTIFIER, name: functionName },
1109
1128
  args,
1110
- statement: body,
1111
- }, startToken, body.endToken);
1112
- }
1113
- /**
1114
- * Parses an export statement
1115
- *
1116
- * exportStatement
1117
- * : "export" (constStatement | functionDeclaration)
1118
- * ;
1119
- */
1120
- parseExport() {
1121
- this._lexer.get();
1122
- const nextToken = this._lexer.peek();
1123
- if (nextToken.type === Token_1.TokenType.Const) {
1124
- if (this._statementLevel > 1) {
1125
- this.reportError("W030", nextToken);
1126
- return null;
1127
- }
1128
- const constStmt = this.parseConstStatement();
1129
- return constStmt === null ? null : Object.assign(Object.assign({}, constStmt), { isExported: true });
1130
- }
1131
- else if (nextToken.type === Token_1.TokenType.Function) {
1132
- if (this._statementLevel > 1) {
1133
- this.reportError("W030", nextToken);
1134
- return null;
1135
- }
1136
- const funcDecl = this.parseFunctionDeclaration();
1137
- return funcDecl === null ? null : Object.assign(Object.assign({}, funcDecl), { isExported: true });
1138
- }
1139
- this.reportError("W024", nextToken);
1140
- return null;
1141
- }
1142
- /**
1143
- * Parse an import declaration
1144
- *
1145
- * importDeclaration
1146
- * : "import" "{" importItem ("," importItem)* [ "," ] "}" from module
1147
- * ;
1148
- *
1149
- * importItem
1150
- * : identifier [ "as" identifier ]
1151
- * ;
1152
- */
1153
- parseImport() {
1154
- const startToken = this._lexer.get();
1155
- this.expectToken(Token_1.TokenType.LBrace, "W012");
1156
- const imports = {};
1157
- let nextToken = this._lexer.peek();
1158
- while (nextToken.type !== Token_1.TokenType.RBrace) {
1159
- if (nextToken.type !== Token_1.TokenType.Identifier) {
1160
- this.reportError("W003", nextToken);
1161
- return null;
1162
- }
1163
- const id = nextToken.text;
1164
- this._lexer.get();
1165
- nextToken = this._lexer.peek();
1166
- if (nextToken.type === Token_1.TokenType.As) {
1167
- this._lexer.get();
1168
- nextToken = this._lexer.peek();
1169
- if (nextToken.type !== Token_1.TokenType.Identifier) {
1170
- this.reportError("W003", nextToken);
1171
- return null;
1172
- }
1173
- if (imports[nextToken.text]) {
1174
- this.reportError("W019", nextToken, nextToken.text);
1175
- return null;
1176
- }
1177
- imports[nextToken.text] = id;
1178
- this._lexer.get();
1179
- }
1180
- else {
1181
- if (imports[id]) {
1182
- this.reportError("W019", nextToken, id);
1183
- return null;
1184
- }
1185
- imports[id] = id;
1186
- }
1187
- nextToken = this._lexer.peek();
1188
- if (nextToken.type === Token_1.TokenType.Comma) {
1189
- this._lexer.get();
1190
- nextToken = this._lexer.peek();
1191
- }
1192
- }
1193
- // --- Skip the closing brace
1194
- this._lexer.get();
1195
- // --- Check for "from"
1196
- this.expectToken(Token_1.TokenType.From, "W025");
1197
- // --- Get the module name
1198
- const moduleToken = this._lexer.peek();
1199
- if (moduleToken.type !== Token_1.TokenType.StringLiteral) {
1200
- this.reportError("W026", moduleToken);
1201
- return null;
1202
- }
1203
- this._lexer.get();
1204
- const literal = this.parseStringLiteral(moduleToken);
1205
- // --- Done.
1206
- return this.createStatementNode("ImportD", {
1207
- imports,
1208
- moduleFile: literal.value,
1209
- }, startToken, moduleToken);
1129
+ stmt,
1130
+ }, startToken, stmt.endToken);
1210
1131
  }
1211
1132
  // ==========================================================================
1212
1133
  // Expression parsing
@@ -1234,15 +1155,15 @@ class Parser {
1234
1155
  return null;
1235
1156
  }
1236
1157
  endToken = leftExpr.endToken;
1237
- const expressions = [];
1158
+ const exprs = [];
1238
1159
  let loose = false;
1239
- if (this._lexer.peek().type === Token_1.TokenType.Comma) {
1240
- expressions.push(leftExpr);
1241
- while (this.skipToken(Token_1.TokenType.Comma)) {
1242
- if (this._lexer.peek().type === Token_1.TokenType.Comma) {
1160
+ if (this._lexer.peek().type === TokenType_1.TokenType.Comma) {
1161
+ exprs.push(leftExpr);
1162
+ while (this.skipToken(TokenType_1.TokenType.Comma)) {
1163
+ if (this._lexer.peek().type === TokenType_1.TokenType.Comma) {
1243
1164
  loose = true;
1244
1165
  endToken = this._lexer.peek();
1245
- expressions.push(this.createExpressionNode("NoArgE", {}, endToken, endToken));
1166
+ exprs.push(this.createExpressionNode(ScriptingSourceTree_1.T_NO_ARG_EXPRESSION, {}, endToken, endToken));
1246
1167
  }
1247
1168
  else {
1248
1169
  const nextExpr = this.parseCondOrSpreadOrAsgnOrArrowExpr();
@@ -1250,17 +1171,17 @@ class Parser {
1250
1171
  break;
1251
1172
  }
1252
1173
  endToken = nextExpr.endToken;
1253
- expressions.push(nextExpr);
1174
+ exprs.push(nextExpr);
1254
1175
  }
1255
1176
  }
1256
1177
  }
1257
- if (!expressions.length) {
1178
+ if (!exprs.length) {
1258
1179
  // --- No sequence
1259
1180
  return leftExpr;
1260
1181
  }
1261
1182
  // --- Create the sequence expression
1262
- leftExpr = this.createExpressionNode("SeqE", {
1263
- expressions,
1183
+ leftExpr = this.createExpressionNode(ScriptingSourceTree_1.T_SEQUENCE_EXPRESSION, {
1184
+ exprs,
1264
1185
  loose,
1265
1186
  }, start, endToken);
1266
1187
  // --- Check for "loose" sequence expression
@@ -1279,23 +1200,23 @@ class Parser {
1279
1200
  */
1280
1201
  parseCondOrSpreadOrAsgnOrArrowExpr() {
1281
1202
  const startToken = this._lexer.peek();
1282
- if (startToken.type === Token_1.TokenType.Spread) {
1203
+ if (startToken.type === TokenType_1.TokenType.Spread) {
1283
1204
  // --- Spread expression
1284
1205
  this._lexer.get();
1285
1206
  const spreadOperand = this.parseNullCoalescingExpr();
1286
1207
  return spreadOperand
1287
- ? this.createExpressionNode("SpreadE", {
1288
- operand: spreadOperand,
1208
+ ? this.createExpressionNode(ScriptingSourceTree_1.T_SPREAD_EXPRESSION, {
1209
+ expr: spreadOperand,
1289
1210
  }, startToken, spreadOperand.endToken)
1290
1211
  : null;
1291
1212
  }
1292
- if (startToken.type === Token_1.TokenType.Function) {
1213
+ if (startToken.type === TokenType_1.TokenType.Function) {
1293
1214
  const funcDecl = this.parseFunctionDeclaration(true);
1294
1215
  return funcDecl
1295
- ? this.createExpressionNode("ArrowE", {
1296
- name: funcDecl.name,
1216
+ ? this.createExpressionNode(ScriptingSourceTree_1.T_ARROW_EXPRESSION, {
1217
+ name: funcDecl.id.name,
1297
1218
  args: funcDecl.args,
1298
- statement: funcDecl.statement,
1219
+ statement: funcDecl.stmt,
1299
1220
  }, startToken, funcDecl.endToken)
1300
1221
  : null;
1301
1222
  }
@@ -1304,32 +1225,32 @@ class Parser {
1304
1225
  return null;
1305
1226
  }
1306
1227
  const nextToken = this._lexer.peek();
1307
- if (nextToken.type === Token_1.TokenType.Arrow) {
1228
+ if (nextToken.type === TokenType_1.TokenType.Arrow) {
1308
1229
  // --- It is an arrow expression
1309
1230
  return this.parseArrowExpression(startToken, otherExpr);
1310
1231
  }
1311
- if (nextToken.type === Token_1.TokenType.QuestionMark) {
1232
+ if (nextToken.type === TokenType_1.TokenType.QuestionMark) {
1312
1233
  this._lexer.get();
1313
1234
  // --- Conditional expression
1314
1235
  const trueExpr = this.getExpression(false);
1315
- this.expectToken(Token_1.TokenType.Colon);
1236
+ this.expectToken(TokenType_1.TokenType.Colon);
1316
1237
  const falseExpr = this.getExpression(false);
1317
- return this.createExpressionNode("CondE", {
1318
- condition: otherExpr,
1319
- consequent: trueExpr,
1320
- alternate: falseExpr,
1238
+ return this.createExpressionNode(ScriptingSourceTree_1.T_CONDITIONAL_EXPRESSION, {
1239
+ cond: otherExpr,
1240
+ thenE: trueExpr,
1241
+ elseE: falseExpr,
1321
1242
  }, startToken, falseExpr.endToken);
1322
1243
  }
1323
1244
  if (TokenTrait_1.tokenTraits[nextToken.type].isAssignment) {
1324
1245
  // --- Assignment
1325
1246
  this._lexer.get();
1326
- const operand = this.getExpression();
1327
- return operand
1328
- ? this.createExpressionNode("AsgnE", {
1247
+ const expr = this.getExpression();
1248
+ return expr
1249
+ ? this.createExpressionNode(ScriptingSourceTree_1.T_ASSIGNMENT_EXPRESSION, {
1329
1250
  leftValue: otherExpr,
1330
- operator: nextToken.text,
1331
- operand,
1332
- }, startToken, operand.endToken)
1251
+ op: nextToken.text,
1252
+ expr,
1253
+ }, startToken, expr.endToken)
1333
1254
  : null;
1334
1255
  }
1335
1256
  return otherExpr;
@@ -1345,28 +1266,28 @@ class Parser {
1345
1266
  let isValid;
1346
1267
  const args = [];
1347
1268
  switch (left.type) {
1348
- case "NoArgE":
1269
+ case ScriptingSourceTree_1.T_NO_ARG_EXPRESSION:
1349
1270
  isValid = true;
1350
1271
  break;
1351
- case "IdE":
1272
+ case ScriptingSourceTree_1.T_IDENTIFIER:
1352
1273
  isValid = ((_a = left.parenthesized) !== null && _a !== void 0 ? _a : 0) <= 1;
1353
1274
  args.push(left);
1354
1275
  break;
1355
- case "SeqE":
1276
+ case ScriptingSourceTree_1.T_SEQUENCE_EXPRESSION:
1356
1277
  isValid = left.parenthesized === 1;
1357
1278
  let spreadFound = false;
1358
1279
  if (isValid) {
1359
- for (const expr of left.expressions) {
1280
+ for (const expr of left.exprs) {
1360
1281
  if (spreadFound) {
1361
1282
  isValid = false;
1362
1283
  break;
1363
1284
  }
1364
1285
  switch (expr.type) {
1365
- case "IdE":
1286
+ case ScriptingSourceTree_1.T_IDENTIFIER:
1366
1287
  isValid = !expr.parenthesized;
1367
1288
  args.push(expr);
1368
1289
  break;
1369
- case "OLitE": {
1290
+ case ScriptingSourceTree_1.T_OBJECT_LITERAL: {
1370
1291
  isValid = !expr.parenthesized;
1371
1292
  if (isValid) {
1372
1293
  const des = this.convertToObjectDestructure(expr);
@@ -1375,7 +1296,7 @@ class Parser {
1375
1296
  }
1376
1297
  break;
1377
1298
  }
1378
- case "ALitE": {
1299
+ case ScriptingSourceTree_1.T_ARRAY_LITERAL: {
1379
1300
  isValid = !expr.parenthesized;
1380
1301
  if (isValid) {
1381
1302
  const des = this.convertToArrayDestructure(expr);
@@ -1384,9 +1305,9 @@ class Parser {
1384
1305
  }
1385
1306
  break;
1386
1307
  }
1387
- case "SpreadE": {
1308
+ case ScriptingSourceTree_1.T_SPREAD_EXPRESSION: {
1388
1309
  spreadFound = true;
1389
- if (expr.operand.type !== "IdE") {
1310
+ if (expr.expr.type !== ScriptingSourceTree_1.T_IDENTIFIER) {
1390
1311
  isValid = false;
1391
1312
  break;
1392
1313
  }
@@ -1400,7 +1321,7 @@ class Parser {
1400
1321
  }
1401
1322
  }
1402
1323
  break;
1403
- case "OLitE":
1324
+ case ScriptingSourceTree_1.T_OBJECT_LITERAL:
1404
1325
  isValid = left.parenthesized === 1;
1405
1326
  if (isValid) {
1406
1327
  const des = this.convertToObjectDestructure(left);
@@ -1408,7 +1329,7 @@ class Parser {
1408
1329
  args.push(des);
1409
1330
  }
1410
1331
  break;
1411
- case "ALitE":
1332
+ case ScriptingSourceTree_1.T_ARRAY_LITERAL:
1412
1333
  isValid = left.parenthesized === 1;
1413
1334
  if (isValid) {
1414
1335
  const des = this.convertToArrayDestructure(left);
@@ -1416,8 +1337,8 @@ class Parser {
1416
1337
  args.push(des);
1417
1338
  }
1418
1339
  break;
1419
- case "SpreadE":
1420
- isValid = left.operand.type === "IdE";
1340
+ case ScriptingSourceTree_1.T_SPREAD_EXPRESSION:
1341
+ isValid = left.expr.type === ScriptingSourceTree_1.T_IDENTIFIER;
1421
1342
  if (isValid) {
1422
1343
  args.push(left);
1423
1344
  }
@@ -1434,7 +1355,7 @@ class Parser {
1434
1355
  // --- Get arrow expression statements
1435
1356
  const statement = this.parseStatement(false);
1436
1357
  return statement
1437
- ? this.createExpressionNode("ArrowE", {
1358
+ ? this.createExpressionNode(ScriptingSourceTree_1.T_ARROW_EXPRESSION, {
1438
1359
  args,
1439
1360
  statement,
1440
1361
  }, start, statement.endToken)
@@ -1451,15 +1372,15 @@ class Parser {
1451
1372
  if (!leftExpr) {
1452
1373
  return null;
1453
1374
  }
1454
- while (this.skipToken(Token_1.TokenType.NullCoalesce)) {
1375
+ while (this.skipToken(TokenType_1.TokenType.NullCoalesce)) {
1455
1376
  const rightExpr = this.parseLogicalOrExpr();
1456
1377
  if (!rightExpr) {
1457
1378
  this.reportError("W001");
1458
1379
  return null;
1459
1380
  }
1460
1381
  let endToken = rightExpr.endToken;
1461
- leftExpr = this.createExpressionNode("BinaryE", {
1462
- operator: "??",
1382
+ leftExpr = this.createExpressionNode(ScriptingSourceTree_1.T_BINARY_EXPRESSION, {
1383
+ op: "??",
1463
1384
  left: leftExpr,
1464
1385
  right: rightExpr,
1465
1386
  }, startToken, endToken);
@@ -1477,15 +1398,15 @@ class Parser {
1477
1398
  if (!leftExpr) {
1478
1399
  return null;
1479
1400
  }
1480
- while (this.skipToken(Token_1.TokenType.LogicalOr)) {
1401
+ while (this.skipToken(TokenType_1.TokenType.LogicalOr)) {
1481
1402
  const rightExpr = this.parseLogicalAndExpr();
1482
1403
  if (!rightExpr) {
1483
1404
  this.reportError("W001");
1484
1405
  return null;
1485
1406
  }
1486
1407
  let endToken = rightExpr.endToken;
1487
- leftExpr = this.createExpressionNode("BinaryE", {
1488
- operator: "||",
1408
+ leftExpr = this.createExpressionNode(ScriptingSourceTree_1.T_BINARY_EXPRESSION, {
1409
+ op: "||",
1489
1410
  left: leftExpr,
1490
1411
  right: rightExpr,
1491
1412
  }, startToken, endToken);
@@ -1503,15 +1424,15 @@ class Parser {
1503
1424
  if (!leftExpr) {
1504
1425
  return null;
1505
1426
  }
1506
- while (this.skipToken(Token_1.TokenType.LogicalAnd)) {
1427
+ while (this.skipToken(TokenType_1.TokenType.LogicalAnd)) {
1507
1428
  const rightExpr = this.parseBitwiseOrExpr();
1508
1429
  if (!rightExpr) {
1509
1430
  this.reportError("W001");
1510
1431
  return null;
1511
1432
  }
1512
1433
  let endToken = rightExpr.endToken;
1513
- leftExpr = this.createExpressionNode("BinaryE", {
1514
- operator: "&&",
1434
+ leftExpr = this.createExpressionNode(ScriptingSourceTree_1.T_BINARY_EXPRESSION, {
1435
+ op: "&&",
1515
1436
  left: leftExpr,
1516
1437
  right: rightExpr,
1517
1438
  }, startToken, endToken);
@@ -1529,15 +1450,15 @@ class Parser {
1529
1450
  if (!leftExpr) {
1530
1451
  return null;
1531
1452
  }
1532
- while (this.skipToken(Token_1.TokenType.BitwiseOr)) {
1453
+ while (this.skipToken(TokenType_1.TokenType.BitwiseOr)) {
1533
1454
  const rightExpr = this.parseBitwiseXorExpr();
1534
1455
  if (!rightExpr) {
1535
1456
  this.reportError("W001");
1536
1457
  return null;
1537
1458
  }
1538
1459
  let endToken = rightExpr.endToken;
1539
- leftExpr = this.createExpressionNode("BinaryE", {
1540
- operator: "|",
1460
+ leftExpr = this.createExpressionNode(ScriptingSourceTree_1.T_BINARY_EXPRESSION, {
1461
+ op: "|",
1541
1462
  left: leftExpr,
1542
1463
  right: rightExpr,
1543
1464
  }, startToken, endToken);
@@ -1555,15 +1476,15 @@ class Parser {
1555
1476
  if (!leftExpr) {
1556
1477
  return null;
1557
1478
  }
1558
- while (this.skipToken(Token_1.TokenType.BitwiseXor)) {
1479
+ while (this.skipToken(TokenType_1.TokenType.BitwiseXor)) {
1559
1480
  const rightExpr = this.parseBitwiseAndExpr();
1560
1481
  if (!rightExpr) {
1561
1482
  this.reportError("W001");
1562
1483
  return null;
1563
1484
  }
1564
1485
  let endToken = rightExpr.endToken;
1565
- leftExpr = this.createExpressionNode("BinaryE", {
1566
- operator: "^",
1486
+ leftExpr = this.createExpressionNode(ScriptingSourceTree_1.T_BINARY_EXPRESSION, {
1487
+ op: "^",
1567
1488
  left: leftExpr,
1568
1489
  right: rightExpr,
1569
1490
  }, startToken, endToken);
@@ -1581,15 +1502,15 @@ class Parser {
1581
1502
  if (!leftExpr) {
1582
1503
  return null;
1583
1504
  }
1584
- while (this.skipToken(Token_1.TokenType.BitwiseAnd)) {
1505
+ while (this.skipToken(TokenType_1.TokenType.BitwiseAnd)) {
1585
1506
  const rightExpr = this.parseEquExpr();
1586
1507
  if (!rightExpr) {
1587
1508
  this.reportError("W001");
1588
1509
  return null;
1589
1510
  }
1590
1511
  let endToken = rightExpr.endToken;
1591
- leftExpr = this.createExpressionNode("BinaryE", {
1592
- operator: "&",
1512
+ leftExpr = this.createExpressionNode(ScriptingSourceTree_1.T_BINARY_EXPRESSION, {
1513
+ op: "&",
1593
1514
  left: leftExpr,
1594
1515
  right: rightExpr,
1595
1516
  }, startToken, endToken);
@@ -1608,16 +1529,15 @@ class Parser {
1608
1529
  return null;
1609
1530
  }
1610
1531
  let opType;
1611
- while ((opType = this.skipTokens(Token_1.TokenType.Equal, Token_1.TokenType.StrictEqual, Token_1.TokenType.NotEqual, Token_1.TokenType.StrictNotEqual))) {
1532
+ while ((opType = this.skipTokens(TokenType_1.TokenType.Equal, TokenType_1.TokenType.StrictEqual, TokenType_1.TokenType.NotEqual, TokenType_1.TokenType.StrictNotEqual))) {
1612
1533
  const rightExpr = this.parseRelOrInExpr();
1613
1534
  if (!rightExpr) {
1614
1535
  this.reportError("W001");
1615
1536
  return null;
1616
1537
  }
1617
1538
  let endToken = rightExpr.endToken;
1618
- leftExpr = this.createExpressionNode("BinaryE", {
1619
- type: "BinaryE",
1620
- operator: opType.text,
1539
+ leftExpr = this.createExpressionNode(ScriptingSourceTree_1.T_BINARY_EXPRESSION, {
1540
+ op: opType.text,
1621
1541
  left: leftExpr,
1622
1542
  right: rightExpr,
1623
1543
  }, startToken, endToken);
@@ -1636,15 +1556,15 @@ class Parser {
1636
1556
  return null;
1637
1557
  }
1638
1558
  let opType;
1639
- while ((opType = this.skipTokens(Token_1.TokenType.LessThan, Token_1.TokenType.LessThanOrEqual, Token_1.TokenType.GreaterThan, Token_1.TokenType.GreaterThanOrEqual, Token_1.TokenType.In))) {
1559
+ while ((opType = this.skipTokens(TokenType_1.TokenType.LessThan, TokenType_1.TokenType.LessThanOrEqual, TokenType_1.TokenType.GreaterThan, TokenType_1.TokenType.GreaterThanOrEqual, TokenType_1.TokenType.In))) {
1640
1560
  const rightExpr = this.parseShiftExpr();
1641
1561
  if (!rightExpr) {
1642
1562
  this.reportError("W001");
1643
1563
  return null;
1644
1564
  }
1645
1565
  let endToken = rightExpr.endToken;
1646
- leftExpr = this.createExpressionNode("BinaryE", {
1647
- operator: opType.text,
1566
+ leftExpr = this.createExpressionNode(ScriptingSourceTree_1.T_BINARY_EXPRESSION, {
1567
+ op: opType.text,
1648
1568
  left: leftExpr,
1649
1569
  right: rightExpr,
1650
1570
  }, startToken, endToken);
@@ -1663,15 +1583,15 @@ class Parser {
1663
1583
  return null;
1664
1584
  }
1665
1585
  let opType;
1666
- while ((opType = this.skipTokens(Token_1.TokenType.ShiftLeft, Token_1.TokenType.ShiftRight, Token_1.TokenType.SignedShiftRight))) {
1586
+ while ((opType = this.skipTokens(TokenType_1.TokenType.ShiftLeft, TokenType_1.TokenType.ShiftRight, TokenType_1.TokenType.SignedShiftRight))) {
1667
1587
  const rightExpr = this.parseAddExpr();
1668
1588
  if (!rightExpr) {
1669
1589
  this.reportError("W001");
1670
1590
  return null;
1671
1591
  }
1672
1592
  let endToken = rightExpr.endToken;
1673
- leftExpr = this.createExpressionNode("BinaryE", {
1674
- operator: opType.text,
1593
+ leftExpr = this.createExpressionNode(ScriptingSourceTree_1.T_BINARY_EXPRESSION, {
1594
+ op: opType.text,
1675
1595
  left: leftExpr,
1676
1596
  right: rightExpr,
1677
1597
  }, startToken, endToken);
@@ -1690,15 +1610,15 @@ class Parser {
1690
1610
  return null;
1691
1611
  }
1692
1612
  let opType;
1693
- while ((opType = this.skipTokens(Token_1.TokenType.Plus, Token_1.TokenType.Minus))) {
1613
+ while ((opType = this.skipTokens(TokenType_1.TokenType.Plus, TokenType_1.TokenType.Minus))) {
1694
1614
  const rightExpr = this.parseMultExpr();
1695
1615
  if (!rightExpr) {
1696
1616
  this.reportError("W001");
1697
1617
  return null;
1698
1618
  }
1699
1619
  let endToken = rightExpr.endToken;
1700
- leftExpr = this.createExpressionNode("BinaryE", {
1701
- operator: opType.text,
1620
+ leftExpr = this.createExpressionNode(ScriptingSourceTree_1.T_BINARY_EXPRESSION, {
1621
+ op: opType.text,
1702
1622
  left: leftExpr,
1703
1623
  right: rightExpr,
1704
1624
  }, startToken, endToken);
@@ -1717,15 +1637,15 @@ class Parser {
1717
1637
  return null;
1718
1638
  }
1719
1639
  let opType;
1720
- while ((opType = this.skipTokens(Token_1.TokenType.Multiply, Token_1.TokenType.Divide, Token_1.TokenType.Remainder))) {
1640
+ while ((opType = this.skipTokens(TokenType_1.TokenType.Multiply, TokenType_1.TokenType.Divide, TokenType_1.TokenType.Remainder))) {
1721
1641
  const rightExpr = this.parseExponentialExpr();
1722
1642
  if (!rightExpr) {
1723
1643
  this.reportError("W001");
1724
1644
  return null;
1725
1645
  }
1726
1646
  let endToken = rightExpr.endToken;
1727
- leftExpr = this.createExpressionNode("BinaryE", {
1728
- operator: opType.text,
1647
+ leftExpr = this.createExpressionNode(ScriptingSourceTree_1.T_BINARY_EXPRESSION, {
1648
+ op: opType.text,
1729
1649
  left: leftExpr,
1730
1650
  right: rightExpr,
1731
1651
  }, startToken, endToken);
@@ -1745,7 +1665,7 @@ class Parser {
1745
1665
  }
1746
1666
  let opType;
1747
1667
  let count = 0;
1748
- while ((opType = this.skipToken(Token_1.TokenType.Exponent))) {
1668
+ while ((opType = this.skipToken(TokenType_1.TokenType.Exponent))) {
1749
1669
  let rightExpr = this.parseUnaryOrPrefixExpr();
1750
1670
  if (!rightExpr) {
1751
1671
  this.reportError("W001");
@@ -1753,20 +1673,20 @@ class Parser {
1753
1673
  }
1754
1674
  let endToken = rightExpr.endToken;
1755
1675
  if (count === 0) {
1756
- leftExpr = this.createExpressionNode("BinaryE", {
1757
- operator: opType.text,
1676
+ leftExpr = this.createExpressionNode(ScriptingSourceTree_1.T_BINARY_EXPRESSION, {
1677
+ op: opType.text,
1758
1678
  left: leftExpr,
1759
1679
  right: rightExpr,
1760
1680
  }, startToken, endToken);
1761
1681
  }
1762
1682
  else {
1763
1683
  const prevLeft = leftExpr;
1764
- leftExpr = this.createExpressionNode("BinaryE", {
1765
- operator: opType.text,
1684
+ leftExpr = this.createExpressionNode(ScriptingSourceTree_1.T_BINARY_EXPRESSION, {
1685
+ op: opType.text,
1766
1686
  left: prevLeft.left,
1767
1687
  right: {
1768
- type: "BinaryE",
1769
- operator: opType.text,
1688
+ type: ScriptingSourceTree_1.T_BINARY_EXPRESSION,
1689
+ op: opType.text,
1770
1690
  left: prevLeft.right,
1771
1691
  right: rightExpr,
1772
1692
  },
@@ -1790,20 +1710,20 @@ class Parser {
1790
1710
  if (!unaryOperand) {
1791
1711
  return null;
1792
1712
  }
1793
- return this.createExpressionNode("UnaryE", {
1794
- operator: startToken.text,
1795
- operand: unaryOperand,
1713
+ return this.createExpressionNode(ScriptingSourceTree_1.T_UNARY_EXPRESSION, {
1714
+ op: startToken.text,
1715
+ expr: unaryOperand,
1796
1716
  }, startToken, unaryOperand.endToken);
1797
1717
  }
1798
- if (startToken.type === Token_1.TokenType.IncOp || startToken.type === Token_1.TokenType.DecOp) {
1718
+ if (startToken.type === TokenType_1.TokenType.IncOp || startToken.type === TokenType_1.TokenType.DecOp) {
1799
1719
  this._lexer.get();
1800
1720
  const prefixOperand = this.parseMemberOrInvocationExpr();
1801
1721
  if (!prefixOperand) {
1802
1722
  return null;
1803
1723
  }
1804
- return this.createExpressionNode("PrefE", {
1805
- operator: startToken.text,
1806
- operand: prefixOperand,
1724
+ return this.createExpressionNode(ScriptingSourceTree_1.T_PREFIX_OP_EXPRESSION, {
1725
+ op: startToken.text,
1726
+ expr: prefixOperand,
1807
1727
  }, startToken, prefixOperand.endToken);
1808
1728
  }
1809
1729
  // --- Not unary or prefix
@@ -1827,27 +1747,27 @@ class Parser {
1827
1747
  do {
1828
1748
  const currentStart = this._lexer.peek();
1829
1749
  switch (currentStart.type) {
1830
- case Token_1.TokenType.LParent: {
1750
+ case TokenType_1.TokenType.LParent: {
1831
1751
  this._lexer.get();
1832
1752
  let args = [];
1833
- if (this._lexer.peek().type !== Token_1.TokenType.RParent) {
1753
+ if (this._lexer.peek().type !== TokenType_1.TokenType.RParent) {
1834
1754
  const expr = this.parseExpr();
1835
1755
  if (!expr) {
1836
1756
  this.reportError("W001");
1837
1757
  return null;
1838
1758
  }
1839
- args = expr.type === "SeqE" ? expr.expressions : [expr];
1759
+ args = expr.type === ScriptingSourceTree_1.T_SEQUENCE_EXPRESSION ? expr.exprs : [expr];
1840
1760
  }
1841
1761
  const endToken = this._lexer.peek();
1842
- this.expectToken(Token_1.TokenType.RParent, "W006");
1843
- primary = this.createExpressionNode("InvokeE", {
1844
- object: primary,
1762
+ this.expectToken(TokenType_1.TokenType.RParent, "W006");
1763
+ primary = this.createExpressionNode(ScriptingSourceTree_1.T_FUNCTION_INVOCATION_EXPRESSION, {
1764
+ obj: primary,
1845
1765
  arguments: args,
1846
1766
  }, startToken, endToken);
1847
1767
  break;
1848
1768
  }
1849
- case Token_1.TokenType.Dot:
1850
- case Token_1.TokenType.OptionalChaining:
1769
+ case TokenType_1.TokenType.Dot:
1770
+ case TokenType_1.TokenType.OptionalChaining:
1851
1771
  this._lexer.get();
1852
1772
  const member = this._lexer.get();
1853
1773
  const memberTrait = TokenTrait_1.tokenTraits[member.type];
@@ -1855,22 +1775,22 @@ class Parser {
1855
1775
  this.reportError("W003");
1856
1776
  return null;
1857
1777
  }
1858
- primary = this.createExpressionNode("MembE", {
1859
- object: primary,
1778
+ primary = this.createExpressionNode(ScriptingSourceTree_1.T_MEMBER_ACCESS_EXPRESSION, {
1779
+ obj: primary,
1860
1780
  member: member.text,
1861
- isOptional: currentStart.type === Token_1.TokenType.OptionalChaining,
1781
+ opt: currentStart.type === TokenType_1.TokenType.OptionalChaining,
1862
1782
  }, startToken, member);
1863
1783
  break;
1864
- case Token_1.TokenType.LSquare:
1784
+ case TokenType_1.TokenType.LSquare:
1865
1785
  this._lexer.get();
1866
1786
  const memberExpr = this.getExpression();
1867
1787
  if (!memberExpr) {
1868
1788
  return null;
1869
1789
  }
1870
1790
  const endToken = this._lexer.peek();
1871
- this.expectToken(Token_1.TokenType.RSquare, "W005");
1872
- primary = this.createExpressionNode("CMembE", {
1873
- object: primary,
1791
+ this.expectToken(TokenType_1.TokenType.RSquare, "W005");
1792
+ primary = this.createExpressionNode(ScriptingSourceTree_1.T_CALCULATED_MEMBER_ACCESS_EXPRESSION, {
1793
+ obj: primary,
1874
1794
  member: memberExpr,
1875
1795
  }, startToken, endToken);
1876
1796
  break;
@@ -1881,11 +1801,11 @@ class Parser {
1881
1801
  } while (!exitLoop);
1882
1802
  // --- Check for postfix operators
1883
1803
  const nextToken = this._lexer.peek();
1884
- if (nextToken.type === Token_1.TokenType.IncOp || nextToken.type === Token_1.TokenType.DecOp) {
1804
+ if (nextToken.type === TokenType_1.TokenType.IncOp || nextToken.type === TokenType_1.TokenType.DecOp) {
1885
1805
  this._lexer.get();
1886
- return this.createExpressionNode("PostfE", {
1887
- operator: nextToken.text,
1888
- operand: primary,
1806
+ return this.createExpressionNode(ScriptingSourceTree_1.T_POSTFIX_OP_EXPRESSION, {
1807
+ op: nextToken.text,
1808
+ expr: primary,
1889
1809
  }, startToken, nextToken);
1890
1810
  }
1891
1811
  return primary;
@@ -1903,99 +1823,88 @@ class Parser {
1903
1823
  var _a;
1904
1824
  const start = this._lexer.peek();
1905
1825
  switch (start.type) {
1906
- case Token_1.TokenType.LParent:
1826
+ case TokenType_1.TokenType.LParent:
1907
1827
  // --- Parenthesised or no-arg expression
1908
1828
  this._lexer.get();
1909
- if (this._lexer.peek().type === Token_1.TokenType.RParent) {
1829
+ if (this._lexer.peek().type === TokenType_1.TokenType.RParent) {
1910
1830
  // --- No-arg
1911
1831
  const endToken = this._lexer.get();
1912
- return this.createExpressionNode("NoArgE", {}, start, endToken);
1832
+ return this.createExpressionNode(ScriptingSourceTree_1.T_NO_ARG_EXPRESSION, {}, start, endToken);
1913
1833
  }
1914
1834
  // --- Parenthesized
1915
- const parenthesizedExpr = this.parseExpr();
1835
+ let parenthesizedExpr = this.parseExpr();
1916
1836
  if (!parenthesizedExpr) {
1917
1837
  return null;
1918
1838
  }
1919
1839
  const endToken = this._lexer.peek();
1920
- this.expectToken(Token_1.TokenType.RParent, "W006");
1921
- (_a = parenthesizedExpr.parenthesized) !== null && _a !== void 0 ? _a : (parenthesizedExpr.parenthesized = 0);
1922
- parenthesizedExpr.parenthesized++;
1923
- parenthesizedExpr.startToken = start;
1924
- parenthesizedExpr.startPosition = start.location.startPosition;
1925
- parenthesizedExpr.startLine = start.location.startLine;
1926
- parenthesizedExpr.startColumn = start.location.startColumn;
1927
- parenthesizedExpr.endToken = endToken;
1928
- parenthesizedExpr.endPosition = endToken.location.endPosition;
1929
- parenthesizedExpr.endLine = endToken.location.endLine;
1930
- parenthesizedExpr.endColumn = endToken.location.endColumn;
1931
- parenthesizedExpr.source = this.getSource(start, endToken);
1932
- return parenthesizedExpr;
1933
- case Token_1.TokenType.Identifier: {
1840
+ this.expectToken(TokenType_1.TokenType.RParent, "W006");
1841
+ return Object.assign(Object.assign({}, parenthesizedExpr), { parenthesized: ((_a = parenthesizedExpr.parenthesized) !== null && _a !== void 0 ? _a : 0) + 1, startToken: start, endToken });
1842
+ case TokenType_1.TokenType.Identifier: {
1934
1843
  const idToken = this._lexer.get();
1935
- return this.createExpressionNode("IdE", {
1844
+ return this.createExpressionNode(ScriptingSourceTree_1.T_IDENTIFIER, {
1936
1845
  name: idToken.text,
1937
1846
  }, idToken, idToken);
1938
1847
  }
1939
- case Token_1.TokenType.Global: {
1848
+ case TokenType_1.TokenType.Global: {
1940
1849
  this._lexer.get();
1941
1850
  const idToken = this._lexer.get();
1942
- if (idToken.type !== Token_1.TokenType.Identifier) {
1851
+ if (idToken.type !== TokenType_1.TokenType.Identifier) {
1943
1852
  this.reportError("W003");
1944
1853
  return null;
1945
1854
  }
1946
- return this.createExpressionNode("IdE", {
1855
+ return this.createExpressionNode(ScriptingSourceTree_1.T_IDENTIFIER, {
1947
1856
  name: idToken.text,
1948
1857
  isGlobal: true,
1949
1858
  }, idToken, idToken);
1950
1859
  }
1951
- case Token_1.TokenType.Backtick:
1860
+ case TokenType_1.TokenType.Backtick:
1952
1861
  return this.parseTemplateLiteral();
1953
- case Token_1.TokenType.False:
1954
- case Token_1.TokenType.True:
1862
+ case TokenType_1.TokenType.False:
1863
+ case TokenType_1.TokenType.True:
1955
1864
  this._lexer.get();
1956
- return this.createExpressionNode("LitE", {
1957
- value: start.type === Token_1.TokenType.True,
1865
+ return this.createExpressionNode(ScriptingSourceTree_1.T_LITERAL, {
1866
+ value: start.type === TokenType_1.TokenType.True,
1958
1867
  }, start, start);
1959
- case Token_1.TokenType.BinaryLiteral:
1868
+ case TokenType_1.TokenType.BinaryLiteral:
1960
1869
  this._lexer.get();
1961
1870
  return this.parseBinaryLiteral(start);
1962
- case Token_1.TokenType.DecimalLiteral:
1871
+ case TokenType_1.TokenType.DecimalLiteral:
1963
1872
  this._lexer.get();
1964
1873
  return this.parseDecimalLiteral(start);
1965
- case Token_1.TokenType.HexadecimalLiteral:
1874
+ case TokenType_1.TokenType.HexadecimalLiteral:
1966
1875
  this._lexer.get();
1967
1876
  return this.parseHexadecimalLiteral(start);
1968
- case Token_1.TokenType.RealLiteral:
1877
+ case TokenType_1.TokenType.RealLiteral:
1969
1878
  this._lexer.get();
1970
1879
  return this.parseRealLiteral(start);
1971
- case Token_1.TokenType.StringLiteral:
1880
+ case TokenType_1.TokenType.StringLiteral:
1972
1881
  this._lexer.get();
1973
1882
  return this.parseStringLiteral(start);
1974
- case Token_1.TokenType.Infinity:
1883
+ case TokenType_1.TokenType.Infinity:
1975
1884
  this._lexer.get();
1976
- return this.createExpressionNode("LitE", {
1885
+ return this.createExpressionNode(ScriptingSourceTree_1.T_LITERAL, {
1977
1886
  value: Infinity,
1978
1887
  }, start, start);
1979
- case Token_1.TokenType.NaN:
1888
+ case TokenType_1.TokenType.NaN:
1980
1889
  this._lexer.get();
1981
- return this.createExpressionNode("LitE", {
1890
+ return this.createExpressionNode(ScriptingSourceTree_1.T_LITERAL, {
1982
1891
  value: NaN,
1983
1892
  }, start, start);
1984
- case Token_1.TokenType.Null:
1893
+ case TokenType_1.TokenType.Null:
1985
1894
  this._lexer.get();
1986
- return this.createExpressionNode("LitE", {
1895
+ return this.createExpressionNode(ScriptingSourceTree_1.T_LITERAL, {
1987
1896
  value: null,
1988
1897
  }, start, start);
1989
- case Token_1.TokenType.Undefined:
1898
+ case TokenType_1.TokenType.Undefined:
1990
1899
  this._lexer.get();
1991
- return this.createExpressionNode("LitE", {
1900
+ return this.createExpressionNode(ScriptingSourceTree_1.T_LITERAL, {
1992
1901
  value: undefined,
1993
1902
  }, start, start);
1994
- case Token_1.TokenType.LSquare:
1903
+ case TokenType_1.TokenType.LSquare:
1995
1904
  return this.parseArrayLiteral();
1996
- case Token_1.TokenType.LBrace:
1905
+ case TokenType_1.TokenType.LBrace:
1997
1906
  return this.parseObjectLiteral();
1998
- case Token_1.TokenType.Divide:
1907
+ case TokenType_1.TokenType.Divide:
1999
1908
  return this.parseRegExpLiteral();
2000
1909
  }
2001
1910
  return null;
@@ -2007,26 +1916,26 @@ class Parser {
2007
1916
  loop: while (true) {
2008
1917
  let nextToken = this._lexer.peek();
2009
1918
  switch (nextToken.type) {
2010
- case Token_1.TokenType.StringLiteral:
1919
+ case TokenType_1.TokenType.StringLiteral:
2011
1920
  this._lexer.get();
2012
1921
  const str = this.parseStringLiteral(nextToken, false);
2013
1922
  segments.push(str);
2014
1923
  break;
2015
- case Token_1.TokenType.DollarLBrace:
1924
+ case TokenType_1.TokenType.DollarLBrace:
2016
1925
  this._lexer.get();
2017
1926
  const innerExpr = this.parseExpr();
2018
1927
  segments.push(innerExpr);
2019
- this.expectToken(Token_1.TokenType.RBrace, "W004");
1928
+ this.expectToken(TokenType_1.TokenType.RBrace, "W004");
2020
1929
  this._lexer.setStartingPhaseToTemplateLiteral();
2021
1930
  break;
2022
- case Token_1.TokenType.Backtick:
1931
+ case TokenType_1.TokenType.Backtick:
2023
1932
  break loop;
2024
1933
  default:
2025
1934
  this.reportError("W004");
2026
1935
  }
2027
1936
  }
2028
1937
  const endToken = this._lexer.get();
2029
- return this.createExpressionNode("TempLitE", { segments }, startToken, endToken);
1938
+ return this.createExpressionNode(ScriptingSourceTree_1.T_TEMPLATE_LITERAL_EXPRESSION, { segments }, startToken, endToken);
2030
1939
  }
2031
1940
  /**
2032
1941
  * Parses an array literal
@@ -2034,15 +1943,15 @@ class Parser {
2034
1943
  parseArrayLiteral() {
2035
1944
  const start = this._lexer.get();
2036
1945
  let expressions = [];
2037
- if (this._lexer.peek().type !== Token_1.TokenType.RSquare) {
1946
+ if (this._lexer.peek().type !== TokenType_1.TokenType.RSquare) {
2038
1947
  const expr = this.getExpression();
2039
1948
  if (expr) {
2040
- expressions = expr.type === "SeqE" ? expr.expressions : [expr];
1949
+ expressions = expr.type === ScriptingSourceTree_1.T_SEQUENCE_EXPRESSION ? expr.exprs : [expr];
2041
1950
  }
2042
1951
  }
2043
1952
  const endToken = this._lexer.peek();
2044
- this.expectToken(Token_1.TokenType.RSquare);
2045
- return this.createExpressionNode("ALitE", {
1953
+ this.expectToken(TokenType_1.TokenType.RSquare);
1954
+ return this.createExpressionNode(ScriptingSourceTree_1.T_ARRAY_LITERAL, {
2046
1955
  items: expressions,
2047
1956
  }, start, endToken);
2048
1957
  }
@@ -2052,23 +1961,23 @@ class Parser {
2052
1961
  parseObjectLiteral() {
2053
1962
  const start = this._lexer.get();
2054
1963
  let props = [];
2055
- if (this._lexer.peek().type !== Token_1.TokenType.RBrace) {
2056
- while (this._lexer.peek().type !== Token_1.TokenType.RBrace) {
1964
+ if (this._lexer.peek().type !== TokenType_1.TokenType.RBrace) {
1965
+ while (this._lexer.peek().type !== TokenType_1.TokenType.RBrace) {
2057
1966
  // --- Check the next token
2058
1967
  const nextToken = this._lexer.peek();
2059
1968
  const traits = TokenTrait_1.tokenTraits[nextToken.type];
2060
1969
  let nameExpr;
2061
1970
  // --- Get property name or calculated property name
2062
1971
  if (traits.expressionStart) {
2063
- if (nextToken.type === Token_1.TokenType.LSquare) {
1972
+ if (nextToken.type === TokenType_1.TokenType.LSquare) {
2064
1973
  this._lexer.get();
2065
1974
  nameExpr = this.getExpression();
2066
1975
  if (!nameExpr) {
2067
1976
  return null;
2068
1977
  }
2069
- this.expectToken(Token_1.TokenType.RSquare, "W005");
2070
- nameExpr = this.createExpressionNode("SeqE", {
2071
- expressions: [nameExpr],
1978
+ this.expectToken(TokenType_1.TokenType.RSquare, "W005");
1979
+ nameExpr = this.createExpressionNode(ScriptingSourceTree_1.T_SEQUENCE_EXPRESSION, {
1980
+ exprs: [nameExpr],
2072
1981
  }, start);
2073
1982
  }
2074
1983
  else if (traits.isPropLiteral) {
@@ -2076,9 +1985,9 @@ class Parser {
2076
1985
  if (!nameExpr) {
2077
1986
  return null;
2078
1987
  }
2079
- if (nameExpr.type !== "IdE" &&
2080
- nameExpr.type !== "LitE" &&
2081
- nameExpr.type !== "SpreadE") {
1988
+ if (nameExpr.type !== ScriptingSourceTree_1.T_IDENTIFIER &&
1989
+ nameExpr.type !== ScriptingSourceTree_1.T_LITERAL &&
1990
+ nameExpr.type !== ScriptingSourceTree_1.T_SPREAD_EXPRESSION) {
2082
1991
  this.reportError("W007");
2083
1992
  return null;
2084
1993
  }
@@ -2090,16 +1999,9 @@ class Parser {
2090
1999
  }
2091
2000
  else if (traits.keywordLike) {
2092
2001
  nameExpr = {
2093
- type: "IdE",
2002
+ type: ScriptingSourceTree_1.T_IDENTIFIER,
2003
+ nodeId: createXmlUiTreeNodeId(),
2094
2004
  name: nextToken.text,
2095
- value: undefined,
2096
- startPosition: nextToken.location.startPosition,
2097
- startLine: nextToken.location.startLine,
2098
- startColumn: nextToken.location.startColumn,
2099
- endPosition: nextToken.location.endPosition,
2100
- endLine: nextToken.location.endLine,
2101
- endColumn: nextToken.location.endColumn,
2102
- source: nextToken.text,
2103
2005
  startToken: nextToken,
2104
2006
  endToken: nextToken,
2105
2007
  };
@@ -2110,33 +2012,29 @@ class Parser {
2110
2012
  return null;
2111
2013
  }
2112
2014
  const nameType = nameExpr.type;
2113
- if (nameType === "SpreadE") {
2015
+ if (nameType === ScriptingSourceTree_1.T_SPREAD_EXPRESSION) {
2114
2016
  props.push(nameExpr);
2115
2017
  }
2116
2018
  else {
2117
- if (nameType === "LitE") {
2019
+ if (nameType === ScriptingSourceTree_1.T_LITERAL) {
2118
2020
  const val = nameExpr.value;
2119
2021
  if (typeof val !== "number" && typeof val !== "string") {
2120
- this.expectToken(Token_1.TokenType.RBrace, "W007");
2022
+ this.expectToken(TokenType_1.TokenType.RBrace, "W007");
2121
2023
  return null;
2122
2024
  }
2123
2025
  }
2124
- // else if (nameType !== "IdE") {
2125
- // this.expectToken(TokenType.RBrace, "W007");
2126
- // return null;
2127
- // }
2128
2026
  // --- Value is optional, when we have a name
2129
2027
  let valueExpr = null;
2130
- if (nameType === "IdE") {
2028
+ if (nameType === ScriptingSourceTree_1.T_IDENTIFIER) {
2131
2029
  const nameFollowerToken = this._lexer.peek();
2132
- if (nameFollowerToken.type === Token_1.TokenType.Comma ||
2133
- nameFollowerToken.type === Token_1.TokenType.RBrace) {
2030
+ if (nameFollowerToken.type === TokenType_1.TokenType.Comma ||
2031
+ nameFollowerToken.type === TokenType_1.TokenType.RBrace) {
2134
2032
  valueExpr = Object.assign({}, nameExpr);
2135
2033
  }
2136
2034
  }
2137
2035
  // --- Move to property value
2138
2036
  if (!valueExpr) {
2139
- this.expectToken(Token_1.TokenType.Colon, "W008");
2037
+ this.expectToken(TokenType_1.TokenType.Colon, "W008");
2140
2038
  valueExpr = this.getExpression(false);
2141
2039
  if (!valueExpr) {
2142
2040
  return null;
@@ -2146,19 +2044,19 @@ class Parser {
2146
2044
  }
2147
2045
  // --- Test property termination
2148
2046
  const next = this._lexer.peek().type;
2149
- if (next === Token_1.TokenType.Comma) {
2047
+ if (next === TokenType_1.TokenType.Comma) {
2150
2048
  this._lexer.get();
2151
2049
  }
2152
2050
  else {
2153
- if (next !== Token_1.TokenType.RBrace) {
2051
+ if (next !== TokenType_1.TokenType.RBrace) {
2154
2052
  break;
2155
2053
  }
2156
2054
  }
2157
2055
  }
2158
2056
  }
2159
2057
  const endToken = this._lexer.peek();
2160
- this.expectToken(Token_1.TokenType.RBrace, "W004");
2161
- return this.createExpressionNode("OLitE", {
2058
+ this.expectToken(TokenType_1.TokenType.RBrace, "W004");
2059
+ return this.createExpressionNode(ScriptingSourceTree_1.T_OBJECT_LITERAL, {
2162
2060
  props,
2163
2061
  }, start, endToken);
2164
2062
  }
@@ -2167,7 +2065,7 @@ class Parser {
2167
2065
  const startToken = this._lexer.peek();
2168
2066
  const result = this._lexer.getRegEx();
2169
2067
  if (result.success) {
2170
- return this.createExpressionNode("LitE", {
2068
+ return this.createExpressionNode(ScriptingSourceTree_1.T_LITERAL, {
2171
2069
  value: new RegExp(result.pattern, result.flags),
2172
2070
  }, startToken, this._lexer.peek());
2173
2071
  }
@@ -2195,7 +2093,7 @@ class Parser {
2195
2093
  */
2196
2094
  expectToken(type, errorCode, allowEof) {
2197
2095
  const next = this._lexer.peek();
2198
- if (next.type === type || (allowEof && next.type === Token_1.TokenType.Eof)) {
2096
+ if (next.type === type || (allowEof && next.type === TokenType_1.TokenType.Eof)) {
2199
2097
  // --- Skip the expected token
2200
2098
  return this._lexer.get();
2201
2099
  }
@@ -2246,9 +2144,6 @@ class Parser {
2246
2144
  this._parseErrors.push({
2247
2145
  code: errorCode,
2248
2146
  text: errorText,
2249
- line: token.location.startLine,
2250
- column: token.location.startColumn,
2251
- position: token.location.startPosition,
2252
2147
  });
2253
2148
  throw new ParserError_1.ParserError(errorText, errorCode);
2254
2149
  function replace(input, placeholder, replacement) {
@@ -2266,21 +2161,14 @@ class Parser {
2266
2161
  * @param endToken The token that ends the expression
2267
2162
  * @param source Expression source code to store to the node
2268
2163
  */
2269
- createNode(type, stump, startToken, endToken, source) {
2164
+ createNode(type, stump, startToken, endToken) {
2270
2165
  if (!endToken) {
2271
2166
  endToken = this._lexer.peek();
2272
2167
  }
2273
- const startPosition = startToken.location.startPosition;
2274
- const endPosition = endToken.location.startPosition;
2275
2168
  return Object.assign({}, stump, {
2276
2169
  type,
2277
- startPosition,
2278
- endPosition,
2279
- startLine: startToken.location.startLine,
2280
- startColumn: startToken.location.startColumn,
2281
- endLine: endToken.location.endLine,
2282
- endColumn: endToken.location.endColumn,
2283
- source: source !== null && source !== void 0 ? source : this.getSource(startToken, endToken),
2170
+ startToken,
2171
+ endToken,
2284
2172
  });
2285
2173
  }
2286
2174
  /**
@@ -2291,24 +2179,16 @@ class Parser {
2291
2179
  * @param endToken The token that ends the expression
2292
2180
  * @param source Expression source code to store to the node
2293
2181
  */
2294
- createExpressionNode(type, stump = {}, startToken, endToken, source) {
2182
+ createExpressionNode(type, stump = {}, startToken, endToken) {
2295
2183
  if (!endToken) {
2296
2184
  endToken = this._lexer.peek();
2297
2185
  }
2298
2186
  if (!startToken) {
2299
2187
  startToken = endToken;
2300
2188
  }
2301
- const startPosition = startToken.location.startPosition;
2302
- const endPosition = endToken.location.endPosition;
2303
2189
  return Object.assign({}, stump, {
2304
2190
  type,
2305
- startPosition,
2306
- endPosition,
2307
- startLine: startToken.location.startLine,
2308
- startColumn: startToken.location.startColumn,
2309
- endLine: endToken.location.endLine,
2310
- endColumn: endToken.location.endColumn,
2311
- source: source !== null && source !== void 0 ? source : this.getSource(startToken, endToken),
2191
+ nodeId: createXmlUiTreeNodeId(),
2312
2192
  startToken,
2313
2193
  endToken,
2314
2194
  });
@@ -2321,38 +2201,13 @@ class Parser {
2321
2201
  * @param endToken The token that ends the statement
2322
2202
  */
2323
2203
  createStatementNode(type, stump, startToken, endToken) {
2324
- var _a, _b, _c, _d, _e;
2325
- const startPosition = (_a = startToken === null || startToken === void 0 ? void 0 : startToken.location) === null || _a === void 0 ? void 0 : _a.startPosition;
2326
- const currentToken = this._lexer.peek();
2327
- const endPosition = endToken
2328
- ? endToken.location.endPosition
2329
- : currentToken.type === Token_1.TokenType.Eof
2330
- ? currentToken.location.startPosition + 1
2331
- : currentToken.location.startPosition;
2332
2204
  return Object.assign({}, stump, {
2333
2205
  type,
2334
- startPosition,
2335
- endPosition,
2336
- startLine: (_b = startToken === null || startToken === void 0 ? void 0 : startToken.location) === null || _b === void 0 ? void 0 : _b.startLine,
2337
- startColumn: (_c = startToken === null || startToken === void 0 ? void 0 : startToken.location) === null || _c === void 0 ? void 0 : _c.startColumn,
2338
- endLine: endToken ? endToken.location.endLine : (_d = startToken === null || startToken === void 0 ? void 0 : startToken.location) === null || _d === void 0 ? void 0 : _d.endLine,
2339
- endColumn: endToken ? endToken.location.endColumn : (_e = startToken === null || startToken === void 0 ? void 0 : startToken.location) === null || _e === void 0 ? void 0 : _e.endColumn,
2340
- source: this.source && startPosition !== undefined && endPosition !== undefined
2341
- ? this.source.substring(startPosition, endPosition)
2342
- : undefined,
2206
+ nodeId: createXmlUiTreeNodeId(),
2343
2207
  startToken,
2344
2208
  endToken,
2345
2209
  });
2346
2210
  }
2347
- /**
2348
- * Gets the source code for the specified token range
2349
- * @param start Start token
2350
- * @param end Optional end token
2351
- * @returns The source code for the token range
2352
- */
2353
- getSource(start, end) {
2354
- return this.source.substring(start.location.startPosition, end.type === Token_1.TokenType.Eof ? end.location.startPosition : end.location.endPosition);
2355
- }
2356
2211
  /**
2357
2212
  * Parses a binary literal
2358
2213
  * @param token Literal token
@@ -2366,7 +2221,7 @@ class Parser {
2366
2221
  else {
2367
2222
  value = parseInt(token.text.substring(2).replace(/[_']/g, ""), 2);
2368
2223
  }
2369
- return this.createExpressionNode("LitE", {
2224
+ return this.createExpressionNode(ScriptingSourceTree_1.T_LITERAL, {
2370
2225
  value,
2371
2226
  }, token, token);
2372
2227
  }
@@ -2383,7 +2238,7 @@ class Parser {
2383
2238
  else {
2384
2239
  value = parseInt(token.text.replace(/[_']/g, ""), 10);
2385
2240
  }
2386
- return this.createExpressionNode("LitE", {
2241
+ return this.createExpressionNode(ScriptingSourceTree_1.T_LITERAL, {
2387
2242
  value,
2388
2243
  }, token, token);
2389
2244
  }
@@ -2400,7 +2255,7 @@ class Parser {
2400
2255
  else {
2401
2256
  value = parseInt(token.text.substring(2).replace(/[_']/g, ""), 16);
2402
2257
  }
2403
- return this.createExpressionNode("LitE", {
2258
+ return this.createExpressionNode(ScriptingSourceTree_1.T_LITERAL, {
2404
2259
  value,
2405
2260
  }, token, token);
2406
2261
  }
@@ -2410,7 +2265,7 @@ class Parser {
2410
2265
  */
2411
2266
  parseRealLiteral(token) {
2412
2267
  let value = parseFloat(token.text.replace(/[_']/g, ""));
2413
- return this.createExpressionNode("LitE", {
2268
+ return this.createExpressionNode(ScriptingSourceTree_1.T_LITERAL, {
2414
2269
  value,
2415
2270
  }, token, token);
2416
2271
  }
@@ -2640,7 +2495,7 @@ class Parser {
2640
2495
  break;
2641
2496
  }
2642
2497
  // --- Done
2643
- return this.createExpressionNode("LitE", {
2498
+ return this.createExpressionNode(ScriptingSourceTree_1.T_LITERAL, {
2644
2499
  value: result,
2645
2500
  }, token, token);
2646
2501
  function isHexaDecimal(ch) {
@@ -2649,43 +2504,43 @@ class Parser {
2649
2504
  }
2650
2505
  convertToArrayDestructure(seq) {
2651
2506
  var _a;
2652
- const items = seq.type === "SeqE" ? seq.expressions : seq.items;
2653
- const result = this.createExpressionNode("Destr", { arrayDestruct: [] }, seq.startToken, seq.endToken);
2507
+ const items = seq.type === ScriptingSourceTree_1.T_SEQUENCE_EXPRESSION ? seq.exprs : seq.items;
2508
+ const result = this.createExpressionNode(ScriptingSourceTree_1.T_DESTRUCTURE, { aDestr: [] }, seq.startToken, seq.endToken);
2654
2509
  // --- Convert all items
2655
2510
  for (const item of items) {
2656
2511
  let arrayD;
2657
2512
  switch (item.type) {
2658
- case "NoArgE":
2659
- arrayD = this.createExpressionNode("ADestr", {}, item.startToken, item.endToken);
2513
+ case ScriptingSourceTree_1.T_NO_ARG_EXPRESSION:
2514
+ arrayD = this.createExpressionNode(ScriptingSourceTree_1.T_ARRAY_DESTRUCTURE, {}, item.startToken, item.endToken);
2660
2515
  break;
2661
- case "IdE":
2662
- arrayD = this.createExpressionNode("ADestr", { id: item.name }, item.startToken, item.endToken);
2516
+ case ScriptingSourceTree_1.T_IDENTIFIER:
2517
+ arrayD = this.createExpressionNode(ScriptingSourceTree_1.T_ARRAY_DESTRUCTURE, { id: item.name }, item.startToken, item.endToken);
2663
2518
  break;
2664
- case "Destr":
2665
- result.arrayDestruct.push(...item.arrayDestruct);
2519
+ case ScriptingSourceTree_1.T_DESTRUCTURE:
2520
+ result.aDestr.push(...item.aDestr);
2666
2521
  break;
2667
- case "ADestr":
2522
+ case ScriptingSourceTree_1.T_ARRAY_DESTRUCTURE:
2668
2523
  arrayD = item;
2669
2524
  break;
2670
- case "ALitE": {
2525
+ case ScriptingSourceTree_1.T_ARRAY_LITERAL: {
2671
2526
  const destructure = this.convertToArrayDestructure(item);
2672
2527
  if (destructure) {
2673
- arrayD = this.createExpressionNode("ADestr", {
2674
- arrayDestruct: destructure.arrayDestruct,
2528
+ arrayD = this.createExpressionNode(ScriptingSourceTree_1.T_ARRAY_DESTRUCTURE, {
2529
+ aDestr: destructure.aDestr,
2675
2530
  }, item.startToken, item.endToken);
2676
2531
  }
2677
2532
  break;
2678
2533
  }
2679
- case "ODestr":
2680
- arrayD = this.createExpressionNode("ADestr", {
2681
- objectDestruct: item,
2534
+ case ScriptingSourceTree_1.T_OBJECT_DESTRUCTURE:
2535
+ arrayD = this.createExpressionNode(ScriptingSourceTree_1.T_ARRAY_DESTRUCTURE, {
2536
+ oDestr: item,
2682
2537
  }, item.startToken, item.endToken);
2683
2538
  break;
2684
- case "OLitE": {
2539
+ case ScriptingSourceTree_1.T_OBJECT_LITERAL: {
2685
2540
  const destructure = this.convertToObjectDestructure(item);
2686
2541
  if (destructure) {
2687
- arrayD = this.createExpressionNode("ADestr", {
2688
- objectDestruct: destructure.objectDestruct,
2542
+ arrayD = this.createExpressionNode(ScriptingSourceTree_1.T_ARRAY_DESTRUCTURE, {
2543
+ oDestr: destructure.oDestr,
2689
2544
  }, item.startToken, item.endToken);
2690
2545
  }
2691
2546
  break;
@@ -2695,66 +2550,66 @@ class Parser {
2695
2550
  return null;
2696
2551
  }
2697
2552
  if (arrayD)
2698
- (_a = result.arrayDestruct) === null || _a === void 0 ? void 0 : _a.push(arrayD);
2553
+ (_a = result.aDestr) === null || _a === void 0 ? void 0 : _a.push(arrayD);
2699
2554
  }
2700
2555
  // --- Done.
2701
2556
  return result;
2702
2557
  }
2703
2558
  convertToObjectDestructure(objLit) {
2704
2559
  var _a;
2705
- const result = this.createExpressionNode("Destr", { objectDestruct: [] }, objLit.startToken, objLit.endToken);
2560
+ const result = this.createExpressionNode(ScriptingSourceTree_1.T_DESTRUCTURE, { oDestr: [] }, objLit.startToken, objLit.endToken);
2706
2561
  // --- Convert all items
2707
2562
  for (const prop of objLit.props) {
2708
2563
  if (Array.isArray(prop)) {
2709
2564
  }
2710
2565
  else {
2711
- this.reportError("W018");
2566
+ reportError("W018");
2712
2567
  return null;
2713
2568
  }
2714
2569
  const [propKey, propValue] = prop;
2715
- if (propKey.type !== "IdE") {
2716
- this.reportError("W018");
2570
+ if (propKey.type !== ScriptingSourceTree_1.T_IDENTIFIER) {
2571
+ reportError("W018");
2717
2572
  return null;
2718
2573
  }
2719
2574
  let objD;
2720
2575
  switch (propValue.type) {
2721
- case "IdE":
2576
+ case ScriptingSourceTree_1.T_IDENTIFIER:
2722
2577
  if (propValue.name === propKey.name) {
2723
- objD = this.createExpressionNode("ODestr", { id: propKey.name }, propValue.startToken, propValue.endToken);
2578
+ objD = this.createExpressionNode(ScriptingSourceTree_1.T_OBJECT_DESTRUCTURE, { id: propKey.name }, propValue.startToken, propValue.endToken);
2724
2579
  }
2725
2580
  else {
2726
- objD = this.createExpressionNode("ODestr", {
2581
+ objD = this.createExpressionNode(ScriptingSourceTree_1.T_OBJECT_DESTRUCTURE, {
2727
2582
  id: propKey.name,
2728
2583
  alias: propValue.name,
2729
2584
  }, propValue.startToken, propValue.endToken);
2730
2585
  }
2731
2586
  break;
2732
- case "ADestr": {
2733
- objD = this.createExpressionNode("ODestr", {
2587
+ case ScriptingSourceTree_1.T_ARRAY_DESTRUCTURE: {
2588
+ objD = this.createExpressionNode(ScriptingSourceTree_1.T_OBJECT_DESTRUCTURE, {
2734
2589
  id: propKey.name,
2735
- arrayDestruct: propValue,
2590
+ aDestr: propValue,
2736
2591
  }, propKey.startToken, propValue.endToken);
2737
2592
  break;
2738
2593
  }
2739
- case "ALitE": {
2594
+ case ScriptingSourceTree_1.T_ARRAY_LITERAL: {
2740
2595
  const destructure = this.convertToArrayDestructure(propValue);
2741
2596
  if (destructure) {
2742
- objD = this.createExpressionNode("ODestr", {
2597
+ objD = this.createExpressionNode(ScriptingSourceTree_1.T_OBJECT_DESTRUCTURE, {
2743
2598
  id: propKey.name,
2744
- arrayDestruct: destructure.arrayDestruct,
2599
+ aDestr: destructure.aDestr,
2745
2600
  }, propKey.startToken, propValue.endToken);
2746
2601
  }
2747
2602
  break;
2748
2603
  }
2749
- case "ODestr":
2604
+ case ScriptingSourceTree_1.T_OBJECT_DESTRUCTURE:
2750
2605
  objD = propValue;
2751
2606
  break;
2752
- case "OLitE": {
2607
+ case ScriptingSourceTree_1.T_OBJECT_LITERAL: {
2753
2608
  const destructure = this.convertToObjectDestructure(propValue);
2754
2609
  if (destructure) {
2755
- objD = this.createExpressionNode("ODestr", {
2610
+ objD = this.createExpressionNode(ScriptingSourceTree_1.T_OBJECT_DESTRUCTURE, {
2756
2611
  id: propKey.name,
2757
- objectDestruct: destructure.objectDestruct,
2612
+ oDestr: destructure.oDestr,
2758
2613
  }, propKey.startToken, propValue.endToken);
2759
2614
  }
2760
2615
  break;
@@ -2764,7 +2619,7 @@ class Parser {
2764
2619
  return null;
2765
2620
  }
2766
2621
  if (objD)
2767
- (_a = result.objectDestruct) === null || _a === void 0 ? void 0 : _a.push(objD);
2622
+ (_a = result.oDestr) === null || _a === void 0 ? void 0 : _a.push(objD);
2768
2623
  }
2769
2624
  // --- Done.
2770
2625
  return result;
@@ -2778,4 +2633,3 @@ class Parser {
2778
2633
  }
2779
2634
  }
2780
2635
  exports.Parser = Parser;
2781
- ("TypeError: Cannot read properties of undefined (reading 'canBeUnary')\n at Parser.parseUnaryOrPrefixExpr (/home/ez/code/work/xmlui/xmlui/src/parsers/scripting/Parser.ts:2041:38)\n at Parser.parseExponentialExpr (/home/ez/code/work/xmlui/xmlui/src/parsers/scripting/Parser.ts:1985:25)\n at Parser.parseMultExpr (/home/ez/code/work/xmlui/xmlui/src/parsers/scripting/Parser.ts:1951:25)\n at Parser.parseAddExpr (/home/ez/code/work/xmlui/xmlui/src/parsers/scripting/Parser.ts:1917:25)\n at Par…nExpr (/home/ez/code/work/xmlui/xmlui/src/parsers/scripting/Parser.ts:1835:25)\n at Parser.parseEquExpr (/home/ez/code/work/xmlui/xmlui/src/parsers/scripting/Parser.ts:1793:25)\n at Parser.parseBitwiseAndExpr (/home/ez/code/work/xmlui/xmlui/src/parsers/scripting/Parser.ts:1760:25)\n at Parser.parseBitwiseXorExpr (/home/ez/code/work/xmlui/xmlui/src/parsers/scripting/Parser.ts:1727:25)\n at Parser.parseBitwiseOrExpr (/home/ez/code/work/xmlui/xmlui/src/parsers/scripting/Parser.ts:1694:25)");