@foxystar/molang 0.1.0

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 (44) hide show
  1. package/README.md +82 -0
  2. package/esm/LRUCache.d.ts +6 -0
  3. package/esm/LRUCache.js +30 -0
  4. package/esm/diagnostics/error.d.ts +12 -0
  5. package/esm/diagnostics/error.js +37 -0
  6. package/esm/diagnostics/suggestions.d.ts +2 -0
  7. package/esm/diagnostics/suggestions.js +35 -0
  8. package/esm/index.d.ts +8 -0
  9. package/esm/index.js +6 -0
  10. package/esm/molang.d.ts +2 -0
  11. package/esm/molang.js +22 -0
  12. package/esm/package.json +3 -0
  13. package/esm/parser/expression.d.ts +87 -0
  14. package/esm/parser/expression.js +19 -0
  15. package/esm/parser/parser.d.ts +20 -0
  16. package/esm/parser/parser.js +490 -0
  17. package/esm/runtime/context.d.ts +19 -0
  18. package/esm/runtime/context.js +51 -0
  19. package/esm/runtime/math.d.ts +32 -0
  20. package/esm/runtime/math.js +89 -0
  21. package/esm/runtime/runtime.d.ts +34 -0
  22. package/esm/runtime/runtime.js +537 -0
  23. package/package.json +39 -0
  24. package/script/LRUCache.d.ts +6 -0
  25. package/script/LRUCache.js +33 -0
  26. package/script/diagnostics/error.d.ts +12 -0
  27. package/script/diagnostics/error.js +42 -0
  28. package/script/diagnostics/suggestions.d.ts +2 -0
  29. package/script/diagnostics/suggestions.js +40 -0
  30. package/script/index.d.ts +8 -0
  31. package/script/index.js +27 -0
  32. package/script/molang.d.ts +2 -0
  33. package/script/molang.js +29 -0
  34. package/script/package.json +3 -0
  35. package/script/parser/expression.d.ts +87 -0
  36. package/script/parser/expression.js +22 -0
  37. package/script/parser/parser.d.ts +20 -0
  38. package/script/parser/parser.js +494 -0
  39. package/script/runtime/context.d.ts +19 -0
  40. package/script/runtime/context.js +57 -0
  41. package/script/runtime/math.d.ts +32 -0
  42. package/script/runtime/math.js +92 -0
  43. package/script/runtime/runtime.d.ts +34 -0
  44. package/script/runtime/runtime.js +567 -0
@@ -0,0 +1,34 @@
1
+ import { Expr, Program } from "../parser/expression.js";
2
+ import { MolangContext } from "./context.js";
3
+ export interface MolangOptions {
4
+ strict?: boolean;
5
+ }
6
+ export declare class ReturnSignal {
7
+ value: unknown;
8
+ constructor(value: unknown);
9
+ }
10
+ export declare class BreakSignal {
11
+ }
12
+ export declare class ContinueSignal {
13
+ }
14
+ export declare class MolangRuntime {
15
+ private context;
16
+ private source;
17
+ private options;
18
+ private rootContext;
19
+ private loopDepth;
20
+ constructor(context: MolangContext, source: string, options?: MolangOptions, rootContext?: MolangContext);
21
+ private static NAMESPACE_ALIASES;
22
+ private safe;
23
+ evaluateProgram(program: Program): unknown;
24
+ private evaluateStatement;
25
+ private assign;
26
+ private findAssignmentRoot;
27
+ evaluate(expr: Expr): any;
28
+ private toNumber;
29
+ private toBoolean;
30
+ private applyOperator;
31
+ static normalizePath(path: string): string[];
32
+ private suggestPath;
33
+ private resolvePath;
34
+ }
@@ -0,0 +1,567 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.MolangRuntime = exports.ContinueSignal = exports.BreakSignal = exports.ReturnSignal = void 0;
27
+ const error_js_1 = require("../diagnostics/error.js");
28
+ const Suggestions = __importStar(require("../diagnostics/suggestions.js"));
29
+ const context_js_1 = require("./context.js");
30
+ class ReturnSignal {
31
+ constructor(value) {
32
+ Object.defineProperty(this, "value", {
33
+ enumerable: true,
34
+ configurable: true,
35
+ writable: true,
36
+ value: value
37
+ });
38
+ }
39
+ ;
40
+ }
41
+ exports.ReturnSignal = ReturnSignal;
42
+ class BreakSignal {
43
+ }
44
+ exports.BreakSignal = BreakSignal;
45
+ ;
46
+ class ContinueSignal {
47
+ }
48
+ exports.ContinueSignal = ContinueSignal;
49
+ ;
50
+ class MolangRuntime {
51
+ constructor(context = context_js_1.DEFAULT_CONTEXT, source, options = {}, rootContext = context) {
52
+ Object.defineProperty(this, "context", {
53
+ enumerable: true,
54
+ configurable: true,
55
+ writable: true,
56
+ value: context
57
+ });
58
+ Object.defineProperty(this, "source", {
59
+ enumerable: true,
60
+ configurable: true,
61
+ writable: true,
62
+ value: source
63
+ });
64
+ Object.defineProperty(this, "options", {
65
+ enumerable: true,
66
+ configurable: true,
67
+ writable: true,
68
+ value: options
69
+ });
70
+ Object.defineProperty(this, "rootContext", {
71
+ enumerable: true,
72
+ configurable: true,
73
+ writable: true,
74
+ value: rootContext
75
+ });
76
+ Object.defineProperty(this, "loopDepth", {
77
+ enumerable: true,
78
+ configurable: true,
79
+ writable: true,
80
+ value: 0
81
+ });
82
+ }
83
+ safe(fn) {
84
+ try {
85
+ return fn();
86
+ }
87
+ catch (e) {
88
+ if (this.options.strict) {
89
+ throw e;
90
+ }
91
+ return 0;
92
+ }
93
+ }
94
+ evaluateProgram(program) {
95
+ try {
96
+ let result = undefined;
97
+ for (const stmt of program.body) {
98
+ result = this.evaluateStatement(stmt);
99
+ }
100
+ return result;
101
+ }
102
+ catch (e) {
103
+ if (e instanceof ReturnSignal) {
104
+ return e.value;
105
+ }
106
+ throw e;
107
+ }
108
+ }
109
+ evaluateStatement(stmt) {
110
+ switch (stmt.type) {
111
+ case "ExprStatement": {
112
+ return this.evaluate(stmt.expr);
113
+ }
114
+ case "AssignStatement": {
115
+ if (stmt.target.type === "ArrowExpression") {
116
+ throw new error_js_1.MolangRuntimeError("Cannot assign through '->'", stmt.target, this.source);
117
+ }
118
+ const value = this.evaluate(stmt.value);
119
+ this.assign(stmt.target, value, stmt);
120
+ return value;
121
+ }
122
+ case "BreakStatement": {
123
+ if (this.loopDepth === 0) {
124
+ throw new error_js_1.MolangRuntimeError("break used outside of loop", stmt, this.source);
125
+ }
126
+ throw new BreakSignal();
127
+ }
128
+ case "ContinueStatement": {
129
+ if (this.loopDepth === 0) {
130
+ throw new error_js_1.MolangRuntimeError("continue used outside of loop", stmt, this.source);
131
+ }
132
+ throw new ContinueSignal();
133
+ }
134
+ case "ReturnStatement": {
135
+ const value = stmt.value
136
+ ? this.evaluate(stmt.value)
137
+ : undefined;
138
+ throw new ReturnSignal(value);
139
+ }
140
+ case "ConditionalStatement": {
141
+ const condition = this.evaluate(stmt.condition);
142
+ if (this.toBoolean(condition)) {
143
+ return this.evaluateStatement(stmt.then);
144
+ }
145
+ if (stmt.else) {
146
+ return this.evaluateStatement(stmt.else);
147
+ }
148
+ return undefined;
149
+ }
150
+ case "LoopStatement": {
151
+ const result = this.toNumber(this.evaluate(stmt.count));
152
+ const count = Math.min(1024, Math.max(0, result | 0));
153
+ this.loopDepth++;
154
+ for (let i = 0; i < count; i++) {
155
+ try {
156
+ this.evaluateStatement(stmt.body);
157
+ }
158
+ catch (e) {
159
+ if (e instanceof BreakSignal) {
160
+ break;
161
+ }
162
+ if (e instanceof ContinueSignal) {
163
+ continue;
164
+ }
165
+ throw e;
166
+ }
167
+ }
168
+ this.loopDepth--;
169
+ return 0;
170
+ }
171
+ case "ForEachStatement": {
172
+ const value = this.evaluate(stmt.iterable);
173
+ if (!Array.isArray(value)) {
174
+ return 0;
175
+ }
176
+ const max = Math.min(1024, value.length);
177
+ for (let i = 0; i < max; i++) {
178
+ try {
179
+ const iterationContext = Object.create(this.context);
180
+ iterationContext.this = value[i];
181
+ const nested = new MolangRuntime(iterationContext, this.source, this.options, this.rootContext);
182
+ // ALWAYS assign iterator
183
+ nested.assign(stmt.iterator, value[i], stmt);
184
+ nested.evaluateStatement(stmt.body);
185
+ }
186
+ catch (e) {
187
+ if (e instanceof BreakSignal) {
188
+ break;
189
+ }
190
+ if (e instanceof ContinueSignal) {
191
+ continue;
192
+ }
193
+ throw e;
194
+ }
195
+ }
196
+ return 0;
197
+ }
198
+ case "BlockStatement": {
199
+ let result = undefined;
200
+ for (const s of stmt.body) {
201
+ result = this.evaluateStatement(s);
202
+ }
203
+ return result;
204
+ }
205
+ default: {
206
+ throw new Error("Unknown statement type");
207
+ }
208
+ }
209
+ }
210
+ assign(target, value, _stmt) {
211
+ // Index assignment: arr[idx] = value
212
+ if (target.type === "IndexExpression") {
213
+ // Ensure the base identifier is assignable
214
+ const root = this.findAssignmentRoot(target.array);
215
+ if (root !== "variable" && root !== "temp") {
216
+ throw new error_js_1.MolangRuntimeError(`Cannot assign to namespace '${root}'`, target, this.source);
217
+ }
218
+ const container = this.evaluate(target.array);
219
+ const index = this.evaluate(target.index);
220
+ if (!(0, context_js_1.isNamespace)(container)) {
221
+ throw new error_js_1.MolangRuntimeError("Cannot assign to property of null or undefined", target, this.source);
222
+ }
223
+ container[index] = value;
224
+ return;
225
+ }
226
+ if (target.type !== "Identifier") {
227
+ throw new error_js_1.MolangRuntimeError("Invalid assignment target", target, this.source);
228
+ }
229
+ const parts = MolangRuntime.normalizePath(target.name);
230
+ if (parts.length < 2) {
231
+ throw new error_js_1.MolangRuntimeError("Assignments must target a namespace like v.x or variable.x", target, this.source);
232
+ }
233
+ // Enforce allowed namespaces (very important for safety)
234
+ const root = parts[0];
235
+ if (root !== "variable" && root !== "temp") {
236
+ throw new error_js_1.MolangRuntimeError(`Cannot assign to namespace '${root}'`, target, this.source);
237
+ }
238
+ let current = this.context;
239
+ for (let i = 0; i < parts.length - 1; i++) {
240
+ const part = parts[i];
241
+ if (!(0, context_js_1.isNamespace)(current)) {
242
+ throw new error_js_1.MolangRuntimeError(`Unknown identifier '${parts.join(".")}'`, target, this.source);
243
+ }
244
+ if (!(part in current)) {
245
+ if (this.options.strict) {
246
+ let message = `Cannot assign to '${parts.join(".")}' because '${parts.slice(0, i + 1).join(".")}' does not exist`;
247
+ const suggestion = this.suggestPath(parts, i, current);
248
+ if (suggestion) {
249
+ message += `. Did you mean '${suggestion}'?`;
250
+ }
251
+ throw new error_js_1.MolangRuntimeError(message, target, this.source);
252
+ }
253
+ current[part] = {};
254
+ }
255
+ current = current[part];
256
+ }
257
+ const last = parts[parts.length - 1];
258
+ if (!(0, context_js_1.isNamespace)(current)) {
259
+ throw new error_js_1.MolangRuntimeError(`Cannot assign to '${parts.join(".")}'`, target, this.source);
260
+ }
261
+ current[last] = value;
262
+ }
263
+ findAssignmentRoot(expr) {
264
+ if (expr.type === "Identifier") {
265
+ return MolangRuntime.normalizePath(expr.name)[0] ?? null;
266
+ }
267
+ if (expr.type === "IndexExpression") {
268
+ return this.findAssignmentRoot(expr.array);
269
+ }
270
+ return null;
271
+ }
272
+ evaluate(expr) {
273
+ switch (expr.type) {
274
+ case "Literal": {
275
+ return expr.value;
276
+ }
277
+ case "Identifier": {
278
+ try {
279
+ return this.resolvePath(expr.path, expr);
280
+ }
281
+ catch {
282
+ return undefined;
283
+ }
284
+ }
285
+ case "BinaryExpression": {
286
+ return this.safe(() => {
287
+ const left = this.evaluate(expr.left);
288
+ const right = this.evaluate(expr.right);
289
+ return this.applyOperator(expr.operator, left, right, expr);
290
+ });
291
+ }
292
+ case "CallExpression": {
293
+ try {
294
+ if (expr.callee.type !== "Identifier") {
295
+ throw new error_js_1.MolangRuntimeError("Invalid function call target", expr.callee, this.source);
296
+ }
297
+ const name = expr.callee.name;
298
+ const func = this.evaluate(expr.callee);
299
+ if (func === undefined) {
300
+ const parts = MolangRuntime.normalizePath(name);
301
+ // resolve parent safely
302
+ let parent = this.context;
303
+ for (let i = 0; i < parts.length - 1; i++) {
304
+ const p = parts[i];
305
+ if (!(0, context_js_1.isNamespace)(parent) || !(p in parent)) {
306
+ break;
307
+ }
308
+ parent = parent[p];
309
+ }
310
+ let message = `Cannot call '${name}' because it is undefined`;
311
+ if ((0, context_js_1.isNamespace)(parent)) {
312
+ const suggestion = this.suggestPath(parts, parts.length - 1, parent);
313
+ if (suggestion) {
314
+ message += `. Did you mean '${suggestion}'?`;
315
+ }
316
+ }
317
+ throw new error_js_1.MolangRuntimeError(message, expr.callee, this.source);
318
+ }
319
+ if (typeof func !== "function") {
320
+ const type = func === null ? "null" : typeof func;
321
+ let message = `Cannot call '${name}' because it is of type '${type}', not a function`;
322
+ const parts = MolangRuntime.normalizePath(name);
323
+ const parent = this.context;
324
+ const suggestion = this.suggestPath(parts, parts.length - 1, parent);
325
+ if (suggestion) {
326
+ message += `. Did you mean '${suggestion}'?`;
327
+ }
328
+ throw new error_js_1.MolangRuntimeError(message, expr.callee, this.source);
329
+ }
330
+ const args = expr.arguments.map(a => this.evaluate(a));
331
+ if (args.length < func.length) {
332
+ throw new error_js_1.MolangRuntimeError(`Function '${name}' expects at least ${func.length} arguments, but got ${args.length}`, expr, this.source);
333
+ }
334
+ return func(...args);
335
+ }
336
+ catch (error) {
337
+ if (error instanceof error_js_1.MolangRuntimeError) {
338
+ throw error;
339
+ }
340
+ throw new error_js_1.MolangRuntimeError(error instanceof Error ? error.message : String(error), expr.callee, this.source);
341
+ }
342
+ }
343
+ case "UnaryExpression": {
344
+ const v = this.evaluate(expr.expression);
345
+ switch (expr.operator) {
346
+ case "-": {
347
+ return -v;
348
+ }
349
+ case "!": {
350
+ return this.toNumber(v) === 0 ? 1 : 0;
351
+ }
352
+ default: {
353
+ throw new error_js_1.MolangRuntimeError(`Unknown unary operator ${expr.operator}`, expr, this.source);
354
+ }
355
+ }
356
+ }
357
+ case "ArrayLiteral": {
358
+ return expr.elements.map(e => this.evaluate(e));
359
+ }
360
+ case "IndexExpression": {
361
+ const container = this.evaluate(expr.array);
362
+ const idx = this.evaluate(expr.index);
363
+ if (!(0, context_js_1.isNamespace)(container)) {
364
+ throw new error_js_1.MolangRuntimeError("Cannot index non-object value", expr, this.source);
365
+ }
366
+ return (container)[idx];
367
+ /*if (typeof container !== "object" || container === null || !Array.isArray(container)) {
368
+ throw new MolangRuntimeError("Cannot index non-array value", expr, this.source);
369
+ }
370
+
371
+ if (typeof idx !== "number" || !Number.isInteger(idx)) {
372
+ throw new MolangRuntimeError("Array index must be an integer", expr, this.source);
373
+ }
374
+
375
+ if (Array.isArray(container) && (idx < 0 || idx >= container.length)) {
376
+ throw new MolangRuntimeError("Array index out of bounds", expr, this.source);
377
+ }
378
+
379
+ return container[idx];*/
380
+ }
381
+ case "ArrowExpression": {
382
+ if (expr.left.type === "ArrowExpression") {
383
+ throw new error_js_1.MolangRuntimeError("Chained '->' not supported", expr, this.source);
384
+ }
385
+ let target = this.evaluate(expr.left);
386
+ if (typeof target === "function") {
387
+ if (target.length !== 0) {
388
+ throw new error_js_1.MolangRuntimeError("Arrow target function must take no arguments", expr.left, this.source);
389
+ }
390
+ try {
391
+ target = target();
392
+ }
393
+ catch (error) {
394
+ if (error instanceof error_js_1.MolangRuntimeError) {
395
+ throw error;
396
+ }
397
+ throw new error_js_1.MolangRuntimeError(`Error calling arrow target: ${error instanceof Error ? error.message : String(error)}`, expr.left, this.source);
398
+ }
399
+ }
400
+ if (typeof target !== "object" || target === null) {
401
+ throw new error_js_1.MolangRuntimeError("Left side of '->' must be an object/context", expr.left, this.source);
402
+ }
403
+ if (!("context" in target) || !("query" in target)) {
404
+ throw new error_js_1.MolangRuntimeError("Arrow target is not a valid entity context", expr.left, this.source);
405
+ }
406
+ // Create a new runtime with swapped context
407
+ const nestedRuntime = new MolangRuntime(target, this.source, this.options, this.rootContext);
408
+ return nestedRuntime.evaluate(expr.right);
409
+ }
410
+ case "ConditionalExpression": {
411
+ const condition = this.evaluate(expr.condition);
412
+ if (this.toBoolean(condition)) {
413
+ return this.evaluate(expr.then);
414
+ }
415
+ // A ? B : C
416
+ if (expr.else) {
417
+ return this.evaluate(expr.else);
418
+ }
419
+ // A ? B → returns 0 if false
420
+ return 0;
421
+ }
422
+ default: {
423
+ throw new Error(`Unknown expression type: ${expr.type}`);
424
+ }
425
+ }
426
+ }
427
+ toNumber(value) {
428
+ if (typeof value === "number") {
429
+ return value;
430
+ }
431
+ else if (typeof value === "boolean") {
432
+ return value ? 1 : 0;
433
+ }
434
+ return Number(value) || 0;
435
+ }
436
+ toBoolean(v) {
437
+ return this.options.strict
438
+ ? Boolean(v)
439
+ : this.toNumber(v) !== 0;
440
+ }
441
+ applyOperator(operator, left, right, expr) {
442
+ switch (operator) {
443
+ case "&":
444
+ case "|":
445
+ case "^":
446
+ case "<<":
447
+ case ">>":
448
+ case ">>>": {
449
+ if (!Number.isInteger(left) || !Number.isInteger(right)) {
450
+ throw new error_js_1.MolangRuntimeError("Bitwise operators require numbers", expr, this.source);
451
+ }
452
+ const l = this.toNumber(left) | 0;
453
+ const r = this.toNumber(right) | 0;
454
+ switch (operator) {
455
+ case "&": return l & r;
456
+ case "|": return l | r;
457
+ case "^": return l ^ r;
458
+ case "<<": return l << r;
459
+ case ">>": return l >> r;
460
+ case ">>>": return l >>> r;
461
+ }
462
+ return 0;
463
+ }
464
+ case "+":
465
+ case "-":
466
+ case "*":
467
+ case "/": {
468
+ const l = this.toNumber(left);
469
+ const r = this.toNumber(right);
470
+ switch (operator) {
471
+ case "+": return l + r;
472
+ case "-": return l - r;
473
+ case "*": return l * r;
474
+ case "/": return l / r;
475
+ }
476
+ return 0;
477
+ }
478
+ case "==": return left == right;
479
+ case "!=": return left != right;
480
+ case "<":
481
+ case ">":
482
+ case "<=":
483
+ case ">=": {
484
+ if ((typeof left === "number" && typeof right === "number") && this.options.strict === true) {
485
+ throw new error_js_1.MolangRuntimeError("Expected numbers for comparison", expr, this.source);
486
+ }
487
+ const l = this.toNumber(left);
488
+ const r = this.toNumber(right);
489
+ switch (operator) {
490
+ case "<": return l < r;
491
+ case ">": return l > r;
492
+ case "<=": return l <= r;
493
+ case ">=": return l >= r;
494
+ }
495
+ return 0;
496
+ }
497
+ case "??": {
498
+ return (left !== undefined && left !== null) ? left : right;
499
+ }
500
+ case "&&":
501
+ case "||": {
502
+ if (typeof left !== "boolean" || typeof right !== "boolean") {
503
+ throw new error_js_1.MolangRuntimeError("Expected booleans", expr, this.source);
504
+ }
505
+ return operator === "&&"
506
+ ? (left && right)
507
+ : (left || right);
508
+ }
509
+ default: {
510
+ throw new error_js_1.MolangRuntimeError(`Unknown operator '${operator}'`, expr, this.source);
511
+ }
512
+ }
513
+ }
514
+ // Paths
515
+ static normalizePath(path) {
516
+ const parts = path.split(".");
517
+ // Apply alias only to the root namespace
518
+ const root = parts[0];
519
+ const alias = MolangRuntime.NAMESPACE_ALIASES[root];
520
+ if (alias) {
521
+ parts[0] = alias;
522
+ }
523
+ return parts;
524
+ }
525
+ suggestPath(parts, index, current) {
526
+ const keys = Object.keys(current);
527
+ const suggestion = Suggestions.findBestMatch(parts[index], keys);
528
+ if (!suggestion)
529
+ return;
530
+ const fixed = [...parts];
531
+ fixed[index] = suggestion;
532
+ return fixed.join(".");
533
+ }
534
+ resolvePath(value, expr) {
535
+ const parts = typeof value === "string" ? MolangRuntime.normalizePath(value) : value;
536
+ let current = this.context;
537
+ for (let i = 0; i < parts.length; i++) {
538
+ const part = parts[i];
539
+ if (!(0, context_js_1.isNamespace)(current)) {
540
+ throw new error_js_1.MolangRuntimeError(`Unknown identifier '${parts.join(".")}'`, expr, this.source);
541
+ }
542
+ if (!(part in current)) {
543
+ let message = `Unknown identifier '${parts.join(".")}'`;
544
+ // Suggestion logic
545
+ const suggestion = this.suggestPath(parts, i, current);
546
+ if (suggestion) {
547
+ message += `. Did you mean '${suggestion}'?`;
548
+ }
549
+ throw new error_js_1.MolangRuntimeError(message, expr, this.source);
550
+ }
551
+ current = current[part];
552
+ }
553
+ return current;
554
+ }
555
+ }
556
+ exports.MolangRuntime = MolangRuntime;
557
+ Object.defineProperty(MolangRuntime, "NAMESPACE_ALIASES", {
558
+ enumerable: true,
559
+ configurable: true,
560
+ writable: true,
561
+ value: {
562
+ v: "variable",
563
+ t: "temp",
564
+ q: "query",
565
+ c: "context",
566
+ }
567
+ });