@tokens-studio/tokenscript-interpreter 0.32.0 → 0.34.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.
- package/dist/chunk-33CDF4L4.js +6444 -0
- package/dist/chunk-33CDF4L4.js.map +1 -0
- package/dist/chunk-AXH5N7KV.js +99 -0
- package/dist/chunk-AXH5N7KV.js.map +1 -0
- package/dist/chunk-QP7M6WUR.js +6227 -0
- package/dist/chunk-QP7M6WUR.js.map +1 -0
- package/dist/cli.js +242 -2
- package/dist/cli.js.map +1 -1
- package/dist/compliance-suite.js +2 -2
- package/dist/config-DtbN3iyg.d.ts +918 -0
- package/dist/lib/{chunk-QYRJ6NSL.cjs → chunk-LEYHQJTL.cjs} +3 -2
- package/dist/lib/chunk-LEYHQJTL.cjs.map +1 -0
- package/dist/lib/{chunk-GKSWF7FF.cjs → chunk-LMGHS2NP.cjs} +102 -100
- package/dist/lib/chunk-LMGHS2NP.cjs.map +1 -0
- package/dist/lib/{chunk-LI2D53SH.js → chunk-LSTH2XJ4.js} +5 -3
- package/dist/lib/chunk-LSTH2XJ4.js.map +1 -0
- package/dist/lib/{chunk-YD3MIYOO.js → chunk-ODVWXGOM.js} +3 -2
- package/dist/lib/chunk-ODVWXGOM.js.map +1 -0
- package/dist/lib/{chunk-UYVHWJIC.js → chunk-RWXDOZAS.js} +250 -5
- package/dist/lib/chunk-RWXDOZAS.js.map +1 -0
- package/dist/lib/{chunk-QGOGK2VP.cjs → chunk-YCIBJDRB.cjs} +790 -543
- package/dist/lib/chunk-YCIBJDRB.cjs.map +1 -0
- package/dist/lib/index.cjs +97 -89
- package/dist/lib/index.d.cts +5 -5
- package/dist/lib/index.d.ts +5 -5
- package/dist/lib/index.js +3 -3
- package/dist/lib/{interpreter-DNmBc--s.d.ts → interpreter-6QwMkUqD.d.cts} +30 -2
- package/dist/lib/{interpreter-CP7CNwDa.d.cts → interpreter-v7WiwSP9.d.ts} +30 -2
- package/dist/lib/interpreter.cjs +73 -73
- package/dist/lib/interpreter.d.cts +4 -4
- package/dist/lib/interpreter.d.ts +4 -4
- package/dist/lib/interpreter.js +3 -3
- package/dist/lib/processor-node.cjs +12 -12
- package/dist/lib/processor-node.d.cts +3 -3
- package/dist/lib/processor-node.d.ts +3 -3
- package/dist/lib/processor-node.js +3 -3
- package/dist/lib/processor.cjs +23 -15
- package/dist/lib/processor.d.cts +18 -5
- package/dist/lib/processor.d.ts +18 -5
- package/dist/lib/processor.js +3 -3
- package/dist/lib/schema.cjs +5 -5
- package/dist/lib/schema.d.cts +1 -1
- package/dist/lib/schema.d.ts +1 -1
- package/dist/lib/schema.js +3 -3
- package/dist/lib/syntax-highlighting.cjs +15 -15
- package/dist/lib/syntax-highlighting.d.cts +1 -1
- package/dist/lib/syntax-highlighting.d.ts +1 -1
- package/dist/lib/syntax-highlighting.js +2 -2
- package/dist/lib/{types-DHgmzR1Z.d.ts → types-BI0AZ4Ej.d.ts} +2 -2
- package/dist/lib/{types-BimJex2v.d.cts → types-EB8V9c46.d.cts} +1 -0
- package/dist/lib/{types-BimJex2v.d.ts → types-EB8V9c46.d.ts} +1 -0
- package/dist/lib/{types-DsJuwrq3.d.cts → types-cFwP43uv.d.cts} +2 -2
- package/dist/lib/types.cjs +6 -6
- package/dist/lib/types.d.cts +1 -1
- package/dist/lib/types.d.ts +1 -1
- package/dist/lib/types.js +1 -1
- package/dist/processor/index.d.ts +15 -2
- package/dist/processor/index.js +24 -3
- package/dist/processor/index.js.map +1 -1
- package/dist/repl.d.ts +1 -1
- package/dist/repl.js +2 -2
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/package.json +1 -1
- package/dist/lib/chunk-GKSWF7FF.cjs.map +0 -1
- package/dist/lib/chunk-LI2D53SH.js.map +0 -1
- package/dist/lib/chunk-QGOGK2VP.cjs.map +0 -1
- package/dist/lib/chunk-QYRJ6NSL.cjs.map +0 -1
- package/dist/lib/chunk-UYVHWJIC.js.map +0 -1
- package/dist/lib/chunk-YD3MIYOO.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkLMGHS2NP_cjs = require('./chunk-LMGHS2NP.cjs');
|
|
4
|
+
var chunkLEYHQJTL_cjs = require('./chunk-LEYHQJTL.cjs');
|
|
5
5
|
var schemaValidation = require('@tokens-studio/schema-validation');
|
|
6
6
|
|
|
7
7
|
// src/interpreter/tolerant/partial-nodes.ts
|
|
@@ -12,7 +12,7 @@ var _PartialReferenceNode = class _PartialReferenceNode {
|
|
|
12
12
|
this.nodeType = "PartialReferenceNode";
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
chunkLEYHQJTL_cjs.__name(_PartialReferenceNode, "PartialReferenceNode");
|
|
16
16
|
var PartialReferenceNode = _PartialReferenceNode;
|
|
17
17
|
var _PartialStringNode = class _PartialStringNode {
|
|
18
18
|
constructor(partialValue, quoteType, token) {
|
|
@@ -22,7 +22,7 @@ var _PartialStringNode = class _PartialStringNode {
|
|
|
22
22
|
this.nodeType = "PartialStringNode";
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
|
|
25
|
+
chunkLEYHQJTL_cjs.__name(_PartialStringNode, "PartialStringNode");
|
|
26
26
|
var PartialStringNode = _PartialStringNode;
|
|
27
27
|
var _PartialFunctionCallNode = class _PartialFunctionCallNode {
|
|
28
28
|
constructor(name, args, token) {
|
|
@@ -32,7 +32,7 @@ var _PartialFunctionCallNode = class _PartialFunctionCallNode {
|
|
|
32
32
|
this.nodeType = "PartialFunctionCallNode";
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
-
|
|
35
|
+
chunkLEYHQJTL_cjs.__name(_PartialFunctionCallNode, "PartialFunctionCallNode");
|
|
36
36
|
var PartialFunctionCallNode = _PartialFunctionCallNode;
|
|
37
37
|
var _PartialBinOpNode = class _PartialBinOpNode {
|
|
38
38
|
constructor(left, opToken) {
|
|
@@ -45,7 +45,7 @@ var _PartialBinOpNode = class _PartialBinOpNode {
|
|
|
45
45
|
return this.opToken.value;
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
chunkLEYHQJTL_cjs.__name(_PartialBinOpNode, "PartialBinOpNode");
|
|
49
49
|
var PartialBinOpNode = _PartialBinOpNode;
|
|
50
50
|
var _PartialUnaryOpNode = class _PartialUnaryOpNode {
|
|
51
51
|
constructor(opToken) {
|
|
@@ -57,7 +57,7 @@ var _PartialUnaryOpNode = class _PartialUnaryOpNode {
|
|
|
57
57
|
return this.opToken.value;
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
|
-
|
|
60
|
+
chunkLEYHQJTL_cjs.__name(_PartialUnaryOpNode, "PartialUnaryOpNode");
|
|
61
61
|
var PartialUnaryOpNode = _PartialUnaryOpNode;
|
|
62
62
|
var _PartialParenNode = class _PartialParenNode {
|
|
63
63
|
constructor(expr, token) {
|
|
@@ -66,7 +66,7 @@ var _PartialParenNode = class _PartialParenNode {
|
|
|
66
66
|
this.nodeType = "PartialParenNode";
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
|
-
|
|
69
|
+
chunkLEYHQJTL_cjs.__name(_PartialParenNode, "PartialParenNode");
|
|
70
70
|
var PartialParenNode = _PartialParenNode;
|
|
71
71
|
|
|
72
72
|
// src/interpreter/ast.ts
|
|
@@ -83,7 +83,7 @@ var _BinOpNode = class _BinOpNode {
|
|
|
83
83
|
return this.opToken.value;
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
|
-
|
|
86
|
+
chunkLEYHQJTL_cjs.__name(_BinOpNode, "BinOpNode");
|
|
87
87
|
var BinOpNode = _BinOpNode;
|
|
88
88
|
var _NumNode = class _NumNode {
|
|
89
89
|
constructor(token) {
|
|
@@ -96,7 +96,7 @@ var _NumNode = class _NumNode {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
-
|
|
99
|
+
chunkLEYHQJTL_cjs.__name(_NumNode, "NumNode");
|
|
100
100
|
var NumNode = _NumNode;
|
|
101
101
|
var _StringNode = class _StringNode {
|
|
102
102
|
constructor(token) {
|
|
@@ -105,8 +105,17 @@ var _StringNode = class _StringNode {
|
|
|
105
105
|
this.value = token.value;
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
|
-
|
|
108
|
+
chunkLEYHQJTL_cjs.__name(_StringNode, "StringNode");
|
|
109
109
|
var StringNode = _StringNode;
|
|
110
|
+
var _TemplateStringNode = class _TemplateStringNode {
|
|
111
|
+
constructor(parts, token) {
|
|
112
|
+
this.parts = parts;
|
|
113
|
+
this.token = token;
|
|
114
|
+
this.nodeType = "TemplateStringNode";
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
chunkLEYHQJTL_cjs.__name(_TemplateStringNode, "TemplateStringNode");
|
|
118
|
+
var TemplateStringNode = _TemplateStringNode;
|
|
110
119
|
var _UnaryOpNode = class _UnaryOpNode {
|
|
111
120
|
constructor(opToken, expr, token) {
|
|
112
121
|
this.opToken = opToken;
|
|
@@ -119,7 +128,7 @@ var _UnaryOpNode = class _UnaryOpNode {
|
|
|
119
128
|
return this.opToken.value;
|
|
120
129
|
}
|
|
121
130
|
};
|
|
122
|
-
|
|
131
|
+
chunkLEYHQJTL_cjs.__name(_UnaryOpNode, "UnaryOpNode");
|
|
123
132
|
var UnaryOpNode = _UnaryOpNode;
|
|
124
133
|
var _ListNode = class _ListNode {
|
|
125
134
|
constructor(elements, token) {
|
|
@@ -128,7 +137,7 @@ var _ListNode = class _ListNode {
|
|
|
128
137
|
this.nodeType = "ListNode";
|
|
129
138
|
}
|
|
130
139
|
};
|
|
131
|
-
|
|
140
|
+
chunkLEYHQJTL_cjs.__name(_ListNode, "ListNode");
|
|
132
141
|
var ListNode = _ListNode;
|
|
133
142
|
var _ImplicitListNode = class _ImplicitListNode extends ListNode {
|
|
134
143
|
constructor(elements, token) {
|
|
@@ -139,7 +148,7 @@ var _ImplicitListNode = class _ImplicitListNode extends ListNode {
|
|
|
139
148
|
this.isImplicit = true;
|
|
140
149
|
}
|
|
141
150
|
};
|
|
142
|
-
|
|
151
|
+
chunkLEYHQJTL_cjs.__name(_ImplicitListNode, "ImplicitListNode");
|
|
143
152
|
var ImplicitListNode = _ImplicitListNode;
|
|
144
153
|
var _FunctionCallNode = class _FunctionCallNode {
|
|
145
154
|
constructor(nameTokenValue, args, token) {
|
|
@@ -149,7 +158,7 @@ var _FunctionCallNode = class _FunctionCallNode {
|
|
|
149
158
|
this.name = nameTokenValue;
|
|
150
159
|
}
|
|
151
160
|
};
|
|
152
|
-
|
|
161
|
+
chunkLEYHQJTL_cjs.__name(_FunctionCallNode, "FunctionCallNode");
|
|
153
162
|
var FunctionCallNode = _FunctionCallNode;
|
|
154
163
|
var _NoOpNode = class _NoOpNode {
|
|
155
164
|
constructor(token) {
|
|
@@ -157,7 +166,7 @@ var _NoOpNode = class _NoOpNode {
|
|
|
157
166
|
this.nodeType = "NoOpNode";
|
|
158
167
|
}
|
|
159
168
|
};
|
|
160
|
-
|
|
169
|
+
chunkLEYHQJTL_cjs.__name(_NoOpNode, "NoOpNode");
|
|
161
170
|
var NoOpNode = _NoOpNode;
|
|
162
171
|
var _ReferenceNode = class _ReferenceNode {
|
|
163
172
|
constructor(token) {
|
|
@@ -166,7 +175,7 @@ var _ReferenceNode = class _ReferenceNode {
|
|
|
166
175
|
this.value = token.value;
|
|
167
176
|
}
|
|
168
177
|
};
|
|
169
|
-
|
|
178
|
+
chunkLEYHQJTL_cjs.__name(_ReferenceNode, "ReferenceNode");
|
|
170
179
|
var ReferenceNode = _ReferenceNode;
|
|
171
180
|
var _IdentifierNode = class _IdentifierNode {
|
|
172
181
|
constructor(token) {
|
|
@@ -175,7 +184,7 @@ var _IdentifierNode = class _IdentifierNode {
|
|
|
175
184
|
this.name = token.value;
|
|
176
185
|
}
|
|
177
186
|
};
|
|
178
|
-
|
|
187
|
+
chunkLEYHQJTL_cjs.__name(_IdentifierNode, "IdentifierNode");
|
|
179
188
|
var IdentifierNode = _IdentifierNode;
|
|
180
189
|
var _HexColorNode = class _HexColorNode {
|
|
181
190
|
constructor(token) {
|
|
@@ -184,7 +193,7 @@ var _HexColorNode = class _HexColorNode {
|
|
|
184
193
|
this.value = token.value;
|
|
185
194
|
}
|
|
186
195
|
};
|
|
187
|
-
|
|
196
|
+
chunkLEYHQJTL_cjs.__name(_HexColorNode, "HexColorNode");
|
|
188
197
|
var HexColorNode = _HexColorNode;
|
|
189
198
|
var _BooleanNode = class _BooleanNode {
|
|
190
199
|
constructor(value, token) {
|
|
@@ -193,7 +202,7 @@ var _BooleanNode = class _BooleanNode {
|
|
|
193
202
|
this.nodeType = "BooleanNode";
|
|
194
203
|
}
|
|
195
204
|
};
|
|
196
|
-
|
|
205
|
+
chunkLEYHQJTL_cjs.__name(_BooleanNode, "BooleanNode");
|
|
197
206
|
var BooleanNode = _BooleanNode;
|
|
198
207
|
var _NullNode = class _NullNode {
|
|
199
208
|
constructor(token) {
|
|
@@ -201,7 +210,7 @@ var _NullNode = class _NullNode {
|
|
|
201
210
|
this.nodeType = "NullNode";
|
|
202
211
|
}
|
|
203
212
|
};
|
|
204
|
-
|
|
213
|
+
chunkLEYHQJTL_cjs.__name(_NullNode, "NullNode");
|
|
205
214
|
var NullNode = _NullNode;
|
|
206
215
|
var _ElementWithUnitNode = class _ElementWithUnitNode {
|
|
207
216
|
constructor(astNode, unitTokenValue, token) {
|
|
@@ -211,7 +220,7 @@ var _ElementWithUnitNode = class _ElementWithUnitNode {
|
|
|
211
220
|
this.unit = unitTokenValue;
|
|
212
221
|
}
|
|
213
222
|
};
|
|
214
|
-
|
|
223
|
+
chunkLEYHQJTL_cjs.__name(_ElementWithUnitNode, "ElementWithUnitNode");
|
|
215
224
|
var ElementWithUnitNode = _ElementWithUnitNode;
|
|
216
225
|
var _AssignNode = class _AssignNode {
|
|
217
226
|
constructor(varName, typeDecl, assignmentExpr, token) {
|
|
@@ -222,7 +231,7 @@ var _AssignNode = class _AssignNode {
|
|
|
222
231
|
this.nodeType = "AssignNode";
|
|
223
232
|
}
|
|
224
233
|
};
|
|
225
|
-
|
|
234
|
+
chunkLEYHQJTL_cjs.__name(_AssignNode, "AssignNode");
|
|
226
235
|
var AssignNode = _AssignNode;
|
|
227
236
|
var _TypeDeclNode = class _TypeDeclNode {
|
|
228
237
|
// baseType: e.g. "Color", "List"
|
|
@@ -241,10 +250,10 @@ var _TypeDeclNode = class _TypeDeclNode {
|
|
|
241
250
|
return typeStr;
|
|
242
251
|
}
|
|
243
252
|
};
|
|
244
|
-
|
|
253
|
+
chunkLEYHQJTL_cjs.__name(_TypeDeclNode, "TypeDeclNode");
|
|
245
254
|
var TypeDeclNode = _TypeDeclNode;
|
|
246
|
-
var attributesToString = /* @__PURE__ */
|
|
247
|
-
var identifiersChainToString = /* @__PURE__ */
|
|
255
|
+
var attributesToString = /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((attrs) => attrs.join("."), "attributesToString");
|
|
256
|
+
var identifiersChainToString = /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((attrs) => attributesToString(attrs.map((x) => x.name)), "identifiersChainToString");
|
|
248
257
|
var _ReassignNode = class _ReassignNode {
|
|
249
258
|
constructor(identifier, value, token) {
|
|
250
259
|
this.identifier = identifier;
|
|
@@ -273,7 +282,7 @@ var _ReassignNode = class _ReassignNode {
|
|
|
273
282
|
return this.attributesChain().map((x) => x.name);
|
|
274
283
|
}
|
|
275
284
|
};
|
|
276
|
-
|
|
285
|
+
chunkLEYHQJTL_cjs.__name(_ReassignNode, "ReassignNode");
|
|
277
286
|
var ReassignNode = _ReassignNode;
|
|
278
287
|
var _ReturnNode = class _ReturnNode {
|
|
279
288
|
constructor(expr, token) {
|
|
@@ -282,7 +291,7 @@ var _ReturnNode = class _ReturnNode {
|
|
|
282
291
|
this.nodeType = "ReturnNode";
|
|
283
292
|
}
|
|
284
293
|
};
|
|
285
|
-
|
|
294
|
+
chunkLEYHQJTL_cjs.__name(_ReturnNode, "ReturnNode");
|
|
286
295
|
var ReturnNode = _ReturnNode;
|
|
287
296
|
var _WhileNode = class _WhileNode {
|
|
288
297
|
constructor(condition, body, token) {
|
|
@@ -292,7 +301,7 @@ var _WhileNode = class _WhileNode {
|
|
|
292
301
|
this.nodeType = "WhileNode";
|
|
293
302
|
}
|
|
294
303
|
};
|
|
295
|
-
|
|
304
|
+
chunkLEYHQJTL_cjs.__name(_WhileNode, "WhileNode");
|
|
296
305
|
var WhileNode = _WhileNode;
|
|
297
306
|
var _ForEachNode = class _ForEachNode {
|
|
298
307
|
constructor(itemVar, indexVar, collection, body, token) {
|
|
@@ -304,7 +313,7 @@ var _ForEachNode = class _ForEachNode {
|
|
|
304
313
|
this.nodeType = "ForEachNode";
|
|
305
314
|
}
|
|
306
315
|
};
|
|
307
|
-
|
|
316
|
+
chunkLEYHQJTL_cjs.__name(_ForEachNode, "ForEachNode");
|
|
308
317
|
var ForEachNode = _ForEachNode;
|
|
309
318
|
var _IfConditionNode = class _IfConditionNode {
|
|
310
319
|
constructor(condition, body, token) {
|
|
@@ -314,7 +323,7 @@ var _IfConditionNode = class _IfConditionNode {
|
|
|
314
323
|
this.nodeType = "IfConditionNode";
|
|
315
324
|
}
|
|
316
325
|
};
|
|
317
|
-
|
|
326
|
+
chunkLEYHQJTL_cjs.__name(_IfConditionNode, "IfConditionNode");
|
|
318
327
|
var IfConditionNode = _IfConditionNode;
|
|
319
328
|
var _IfNode = class _IfNode {
|
|
320
329
|
constructor(conditions, elseBody, token) {
|
|
@@ -324,7 +333,7 @@ var _IfNode = class _IfNode {
|
|
|
324
333
|
this.nodeType = "IfNode";
|
|
325
334
|
}
|
|
326
335
|
};
|
|
327
|
-
|
|
336
|
+
chunkLEYHQJTL_cjs.__name(_IfNode, "IfNode");
|
|
328
337
|
var IfNode = _IfNode;
|
|
329
338
|
var _BlockNode = class _BlockNode {
|
|
330
339
|
constructor(statements, token) {
|
|
@@ -334,7 +343,7 @@ var _BlockNode = class _BlockNode {
|
|
|
334
343
|
this.nodeType = "BlockNode";
|
|
335
344
|
}
|
|
336
345
|
};
|
|
337
|
-
|
|
346
|
+
chunkLEYHQJTL_cjs.__name(_BlockNode, "BlockNode");
|
|
338
347
|
var BlockNode = _BlockNode;
|
|
339
348
|
var _StatementListNode = class _StatementListNode {
|
|
340
349
|
constructor(statements, token) {
|
|
@@ -343,7 +352,7 @@ var _StatementListNode = class _StatementListNode {
|
|
|
343
352
|
this.nodeType = "StatementListNode";
|
|
344
353
|
}
|
|
345
354
|
};
|
|
346
|
-
|
|
355
|
+
chunkLEYHQJTL_cjs.__name(_StatementListNode, "StatementListNode");
|
|
347
356
|
var StatementListNode = _StatementListNode;
|
|
348
357
|
var _AttributeAccessNode = class _AttributeAccessNode {
|
|
349
358
|
// 'left' is the object, 'right' is the attribute (IdentifierNode) or method (FunctionCallNode)
|
|
@@ -355,7 +364,7 @@ var _AttributeAccessNode = class _AttributeAccessNode {
|
|
|
355
364
|
this.nodeType = "AttributeAccessNode";
|
|
356
365
|
}
|
|
357
366
|
};
|
|
358
|
-
|
|
367
|
+
chunkLEYHQJTL_cjs.__name(_AttributeAccessNode, "AttributeAccessNode");
|
|
359
368
|
var AttributeAccessNode = _AttributeAccessNode;
|
|
360
369
|
function walkAST(node, onVisit) {
|
|
361
370
|
onVisit(node);
|
|
@@ -404,6 +413,10 @@ function walkAST(node, onVisit) {
|
|
|
404
413
|
for (const statement of node.statements) {
|
|
405
414
|
walkAST(statement, onVisit);
|
|
406
415
|
}
|
|
416
|
+
} else if (node instanceof TemplateStringNode) {
|
|
417
|
+
for (const part of node.parts) {
|
|
418
|
+
walkAST(part, onVisit);
|
|
419
|
+
}
|
|
407
420
|
} else if (node instanceof AttributeAccessNode) {
|
|
408
421
|
walkAST(node.left, onVisit);
|
|
409
422
|
if (node.right instanceof FunctionCallNode || node.right instanceof PartialFunctionCallNode) {
|
|
@@ -419,7 +432,7 @@ function walkAST(node, onVisit) {
|
|
|
419
432
|
walkAST(node.expr, onVisit);
|
|
420
433
|
}
|
|
421
434
|
}
|
|
422
|
-
|
|
435
|
+
chunkLEYHQJTL_cjs.__name(walkAST, "walkAST");
|
|
423
436
|
function filterAST(ast, predicate) {
|
|
424
437
|
const results = [];
|
|
425
438
|
walkAST(ast, (node) => {
|
|
@@ -429,7 +442,7 @@ function filterAST(ast, predicate) {
|
|
|
429
442
|
});
|
|
430
443
|
return results;
|
|
431
444
|
}
|
|
432
|
-
|
|
445
|
+
chunkLEYHQJTL_cjs.__name(filterAST, "filterAST");
|
|
433
446
|
function collectReferenceNodes(ast, targetName) {
|
|
434
447
|
if (targetName) {
|
|
435
448
|
return filterAST(
|
|
@@ -439,7 +452,7 @@ function collectReferenceNodes(ast, targetName) {
|
|
|
439
452
|
}
|
|
440
453
|
return filterAST(ast, (node) => node instanceof ReferenceNode);
|
|
441
454
|
}
|
|
442
|
-
|
|
455
|
+
chunkLEYHQJTL_cjs.__name(collectReferenceNodes, "collectReferenceNodes");
|
|
443
456
|
|
|
444
457
|
// src/interpreter/utils/references.ts
|
|
445
458
|
function renameReferences(originalValue, ast, renameMap) {
|
|
@@ -447,7 +460,7 @@ function renameReferences(originalValue, ast, renameMap) {
|
|
|
447
460
|
for (const [oldName, newName] of Object.entries(renameMap)) {
|
|
448
461
|
const references = collectReferenceNodes(ast, oldName);
|
|
449
462
|
for (const ref of references) {
|
|
450
|
-
if (
|
|
463
|
+
if (chunkLMGHS2NP_cjs.isSome(ref.token.pos) && chunkLMGHS2NP_cjs.isSome(ref.token.endPos)) {
|
|
451
464
|
positions.push({
|
|
452
465
|
start: ref.token.pos,
|
|
453
466
|
end: ref.token.endPos,
|
|
@@ -464,15 +477,15 @@ function renameReferences(originalValue, ast, renameMap) {
|
|
|
464
477
|
}
|
|
465
478
|
return result;
|
|
466
479
|
}
|
|
467
|
-
|
|
480
|
+
chunkLEYHQJTL_cjs.__name(renameReferences, "renameReferences");
|
|
468
481
|
|
|
469
482
|
// src/interpreter/lexer.ts
|
|
470
483
|
var SUPPORTED_FORMAT_STRINGS = {};
|
|
471
|
-
for (const val of Object.values(
|
|
484
|
+
for (const val of Object.values(chunkLEYHQJTL_cjs.SupportedFormats)) {
|
|
472
485
|
SUPPORTED_FORMAT_STRINGS[val.toLowerCase()] = val;
|
|
473
486
|
}
|
|
474
487
|
var RESERVED_KEYWORD_STRINGS = {};
|
|
475
|
-
for (const val of Object.values(
|
|
488
|
+
for (const val of Object.values(chunkLEYHQJTL_cjs.ReservedKeyword)) {
|
|
476
489
|
RESERVED_KEYWORD_STRINGS[val.toLowerCase()] = val;
|
|
477
490
|
}
|
|
478
491
|
var _Lexer = class _Lexer {
|
|
@@ -503,7 +516,7 @@ var _Lexer = class _Lexer {
|
|
|
503
516
|
return this._lastUnitableToken !== null && this._lastUnitableToken.endPos === startPos;
|
|
504
517
|
}
|
|
505
518
|
error(code, data) {
|
|
506
|
-
throw new
|
|
519
|
+
throw new chunkLMGHS2NP_cjs.LexerError(code, {
|
|
507
520
|
line: this.line,
|
|
508
521
|
data
|
|
509
522
|
});
|
|
@@ -531,7 +544,7 @@ var _Lexer = class _Lexer {
|
|
|
531
544
|
return this.text[this.pos + n] ?? null;
|
|
532
545
|
}
|
|
533
546
|
skipWhitespace() {
|
|
534
|
-
while (
|
|
547
|
+
while (chunkLMGHS2NP_cjs.isSpace(this.currentChar)) {
|
|
535
548
|
this.advance();
|
|
536
549
|
}
|
|
537
550
|
}
|
|
@@ -553,7 +566,7 @@ var _Lexer = class _Lexer {
|
|
|
553
566
|
if (this.currentChar === ".") {
|
|
554
567
|
result += "0";
|
|
555
568
|
}
|
|
556
|
-
while (
|
|
569
|
+
while (chunkLMGHS2NP_cjs.isNumber2(this.currentChar) || this.currentChar === ".") {
|
|
557
570
|
if (this.currentChar === ".") {
|
|
558
571
|
if (hasDecimalPoint) {
|
|
559
572
|
this.error("LEXER_MULTIPLE_DECIMAL_POINTS" /* MULTIPLE_DECIMAL_POINTS */, {
|
|
@@ -578,11 +591,11 @@ var _Lexer = class _Lexer {
|
|
|
578
591
|
// Python like isdigit, that allows numbers starting with '.'
|
|
579
592
|
isDigit() {
|
|
580
593
|
if (this.currentChar === null) return false;
|
|
581
|
-
return
|
|
594
|
+
return chunkLMGHS2NP_cjs.isNumber2(this.currentChar) || this.currentChar === "." && chunkLMGHS2NP_cjs.isNumber2(this.peek());
|
|
582
595
|
}
|
|
583
596
|
isValidIdentifierStart(char) {
|
|
584
597
|
if (char === null) return false;
|
|
585
|
-
if (
|
|
598
|
+
if (chunkLMGHS2NP_cjs.isAlpha(char)) return true;
|
|
586
599
|
const cp = char.codePointAt(0) ?? 0;
|
|
587
600
|
if (cp <= 127) return false;
|
|
588
601
|
if (cp === 180 /* FORWARD_TICK */) return false;
|
|
@@ -592,7 +605,7 @@ var _Lexer = class _Lexer {
|
|
|
592
605
|
isValidStringElement(char) {
|
|
593
606
|
if (char === null) return false;
|
|
594
607
|
const cp = char.codePointAt(0) ?? 0;
|
|
595
|
-
return
|
|
608
|
+
return chunkLMGHS2NP_cjs.isAlphaNumeric(char) || cp === 45 /* HYPHEN */ || cp === 95 /* UNDERSCORE */ || cp > 127;
|
|
596
609
|
}
|
|
597
610
|
stringElement() {
|
|
598
611
|
const startPos = this.pos;
|
|
@@ -641,7 +654,7 @@ var _Lexer = class _Lexer {
|
|
|
641
654
|
}
|
|
642
655
|
this.error("LEXER_UNTERMINATED_REFERENCE" /* UNTERMINATED_REFERENCE */, {});
|
|
643
656
|
}
|
|
644
|
-
if (
|
|
657
|
+
if (chunkLMGHS2NP_cjs.isSpace(this.currentChar)) {
|
|
645
658
|
this.advance();
|
|
646
659
|
continue;
|
|
647
660
|
}
|
|
@@ -713,10 +726,55 @@ var _Lexer = class _Lexer {
|
|
|
713
726
|
endPos: this.pos
|
|
714
727
|
};
|
|
715
728
|
}
|
|
729
|
+
/**
|
|
730
|
+
* Read a backtick-delimited template string.
|
|
731
|
+
* Supports escape sequences: \{ \$ \` \\
|
|
732
|
+
* The raw content (with escapes preserved) is stored as the token value.
|
|
733
|
+
* The parser handles splitting into segments.
|
|
734
|
+
*/
|
|
735
|
+
templateString() {
|
|
736
|
+
const startPos = this.pos;
|
|
737
|
+
this.eat("`");
|
|
738
|
+
let result = "";
|
|
739
|
+
while (this.currentChar !== null && this.currentChar !== "`") {
|
|
740
|
+
if (this.currentChar === "\\") {
|
|
741
|
+
const next = this.peek();
|
|
742
|
+
if (next === "{" || next === "$" || next === "`" || next === "\\") {
|
|
743
|
+
result += "\\";
|
|
744
|
+
result += next;
|
|
745
|
+
this.advance();
|
|
746
|
+
this.advance();
|
|
747
|
+
continue;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
result += this.currentChar;
|
|
751
|
+
this.advance();
|
|
752
|
+
}
|
|
753
|
+
if (this.currentChar === null) {
|
|
754
|
+
if (this.tolerant) {
|
|
755
|
+
return {
|
|
756
|
+
type: "TEMPLATE_STRING" /* TEMPLATE_STRING */,
|
|
757
|
+
value: result,
|
|
758
|
+
line: this.line,
|
|
759
|
+
pos: startPos,
|
|
760
|
+
endPos: this.pos
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
this.error("LEXER_UNTERMINATED_TEMPLATE_STRING" /* UNTERMINATED_TEMPLATE_STRING */, {});
|
|
764
|
+
}
|
|
765
|
+
this.eat("`");
|
|
766
|
+
return {
|
|
767
|
+
type: "TEMPLATE_STRING" /* TEMPLATE_STRING */,
|
|
768
|
+
value: result,
|
|
769
|
+
line: this.line,
|
|
770
|
+
pos: startPos,
|
|
771
|
+
endPos: this.pos
|
|
772
|
+
};
|
|
773
|
+
}
|
|
716
774
|
hexColor() {
|
|
717
775
|
const startPos = this.pos;
|
|
718
776
|
let result = "";
|
|
719
|
-
while (
|
|
777
|
+
while (chunkLMGHS2NP_cjs.isAlpha(this.currentChar) || this.isDigit() || this.currentChar === "#") {
|
|
720
778
|
result += this.currentChar;
|
|
721
779
|
this.advance();
|
|
722
780
|
}
|
|
@@ -763,6 +821,9 @@ var _Lexer = class _Lexer {
|
|
|
763
821
|
if (this.currentChar === "'" || this.currentChar === '"') {
|
|
764
822
|
return this.collectToken(this.explicitString(this.currentChar));
|
|
765
823
|
}
|
|
824
|
+
if (this.currentChar === "`") {
|
|
825
|
+
return this.collectToken(this.templateString());
|
|
826
|
+
}
|
|
766
827
|
if (this.isValidIdentifierStart(this.currentChar)) {
|
|
767
828
|
return this.collectToken(this.stringElement());
|
|
768
829
|
}
|
|
@@ -905,7 +966,7 @@ var _Lexer = class _Lexer {
|
|
|
905
966
|
});
|
|
906
967
|
}
|
|
907
968
|
if (this.currentChar === ".") {
|
|
908
|
-
if (this.peek() !== null &&
|
|
969
|
+
if (this.peek() !== null && chunkLMGHS2NP_cjs.isNumber2(this.peek())) {
|
|
909
970
|
return this.collectToken(this.number());
|
|
910
971
|
}
|
|
911
972
|
const startPos = this.pos;
|
|
@@ -1137,7 +1198,7 @@ var _Lexer = class _Lexer {
|
|
|
1137
1198
|
};
|
|
1138
1199
|
}
|
|
1139
1200
|
};
|
|
1140
|
-
|
|
1201
|
+
chunkLEYHQJTL_cjs.__name(_Lexer, "Lexer");
|
|
1141
1202
|
var Lexer = _Lexer;
|
|
1142
1203
|
|
|
1143
1204
|
// src/interpreter/tolerant/types.ts
|
|
@@ -1262,7 +1323,7 @@ ${contextText}`;
|
|
|
1262
1323
|
const formattedMessage = this.formatError(
|
|
1263
1324
|
message || (code === "PARSER_INVALID_SYNTAX" /* INVALID_SYNTAX */ ? "Invalid syntax" : code)
|
|
1264
1325
|
);
|
|
1265
|
-
throw new
|
|
1326
|
+
throw new chunkLMGHS2NP_cjs.ParserError(code, {
|
|
1266
1327
|
token: this.currentToken,
|
|
1267
1328
|
data: { ...data, message: formattedMessage }
|
|
1268
1329
|
});
|
|
@@ -1406,7 +1467,7 @@ ${contextText}`;
|
|
|
1406
1467
|
if (this.currentToken.type === "STRING" /* STRING */) {
|
|
1407
1468
|
const nextToken = this.lexer.peekToken();
|
|
1408
1469
|
if (nextToken && nextToken.type === "ASSIGN" /* ASSIGN */) {
|
|
1409
|
-
throw new
|
|
1470
|
+
throw new chunkLMGHS2NP_cjs.ParserError("PARSER_CONDITION_MUST_BE_BOOLEAN" /* CONDITION_MUST_BE_BOOLEAN */, {
|
|
1410
1471
|
token: this.currentToken
|
|
1411
1472
|
});
|
|
1412
1473
|
}
|
|
@@ -1429,7 +1490,7 @@ ${contextText}`;
|
|
|
1429
1490
|
forStatement() {
|
|
1430
1491
|
const forToken = this.eat("RESERVED_KEYWORD" /* RESERVED_KEYWORD */);
|
|
1431
1492
|
if (!this.isIdentifierToken()) {
|
|
1432
|
-
throw new
|
|
1493
|
+
throw new chunkLMGHS2NP_cjs.ParserError("PARSER_EXPECTED_TOKEN_TYPE" /* EXPECTED_TOKEN_TYPE */, {
|
|
1433
1494
|
token: this.currentToken,
|
|
1434
1495
|
data: { expectedType: "identifier", actualType: this.currentToken.type }
|
|
1435
1496
|
});
|
|
@@ -1440,7 +1501,7 @@ ${contextText}`;
|
|
|
1440
1501
|
if (this.currentToken.type === "COMMA" /* COMMA */) {
|
|
1441
1502
|
this.eat("COMMA" /* COMMA */);
|
|
1442
1503
|
if (!this.isIdentifierToken()) {
|
|
1443
|
-
throw new
|
|
1504
|
+
throw new chunkLMGHS2NP_cjs.ParserError("PARSER_EXPECTED_TOKEN_TYPE" /* EXPECTED_TOKEN_TYPE */, {
|
|
1444
1505
|
token: this.currentToken,
|
|
1445
1506
|
data: { expectedType: "identifier", actualType: this.currentToken.type }
|
|
1446
1507
|
});
|
|
@@ -1449,7 +1510,7 @@ ${contextText}`;
|
|
|
1449
1510
|
this.eat(this.currentToken.type);
|
|
1450
1511
|
}
|
|
1451
1512
|
if (!this.isIdentifierToken() || this.currentToken.value !== "in") {
|
|
1452
|
-
throw new
|
|
1513
|
+
throw new chunkLMGHS2NP_cjs.ParserError("PARSER_EXPECTED_TOKEN_TYPE" /* EXPECTED_TOKEN_TYPE */, {
|
|
1453
1514
|
token: this.currentToken,
|
|
1454
1515
|
data: { expectedType: "'in'", actualType: this.currentToken.value }
|
|
1455
1516
|
});
|
|
@@ -1689,6 +1750,9 @@ ${contextText}`;
|
|
|
1689
1750
|
node = this.attributeAccess(node);
|
|
1690
1751
|
return node;
|
|
1691
1752
|
}
|
|
1753
|
+
if (token.type === "TEMPLATE_STRING" /* TEMPLATE_STRING */) {
|
|
1754
|
+
return this.templateString();
|
|
1755
|
+
}
|
|
1692
1756
|
if (token.type === "EXPLICIT_STRING" /* EXPLICIT_STRING */) {
|
|
1693
1757
|
this.eat("EXPLICIT_STRING" /* EXPLICIT_STRING */);
|
|
1694
1758
|
let node = new StringNode(token);
|
|
@@ -1748,6 +1812,122 @@ ${contextText}`;
|
|
|
1748
1812
|
this.eat("RPAREN" /* RPAREN */);
|
|
1749
1813
|
return new FunctionCallNode(functionName.value, args, functionName);
|
|
1750
1814
|
}
|
|
1815
|
+
/**
|
|
1816
|
+
* Parse a TEMPLATE_STRING token into a TemplateStringNode.
|
|
1817
|
+
* Scans the raw content for:
|
|
1818
|
+
* - {ref.path} → ReferenceNode
|
|
1819
|
+
* - ${expression} → parsed sub-expression
|
|
1820
|
+
* - \{ \${ \` \\ → escaped literals (backslash removed)
|
|
1821
|
+
* - everything else → literal StringNode segments
|
|
1822
|
+
*/
|
|
1823
|
+
templateString() {
|
|
1824
|
+
const token = this.currentToken;
|
|
1825
|
+
const raw = token.value;
|
|
1826
|
+
this.eat("TEMPLATE_STRING" /* TEMPLATE_STRING */);
|
|
1827
|
+
const parts = [];
|
|
1828
|
+
let literal = "";
|
|
1829
|
+
let i = 0;
|
|
1830
|
+
const flushLiteral = /* @__PURE__ */ chunkLEYHQJTL_cjs.__name(() => {
|
|
1831
|
+
if (literal.length > 0) {
|
|
1832
|
+
parts.push(new StringNode({ ...token, value: literal }));
|
|
1833
|
+
literal = "";
|
|
1834
|
+
}
|
|
1835
|
+
}, "flushLiteral");
|
|
1836
|
+
while (i < raw.length) {
|
|
1837
|
+
const ch = raw[i];
|
|
1838
|
+
if (ch === "\\" && i + 1 < raw.length) {
|
|
1839
|
+
const next = raw[i + 1];
|
|
1840
|
+
if (next === "{" || next === "`" || next === "\\") {
|
|
1841
|
+
literal += next;
|
|
1842
|
+
i += 2;
|
|
1843
|
+
continue;
|
|
1844
|
+
}
|
|
1845
|
+
if (next === "$") {
|
|
1846
|
+
if (i + 2 < raw.length && raw[i + 2] === "{") {
|
|
1847
|
+
literal += "${";
|
|
1848
|
+
i += 3;
|
|
1849
|
+
} else {
|
|
1850
|
+
literal += "$";
|
|
1851
|
+
i += 2;
|
|
1852
|
+
}
|
|
1853
|
+
continue;
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
if (ch === "$" && i + 1 < raw.length && raw[i + 1] === "{") {
|
|
1857
|
+
flushLiteral();
|
|
1858
|
+
const start = i + 2;
|
|
1859
|
+
let depth = 1;
|
|
1860
|
+
let j = start;
|
|
1861
|
+
while (j < raw.length && depth > 0) {
|
|
1862
|
+
if (raw[j] === "`") {
|
|
1863
|
+
this.error("PARSER_INVALID_SYNTAX" /* INVALID_SYNTAX */, {
|
|
1864
|
+
message: "Nested template strings are not allowed inside ${...}"
|
|
1865
|
+
});
|
|
1866
|
+
}
|
|
1867
|
+
if (raw[j] === "{") depth++;
|
|
1868
|
+
else if (raw[j] === "}") depth--;
|
|
1869
|
+
if (depth > 0) j++;
|
|
1870
|
+
}
|
|
1871
|
+
if (depth !== 0) {
|
|
1872
|
+
this.error("PARSER_INVALID_SYNTAX" /* INVALID_SYNTAX */, {
|
|
1873
|
+
message: "Unterminated ${...} in template string"
|
|
1874
|
+
});
|
|
1875
|
+
}
|
|
1876
|
+
const exprStr = raw.slice(start, j);
|
|
1877
|
+
const subLexer = new Lexer(exprStr);
|
|
1878
|
+
const subParser = new _Parser(subLexer);
|
|
1879
|
+
const exprNode = subParser.expr();
|
|
1880
|
+
for (const ref of subParser.requiredReferences) {
|
|
1881
|
+
this.requiredReferences.add(ref);
|
|
1882
|
+
}
|
|
1883
|
+
parts.push(exprNode);
|
|
1884
|
+
i = j + 1;
|
|
1885
|
+
continue;
|
|
1886
|
+
}
|
|
1887
|
+
if (ch === "{") {
|
|
1888
|
+
flushLiteral();
|
|
1889
|
+
const start = i + 1;
|
|
1890
|
+
let j = start;
|
|
1891
|
+
while (j < raw.length && raw[j] !== "}") {
|
|
1892
|
+
if (raw[j] === "{") {
|
|
1893
|
+
this.error("PARSER_INVALID_SYNTAX" /* INVALID_SYNTAX */, {
|
|
1894
|
+
message: "Nested braces in template reference"
|
|
1895
|
+
});
|
|
1896
|
+
}
|
|
1897
|
+
j++;
|
|
1898
|
+
}
|
|
1899
|
+
if (j >= raw.length) {
|
|
1900
|
+
this.error("PARSER_INVALID_SYNTAX" /* INVALID_SYNTAX */, {
|
|
1901
|
+
message: "Unterminated {ref} in template string"
|
|
1902
|
+
});
|
|
1903
|
+
}
|
|
1904
|
+
let refPath = raw.slice(start, j);
|
|
1905
|
+
refPath = refPath.replace(/[ \t]/g, "");
|
|
1906
|
+
if (refPath.length === 0) {
|
|
1907
|
+
this.error("PARSER_INVALID_SYNTAX" /* INVALID_SYNTAX */, {
|
|
1908
|
+
message: "Empty reference in template string"
|
|
1909
|
+
});
|
|
1910
|
+
}
|
|
1911
|
+
this.requiredReferences.add(refPath);
|
|
1912
|
+
parts.push(
|
|
1913
|
+
new ReferenceNode({
|
|
1914
|
+
...token,
|
|
1915
|
+
type: "REFERENCE" /* REFERENCE */,
|
|
1916
|
+
value: refPath
|
|
1917
|
+
})
|
|
1918
|
+
);
|
|
1919
|
+
i = j + 1;
|
|
1920
|
+
continue;
|
|
1921
|
+
}
|
|
1922
|
+
literal += ch;
|
|
1923
|
+
i++;
|
|
1924
|
+
}
|
|
1925
|
+
flushLiteral();
|
|
1926
|
+
if (parts.length === 1 && parts[0] instanceof StringNode) {
|
|
1927
|
+
return parts[0];
|
|
1928
|
+
}
|
|
1929
|
+
return new TemplateStringNode(parts, token);
|
|
1930
|
+
}
|
|
1751
1931
|
parse(inlineMode = false) {
|
|
1752
1932
|
if (this.tolerant && !inlineMode) {
|
|
1753
1933
|
this.error("PARSER_TOLERANT_REQUIRES_INLINE" /* TOLERANT_REQUIRES_INLINE */);
|
|
@@ -1763,7 +1943,7 @@ ${contextText}`;
|
|
|
1763
1943
|
return node;
|
|
1764
1944
|
}
|
|
1765
1945
|
};
|
|
1766
|
-
|
|
1946
|
+
chunkLEYHQJTL_cjs.__name(_Parser, "Parser");
|
|
1767
1947
|
var Parser = _Parser;
|
|
1768
1948
|
function parseExpression(text) {
|
|
1769
1949
|
const lexer = new Lexer(text);
|
|
@@ -1775,11 +1955,11 @@ function parseExpression(text) {
|
|
|
1775
1955
|
ast
|
|
1776
1956
|
};
|
|
1777
1957
|
}
|
|
1778
|
-
|
|
1958
|
+
chunkLEYHQJTL_cjs.__name(parseExpression, "parseExpression");
|
|
1779
1959
|
|
|
1780
1960
|
// src/processor/builders/index.ts
|
|
1781
1961
|
var builders_exports = {};
|
|
1782
|
-
|
|
1962
|
+
chunkLEYHQJTL_cjs.__export(builders_exports, {
|
|
1783
1963
|
FlatObjectBuilder: () => FlatObjectBuilder,
|
|
1784
1964
|
MapBuilder: () => MapBuilder,
|
|
1785
1965
|
NestedObjectBuilder: () => NestedObjectBuilder,
|
|
@@ -1865,7 +2045,7 @@ var _DependencyTracker = class _DependencyTracker {
|
|
|
1865
2045
|
return values ? new Set(values) : /* @__PURE__ */ new Set();
|
|
1866
2046
|
}
|
|
1867
2047
|
};
|
|
1868
|
-
|
|
2048
|
+
chunkLEYHQJTL_cjs.__name(_DependencyTracker, "DependencyTracker");
|
|
1869
2049
|
var DependencyTracker = _DependencyTracker;
|
|
1870
2050
|
|
|
1871
2051
|
// src/processor/resolver/helpers.ts
|
|
@@ -1875,7 +2055,7 @@ function getAffectedTokens(result) {
|
|
|
1875
2055
|
}
|
|
1876
2056
|
return new Set(result.dependants.graph.getNodes().keys());
|
|
1877
2057
|
}
|
|
1878
|
-
|
|
2058
|
+
chunkLEYHQJTL_cjs.__name(getAffectedTokens, "getAffectedTokens");
|
|
1879
2059
|
function getBrokenReferences(result) {
|
|
1880
2060
|
if (!result.issues) {
|
|
1881
2061
|
return /* @__PURE__ */ new Set();
|
|
@@ -1883,7 +2063,7 @@ function getBrokenReferences(result) {
|
|
|
1883
2063
|
const brokenRefs = /* @__PURE__ */ new Set();
|
|
1884
2064
|
for (const [tokenPath, issues] of result.issues) {
|
|
1885
2065
|
for (const issue of issues) {
|
|
1886
|
-
if (
|
|
2066
|
+
if (chunkLMGHS2NP_cjs.isLanguageError(issue) && (issue.code === "PROC_TOKEN_NOT_FOUND" /* TOKEN_NOT_FOUND */ || issue.code === "PROC_DEPENDENCY_ERROR" /* DEPENDENCY_ERROR */)) {
|
|
1887
2067
|
brokenRefs.add(tokenPath);
|
|
1888
2068
|
break;
|
|
1889
2069
|
}
|
|
@@ -1891,11 +2071,11 @@ function getBrokenReferences(result) {
|
|
|
1891
2071
|
}
|
|
1892
2072
|
return brokenRefs;
|
|
1893
2073
|
}
|
|
1894
|
-
|
|
2074
|
+
chunkLEYHQJTL_cjs.__name(getBrokenReferences, "getBrokenReferences");
|
|
1895
2075
|
function getRenamedReferences(_result, modifiedTokens) {
|
|
1896
2076
|
return modifiedTokens;
|
|
1897
2077
|
}
|
|
1898
|
-
|
|
2078
|
+
chunkLEYHQJTL_cjs.__name(getRenamedReferences, "getRenamedReferences");
|
|
1899
2079
|
function getModifiedDependants(oldTokens, result) {
|
|
1900
2080
|
const modified = /* @__PURE__ */ new Set();
|
|
1901
2081
|
const affectedTokens = getAffectedTokens(result);
|
|
@@ -1908,7 +2088,7 @@ function getModifiedDependants(oldTokens, result) {
|
|
|
1908
2088
|
}
|
|
1909
2089
|
return modified;
|
|
1910
2090
|
}
|
|
1911
|
-
|
|
2091
|
+
chunkLEYHQJTL_cjs.__name(getModifiedDependants, "getModifiedDependants");
|
|
1912
2092
|
|
|
1913
2093
|
// src/processor/resolver/issue-helpers.ts
|
|
1914
2094
|
function getTokenError(issues, tokenName) {
|
|
@@ -1917,7 +2097,7 @@ function getTokenError(issues, tokenName) {
|
|
|
1917
2097
|
if (!tokenIssues) return void 0;
|
|
1918
2098
|
return tokenIssues.find((issue) => "code" in issue);
|
|
1919
2099
|
}
|
|
1920
|
-
|
|
2100
|
+
chunkLEYHQJTL_cjs.__name(getTokenError, "getTokenError");
|
|
1921
2101
|
|
|
1922
2102
|
// src/processor/resolver/PrefixExtractor.ts
|
|
1923
2103
|
var _PrefixExtractor = class _PrefixExtractor {
|
|
@@ -1948,7 +2128,7 @@ var _PrefixExtractor = class _PrefixExtractor {
|
|
|
1948
2128
|
this.prefixCache.clear();
|
|
1949
2129
|
}
|
|
1950
2130
|
};
|
|
1951
|
-
|
|
2131
|
+
chunkLEYHQJTL_cjs.__name(_PrefixExtractor, "PrefixExtractor");
|
|
1952
2132
|
var PrefixExtractor = _PrefixExtractor;
|
|
1953
2133
|
|
|
1954
2134
|
// src/processor/resolver/PrefixManager.ts
|
|
@@ -2015,7 +2195,7 @@ var _PrefixManager = class _PrefixManager {
|
|
|
2015
2195
|
}
|
|
2016
2196
|
}
|
|
2017
2197
|
if (dictionaryEntries.size === 0) return void 0;
|
|
2018
|
-
return new
|
|
2198
|
+
return new chunkLMGHS2NP_cjs.DictionarySymbol(dictionaryEntries, this.config);
|
|
2019
2199
|
}
|
|
2020
2200
|
findParentToken(reference, tokens) {
|
|
2021
2201
|
const cached = this.parentLookupCache.get(reference);
|
|
@@ -2070,12 +2250,12 @@ var _PrefixManager = class _PrefixManager {
|
|
|
2070
2250
|
}
|
|
2071
2251
|
toSymbol(value) {
|
|
2072
2252
|
if (value === void 0) return void 0;
|
|
2073
|
-
if (value === null) return new
|
|
2074
|
-
if (
|
|
2075
|
-
return new
|
|
2253
|
+
if (value === null) return new chunkLMGHS2NP_cjs.NullSymbol(this.config);
|
|
2254
|
+
if (chunkLMGHS2NP_cjs.isTokenscriptSymbol(value)) return value;
|
|
2255
|
+
return new chunkLMGHS2NP_cjs.StringSymbol(String(value), this.config);
|
|
2076
2256
|
}
|
|
2077
2257
|
};
|
|
2078
|
-
|
|
2258
|
+
chunkLEYHQJTL_cjs.__name(_PrefixManager, "PrefixManager");
|
|
2079
2259
|
var PrefixManager = _PrefixManager;
|
|
2080
2260
|
|
|
2081
2261
|
// src/processor/resolver/ReadinessTracker.ts
|
|
@@ -2109,7 +2289,7 @@ var _ReadinessTracker = class _ReadinessTracker {
|
|
|
2109
2289
|
this.readyCache.clear();
|
|
2110
2290
|
}
|
|
2111
2291
|
};
|
|
2112
|
-
|
|
2292
|
+
chunkLEYHQJTL_cjs.__name(_ReadinessTracker, "ReadinessTracker");
|
|
2113
2293
|
var ReadinessTracker = _ReadinessTracker;
|
|
2114
2294
|
|
|
2115
2295
|
// src/processor/resolver/ResolutionNotifier.ts
|
|
@@ -2176,35 +2356,35 @@ var _ResolutionNotifier = class _ResolutionNotifier {
|
|
|
2176
2356
|
}
|
|
2177
2357
|
}
|
|
2178
2358
|
};
|
|
2179
|
-
|
|
2359
|
+
chunkLEYHQJTL_cjs.__name(_ResolutionNotifier, "ResolutionNotifier");
|
|
2180
2360
|
var ResolutionNotifier = _ResolutionNotifier;
|
|
2181
2361
|
|
|
2182
2362
|
// src/interpreter/operations.ts
|
|
2183
2363
|
function decomposeUnit(operand) {
|
|
2184
|
-
if (operand instanceof
|
|
2364
|
+
if (operand instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol) {
|
|
2185
2365
|
return { value: operand.value, unit: operand.unit };
|
|
2186
2366
|
}
|
|
2187
|
-
if (operand instanceof
|
|
2367
|
+
if (operand instanceof chunkLMGHS2NP_cjs.NumberSymbol) {
|
|
2188
2368
|
return { value: operand.value, unit: null };
|
|
2189
2369
|
}
|
|
2190
|
-
throw new
|
|
2370
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("OP_UNSUPPORTED_OPERAND_TYPE" /* UNSUPPORTED_OPERAND_TYPE */, {
|
|
2191
2371
|
data: { type: operand.type }
|
|
2192
2372
|
});
|
|
2193
2373
|
}
|
|
2194
|
-
|
|
2374
|
+
chunkLEYHQJTL_cjs.__name(decomposeUnit, "decomposeUnit");
|
|
2195
2375
|
function recomposeUnit(value, units, _config) {
|
|
2196
2376
|
const validUnits = units.filter((u) => u !== null);
|
|
2197
2377
|
if (validUnits.length === 0) {
|
|
2198
|
-
return new
|
|
2378
|
+
return new chunkLMGHS2NP_cjs.NumberSymbol(value);
|
|
2199
2379
|
}
|
|
2200
2380
|
if (new Set(validUnits).size > 1) {
|
|
2201
|
-
throw new
|
|
2381
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("OP_CANNOT_MIX_UNITS" /* CANNOT_MIX_UNITS */, {
|
|
2202
2382
|
data: { units: validUnits }
|
|
2203
2383
|
});
|
|
2204
2384
|
}
|
|
2205
|
-
return new
|
|
2385
|
+
return new chunkLMGHS2NP_cjs.NumberWithUnitSymbol(value, validUnits[0]);
|
|
2206
2386
|
}
|
|
2207
|
-
|
|
2387
|
+
chunkLEYHQJTL_cjs.__name(recomposeUnit, "recomposeUnit");
|
|
2208
2388
|
function mathWrapper(func) {
|
|
2209
2389
|
return (a, b, config) => {
|
|
2210
2390
|
if (config?.unitManager) {
|
|
@@ -2227,91 +2407,91 @@ function mathWrapper(func) {
|
|
|
2227
2407
|
return recomposeUnit(resultValue, [opA.unit, opB.unit]);
|
|
2228
2408
|
};
|
|
2229
2409
|
}
|
|
2230
|
-
|
|
2410
|
+
chunkLEYHQJTL_cjs.__name(mathWrapper, "mathWrapper");
|
|
2231
2411
|
function equalityComparisonWrapper(fn) {
|
|
2232
2412
|
return (a, b) => {
|
|
2233
|
-
const isNullComparison = a instanceof
|
|
2413
|
+
const isNullComparison = a instanceof chunkLMGHS2NP_cjs.NullSymbol || b instanceof chunkLMGHS2NP_cjs.NullSymbol;
|
|
2234
2414
|
if (!isNullComparison) {
|
|
2235
|
-
const isNumericA = a instanceof
|
|
2236
|
-
const isNumericB = b instanceof
|
|
2415
|
+
const isNumericA = a instanceof chunkLMGHS2NP_cjs.NumberSymbol || a instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol;
|
|
2416
|
+
const isNumericB = b instanceof chunkLMGHS2NP_cjs.NumberSymbol || b instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol;
|
|
2237
2417
|
if (isNumericA && !isNumericB) {
|
|
2238
|
-
throw new
|
|
2418
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("OP_INCOMPATIBLE_TYPES" /* INCOMPATIBLE_TYPES */, {
|
|
2239
2419
|
data: { typeA: a.type, typeB: b.type }
|
|
2240
2420
|
});
|
|
2241
2421
|
}
|
|
2242
|
-
const isStringA = a instanceof
|
|
2243
|
-
const isStringB = b instanceof
|
|
2422
|
+
const isStringA = a instanceof chunkLMGHS2NP_cjs.StringSymbol;
|
|
2423
|
+
const isStringB = b instanceof chunkLMGHS2NP_cjs.StringSymbol;
|
|
2244
2424
|
if (isStringA && !isStringB) {
|
|
2245
|
-
throw new
|
|
2425
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("OP_INCOMPATIBLE_TYPES" /* INCOMPATIBLE_TYPES */, {
|
|
2246
2426
|
data: { typeA: a.type, typeB: b.type }
|
|
2247
2427
|
});
|
|
2248
2428
|
}
|
|
2249
|
-
const isBooleanA = a instanceof
|
|
2250
|
-
const isBooleanB = b instanceof
|
|
2429
|
+
const isBooleanA = a instanceof chunkLMGHS2NP_cjs.BooleanSymbol;
|
|
2430
|
+
const isBooleanB = b instanceof chunkLMGHS2NP_cjs.BooleanSymbol;
|
|
2251
2431
|
if (isBooleanA && !isBooleanB) {
|
|
2252
|
-
throw new
|
|
2432
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("OP_INCOMPATIBLE_TYPES" /* INCOMPATIBLE_TYPES */, {
|
|
2253
2433
|
data: { typeA: a.type, typeB: b.type }
|
|
2254
2434
|
});
|
|
2255
2435
|
}
|
|
2256
|
-
if (a instanceof
|
|
2257
|
-
throw new
|
|
2436
|
+
if (a instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol && b instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol && a.unit !== b.unit) {
|
|
2437
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("OP_CANNOT_COMPARE_UNITS" /* CANNOT_COMPARE_UNITS */, {
|
|
2258
2438
|
data: { unitA: a.unit, unitB: b.unit }
|
|
2259
2439
|
});
|
|
2260
2440
|
}
|
|
2261
2441
|
}
|
|
2262
|
-
return new
|
|
2442
|
+
return new chunkLMGHS2NP_cjs.BooleanSymbol(fn(a.value, b.value));
|
|
2263
2443
|
};
|
|
2264
2444
|
}
|
|
2265
|
-
|
|
2445
|
+
chunkLEYHQJTL_cjs.__name(equalityComparisonWrapper, "equalityComparisonWrapper");
|
|
2266
2446
|
function orderingComparisonWrapper(fn) {
|
|
2267
2447
|
return (a, b) => {
|
|
2268
|
-
if (a instanceof
|
|
2269
|
-
throw new
|
|
2448
|
+
if (a instanceof chunkLMGHS2NP_cjs.NullSymbol || b instanceof chunkLMGHS2NP_cjs.NullSymbol || chunkLMGHS2NP_cjs.isNull(a.value) || chunkLMGHS2NP_cjs.isNull(b.value)) {
|
|
2449
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("OP_ORDERING_WITH_NULL" /* ORDERING_WITH_NULL */);
|
|
2270
2450
|
}
|
|
2271
|
-
const isNumericA = a instanceof
|
|
2272
|
-
const isNumericB = b instanceof
|
|
2451
|
+
const isNumericA = a instanceof chunkLMGHS2NP_cjs.NumberSymbol || a instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol;
|
|
2452
|
+
const isNumericB = b instanceof chunkLMGHS2NP_cjs.NumberSymbol || b instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol;
|
|
2273
2453
|
if (isNumericA && !isNumericB) {
|
|
2274
|
-
throw new
|
|
2454
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("OP_INCOMPATIBLE_TYPES" /* INCOMPATIBLE_TYPES */, {
|
|
2275
2455
|
data: { typeA: a.type, typeB: b.type }
|
|
2276
2456
|
});
|
|
2277
2457
|
}
|
|
2278
|
-
const isStringA = a instanceof
|
|
2279
|
-
const isStringB = b instanceof
|
|
2458
|
+
const isStringA = a instanceof chunkLMGHS2NP_cjs.StringSymbol;
|
|
2459
|
+
const isStringB = b instanceof chunkLMGHS2NP_cjs.StringSymbol;
|
|
2280
2460
|
if (isStringA && !isStringB) {
|
|
2281
|
-
throw new
|
|
2461
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("OP_INCOMPATIBLE_TYPES" /* INCOMPATIBLE_TYPES */, {
|
|
2282
2462
|
data: { typeA: a.type, typeB: b.type }
|
|
2283
2463
|
});
|
|
2284
2464
|
}
|
|
2285
|
-
const isBooleanA = a instanceof
|
|
2286
|
-
const isBooleanB = b instanceof
|
|
2465
|
+
const isBooleanA = a instanceof chunkLMGHS2NP_cjs.BooleanSymbol;
|
|
2466
|
+
const isBooleanB = b instanceof chunkLMGHS2NP_cjs.BooleanSymbol;
|
|
2287
2467
|
if (isBooleanA && !isBooleanB) {
|
|
2288
|
-
throw new
|
|
2468
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("OP_INCOMPATIBLE_TYPES" /* INCOMPATIBLE_TYPES */, {
|
|
2289
2469
|
data: { typeA: a.type, typeB: b.type }
|
|
2290
2470
|
});
|
|
2291
2471
|
}
|
|
2292
|
-
if (a instanceof
|
|
2293
|
-
throw new
|
|
2472
|
+
if (a instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol && b instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol && a.unit !== b.unit) {
|
|
2473
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("OP_CANNOT_COMPARE_UNITS" /* CANNOT_COMPARE_UNITS */, {
|
|
2294
2474
|
data: { unitA: a.unit, unitB: b.unit }
|
|
2295
2475
|
});
|
|
2296
2476
|
}
|
|
2297
|
-
return new
|
|
2477
|
+
return new chunkLMGHS2NP_cjs.BooleanSymbol(fn(a.value, b.value));
|
|
2298
2478
|
};
|
|
2299
2479
|
}
|
|
2300
|
-
|
|
2480
|
+
chunkLEYHQJTL_cjs.__name(orderingComparisonWrapper, "orderingComparisonWrapper");
|
|
2301
2481
|
var LOGICAL_BOOLEAN_IMPLEMENTATIONS = {
|
|
2302
2482
|
["&&" /* LOGIC_AND */]: (a, b) => {
|
|
2303
|
-
if (!(a instanceof
|
|
2304
|
-
throw new
|
|
2483
|
+
if (!(a instanceof chunkLMGHS2NP_cjs.BooleanSymbol) || !(b instanceof chunkLMGHS2NP_cjs.BooleanSymbol))
|
|
2484
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("OP_LOGICAL_REQUIRES_BOOLEAN" /* LOGICAL_REQUIRES_BOOLEAN */, {
|
|
2305
2485
|
data: { operator: "&&" }
|
|
2306
2486
|
});
|
|
2307
|
-
return new
|
|
2487
|
+
return new chunkLMGHS2NP_cjs.BooleanSymbol(a.value && b.value);
|
|
2308
2488
|
},
|
|
2309
2489
|
["||" /* LOGIC_OR */]: (a, b) => {
|
|
2310
|
-
if (!(a instanceof
|
|
2311
|
-
throw new
|
|
2490
|
+
if (!(a instanceof chunkLMGHS2NP_cjs.BooleanSymbol) || !(b instanceof chunkLMGHS2NP_cjs.BooleanSymbol))
|
|
2491
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("OP_LOGICAL_REQUIRES_BOOLEAN" /* LOGICAL_REQUIRES_BOOLEAN */, {
|
|
2312
2492
|
data: { operator: "||" }
|
|
2313
2493
|
});
|
|
2314
|
-
return new
|
|
2494
|
+
return new chunkLMGHS2NP_cjs.BooleanSymbol(a.value || b.value);
|
|
2315
2495
|
}
|
|
2316
2496
|
};
|
|
2317
2497
|
function powerWrapper(func) {
|
|
@@ -2319,7 +2499,7 @@ function powerWrapper(func) {
|
|
|
2319
2499
|
const opA = decomposeUnit(a);
|
|
2320
2500
|
const opB = decomposeUnit(b);
|
|
2321
2501
|
if (opA.unit && opB.unit) {
|
|
2322
|
-
throw new
|
|
2502
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("OP_UNIT_EXPONENT_NOT_SUPPORTED" /* UNIT_EXPONENT_NOT_SUPPORTED */, {
|
|
2323
2503
|
data: { unitA: opA.unit, unitB: opB.unit }
|
|
2324
2504
|
});
|
|
2325
2505
|
}
|
|
@@ -2327,30 +2507,30 @@ function powerWrapper(func) {
|
|
|
2327
2507
|
return recomposeUnit(resultValue, [opA.unit, opB.unit]);
|
|
2328
2508
|
};
|
|
2329
2509
|
}
|
|
2330
|
-
|
|
2510
|
+
chunkLEYHQJTL_cjs.__name(powerWrapper, "powerWrapper");
|
|
2331
2511
|
function multiplyDivideWrapper(func) {
|
|
2332
2512
|
return (a, b, config) => {
|
|
2333
2513
|
if (config?.unitManager) {
|
|
2334
|
-
const aIsPercent = a instanceof
|
|
2335
|
-
const bIsPercent = b instanceof
|
|
2514
|
+
const aIsPercent = a instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol && config.unitManager.getSpecByKeyword(a.unit)?.type === "relative";
|
|
2515
|
+
const bIsPercent = b instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol && config.unitManager.getSpecByKeyword(b.unit)?.type === "relative";
|
|
2336
2516
|
if (aIsPercent && !bIsPercent) {
|
|
2337
2517
|
const resultValue = func(a.value / 100, b.value);
|
|
2338
|
-
return b instanceof
|
|
2518
|
+
return b instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol ? new chunkLMGHS2NP_cjs.NumberWithUnitSymbol(resultValue, b.unit) : new chunkLMGHS2NP_cjs.NumberSymbol(resultValue);
|
|
2339
2519
|
} else if (bIsPercent && !aIsPercent) {
|
|
2340
2520
|
const resultValue = func(a.value, b.value / 100);
|
|
2341
|
-
return a instanceof
|
|
2521
|
+
return a instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol ? new chunkLMGHS2NP_cjs.NumberWithUnitSymbol(resultValue, a.unit) : new chunkLMGHS2NP_cjs.NumberSymbol(resultValue);
|
|
2342
2522
|
}
|
|
2343
2523
|
}
|
|
2344
2524
|
return mathWrapper(func)(a, b, config);
|
|
2345
2525
|
};
|
|
2346
2526
|
}
|
|
2347
|
-
|
|
2527
|
+
chunkLEYHQJTL_cjs.__name(multiplyDivideWrapper, "multiplyDivideWrapper");
|
|
2348
2528
|
var MATH_IMPLEMENTATIONS = {
|
|
2349
2529
|
["+" /* ADD */]: mathWrapper((a, b) => a + b),
|
|
2350
2530
|
["-" /* SUBTRACT */]: mathWrapper((a, b) => a - b),
|
|
2351
2531
|
["*" /* MULTIPLY */]: multiplyDivideWrapper((a, b) => a * b),
|
|
2352
2532
|
["/" /* DIVIDE */]: multiplyDivideWrapper((a, b) => {
|
|
2353
|
-
if (b === 0) throw new
|
|
2533
|
+
if (b === 0) throw new chunkLMGHS2NP_cjs.InterpreterError("OP_DIVISION_BY_ZERO" /* DIVISION_BY_ZERO */);
|
|
2354
2534
|
return a / b;
|
|
2355
2535
|
}),
|
|
2356
2536
|
["^" /* POWER */]: powerWrapper((a, b) => a ** b)
|
|
@@ -2385,7 +2565,7 @@ var _SymbolTable = class _SymbolTable {
|
|
|
2385
2565
|
this.symbols = {};
|
|
2386
2566
|
}
|
|
2387
2567
|
};
|
|
2388
|
-
|
|
2568
|
+
chunkLEYHQJTL_cjs.__name(_SymbolTable, "SymbolTable");
|
|
2389
2569
|
var SymbolTable = _SymbolTable;
|
|
2390
2570
|
|
|
2391
2571
|
// src/interpreter/interpreter.ts
|
|
@@ -2394,7 +2574,7 @@ var _ReturnSignal = class _ReturnSignal {
|
|
|
2394
2574
|
this.value = value;
|
|
2395
2575
|
}
|
|
2396
2576
|
};
|
|
2397
|
-
|
|
2577
|
+
chunkLEYHQJTL_cjs.__name(_ReturnSignal, "ReturnSignal");
|
|
2398
2578
|
var ReturnSignal = _ReturnSignal;
|
|
2399
2579
|
var _Interpreter = class _Interpreter {
|
|
2400
2580
|
constructor(input, options) {
|
|
@@ -2418,7 +2598,7 @@ var _Interpreter = class _Interpreter {
|
|
|
2418
2598
|
this.references = references;
|
|
2419
2599
|
} else if (references) {
|
|
2420
2600
|
for (const key in references) {
|
|
2421
|
-
this.references.set(key,
|
|
2601
|
+
this.references.set(key, chunkLMGHS2NP_cjs.jsValueToSymbolType(references[key], this.config));
|
|
2422
2602
|
}
|
|
2423
2603
|
} else {
|
|
2424
2604
|
this.references = /* @__PURE__ */ new Map();
|
|
@@ -2445,7 +2625,7 @@ var _Interpreter = class _Interpreter {
|
|
|
2445
2625
|
this.symbolTable.set(name, value);
|
|
2446
2626
|
}
|
|
2447
2627
|
coerceValue(constructorSymbol, valueSymbol) {
|
|
2448
|
-
if (valueSymbol instanceof
|
|
2628
|
+
if (valueSymbol instanceof chunkLMGHS2NP_cjs.NullSymbol) return constructorSymbol;
|
|
2449
2629
|
if (constructorSymbol.typeEquals(valueSymbol)) return valueSymbol;
|
|
2450
2630
|
}
|
|
2451
2631
|
// Visit Functions -------------------------------------------------------------
|
|
@@ -2455,7 +2635,7 @@ var _Interpreter = class _Interpreter {
|
|
|
2455
2635
|
if (typeof this[visitorMethodName] === "function") {
|
|
2456
2636
|
return this[visitorMethodName](node);
|
|
2457
2637
|
}
|
|
2458
|
-
throw new
|
|
2638
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_UNKNOWN_NODE_TYPE" /* UNKNOWN_NODE_TYPE */, {
|
|
2459
2639
|
token: node.token,
|
|
2460
2640
|
data: { nodeType: node.nodeType }
|
|
2461
2641
|
});
|
|
@@ -2471,8 +2651,8 @@ var _Interpreter = class _Interpreter {
|
|
|
2471
2651
|
}
|
|
2472
2652
|
const mathImpl = MATH_IMPLEMENTATIONS[opVal];
|
|
2473
2653
|
if (mathImpl) {
|
|
2474
|
-
if (!((left instanceof
|
|
2475
|
-
throw new
|
|
2654
|
+
if (!((left instanceof chunkLMGHS2NP_cjs.NumberSymbol || left instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol) && (right instanceof chunkLMGHS2NP_cjs.NumberSymbol || right instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol))) {
|
|
2655
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_ARITHMETIC_REQUIRES_NUMBER" /* ARITHMETIC_REQUIRES_NUMBER */, {
|
|
2476
2656
|
token: node.opToken,
|
|
2477
2657
|
data: { operator: opVal, leftType: left.type, rightType: right.type }
|
|
2478
2658
|
});
|
|
@@ -2483,75 +2663,116 @@ var _Interpreter = class _Interpreter {
|
|
|
2483
2663
|
if (comparisonImpl) {
|
|
2484
2664
|
return comparisonImpl(left, right);
|
|
2485
2665
|
}
|
|
2486
|
-
throw new
|
|
2666
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_UNKNOWN_BINARY_OPERATOR" /* UNKNOWN_BINARY_OPERATOR */, {
|
|
2487
2667
|
token: node.opToken,
|
|
2488
2668
|
data: { operator: opVal, tokenType: opType }
|
|
2489
2669
|
});
|
|
2490
2670
|
}
|
|
2491
2671
|
visitNumNode(node) {
|
|
2492
|
-
return new
|
|
2672
|
+
return new chunkLMGHS2NP_cjs.NumberSymbol(node.value, this.config);
|
|
2493
2673
|
}
|
|
2494
2674
|
visitStringNode(node) {
|
|
2495
|
-
return new
|
|
2675
|
+
return new chunkLMGHS2NP_cjs.StringSymbol(node.value, this.config);
|
|
2676
|
+
}
|
|
2677
|
+
visitTemplateStringNode(node) {
|
|
2678
|
+
if (node.parts.length === 0) {
|
|
2679
|
+
return new chunkLMGHS2NP_cjs.StringSymbol("", this.config);
|
|
2680
|
+
}
|
|
2681
|
+
if (node.parts.length === 1) {
|
|
2682
|
+
const val = this.visit(node.parts[0]);
|
|
2683
|
+
this.validateTemplateValue(val, node);
|
|
2684
|
+
return val;
|
|
2685
|
+
}
|
|
2686
|
+
let result = "";
|
|
2687
|
+
for (const part of node.parts) {
|
|
2688
|
+
const val = this.visit(part);
|
|
2689
|
+
this.validateTemplateValue(val, node);
|
|
2690
|
+
result += val.toString();
|
|
2691
|
+
}
|
|
2692
|
+
return new chunkLMGHS2NP_cjs.StringSymbol(result, this.config);
|
|
2693
|
+
}
|
|
2694
|
+
/**
|
|
2695
|
+
* Validate that a value is a primitive type allowed in template string interpolation.
|
|
2696
|
+
* Lists, Dictionaries, and non-hex Colors are rejected.
|
|
2697
|
+
*/
|
|
2698
|
+
validateTemplateValue(val, node) {
|
|
2699
|
+
if (val instanceof chunkLMGHS2NP_cjs.ListSymbol) {
|
|
2700
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_TEMPLATE_INVALID_TYPE" /* TEMPLATE_INVALID_TYPE */, {
|
|
2701
|
+
token: node.token,
|
|
2702
|
+
data: { valueType: "List" }
|
|
2703
|
+
});
|
|
2704
|
+
}
|
|
2705
|
+
if (val instanceof chunkLMGHS2NP_cjs.DictionarySymbol) {
|
|
2706
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_TEMPLATE_INVALID_TYPE" /* TEMPLATE_INVALID_TYPE */, {
|
|
2707
|
+
token: node.token,
|
|
2708
|
+
data: { valueType: "Dictionary" }
|
|
2709
|
+
});
|
|
2710
|
+
}
|
|
2711
|
+
if (val instanceof chunkLMGHS2NP_cjs.ColorSymbol && !val.isHex()) {
|
|
2712
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_TEMPLATE_INVALID_TYPE" /* TEMPLATE_INVALID_TYPE */, {
|
|
2713
|
+
token: node.token,
|
|
2714
|
+
data: { valueType: `Color.${val.subType}` }
|
|
2715
|
+
});
|
|
2716
|
+
}
|
|
2496
2717
|
}
|
|
2497
2718
|
/**
|
|
2498
2719
|
* Bare identifiers are treated as string literals if not found as variables
|
|
2499
2720
|
* Check symbol table first (variables override references), then references
|
|
2500
2721
|
*/
|
|
2501
2722
|
visitIdentifierNode(node) {
|
|
2502
|
-
return this.symbolTable.get(node.name) || this.getReference(node.name) || new
|
|
2723
|
+
return this.symbolTable.get(node.name) || this.getReference(node.name) || new chunkLMGHS2NP_cjs.StringSymbol(node.name, this.config);
|
|
2503
2724
|
}
|
|
2504
2725
|
visitUnaryOpNode(node) {
|
|
2505
2726
|
const result = this.visit(node.expr);
|
|
2506
2727
|
if (node.op === "-" /* SUBTRACT */) {
|
|
2507
|
-
if (result instanceof
|
|
2728
|
+
if (result instanceof chunkLMGHS2NP_cjs.NumberSymbol) {
|
|
2508
2729
|
if (result.value === null) {
|
|
2509
|
-
throw new
|
|
2730
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_UNARY_MINUS_NULL" /* UNARY_MINUS_NULL */, {
|
|
2510
2731
|
token: node.opToken,
|
|
2511
2732
|
data: { symbolType: "NumberSymbol" }
|
|
2512
2733
|
});
|
|
2513
2734
|
}
|
|
2514
|
-
return new
|
|
2735
|
+
return new chunkLMGHS2NP_cjs.NumberSymbol(-result.value, this.config);
|
|
2515
2736
|
}
|
|
2516
|
-
if (result instanceof
|
|
2737
|
+
if (result instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol) {
|
|
2517
2738
|
if (result.value === null) {
|
|
2518
|
-
throw new
|
|
2739
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_UNARY_MINUS_NULL" /* UNARY_MINUS_NULL */, {
|
|
2519
2740
|
token: node.opToken,
|
|
2520
2741
|
data: { symbolType: "NumberWithUnitSymbol" }
|
|
2521
2742
|
});
|
|
2522
2743
|
}
|
|
2523
|
-
return new
|
|
2744
|
+
return new chunkLMGHS2NP_cjs.NumberWithUnitSymbol(-result.value, result.unit, this.config);
|
|
2524
2745
|
}
|
|
2525
|
-
throw new
|
|
2746
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_UNARY_PLUS_NON_NUMBER" /* UNARY_PLUS_NON_NUMBER */, {
|
|
2526
2747
|
token: node.opToken,
|
|
2527
2748
|
data: { value: String(result.value) }
|
|
2528
2749
|
});
|
|
2529
2750
|
}
|
|
2530
2751
|
if (node.op === "+" /* ADD */) {
|
|
2531
|
-
if (result instanceof
|
|
2752
|
+
if (result instanceof chunkLMGHS2NP_cjs.NumberSymbol || result instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol) {
|
|
2532
2753
|
return result;
|
|
2533
2754
|
}
|
|
2534
|
-
throw new
|
|
2755
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_UNARY_PLUS_NON_NUMBER" /* UNARY_PLUS_NON_NUMBER */, {
|
|
2535
2756
|
token: node.opToken,
|
|
2536
2757
|
data: { value: String(result.value) }
|
|
2537
2758
|
});
|
|
2538
2759
|
}
|
|
2539
2760
|
if (node.op === "!" /* LOGIC_NOT */) {
|
|
2540
|
-
if (result instanceof
|
|
2541
|
-
return new
|
|
2761
|
+
if (result instanceof chunkLMGHS2NP_cjs.BooleanSymbol) {
|
|
2762
|
+
return new chunkLMGHS2NP_cjs.BooleanSymbol(!result.value, this.config);
|
|
2542
2763
|
}
|
|
2543
|
-
throw new
|
|
2764
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_UNARY_NOT_NON_BOOLEAN" /* UNARY_NOT_NON_BOOLEAN */, {
|
|
2544
2765
|
token: node.opToken,
|
|
2545
2766
|
data: { value: String(result.value) }
|
|
2546
2767
|
});
|
|
2547
2768
|
}
|
|
2548
|
-
throw new
|
|
2769
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_UNKNOWN_UNARY_OPERATOR" /* UNKNOWN_UNARY_OPERATOR */, {
|
|
2549
2770
|
token: node.opToken,
|
|
2550
2771
|
data: { operator: node.op }
|
|
2551
2772
|
});
|
|
2552
2773
|
}
|
|
2553
2774
|
visitListNode(node) {
|
|
2554
|
-
return new
|
|
2775
|
+
return new chunkLMGHS2NP_cjs.ListSymbol(
|
|
2555
2776
|
node.elements.map((el) => this.visit(el)),
|
|
2556
2777
|
node instanceof ImplicitListNode,
|
|
2557
2778
|
this.config
|
|
@@ -2563,7 +2784,7 @@ var _Interpreter = class _Interpreter {
|
|
|
2563
2784
|
visitReferenceNode(node) {
|
|
2564
2785
|
const value = this.getReference(node.value);
|
|
2565
2786
|
if (!value) {
|
|
2566
|
-
throw new
|
|
2787
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_UNKNOWN_REFERENCE" /* UNKNOWN_REFERENCE */, {
|
|
2567
2788
|
token: node.token,
|
|
2568
2789
|
data: { reference: node.value }
|
|
2569
2790
|
});
|
|
@@ -2571,18 +2792,18 @@ var _Interpreter = class _Interpreter {
|
|
|
2571
2792
|
return value;
|
|
2572
2793
|
}
|
|
2573
2794
|
visitHexColorNode(node) {
|
|
2574
|
-
const { color, alpha } =
|
|
2575
|
-
return new
|
|
2795
|
+
const { color, alpha } = chunkLMGHS2NP_cjs.parseHexWithAlpha(node.value);
|
|
2796
|
+
return new chunkLMGHS2NP_cjs.ColorSymbol(color, "Hex", alpha, this.config);
|
|
2576
2797
|
}
|
|
2577
2798
|
visitBooleanNode(node) {
|
|
2578
|
-
return new
|
|
2799
|
+
return new chunkLMGHS2NP_cjs.BooleanSymbol(node.value, this.config);
|
|
2579
2800
|
}
|
|
2580
2801
|
visitNullNode(_node) {
|
|
2581
|
-
return new
|
|
2802
|
+
return new chunkLMGHS2NP_cjs.NullSymbol(this.config);
|
|
2582
2803
|
}
|
|
2583
2804
|
visitElementWithUnitNode(node) {
|
|
2584
2805
|
const valNodeVisit = this.visit(node.astNode);
|
|
2585
|
-
return new
|
|
2806
|
+
return new chunkLMGHS2NP_cjs.NumberWithUnitSymbol(valNodeVisit?.value, node.unit, this.config);
|
|
2586
2807
|
}
|
|
2587
2808
|
visitFunctionCallNode(node) {
|
|
2588
2809
|
const fnName = node.name.toLowerCase();
|
|
@@ -2597,11 +2818,11 @@ var _Interpreter = class _Interpreter {
|
|
|
2597
2818
|
if (this.config.colorManager.hasInitializer(fnName)) {
|
|
2598
2819
|
return this.config.colorManager.executeInitializer(fnName, args);
|
|
2599
2820
|
}
|
|
2600
|
-
if (
|
|
2821
|
+
if (chunkLEYHQJTL_cjs.UNINTERPRETED_KEYWORDS.includes(fnName)) {
|
|
2601
2822
|
const argStrings = args.map((arg) => arg.toString());
|
|
2602
|
-
return new
|
|
2823
|
+
return new chunkLMGHS2NP_cjs.StringSymbol(`${fnName}(${argStrings.join(", ")})`, this.config);
|
|
2603
2824
|
}
|
|
2604
|
-
throw new
|
|
2825
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_UNKNOWN_FUNCTION" /* UNKNOWN_FUNCTION */, {
|
|
2605
2826
|
token: node.token,
|
|
2606
2827
|
data: { functionName: node.name }
|
|
2607
2828
|
});
|
|
@@ -2609,13 +2830,13 @@ var _Interpreter = class _Interpreter {
|
|
|
2609
2830
|
visitAssignNode(node) {
|
|
2610
2831
|
const name = node.varName.name;
|
|
2611
2832
|
if ([".", "[", "-"].some((c) => name.includes(c))) {
|
|
2612
|
-
throw new
|
|
2833
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_INVALID_VARIABLE_NAME" /* INVALID_VARIABLE_NAME */, {
|
|
2613
2834
|
token: node.varName.token,
|
|
2614
2835
|
data: { name }
|
|
2615
2836
|
});
|
|
2616
2837
|
}
|
|
2617
2838
|
if (this.symbolTable.isDefined(name)) {
|
|
2618
|
-
throw new
|
|
2839
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_VARIABLE_ALREADY_DEFINED" /* VARIABLE_ALREADY_DEFINED */, {
|
|
2619
2840
|
token: node.varName.token,
|
|
2620
2841
|
data: { name }
|
|
2621
2842
|
});
|
|
@@ -2623,11 +2844,11 @@ var _Interpreter = class _Interpreter {
|
|
|
2623
2844
|
const baseType = node.typeDecl.baseType.name;
|
|
2624
2845
|
const subType = node.typeDecl.subTypes[0]?.name;
|
|
2625
2846
|
if (!this.config.isTypeDefined(baseType, subType)) {
|
|
2626
|
-
throw new
|
|
2847
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_INVALID_VARIABLE_TYPE" /* INVALID_VARIABLE_TYPE */, {
|
|
2627
2848
|
token: node.varName.token,
|
|
2628
2849
|
data: {
|
|
2629
|
-
typeName:
|
|
2630
|
-
validTypes: Object.keys(
|
|
2850
|
+
typeName: chunkLMGHS2NP_cjs.typeName(baseType, subType),
|
|
2851
|
+
validTypes: Object.keys(chunkLMGHS2NP_cjs.basicSymbolTypes).join(", ")
|
|
2631
2852
|
}
|
|
2632
2853
|
});
|
|
2633
2854
|
}
|
|
@@ -2635,7 +2856,7 @@ var _Interpreter = class _Interpreter {
|
|
|
2635
2856
|
const valueSymbol = node.assignmentExpr ? this.visit(node.assignmentExpr) : constructorSymbol;
|
|
2636
2857
|
const coercedValueSymbol = this.coerceValue(constructorSymbol, valueSymbol);
|
|
2637
2858
|
if (!coercedValueSymbol) {
|
|
2638
|
-
throw new
|
|
2859
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_INVALID_VALUE_FOR_VARIABLE" /* INVALID_VALUE_FOR_VARIABLE */, {
|
|
2639
2860
|
token: node.varName.token,
|
|
2640
2861
|
data: { value: String(valueSymbol.value), type: baseType, name }
|
|
2641
2862
|
});
|
|
@@ -2646,25 +2867,25 @@ var _Interpreter = class _Interpreter {
|
|
|
2646
2867
|
const baseIdentifier = node.baseIdentifier();
|
|
2647
2868
|
const existingVar = this.symbolTable.get(baseIdentifier.name);
|
|
2648
2869
|
if (existingVar === null) {
|
|
2649
|
-
throw new
|
|
2870
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_VARIABLE_NOT_FOUND" /* VARIABLE_NOT_FOUND */, {
|
|
2650
2871
|
token: baseIdentifier.token,
|
|
2651
2872
|
data: { name: baseIdentifier.name }
|
|
2652
2873
|
});
|
|
2653
2874
|
}
|
|
2654
2875
|
const value = this.visit(node.value);
|
|
2655
2876
|
if (value === null) {
|
|
2656
|
-
throw new
|
|
2877
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_ASSIGNMENT_VALUE_NULL" /* ASSIGNMENT_VALUE_NULL */, {
|
|
2657
2878
|
token: node.value.token,
|
|
2658
2879
|
data: { identifier: node.identifierToString() }
|
|
2659
2880
|
});
|
|
2660
2881
|
}
|
|
2661
2882
|
if (node.isAttributeAssignment()) {
|
|
2662
|
-
if (existingVar instanceof
|
|
2883
|
+
if (existingVar instanceof chunkLMGHS2NP_cjs.ColorSymbol) {
|
|
2663
2884
|
this.config.colorManager.setAttribute(existingVar, node, value);
|
|
2664
2885
|
}
|
|
2665
2886
|
} else {
|
|
2666
|
-
if (
|
|
2667
|
-
throw new
|
|
2887
|
+
if (chunkLMGHS2NP_cjs.typeEquals(value.type, "list")) ; else if (!chunkLMGHS2NP_cjs.typeEquals(existingVar.type, value.type)) {
|
|
2888
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_TYPE_MISMATCH" /* TYPE_MISMATCH */, {
|
|
2668
2889
|
token: baseIdentifier.token,
|
|
2669
2890
|
data: {
|
|
2670
2891
|
value: String(value),
|
|
@@ -2675,7 +2896,7 @@ var _Interpreter = class _Interpreter {
|
|
|
2675
2896
|
});
|
|
2676
2897
|
}
|
|
2677
2898
|
if (!existingVar.validValue(value)) {
|
|
2678
|
-
throw new
|
|
2899
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_CANNOT_ASSIGN_TYPE" /* CANNOT_ASSIGN_TYPE */, {
|
|
2679
2900
|
token: node.value.token,
|
|
2680
2901
|
data: {
|
|
2681
2902
|
valueType: value.type,
|
|
@@ -2696,14 +2917,14 @@ var _Interpreter = class _Interpreter {
|
|
|
2696
2917
|
if (left.hasMethod(right.name, args)) {
|
|
2697
2918
|
const result = left.callMethod?.(right.name, args);
|
|
2698
2919
|
if (result === null || result === void 0) {
|
|
2699
|
-
throw new
|
|
2920
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_METHOD_RETURNED_NULL" /* METHOD_RETURNED_NULL */, {
|
|
2700
2921
|
token: node.token,
|
|
2701
2922
|
data: { methodName: right.name }
|
|
2702
2923
|
});
|
|
2703
2924
|
}
|
|
2704
2925
|
return result;
|
|
2705
2926
|
}
|
|
2706
|
-
throw new
|
|
2927
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_METHOD_NOT_FOUND" /* METHOD_NOT_FOUND */, {
|
|
2707
2928
|
token: node.token,
|
|
2708
2929
|
data: { methodName: right.name, value: String(left), type: left.type }
|
|
2709
2930
|
});
|
|
@@ -2712,24 +2933,24 @@ var _Interpreter = class _Interpreter {
|
|
|
2712
2933
|
if (left.hasAttribute(right.name)) {
|
|
2713
2934
|
const result = left.getAttribute?.(right.name);
|
|
2714
2935
|
if (result === null || result === void 0) {
|
|
2715
|
-
throw new
|
|
2936
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_ATTRIBUTE_RETURNED_NULL" /* ATTRIBUTE_RETURNED_NULL */, {
|
|
2716
2937
|
token: node.token,
|
|
2717
2938
|
data: { attributeName: right.name }
|
|
2718
2939
|
});
|
|
2719
2940
|
}
|
|
2720
2941
|
return result;
|
|
2721
2942
|
}
|
|
2722
|
-
throw new
|
|
2943
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_ATTRIBUTE_NOT_FOUND" /* ATTRIBUTE_NOT_FOUND */, {
|
|
2723
2944
|
token: node.token,
|
|
2724
2945
|
data: {
|
|
2725
2946
|
attributeName: right.name,
|
|
2726
|
-
value: left instanceof
|
|
2947
|
+
value: left instanceof chunkLMGHS2NP_cjs.ColorSymbol ? "Color" : String(left),
|
|
2727
2948
|
type: left.type
|
|
2728
2949
|
}
|
|
2729
2950
|
});
|
|
2730
2951
|
}
|
|
2731
2952
|
}
|
|
2732
|
-
throw new
|
|
2953
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_CANNOT_ACCESS_ATTRIBUTES" /* CANNOT_ACCESS_ATTRIBUTES */, {
|
|
2733
2954
|
token: node.token,
|
|
2734
2955
|
data: { type: left.type }
|
|
2735
2956
|
});
|
|
@@ -2752,13 +2973,13 @@ var _Interpreter = class _Interpreter {
|
|
|
2752
2973
|
while (true) {
|
|
2753
2974
|
iterations++;
|
|
2754
2975
|
if (iterations > this.config.languageOptions.MAX_ITERATIONS) {
|
|
2755
|
-
throw new
|
|
2976
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_MAX_ITERATIONS_EXCEEDED" /* MAX_ITERATIONS_EXCEEDED */, {
|
|
2756
2977
|
token: node.token
|
|
2757
2978
|
});
|
|
2758
2979
|
}
|
|
2759
2980
|
const conditionNode = this.visit(node.condition);
|
|
2760
|
-
if (!(conditionNode instanceof
|
|
2761
|
-
throw new
|
|
2981
|
+
if (!(conditionNode instanceof chunkLMGHS2NP_cjs.BooleanSymbol)) {
|
|
2982
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_WHILE_CONDITION_NOT_BOOLEAN" /* WHILE_CONDITION_NOT_BOOLEAN */, {
|
|
2762
2983
|
token: node.condition?.token
|
|
2763
2984
|
});
|
|
2764
2985
|
}
|
|
@@ -2768,28 +2989,28 @@ var _Interpreter = class _Interpreter {
|
|
|
2768
2989
|
}
|
|
2769
2990
|
visitForEachNode(node) {
|
|
2770
2991
|
if (this.symbolTable.isDefined(node.itemVar)) {
|
|
2771
|
-
throw new
|
|
2992
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_FOR_EACH_VARIABLE_SHADOW" /* FOR_EACH_VARIABLE_SHADOW */, {
|
|
2772
2993
|
token: node.token,
|
|
2773
2994
|
data: { name: node.itemVar }
|
|
2774
2995
|
});
|
|
2775
2996
|
}
|
|
2776
2997
|
if (node.indexVar !== null) {
|
|
2777
2998
|
if (node.indexVar === node.itemVar) {
|
|
2778
|
-
throw new
|
|
2999
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_FOR_EACH_DUPLICATE_VARS" /* FOR_EACH_DUPLICATE_VARS */, {
|
|
2779
3000
|
token: node.token,
|
|
2780
3001
|
data: { name: node.itemVar }
|
|
2781
3002
|
});
|
|
2782
3003
|
}
|
|
2783
3004
|
if (this.symbolTable.isDefined(node.indexVar)) {
|
|
2784
|
-
throw new
|
|
3005
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_FOR_EACH_VARIABLE_SHADOW" /* FOR_EACH_VARIABLE_SHADOW */, {
|
|
2785
3006
|
token: node.token,
|
|
2786
3007
|
data: { name: node.indexVar }
|
|
2787
3008
|
});
|
|
2788
3009
|
}
|
|
2789
3010
|
}
|
|
2790
3011
|
const collectionVal = this.visit(node.collection);
|
|
2791
|
-
if (!(collectionVal instanceof
|
|
2792
|
-
throw new
|
|
3012
|
+
if (!(collectionVal instanceof chunkLMGHS2NP_cjs.ListSymbol)) {
|
|
3013
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_FOR_EACH_NOT_LIST" /* FOR_EACH_NOT_LIST */, {
|
|
2793
3014
|
token: node.token,
|
|
2794
3015
|
data: { actualType: collectionVal?.type ?? "null" }
|
|
2795
3016
|
});
|
|
@@ -2800,7 +3021,7 @@ var _Interpreter = class _Interpreter {
|
|
|
2800
3021
|
const item = elements[idx];
|
|
2801
3022
|
this.symbolTable.set(node.itemVar, item);
|
|
2802
3023
|
if (node.indexVar !== null) {
|
|
2803
|
-
this.symbolTable.set(node.indexVar, new
|
|
3024
|
+
this.symbolTable.set(node.indexVar, new chunkLMGHS2NP_cjs.NumberSymbol(idx, this.config));
|
|
2804
3025
|
}
|
|
2805
3026
|
let bodyResult = null;
|
|
2806
3027
|
try {
|
|
@@ -2815,19 +3036,19 @@ var _Interpreter = class _Interpreter {
|
|
|
2815
3036
|
}
|
|
2816
3037
|
throw e;
|
|
2817
3038
|
}
|
|
2818
|
-
results.push(bodyResult ?? new
|
|
3039
|
+
results.push(bodyResult ?? new chunkLMGHS2NP_cjs.NullSymbol(this.config));
|
|
2819
3040
|
}
|
|
2820
3041
|
this.symbolTable.delete(node.itemVar);
|
|
2821
3042
|
if (node.indexVar !== null) {
|
|
2822
3043
|
this.symbolTable.delete(node.indexVar);
|
|
2823
3044
|
}
|
|
2824
|
-
return new
|
|
3045
|
+
return new chunkLMGHS2NP_cjs.ListSymbol(results, false, this.config);
|
|
2825
3046
|
}
|
|
2826
3047
|
visitIfNode(node) {
|
|
2827
3048
|
for (const conditionNode of node.conditions) {
|
|
2828
3049
|
const condition = this.visit(conditionNode.condition);
|
|
2829
|
-
if (!(condition instanceof
|
|
2830
|
-
throw new
|
|
3050
|
+
if (!(condition instanceof chunkLMGHS2NP_cjs.BooleanSymbol)) {
|
|
3051
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_IF_CONDITION_NOT_BOOLEAN" /* IF_CONDITION_NOT_BOOLEAN */, {
|
|
2831
3052
|
token: conditionNode.condition.token
|
|
2832
3053
|
});
|
|
2833
3054
|
}
|
|
@@ -2852,20 +3073,20 @@ var _Interpreter = class _Interpreter {
|
|
|
2852
3073
|
} else if (e instanceof Error) {
|
|
2853
3074
|
throw e;
|
|
2854
3075
|
} else {
|
|
2855
|
-
throw new
|
|
3076
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("INT_UNKNOWN_ERROR" /* UNKNOWN_ERROR */);
|
|
2856
3077
|
}
|
|
2857
3078
|
}
|
|
2858
3079
|
return result;
|
|
2859
3080
|
}
|
|
2860
3081
|
};
|
|
2861
|
-
|
|
3082
|
+
chunkLEYHQJTL_cjs.__name(_Interpreter, "Interpreter");
|
|
2862
3083
|
var Interpreter = _Interpreter;
|
|
2863
3084
|
|
|
2864
3085
|
// src/processor/errors.ts
|
|
2865
3086
|
function createDependencyError(tokenName, dependencyName, originalError) {
|
|
2866
3087
|
const { chain, rootError } = extractDependencyInfo(tokenName, dependencyName, originalError);
|
|
2867
3088
|
const chainStr = chain.join(" \u2192 ");
|
|
2868
|
-
return new
|
|
3089
|
+
return new chunkLMGHS2NP_cjs.ProcessorError("PROC_DEPENDENCY_ERROR" /* DEPENDENCY_ERROR */, {
|
|
2869
3090
|
data: {
|
|
2870
3091
|
tokenName,
|
|
2871
3092
|
chain: chainStr,
|
|
@@ -2873,9 +3094,9 @@ function createDependencyError(tokenName, dependencyName, originalError) {
|
|
|
2873
3094
|
}
|
|
2874
3095
|
});
|
|
2875
3096
|
}
|
|
2876
|
-
|
|
3097
|
+
chunkLEYHQJTL_cjs.__name(createDependencyError, "createDependencyError");
|
|
2877
3098
|
function extractDependencyInfo(tokenName, dependencyName, error) {
|
|
2878
|
-
if (error instanceof
|
|
3099
|
+
if (error instanceof chunkLMGHS2NP_cjs.ProcessorError && error.code === "PROC_DEPENDENCY_ERROR" /* DEPENDENCY_ERROR */ && error.data.chain) {
|
|
2879
3100
|
const existingChain = String(error.data.chain).split(" \u2192 ");
|
|
2880
3101
|
return {
|
|
2881
3102
|
chain: [tokenName, ...existingChain],
|
|
@@ -2887,7 +3108,7 @@ function extractDependencyInfo(tokenName, dependencyName, error) {
|
|
|
2887
3108
|
rootError: error
|
|
2888
3109
|
};
|
|
2889
3110
|
}
|
|
2890
|
-
|
|
3111
|
+
chunkLEYHQJTL_cjs.__name(extractDependencyInfo, "extractDependencyInfo");
|
|
2891
3112
|
|
|
2892
3113
|
// src/processor/resolver/TokenInterpreter.ts
|
|
2893
3114
|
var _TokenInterpreter = class _TokenInterpreter {
|
|
@@ -2917,14 +3138,14 @@ var _TokenInterpreter = class _TokenInterpreter {
|
|
|
2917
3138
|
if (result !== null && typeof result !== "string") {
|
|
2918
3139
|
this.parsedConstants.set(name, result);
|
|
2919
3140
|
} else if (typeof result === "string") {
|
|
2920
|
-
this.parsedConstants.set(name,
|
|
3141
|
+
this.parsedConstants.set(name, chunkLMGHS2NP_cjs.jsValueToSymbolType(result, this.config));
|
|
2921
3142
|
}
|
|
2922
3143
|
}
|
|
2923
3144
|
} catch {
|
|
2924
|
-
this.parsedConstants.set(name,
|
|
3145
|
+
this.parsedConstants.set(name, chunkLMGHS2NP_cjs.jsValueToSymbolType(rawValue, this.config));
|
|
2925
3146
|
}
|
|
2926
3147
|
} else {
|
|
2927
|
-
this.parsedConstants.set(name,
|
|
3148
|
+
this.parsedConstants.set(name, chunkLMGHS2NP_cjs.jsValueToSymbolType(rawValue, this.config));
|
|
2928
3149
|
}
|
|
2929
3150
|
}
|
|
2930
3151
|
}
|
|
@@ -2955,7 +3176,7 @@ var _TokenInterpreter = class _TokenInterpreter {
|
|
|
2955
3176
|
this.interpreter.setAst(ast);
|
|
2956
3177
|
return this.interpreter.interpret();
|
|
2957
3178
|
} catch (error) {
|
|
2958
|
-
if (
|
|
3179
|
+
if (chunkLMGHS2NP_cjs.isLanguageError(error)) {
|
|
2959
3180
|
return error;
|
|
2960
3181
|
}
|
|
2961
3182
|
return new Error("Unknown error during token interpretation", { cause: error });
|
|
@@ -2968,7 +3189,7 @@ var _TokenInterpreter = class _TokenInterpreter {
|
|
|
2968
3189
|
return createDependencyError(tokenName, dep, depValue);
|
|
2969
3190
|
}
|
|
2970
3191
|
if (missingDependencies?.has(dep)) {
|
|
2971
|
-
const error = new
|
|
3192
|
+
const error = new chunkLMGHS2NP_cjs.ProcessorError("PROC_TOKEN_NOT_FOUND" /* TOKEN_NOT_FOUND */, {
|
|
2972
3193
|
data: { tokenName: dep }
|
|
2973
3194
|
});
|
|
2974
3195
|
return createDependencyError(tokenName, dep, error);
|
|
@@ -2977,7 +3198,7 @@ var _TokenInterpreter = class _TokenInterpreter {
|
|
|
2977
3198
|
return void 0;
|
|
2978
3199
|
}
|
|
2979
3200
|
flattenDictionaryToCache(tokenName, value) {
|
|
2980
|
-
if (!(value instanceof
|
|
3201
|
+
if (!(value instanceof chunkLMGHS2NP_cjs.DictionarySymbol) || !value.value) {
|
|
2981
3202
|
return [];
|
|
2982
3203
|
}
|
|
2983
3204
|
const flattenedNames = [];
|
|
@@ -3000,7 +3221,7 @@ var _TokenInterpreter = class _TokenInterpreter {
|
|
|
3000
3221
|
);
|
|
3001
3222
|
}
|
|
3002
3223
|
};
|
|
3003
|
-
|
|
3224
|
+
chunkLEYHQJTL_cjs.__name(_TokenInterpreter, "TokenInterpreter");
|
|
3004
3225
|
var TokenInterpreter = _TokenInterpreter;
|
|
3005
3226
|
|
|
3006
3227
|
// src/processor/object-parsers/default-object-parsers.ts
|
|
@@ -3016,29 +3237,29 @@ function parseValueToSymbol(value, config, parsers = defaultObjectParsers) {
|
|
|
3016
3237
|
return parser.toSymbol(value, config);
|
|
3017
3238
|
}
|
|
3018
3239
|
}
|
|
3019
|
-
return
|
|
3240
|
+
return chunkLMGHS2NP_cjs.jsValueToSymbolType(value, config);
|
|
3020
3241
|
}
|
|
3021
|
-
|
|
3242
|
+
chunkLEYHQJTL_cjs.__name(parseValueToSymbol, "parseValueToSymbol");
|
|
3022
3243
|
function createTokenSymbol(value, tokenType = "unknown", config, parsers = defaultObjectParsers, metadata) {
|
|
3023
|
-
if (
|
|
3244
|
+
if (chunkLMGHS2NP_cjs.isObject(value)) {
|
|
3024
3245
|
const symbolMap = {};
|
|
3025
3246
|
for (const [key, val] of Object.entries(value)) {
|
|
3026
3247
|
symbolMap[key] = parseValueToSymbol(val, config, parsers);
|
|
3027
3248
|
}
|
|
3028
|
-
return new
|
|
3249
|
+
return new chunkLMGHS2NP_cjs.TokenSymbol(tokenType, symbolMap, config, metadata);
|
|
3029
3250
|
}
|
|
3030
|
-
if (
|
|
3251
|
+
if (chunkLMGHS2NP_cjs.isArray(value)) {
|
|
3031
3252
|
const symbolArray = value.map((val) => parseValueToSymbol(val, config, parsers));
|
|
3032
|
-
return new
|
|
3253
|
+
return new chunkLMGHS2NP_cjs.TokenSymbol(tokenType, symbolArray, config, metadata);
|
|
3033
3254
|
}
|
|
3034
|
-
return new
|
|
3255
|
+
return new chunkLMGHS2NP_cjs.TokenSymbol(tokenType, value, config, metadata);
|
|
3035
3256
|
}
|
|
3036
|
-
|
|
3257
|
+
chunkLEYHQJTL_cjs.__name(createTokenSymbol, "createTokenSymbol");
|
|
3037
3258
|
function buildValueFromResolvedFields(currentPath, originalValue, resolvedFields, config, parsers = defaultObjectParsers) {
|
|
3038
3259
|
if (resolvedFields.has(currentPath)) {
|
|
3039
3260
|
return resolvedFields.get(currentPath);
|
|
3040
3261
|
}
|
|
3041
|
-
if (
|
|
3262
|
+
if (chunkLMGHS2NP_cjs.isObject(originalValue)) {
|
|
3042
3263
|
for (const parser of parsers) {
|
|
3043
3264
|
if (parser.predicate(originalValue)) {
|
|
3044
3265
|
return parser.toSymbol(originalValue, config);
|
|
@@ -3055,9 +3276,9 @@ function buildValueFromResolvedFields(currentPath, originalValue, resolvedFields
|
|
|
3055
3276
|
parsers
|
|
3056
3277
|
);
|
|
3057
3278
|
}
|
|
3058
|
-
return new
|
|
3279
|
+
return new chunkLMGHS2NP_cjs.DictionarySymbol(symbolMap, config);
|
|
3059
3280
|
}
|
|
3060
|
-
if (
|
|
3281
|
+
if (chunkLMGHS2NP_cjs.isArray(originalValue)) {
|
|
3061
3282
|
const symbolArray = [];
|
|
3062
3283
|
for (let i = 0; i < originalValue.length; i++) {
|
|
3063
3284
|
const fieldPath = `${currentPath}[${i}]`;
|
|
@@ -3065,13 +3286,13 @@ function buildValueFromResolvedFields(currentPath, originalValue, resolvedFields
|
|
|
3065
3286
|
buildValueFromResolvedFields(fieldPath, originalValue[i], resolvedFields, config, parsers)
|
|
3066
3287
|
);
|
|
3067
3288
|
}
|
|
3068
|
-
return new
|
|
3289
|
+
return new chunkLMGHS2NP_cjs.ListSymbol(symbolArray, false, config);
|
|
3069
3290
|
}
|
|
3070
3291
|
return parseValueToSymbol(originalValue, config, parsers);
|
|
3071
3292
|
}
|
|
3072
|
-
|
|
3293
|
+
chunkLEYHQJTL_cjs.__name(buildValueFromResolvedFields, "buildValueFromResolvedFields");
|
|
3073
3294
|
function createTokenSymbolFromResolvedFields(tokenName, resolvedFields, originalValue, tokenType = "unknown", config, parsers = defaultObjectParsers, metadata) {
|
|
3074
|
-
if (
|
|
3295
|
+
if (chunkLMGHS2NP_cjs.isObject(originalValue)) {
|
|
3075
3296
|
const symbolMap = {};
|
|
3076
3297
|
for (const [key, val] of Object.entries(originalValue)) {
|
|
3077
3298
|
const fieldPath = `${tokenName}.${key}`;
|
|
@@ -3083,9 +3304,9 @@ function createTokenSymbolFromResolvedFields(tokenName, resolvedFields, original
|
|
|
3083
3304
|
parsers
|
|
3084
3305
|
);
|
|
3085
3306
|
}
|
|
3086
|
-
return new
|
|
3307
|
+
return new chunkLMGHS2NP_cjs.TokenSymbol(tokenType, symbolMap, config, metadata);
|
|
3087
3308
|
}
|
|
3088
|
-
if (
|
|
3309
|
+
if (chunkLMGHS2NP_cjs.isArray(originalValue)) {
|
|
3089
3310
|
const symbolArray = [];
|
|
3090
3311
|
for (let i = 0; i < originalValue.length; i++) {
|
|
3091
3312
|
const fieldPath = `${tokenName}[${i}]`;
|
|
@@ -3093,11 +3314,11 @@ function createTokenSymbolFromResolvedFields(tokenName, resolvedFields, original
|
|
|
3093
3314
|
buildValueFromResolvedFields(fieldPath, originalValue[i], resolvedFields, config, parsers)
|
|
3094
3315
|
);
|
|
3095
3316
|
}
|
|
3096
|
-
return new
|
|
3317
|
+
return new chunkLMGHS2NP_cjs.TokenSymbol(tokenType, symbolArray, config, metadata);
|
|
3097
3318
|
}
|
|
3098
|
-
return new
|
|
3319
|
+
return new chunkLMGHS2NP_cjs.TokenSymbol(tokenType, originalValue, config, metadata);
|
|
3099
3320
|
}
|
|
3100
|
-
|
|
3321
|
+
chunkLEYHQJTL_cjs.__name(createTokenSymbolFromResolvedFields, "createTokenSymbolFromResolvedFields");
|
|
3101
3322
|
|
|
3102
3323
|
// src/processor/utils/DependencyGraph.ts
|
|
3103
3324
|
var _DependencyGraph = class _DependencyGraph {
|
|
@@ -3133,7 +3354,7 @@ var _DependencyGraph = class _DependencyGraph {
|
|
|
3133
3354
|
const visited = /* @__PURE__ */ new Set();
|
|
3134
3355
|
const recursionStack = /* @__PURE__ */ new Set();
|
|
3135
3356
|
const path = [];
|
|
3136
|
-
const dfs = /* @__PURE__ */
|
|
3357
|
+
const dfs = /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((node) => {
|
|
3137
3358
|
visited.add(node);
|
|
3138
3359
|
recursionStack.add(node);
|
|
3139
3360
|
path.push(node);
|
|
@@ -3203,28 +3424,43 @@ var _DependencyGraph = class _DependencyGraph {
|
|
|
3203
3424
|
}
|
|
3204
3425
|
const cycle = this.findCycle(remainingNodes);
|
|
3205
3426
|
const tokens = `${cycle.map((n) => String(n)).join(" \u2192 ")} \u2192 ${String(cycle[0])}`;
|
|
3206
|
-
throw new
|
|
3427
|
+
throw new chunkLMGHS2NP_cjs.ProcessorError("PROC_CIRCULAR_DEPENDENCY" /* CIRCULAR_DEPENDENCY */, {
|
|
3207
3428
|
data: { tokens }
|
|
3208
3429
|
});
|
|
3209
3430
|
}
|
|
3210
3431
|
return result;
|
|
3211
3432
|
}
|
|
3212
3433
|
};
|
|
3213
|
-
|
|
3434
|
+
chunkLEYHQJTL_cjs.__name(_DependencyGraph, "DependencyGraph");
|
|
3214
3435
|
var DependencyGraph = _DependencyGraph;
|
|
3215
3436
|
|
|
3437
|
+
// src/processor/utils/name-validation.ts
|
|
3438
|
+
var INVALID_TOKEN_NAME_CHARS = /[ \t\n\r\f{}[\]]/;
|
|
3439
|
+
function validateTokenName(name) {
|
|
3440
|
+
return name.length > 0 && !INVALID_TOKEN_NAME_CHARS.test(name);
|
|
3441
|
+
}
|
|
3442
|
+
chunkLEYHQJTL_cjs.__name(validateTokenName, "validateTokenName");
|
|
3443
|
+
function splitTokenPath(path) {
|
|
3444
|
+
return path.split(".");
|
|
3445
|
+
}
|
|
3446
|
+
chunkLEYHQJTL_cjs.__name(splitTokenPath, "splitTokenPath");
|
|
3447
|
+
function validateTokenPath(path) {
|
|
3448
|
+
return splitTokenPath(path).every(validateTokenName);
|
|
3449
|
+
}
|
|
3450
|
+
chunkLEYHQJTL_cjs.__name(validateTokenPath, "validateTokenPath");
|
|
3451
|
+
|
|
3216
3452
|
// src/processor/utils/structured-tokens.ts
|
|
3217
3453
|
function matchesObjectParser(value, parsers) {
|
|
3218
|
-
if (!
|
|
3454
|
+
if (!chunkLMGHS2NP_cjs.isObject(value)) return false;
|
|
3219
3455
|
return parsers.some((parser) => parser.predicate(value));
|
|
3220
3456
|
}
|
|
3221
|
-
|
|
3457
|
+
chunkLEYHQJTL_cjs.__name(matchesObjectParser, "matchesObjectParser");
|
|
3222
3458
|
function extractStringFields(value, parentPath, objectParsers = defaultObjectParsers) {
|
|
3223
3459
|
const result = /* @__PURE__ */ new Map();
|
|
3224
|
-
const processValue = /* @__PURE__ */
|
|
3225
|
-
if (
|
|
3460
|
+
const processValue = /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((val, path) => {
|
|
3461
|
+
if (chunkLMGHS2NP_cjs.isString(val)) {
|
|
3226
3462
|
result.set(path, val);
|
|
3227
|
-
} else if (
|
|
3463
|
+
} else if (chunkLMGHS2NP_cjs.isObject(val)) {
|
|
3228
3464
|
if (matchesObjectParser(val, objectParsers)) {
|
|
3229
3465
|
return;
|
|
3230
3466
|
}
|
|
@@ -3232,35 +3468,35 @@ function extractStringFields(value, parentPath, objectParsers = defaultObjectPar
|
|
|
3232
3468
|
for (const [nestedPath, nestedVal] of nested) {
|
|
3233
3469
|
result.set(nestedPath, nestedVal);
|
|
3234
3470
|
}
|
|
3235
|
-
} else if (
|
|
3471
|
+
} else if (chunkLMGHS2NP_cjs.isArray(val)) {
|
|
3236
3472
|
const nested = extractStringFields(val, path, objectParsers);
|
|
3237
3473
|
for (const [nestedPath, nestedVal] of nested) {
|
|
3238
3474
|
result.set(nestedPath, nestedVal);
|
|
3239
3475
|
}
|
|
3240
3476
|
}
|
|
3241
3477
|
}, "processValue");
|
|
3242
|
-
if (
|
|
3478
|
+
if (chunkLMGHS2NP_cjs.isObject(value)) {
|
|
3243
3479
|
for (const [key, val] of Object.entries(value)) {
|
|
3244
3480
|
processValue(val, `${parentPath}.${key}`);
|
|
3245
3481
|
}
|
|
3246
|
-
} else if (
|
|
3482
|
+
} else if (chunkLMGHS2NP_cjs.isArray(value)) {
|
|
3247
3483
|
for (let i = 0; i < value.length; i++) {
|
|
3248
3484
|
processValue(value[i], `${parentPath}[${i}]`);
|
|
3249
3485
|
}
|
|
3250
3486
|
}
|
|
3251
3487
|
return result;
|
|
3252
3488
|
}
|
|
3253
|
-
|
|
3489
|
+
chunkLEYHQJTL_cjs.__name(extractStringFields, "extractStringFields");
|
|
3254
3490
|
|
|
3255
3491
|
// src/processor/utils/tokens.ts
|
|
3256
3492
|
function getTokenValue(data) {
|
|
3257
|
-
return
|
|
3493
|
+
return chunkLMGHS2NP_cjs.isString(data) ? data : data.$value;
|
|
3258
3494
|
}
|
|
3259
|
-
|
|
3495
|
+
chunkLEYHQJTL_cjs.__name(getTokenValue, "getTokenValue");
|
|
3260
3496
|
function setTokenValue(value) {
|
|
3261
|
-
return
|
|
3497
|
+
return chunkLMGHS2NP_cjs.isString(value) ? { $value: value } : value;
|
|
3262
3498
|
}
|
|
3263
|
-
|
|
3499
|
+
chunkLEYHQJTL_cjs.__name(setTokenValue, "setTokenValue");
|
|
3264
3500
|
function flattenTokensObject(obj, prefixAccumulator = "") {
|
|
3265
3501
|
const result = /* @__PURE__ */ new Map();
|
|
3266
3502
|
for (const [prefix, value] of Object.entries(obj)) {
|
|
@@ -3268,9 +3504,9 @@ function flattenTokensObject(obj, prefixAccumulator = "") {
|
|
|
3268
3504
|
continue;
|
|
3269
3505
|
}
|
|
3270
3506
|
const path = prefixAccumulator ? `${prefixAccumulator}.${prefix}` : prefix;
|
|
3271
|
-
if (
|
|
3507
|
+
if (chunkLMGHS2NP_cjs.isObject(value)) {
|
|
3272
3508
|
const objValue = value;
|
|
3273
|
-
const tokenValue =
|
|
3509
|
+
const tokenValue = chunkLMGHS2NP_cjs.getKeyAlt(["$value", "value"], objValue);
|
|
3274
3510
|
if (tokenValue !== void 0) {
|
|
3275
3511
|
const tokenType = objValue.$type;
|
|
3276
3512
|
const tokenMetadata = objValue.$metadata;
|
|
@@ -3292,23 +3528,23 @@ function flattenTokensObject(obj, prefixAccumulator = "") {
|
|
|
3292
3528
|
}
|
|
3293
3529
|
return result;
|
|
3294
3530
|
}
|
|
3295
|
-
|
|
3531
|
+
chunkLEYHQJTL_cjs.__name(flattenTokensObject, "flattenTokensObject");
|
|
3296
3532
|
function normalizeToTokenData(value) {
|
|
3297
3533
|
if (typeof value === "string") {
|
|
3298
3534
|
return { $value: value };
|
|
3299
3535
|
}
|
|
3300
|
-
if (
|
|
3536
|
+
if (chunkLMGHS2NP_cjs.isObject(value) && "$value" in value) {
|
|
3301
3537
|
const obj = value;
|
|
3302
3538
|
const metadata = obj.$metadata;
|
|
3303
3539
|
return {
|
|
3304
3540
|
$value: obj.$value,
|
|
3305
|
-
...
|
|
3541
|
+
...chunkLMGHS2NP_cjs.isString(obj.$type) && { $type: obj.$type },
|
|
3306
3542
|
...metadata !== void 0 && { $metadata: metadata }
|
|
3307
3543
|
};
|
|
3308
3544
|
}
|
|
3309
3545
|
return { $value: value };
|
|
3310
3546
|
}
|
|
3311
|
-
|
|
3547
|
+
chunkLEYHQJTL_cjs.__name(normalizeToTokenData, "normalizeToTokenData");
|
|
3312
3548
|
function recordToMap(record) {
|
|
3313
3549
|
const map = /* @__PURE__ */ new Map();
|
|
3314
3550
|
for (const [key, value] of Object.entries(record)) {
|
|
@@ -3316,14 +3552,14 @@ function recordToMap(record) {
|
|
|
3316
3552
|
}
|
|
3317
3553
|
return map;
|
|
3318
3554
|
}
|
|
3319
|
-
|
|
3555
|
+
chunkLEYHQJTL_cjs.__name(recordToMap, "recordToMap");
|
|
3320
3556
|
function isNested(obj) {
|
|
3321
3557
|
return Object.keys(obj).some((key) => {
|
|
3322
3558
|
const value = obj[key];
|
|
3323
|
-
return
|
|
3559
|
+
return chunkLMGHS2NP_cjs.isObject(value) && !key.startsWith("$");
|
|
3324
3560
|
});
|
|
3325
3561
|
}
|
|
3326
|
-
|
|
3562
|
+
chunkLEYHQJTL_cjs.__name(isNested, "isNested");
|
|
3327
3563
|
|
|
3328
3564
|
// src/processor/validator/types.ts
|
|
3329
3565
|
var ValidationSeverity = /* @__PURE__ */ ((ValidationSeverity2) => {
|
|
@@ -3339,12 +3575,12 @@ function collectTypeValidationIssues(config, tokenName, tokenType, value) {
|
|
|
3339
3575
|
if (!config.tokenManager.getSpecByType(tokenType)) return [];
|
|
3340
3576
|
if (value === null || typeof value === "string") return [];
|
|
3341
3577
|
let valueToValidate;
|
|
3342
|
-
if (value instanceof
|
|
3578
|
+
if (value instanceof chunkLMGHS2NP_cjs.TokenSymbol) {
|
|
3343
3579
|
const innerValue = value.value;
|
|
3344
3580
|
if (Array.isArray(innerValue)) {
|
|
3345
|
-
valueToValidate = new
|
|
3581
|
+
valueToValidate = new chunkLMGHS2NP_cjs.ListSymbol(innerValue, false, config);
|
|
3346
3582
|
} else if (innerValue instanceof Map) {
|
|
3347
|
-
valueToValidate = new
|
|
3583
|
+
valueToValidate = new chunkLMGHS2NP_cjs.DictionarySymbol(innerValue, config);
|
|
3348
3584
|
} else {
|
|
3349
3585
|
valueToValidate = value;
|
|
3350
3586
|
}
|
|
@@ -3370,7 +3606,7 @@ function collectTypeValidationIssues(config, tokenName, tokenType, value) {
|
|
|
3370
3606
|
}
|
|
3371
3607
|
return issues;
|
|
3372
3608
|
}
|
|
3373
|
-
|
|
3609
|
+
chunkLEYHQJTL_cjs.__name(collectTypeValidationIssues, "collectTypeValidationIssues");
|
|
3374
3610
|
function parseFieldPath(fieldPath) {
|
|
3375
3611
|
const result = [];
|
|
3376
3612
|
let remaining = fieldPath;
|
|
@@ -3395,7 +3631,7 @@ function parseFieldPath(fieldPath) {
|
|
|
3395
3631
|
}
|
|
3396
3632
|
return result;
|
|
3397
3633
|
}
|
|
3398
|
-
|
|
3634
|
+
chunkLEYHQJTL_cjs.__name(parseFieldPath, "parseFieldPath");
|
|
3399
3635
|
function errorToValidationIssue(error, parentToken, path) {
|
|
3400
3636
|
return {
|
|
3401
3637
|
code: error.code,
|
|
@@ -3407,7 +3643,7 @@ function errorToValidationIssue(error, parentToken, path) {
|
|
|
3407
3643
|
data: error.data
|
|
3408
3644
|
};
|
|
3409
3645
|
}
|
|
3410
|
-
|
|
3646
|
+
chunkLEYHQJTL_cjs.__name(errorToValidationIssue, "errorToValidationIssue");
|
|
3411
3647
|
function getTokenDependencyGraph(tokenName, graph) {
|
|
3412
3648
|
const reverseDeps = /* @__PURE__ */ new Map();
|
|
3413
3649
|
const graphNodes = graph.getNodes();
|
|
@@ -3456,7 +3692,7 @@ function getTokenDependencyGraph(tokenName, graph) {
|
|
|
3456
3692
|
subgraph
|
|
3457
3693
|
};
|
|
3458
3694
|
}
|
|
3459
|
-
|
|
3695
|
+
chunkLEYHQJTL_cjs.__name(getTokenDependencyGraph, "getTokenDependencyGraph");
|
|
3460
3696
|
var _PrefixResolver = class _PrefixResolver {
|
|
3461
3697
|
constructor(params) {
|
|
3462
3698
|
this.params = params;
|
|
@@ -3508,10 +3744,10 @@ var _PrefixResolver = class _PrefixResolver {
|
|
|
3508
3744
|
this.addIssue(parentToken, issue);
|
|
3509
3745
|
}
|
|
3510
3746
|
ensureLanguageError(error) {
|
|
3511
|
-
if (
|
|
3747
|
+
if (chunkLMGHS2NP_cjs.isLanguageError(error)) {
|
|
3512
3748
|
return error;
|
|
3513
3749
|
}
|
|
3514
|
-
return new
|
|
3750
|
+
return new chunkLMGHS2NP_cjs.ProcessorError("PROC_UNKNOWN_PARSING_ERROR" /* UNKNOWN_PARSING_ERROR */, {
|
|
3515
3751
|
data: { error: error.message }
|
|
3516
3752
|
});
|
|
3517
3753
|
}
|
|
@@ -3559,12 +3795,12 @@ var _PrefixResolver = class _PrefixResolver {
|
|
|
3559
3795
|
try {
|
|
3560
3796
|
return parseExpression(value);
|
|
3561
3797
|
} catch (error) {
|
|
3562
|
-
if (
|
|
3798
|
+
if (chunkLMGHS2NP_cjs.isLanguageError(error)) {
|
|
3563
3799
|
return this.resolveError(refPath, error, value);
|
|
3564
3800
|
}
|
|
3565
3801
|
return this.resolveError(
|
|
3566
3802
|
refPath,
|
|
3567
|
-
new
|
|
3803
|
+
new chunkLMGHS2NP_cjs.ProcessorError("PROC_UNKNOWN_PARSING_ERROR" /* UNKNOWN_PARSING_ERROR */, {
|
|
3568
3804
|
data: { error: error instanceof Error ? error.message : String(error) }
|
|
3569
3805
|
}),
|
|
3570
3806
|
value
|
|
@@ -3650,25 +3886,34 @@ var _PrefixResolver = class _PrefixResolver {
|
|
|
3650
3886
|
parseAndBuildGraph() {
|
|
3651
3887
|
this.earlyResolved = [];
|
|
3652
3888
|
for (const [tokenName, tokenData] of this.tokens.entries()) {
|
|
3889
|
+
if (!validateTokenPath(tokenName)) {
|
|
3890
|
+
this.addIssue(tokenName, {
|
|
3891
|
+
code: "INVALID_TOKEN_NAME",
|
|
3892
|
+
severity: "error" /* ERROR */,
|
|
3893
|
+
message: `token "${tokenName}" contains invalid characters in name (spaces, braces, or brackets are not allowed)`,
|
|
3894
|
+
tokenName,
|
|
3895
|
+
data: { path: tokenName }
|
|
3896
|
+
});
|
|
3897
|
+
}
|
|
3653
3898
|
const tokenValue = getTokenValue(tokenData);
|
|
3654
|
-
if (
|
|
3655
|
-
const symbol = new
|
|
3899
|
+
if (chunkLMGHS2NP_cjs.isString(tokenValue) && chunkLEYHQJTL_cjs.UNINTERPRETED_KEYWORDS.includes(tokenValue)) {
|
|
3900
|
+
const symbol = new chunkLMGHS2NP_cjs.StringSymbol(tokenValue, this.config);
|
|
3656
3901
|
this.earlyResolvePrimitiveToken(tokenName, symbol);
|
|
3657
3902
|
continue;
|
|
3658
3903
|
}
|
|
3659
|
-
if (
|
|
3660
|
-
this.earlyResolvePrimitiveToken(tokenName, new
|
|
3904
|
+
if (chunkLMGHS2NP_cjs.isNumber(tokenValue)) {
|
|
3905
|
+
this.earlyResolvePrimitiveToken(tokenName, new chunkLMGHS2NP_cjs.NumberSymbol(tokenValue, this.config));
|
|
3661
3906
|
continue;
|
|
3662
3907
|
}
|
|
3663
|
-
if (
|
|
3664
|
-
this.earlyResolvePrimitiveToken(tokenName, new
|
|
3908
|
+
if (chunkLMGHS2NP_cjs.isBoolean(tokenValue)) {
|
|
3909
|
+
this.earlyResolvePrimitiveToken(tokenName, new chunkLMGHS2NP_cjs.BooleanSymbol(tokenValue, this.config));
|
|
3665
3910
|
continue;
|
|
3666
3911
|
}
|
|
3667
|
-
if (
|
|
3668
|
-
this.earlyResolvePrimitiveToken(tokenName, new
|
|
3912
|
+
if (chunkLMGHS2NP_cjs.isNull(tokenValue)) {
|
|
3913
|
+
this.earlyResolvePrimitiveToken(tokenName, new chunkLMGHS2NP_cjs.NullSymbol(this.config));
|
|
3669
3914
|
continue;
|
|
3670
3915
|
}
|
|
3671
|
-
if (
|
|
3916
|
+
if (chunkLMGHS2NP_cjs.isObject(tokenValue) || chunkLMGHS2NP_cjs.isArray(tokenValue)) {
|
|
3672
3917
|
this.handleStructuredToken(tokenName, setTokenValue(tokenData));
|
|
3673
3918
|
continue;
|
|
3674
3919
|
}
|
|
@@ -3909,7 +4154,7 @@ var _PrefixResolver = class _PrefixResolver {
|
|
|
3909
4154
|
for (const [fieldPath] of stringFields) {
|
|
3910
4155
|
const fieldValue = this.resolved.get(fieldPath);
|
|
3911
4156
|
if (fieldValue === void 0) {
|
|
3912
|
-
const error = new
|
|
4157
|
+
const error = new chunkLMGHS2NP_cjs.ProcessorError("PROC_SUB_FIELD_NOT_RESOLVED" /* SUB_FIELD_NOT_RESOLVED */, {
|
|
3913
4158
|
data: { fieldPath }
|
|
3914
4159
|
});
|
|
3915
4160
|
this.resolved.set(tokenName, error);
|
|
@@ -3955,7 +4200,7 @@ var _PrefixResolver = class _PrefixResolver {
|
|
|
3955
4200
|
if (satisfied?.has(child) || this.referenceCache.has(child) || this.resolved.has(child)) {
|
|
3956
4201
|
continue;
|
|
3957
4202
|
}
|
|
3958
|
-
const error = parentValue instanceof Error ? createDependencyError(child, parent, parentValue) : new
|
|
4203
|
+
const error = parentValue instanceof Error ? createDependencyError(child, parent, parentValue) : new chunkLMGHS2NP_cjs.ProcessorError("PROC_TOKEN_NOT_FOUND" /* TOKEN_NOT_FOUND */, {
|
|
3959
4204
|
data: { tokenName: child }
|
|
3960
4205
|
});
|
|
3961
4206
|
this.resolved.set(child, error);
|
|
@@ -4054,9 +4299,9 @@ var _PrefixResolver = class _PrefixResolver {
|
|
|
4054
4299
|
tokenValueStr = String(getTokenValue(originalValue));
|
|
4055
4300
|
}
|
|
4056
4301
|
const dependsOnMissing = tokensWithMissingDeps.has(tokenName);
|
|
4057
|
-
const error = dependsOnMissing ? new
|
|
4302
|
+
const error = dependsOnMissing ? new chunkLMGHS2NP_cjs.ProcessorError("PROC_TOKEN_NOT_FOUND" /* TOKEN_NOT_FOUND */, {
|
|
4058
4303
|
data: { tokenName }
|
|
4059
|
-
}) : new
|
|
4304
|
+
}) : new chunkLMGHS2NP_cjs.ProcessorError("PROC_CIRCULAR_DEPENDENCY" /* CIRCULAR_DEPENDENCY */, {
|
|
4060
4305
|
data: { tokens: tokenName }
|
|
4061
4306
|
});
|
|
4062
4307
|
this.resolved.set(tokenName, error);
|
|
@@ -4083,7 +4328,7 @@ var _PrefixResolver = class _PrefixResolver {
|
|
|
4083
4328
|
}
|
|
4084
4329
|
}
|
|
4085
4330
|
};
|
|
4086
|
-
|
|
4331
|
+
chunkLEYHQJTL_cjs.__name(_PrefixResolver, "PrefixResolver");
|
|
4087
4332
|
var PrefixResolver = _PrefixResolver;
|
|
4088
4333
|
var _TokenResolver = class _TokenResolver {
|
|
4089
4334
|
processTokens(tokens, callbacks, config, objectParsers) {
|
|
@@ -4111,7 +4356,7 @@ var _TokenResolver = class _TokenResolver {
|
|
|
4111
4356
|
*/
|
|
4112
4357
|
getTokenDependencyGraph(tokenName) {
|
|
4113
4358
|
if (!this.prefixResolver) {
|
|
4114
|
-
throw new
|
|
4359
|
+
throw new chunkLMGHS2NP_cjs.ProcessorError("PROC_RESOLVER_NOT_INITIALIZED" /* RESOLVER_NOT_INITIALIZED */);
|
|
4115
4360
|
}
|
|
4116
4361
|
const graph = this.prefixResolver.getGraph();
|
|
4117
4362
|
const reverseDeps = /* @__PURE__ */ new Map();
|
|
@@ -4164,10 +4409,10 @@ var _TokenResolver = class _TokenResolver {
|
|
|
4164
4409
|
build(tokens, config, objectParsers) {
|
|
4165
4410
|
const output = /* @__PURE__ */ new Map();
|
|
4166
4411
|
const callbacks = {
|
|
4167
|
-
onResolve: /* @__PURE__ */
|
|
4412
|
+
onResolve: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((tokenName, value) => {
|
|
4168
4413
|
output.set(tokenName, value);
|
|
4169
4414
|
}, "onResolve"),
|
|
4170
|
-
onError: /* @__PURE__ */
|
|
4415
|
+
onError: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((tokenName, _error, originalValue) => {
|
|
4171
4416
|
output.set(tokenName, originalValue);
|
|
4172
4417
|
}, "onError")
|
|
4173
4418
|
};
|
|
@@ -4197,7 +4442,7 @@ var _TokenResolver = class _TokenResolver {
|
|
|
4197
4442
|
}
|
|
4198
4443
|
ensureInitialized() {
|
|
4199
4444
|
if (!this.prefixResolver || !this.tokens) {
|
|
4200
|
-
throw new
|
|
4445
|
+
throw new chunkLMGHS2NP_cjs.ProcessorError("PROC_RESOLVER_NOT_INITIALIZED" /* RESOLVER_NOT_INITIALIZED */);
|
|
4201
4446
|
}
|
|
4202
4447
|
}
|
|
4203
4448
|
normalizeTokenPath(tokenPath) {
|
|
@@ -4206,17 +4451,17 @@ var _TokenResolver = class _TokenResolver {
|
|
|
4206
4451
|
createOutputCallbacks() {
|
|
4207
4452
|
const output = /* @__PURE__ */ new Map();
|
|
4208
4453
|
const callbacks = {
|
|
4209
|
-
onResolve: /* @__PURE__ */
|
|
4454
|
+
onResolve: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((name, value) => {
|
|
4210
4455
|
output.set(name, value);
|
|
4211
4456
|
}, "onResolve"),
|
|
4212
|
-
onError: /* @__PURE__ */
|
|
4457
|
+
onError: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((_name, _error) => {
|
|
4213
4458
|
}, "onError")
|
|
4214
4459
|
};
|
|
4215
4460
|
return { output, callbacks };
|
|
4216
4461
|
}
|
|
4217
4462
|
rebuildResolver(updatedTokens, callbacks, changedTokenPath) {
|
|
4218
4463
|
if (!this.prefixResolver) {
|
|
4219
|
-
throw new
|
|
4464
|
+
throw new chunkLMGHS2NP_cjs.ProcessorError("PROC_RESOLVER_NOT_INITIALIZED" /* RESOLVER_NOT_INITIALIZED */);
|
|
4220
4465
|
}
|
|
4221
4466
|
let dirtyTokens = null;
|
|
4222
4467
|
if (changedTokenPath) {
|
|
@@ -4255,24 +4500,24 @@ var _TokenResolver = class _TokenResolver {
|
|
|
4255
4500
|
updated: false
|
|
4256
4501
|
};
|
|
4257
4502
|
}
|
|
4258
|
-
throw new
|
|
4503
|
+
throw new chunkLMGHS2NP_cjs.ProcessorError("PROC_TOKEN_NOT_FOUND" /* TOKEN_NOT_FOUND */, {
|
|
4259
4504
|
data: { tokenName: prevPath }
|
|
4260
4505
|
});
|
|
4261
4506
|
}
|
|
4262
4507
|
const oldTokenData = this.tokens.get(prevPath);
|
|
4263
4508
|
if (!oldTokenData) {
|
|
4264
|
-
throw new
|
|
4509
|
+
throw new chunkLMGHS2NP_cjs.ProcessorError("PROC_TOKEN_NOT_FOUND" /* TOKEN_NOT_FOUND */, {
|
|
4265
4510
|
data: { tokenName: prevPath }
|
|
4266
4511
|
});
|
|
4267
4512
|
}
|
|
4268
4513
|
const isRename = newPath && newPath !== prevPath;
|
|
4269
4514
|
if (isRename && this.tokens.has(newPath)) {
|
|
4270
|
-
throw new
|
|
4515
|
+
throw new chunkLMGHS2NP_cjs.ProcessorError("PROC_TOKEN_ALREADY_EXISTS" /* TOKEN_ALREADY_EXISTS */, {
|
|
4271
4516
|
data: { tokenName: newPath }
|
|
4272
4517
|
});
|
|
4273
4518
|
}
|
|
4274
4519
|
if (!this.prefixResolver) {
|
|
4275
|
-
throw new
|
|
4520
|
+
throw new chunkLMGHS2NP_cjs.ProcessorError("PROC_RESOLVER_NOT_INITIALIZED" /* RESOLVER_NOT_INITIALIZED */);
|
|
4276
4521
|
}
|
|
4277
4522
|
const currentGraph = this.prefixResolver.getGraph();
|
|
4278
4523
|
const { tokens: affectedTokens } = getTokenDependencyGraph(prevPath, currentGraph);
|
|
@@ -4285,7 +4530,7 @@ var _TokenResolver = class _TokenResolver {
|
|
|
4285
4530
|
const dependentTokenData = updatedTokens.get(dependentToken);
|
|
4286
4531
|
if (!dependentTokenData) continue;
|
|
4287
4532
|
const dependentValue = getTokenValue(dependentTokenData);
|
|
4288
|
-
if (!
|
|
4533
|
+
if (!chunkLMGHS2NP_cjs.isString(dependentValue)) continue;
|
|
4289
4534
|
const ast = tokenInterpreter.getTokenAST(dependentToken);
|
|
4290
4535
|
if (!ast) continue;
|
|
4291
4536
|
const updatedValue = renameReferences(dependentValue, ast, renameMap);
|
|
@@ -4302,7 +4547,7 @@ var _TokenResolver = class _TokenResolver {
|
|
|
4302
4547
|
const { output, callbacks } = this.createOutputCallbacks();
|
|
4303
4548
|
const resolverResult = this.rebuildResolver(updatedTokens, callbacks, prevPath);
|
|
4304
4549
|
if (!this.prefixResolver) {
|
|
4305
|
-
throw new
|
|
4550
|
+
throw new chunkLMGHS2NP_cjs.ProcessorError("PROC_RESOLVER_NOT_INITIALIZED" /* RESOLVER_NOT_INITIALIZED */);
|
|
4306
4551
|
}
|
|
4307
4552
|
const { subgraph } = getTokenDependencyGraph(finalPath, this.prefixResolver.getGraph());
|
|
4308
4553
|
const resolvedValue = output.get(finalPath);
|
|
@@ -4319,7 +4564,7 @@ var _TokenResolver = class _TokenResolver {
|
|
|
4319
4564
|
const { tokenPath, tokenData } = params;
|
|
4320
4565
|
const normalizedTokenPath = this.normalizeTokenPath(tokenPath);
|
|
4321
4566
|
if (this.tokens?.has(normalizedTokenPath)) {
|
|
4322
|
-
throw new
|
|
4567
|
+
throw new chunkLMGHS2NP_cjs.ProcessorError("PROC_TOKEN_ALREADY_EXISTS" /* TOKEN_ALREADY_EXISTS */, {
|
|
4323
4568
|
data: { tokenName: normalizedTokenPath }
|
|
4324
4569
|
});
|
|
4325
4570
|
}
|
|
@@ -4329,7 +4574,7 @@ var _TokenResolver = class _TokenResolver {
|
|
|
4329
4574
|
const { output, callbacks } = this.createOutputCallbacks();
|
|
4330
4575
|
const resolverResult = this.rebuildResolver(updatedTokens, callbacks, normalizedTokenPath);
|
|
4331
4576
|
if (!this.prefixResolver) {
|
|
4332
|
-
throw new
|
|
4577
|
+
throw new chunkLMGHS2NP_cjs.ProcessorError("PROC_RESOLVER_NOT_INITIALIZED" /* RESOLVER_NOT_INITIALIZED */);
|
|
4333
4578
|
}
|
|
4334
4579
|
const { subgraph } = getTokenDependencyGraph(
|
|
4335
4580
|
normalizedTokenPath,
|
|
@@ -4349,12 +4594,12 @@ var _TokenResolver = class _TokenResolver {
|
|
|
4349
4594
|
const { tokenPath } = params;
|
|
4350
4595
|
const normalizedTokenPath = this.normalizeTokenPath(tokenPath);
|
|
4351
4596
|
if (!this.tokens?.has(normalizedTokenPath)) {
|
|
4352
|
-
throw new
|
|
4597
|
+
throw new chunkLMGHS2NP_cjs.ProcessorError("PROC_TOKEN_NOT_FOUND" /* TOKEN_NOT_FOUND */, {
|
|
4353
4598
|
data: { tokenName: normalizedTokenPath }
|
|
4354
4599
|
});
|
|
4355
4600
|
}
|
|
4356
4601
|
if (!this.prefixResolver) {
|
|
4357
|
-
throw new
|
|
4602
|
+
throw new chunkLMGHS2NP_cjs.ProcessorError("PROC_RESOLVER_NOT_INITIALIZED" /* RESOLVER_NOT_INITIALIZED */);
|
|
4358
4603
|
}
|
|
4359
4604
|
const currentGraph = this.prefixResolver.getGraph();
|
|
4360
4605
|
const { subgraph } = getTokenDependencyGraph(normalizedTokenPath, currentGraph);
|
|
@@ -4388,7 +4633,7 @@ var _TokenResolver = class _TokenResolver {
|
|
|
4388
4633
|
resolveValue(params) {
|
|
4389
4634
|
this.ensureInitialized();
|
|
4390
4635
|
if (!this.prefixResolver) {
|
|
4391
|
-
throw new
|
|
4636
|
+
throw new chunkLMGHS2NP_cjs.ProcessorError("PROC_RESOLVER_NOT_INITIALIZED" /* RESOLVER_NOT_INITIALIZED */);
|
|
4392
4637
|
}
|
|
4393
4638
|
const { value, type, validate } = params;
|
|
4394
4639
|
const issues = [];
|
|
@@ -4401,7 +4646,7 @@ var _TokenResolver = class _TokenResolver {
|
|
|
4401
4646
|
const result = parseExpression(valueStr);
|
|
4402
4647
|
ast = result.ast;
|
|
4403
4648
|
} catch (error) {
|
|
4404
|
-
if (
|
|
4649
|
+
if (chunkLMGHS2NP_cjs.isLanguageError(error)) {
|
|
4405
4650
|
issues.push(error);
|
|
4406
4651
|
return { resolved: null, issues };
|
|
4407
4652
|
}
|
|
@@ -4413,7 +4658,7 @@ var _TokenResolver = class _TokenResolver {
|
|
|
4413
4658
|
const tokenInterpreter = this.prefixResolver.getTokenInterpreter();
|
|
4414
4659
|
const resolved = tokenInterpreter.interpretTokenWithAST("\0__preview__", ast);
|
|
4415
4660
|
if (resolved instanceof Error) {
|
|
4416
|
-
if (
|
|
4661
|
+
if (chunkLMGHS2NP_cjs.isLanguageError(resolved)) {
|
|
4417
4662
|
issues.push(resolved);
|
|
4418
4663
|
}
|
|
4419
4664
|
return { resolved: null, issues };
|
|
@@ -4424,7 +4669,7 @@ var _TokenResolver = class _TokenResolver {
|
|
|
4424
4669
|
return { resolved, issues };
|
|
4425
4670
|
}
|
|
4426
4671
|
};
|
|
4427
|
-
|
|
4672
|
+
chunkLEYHQJTL_cjs.__name(_TokenResolver, "TokenResolver");
|
|
4428
4673
|
var TokenResolver = _TokenResolver;
|
|
4429
4674
|
|
|
4430
4675
|
// src/processor/builders/MapBuilder.ts
|
|
@@ -4448,7 +4693,7 @@ var _MapBuilder = class _MapBuilder {
|
|
|
4448
4693
|
return this.successfullyResolved;
|
|
4449
4694
|
}
|
|
4450
4695
|
};
|
|
4451
|
-
|
|
4696
|
+
chunkLEYHQJTL_cjs.__name(_MapBuilder, "MapBuilder");
|
|
4452
4697
|
var MapBuilder = _MapBuilder;
|
|
4453
4698
|
|
|
4454
4699
|
// src/processor/builders/base.ts
|
|
@@ -4480,29 +4725,29 @@ function buildTokens(tokens, options) {
|
|
|
4480
4725
|
resolver: result.resolver
|
|
4481
4726
|
};
|
|
4482
4727
|
}
|
|
4483
|
-
|
|
4728
|
+
chunkLEYHQJTL_cjs.__name(buildTokens, "buildTokens");
|
|
4484
4729
|
|
|
4485
4730
|
// src/processor/builders/flatten.ts
|
|
4486
4731
|
function flattenChildrenObject(result, prefix, callback) {
|
|
4487
|
-
if (result instanceof
|
|
4732
|
+
if (result instanceof chunkLMGHS2NP_cjs.DictionarySymbol) {
|
|
4488
4733
|
flattenChildrenMap(result.value, prefix, callback);
|
|
4489
4734
|
}
|
|
4490
4735
|
}
|
|
4491
|
-
|
|
4736
|
+
chunkLEYHQJTL_cjs.__name(flattenChildrenObject, "flattenChildrenObject");
|
|
4492
4737
|
function flattenChildrenMap(map, prefix, callback) {
|
|
4493
4738
|
for (const [key, value] of map.entries()) {
|
|
4494
4739
|
const newKey = `${prefix}.${key}`;
|
|
4495
4740
|
if (typeof value === "undefined") {
|
|
4496
4741
|
continue;
|
|
4497
4742
|
}
|
|
4498
|
-
if (value instanceof
|
|
4743
|
+
if (value instanceof chunkLMGHS2NP_cjs.DictionarySymbol) {
|
|
4499
4744
|
flattenChildrenMap(value.value, newKey, callback);
|
|
4500
4745
|
} else {
|
|
4501
4746
|
callback(newKey, value);
|
|
4502
4747
|
}
|
|
4503
4748
|
}
|
|
4504
4749
|
}
|
|
4505
|
-
|
|
4750
|
+
chunkLEYHQJTL_cjs.__name(flattenChildrenMap, "flattenChildrenMap");
|
|
4506
4751
|
|
|
4507
4752
|
// src/processor/builders/ObjectBuilder.ts
|
|
4508
4753
|
function setNestedValue(target, path, value) {
|
|
@@ -4518,20 +4763,20 @@ function setNestedValue(target, path, value) {
|
|
|
4518
4763
|
cursor[key] = value;
|
|
4519
4764
|
return;
|
|
4520
4765
|
}
|
|
4521
|
-
if (!
|
|
4766
|
+
if (!chunkLMGHS2NP_cjs.isObject(cursor[key])) {
|
|
4522
4767
|
cursor[key] = {};
|
|
4523
4768
|
}
|
|
4524
4769
|
cursor = cursor[key];
|
|
4525
4770
|
}
|
|
4526
4771
|
}
|
|
4527
|
-
|
|
4772
|
+
chunkLEYHQJTL_cjs.__name(setNestedValue, "setNestedValue");
|
|
4528
4773
|
var _NestedObjectBuilder = class _NestedObjectBuilder {
|
|
4529
4774
|
constructor() {
|
|
4530
4775
|
this.name = "nested";
|
|
4531
4776
|
this.result = {};
|
|
4532
4777
|
}
|
|
4533
4778
|
onResolve(tokenName, value) {
|
|
4534
|
-
const serialized =
|
|
4779
|
+
const serialized = chunkLMGHS2NP_cjs.serializeInterpreterResult(value, { stringify: true });
|
|
4535
4780
|
if (typeof serialized !== "undefined") {
|
|
4536
4781
|
setNestedValue(this.result, tokenName, serialized);
|
|
4537
4782
|
}
|
|
@@ -4543,7 +4788,7 @@ var _NestedObjectBuilder = class _NestedObjectBuilder {
|
|
|
4543
4788
|
return this.result;
|
|
4544
4789
|
}
|
|
4545
4790
|
};
|
|
4546
|
-
|
|
4791
|
+
chunkLEYHQJTL_cjs.__name(_NestedObjectBuilder, "NestedObjectBuilder");
|
|
4547
4792
|
var NestedObjectBuilder = _NestedObjectBuilder;
|
|
4548
4793
|
var _FlatObjectBuilder = class _FlatObjectBuilder {
|
|
4549
4794
|
constructor() {
|
|
@@ -4554,10 +4799,10 @@ var _FlatObjectBuilder = class _FlatObjectBuilder {
|
|
|
4554
4799
|
let didFlatten = false;
|
|
4555
4800
|
flattenChildrenObject(value, tokenName, (key, val) => {
|
|
4556
4801
|
didFlatten = true;
|
|
4557
|
-
this.result[key] =
|
|
4802
|
+
this.result[key] = chunkLMGHS2NP_cjs.serializeInterpreterResult(val, { stringify: true });
|
|
4558
4803
|
});
|
|
4559
4804
|
if (!didFlatten) {
|
|
4560
|
-
const serialized =
|
|
4805
|
+
const serialized = chunkLMGHS2NP_cjs.serializeInterpreterResult(value, { stringify: true });
|
|
4561
4806
|
if (typeof serialized !== "undefined") {
|
|
4562
4807
|
this.result[tokenName] = serialized;
|
|
4563
4808
|
}
|
|
@@ -4570,24 +4815,24 @@ var _FlatObjectBuilder = class _FlatObjectBuilder {
|
|
|
4570
4815
|
return this.result;
|
|
4571
4816
|
}
|
|
4572
4817
|
};
|
|
4573
|
-
|
|
4818
|
+
chunkLEYHQJTL_cjs.__name(_FlatObjectBuilder, "FlatObjectBuilder");
|
|
4574
4819
|
var FlatObjectBuilder = _FlatObjectBuilder;
|
|
4575
4820
|
|
|
4576
4821
|
// src/processor/builders/StringMapBuilder.ts
|
|
4577
4822
|
var _StringMapBuilder = class _StringMapBuilder extends MapBuilder {
|
|
4578
4823
|
onResolve(tokenName, value) {
|
|
4579
4824
|
super.onResolve(tokenName, value);
|
|
4580
|
-
this.result.set(tokenName,
|
|
4825
|
+
this.result.set(tokenName, chunkLMGHS2NP_cjs.stringifyInterpreterResult(value));
|
|
4581
4826
|
}
|
|
4582
4827
|
getResult() {
|
|
4583
4828
|
const stringMap = /* @__PURE__ */ new Map();
|
|
4584
4829
|
for (const [key, value] of this.result.entries()) {
|
|
4585
|
-
stringMap.set(key, typeof value === "string" ? value :
|
|
4830
|
+
stringMap.set(key, typeof value === "string" ? value : chunkLMGHS2NP_cjs.stringifyInterpreterResult(value));
|
|
4586
4831
|
}
|
|
4587
4832
|
return stringMap;
|
|
4588
4833
|
}
|
|
4589
4834
|
};
|
|
4590
|
-
|
|
4835
|
+
chunkLEYHQJTL_cjs.__name(_StringMapBuilder, "StringMapBuilder");
|
|
4591
4836
|
var StringMapBuilder = _StringMapBuilder;
|
|
4592
4837
|
var TokenSetStatus = schemaValidation.z.enum(["enabled", "source"]);
|
|
4593
4838
|
var SelectedTokenSetsObjectSchema = schemaValidation.z.record(schemaValidation.z.string(), TokenSetStatus);
|
|
@@ -4609,13 +4854,13 @@ var ThemeSchema = schemaValidation.z.object({
|
|
|
4609
4854
|
group: schemaValidation.z.string().optional()
|
|
4610
4855
|
});
|
|
4611
4856
|
var ThemesArraySchema = schemaValidation.z.array(ThemeSchema);
|
|
4612
|
-
var selectTheme = /* @__PURE__ */
|
|
4857
|
+
var selectTheme = /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((themes, themeName) => {
|
|
4613
4858
|
return themes.find((theme) => theme.name === themeName);
|
|
4614
4859
|
}, "selectTheme");
|
|
4615
|
-
var resolveThemes = /* @__PURE__ */
|
|
4860
|
+
var resolveThemes = /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((jsonFiles) => {
|
|
4616
4861
|
const themesFile = jsonFiles.$themes;
|
|
4617
4862
|
if (themesFile) {
|
|
4618
|
-
if (
|
|
4863
|
+
if (chunkLMGHS2NP_cjs.isObject(themesFile) && "$themes" in themesFile) {
|
|
4619
4864
|
const inner = ThemesArraySchema.safeParse(themesFile.$themes);
|
|
4620
4865
|
if (inner.success) {
|
|
4621
4866
|
return ["$themes", inner.data];
|
|
@@ -4628,7 +4873,7 @@ var resolveThemes = /* @__PURE__ */ chunkQYRJ6NSL_cjs.__name((jsonFiles) => {
|
|
|
4628
4873
|
}
|
|
4629
4874
|
return void 0;
|
|
4630
4875
|
}, "resolveThemes");
|
|
4631
|
-
var extractSetNames = /* @__PURE__ */
|
|
4876
|
+
var extractSetNames = /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((selectedTokenSets) => {
|
|
4632
4877
|
if (Array.isArray(selectedTokenSets)) {
|
|
4633
4878
|
return selectedTokenSets.map((set) => set.id);
|
|
4634
4879
|
}
|
|
@@ -4641,14 +4886,14 @@ function determineSets(jsonFiles, activeSets, activeTheme) {
|
|
|
4641
4886
|
if (activeTheme) {
|
|
4642
4887
|
const resolved = resolveThemes(jsonFiles);
|
|
4643
4888
|
if (!resolved) {
|
|
4644
|
-
throw new
|
|
4889
|
+
throw new chunkLMGHS2NP_cjs.ProcessorError("PROC_NO_THEMES_FOUND" /* NO_THEMES_FOUND */, {
|
|
4645
4890
|
data: { themeName: activeTheme }
|
|
4646
4891
|
});
|
|
4647
4892
|
}
|
|
4648
4893
|
const [, themes] = resolved;
|
|
4649
4894
|
const theme = selectTheme(themes, activeTheme);
|
|
4650
4895
|
if (!theme) {
|
|
4651
|
-
throw new
|
|
4896
|
+
throw new chunkLMGHS2NP_cjs.ProcessorError("PROC_THEME_NOT_FOUND" /* THEME_NOT_FOUND */, {
|
|
4652
4897
|
data: {
|
|
4653
4898
|
themeName: activeTheme,
|
|
4654
4899
|
availableThemes: themes.map((t) => t.name)
|
|
@@ -4662,18 +4907,18 @@ function determineSets(jsonFiles, activeSets, activeTheme) {
|
|
|
4662
4907
|
return keys;
|
|
4663
4908
|
}
|
|
4664
4909
|
if (keys.length > 1) {
|
|
4665
|
-
throw new
|
|
4910
|
+
throw new chunkLMGHS2NP_cjs.ProcessorError("PROC_MULTIPLE_SETS_NO_SELECTION" /* MULTIPLE_SETS_NO_SELECTION */, {
|
|
4666
4911
|
data: { setNames: keys }
|
|
4667
4912
|
});
|
|
4668
4913
|
}
|
|
4669
|
-
throw new
|
|
4914
|
+
throw new chunkLMGHS2NP_cjs.ProcessorError("PROC_NO_SETS_TO_PROCESS" /* NO_SETS_TO_PROCESS */);
|
|
4670
4915
|
}
|
|
4671
|
-
|
|
4916
|
+
chunkLEYHQJTL_cjs.__name(determineSets, "determineSets");
|
|
4672
4917
|
function getSetTokens(setData) {
|
|
4673
4918
|
if (setData instanceof Map) {
|
|
4674
4919
|
return setData;
|
|
4675
4920
|
}
|
|
4676
|
-
if (!
|
|
4921
|
+
if (!chunkLMGHS2NP_cjs.isObject(setData)) {
|
|
4677
4922
|
return /* @__PURE__ */ new Map();
|
|
4678
4923
|
}
|
|
4679
4924
|
if (isNested(setData)) {
|
|
@@ -4681,7 +4926,7 @@ function getSetTokens(setData) {
|
|
|
4681
4926
|
}
|
|
4682
4927
|
return recordToMap(setData);
|
|
4683
4928
|
}
|
|
4684
|
-
|
|
4929
|
+
chunkLEYHQJTL_cjs.__name(getSetTokens, "getSetTokens");
|
|
4685
4930
|
function flattenToTokens(sets, setNames) {
|
|
4686
4931
|
const tokens = /* @__PURE__ */ new Map();
|
|
4687
4932
|
const entries = sets instanceof Map ? sets.entries() : setNames.map((name) => [name, sets[name]]);
|
|
@@ -4690,12 +4935,12 @@ function flattenToTokens(sets, setNames) {
|
|
|
4690
4935
|
tokens.set(key, normalizeToTokenData(setData));
|
|
4691
4936
|
} else {
|
|
4692
4937
|
if (!setData) {
|
|
4693
|
-
throw new
|
|
4938
|
+
throw new chunkLMGHS2NP_cjs.ProcessorError("PROC_TOKEN_SET_NOT_FOUND" /* TOKEN_SET_NOT_FOUND */, {
|
|
4694
4939
|
data: { setName: key }
|
|
4695
4940
|
});
|
|
4696
4941
|
}
|
|
4697
|
-
if (!
|
|
4698
|
-
throw new
|
|
4942
|
+
if (!chunkLMGHS2NP_cjs.isObject(setData) && !(setData instanceof Map)) {
|
|
4943
|
+
throw new chunkLMGHS2NP_cjs.ProcessorError("PROC_TOKEN_SET_INVALID" /* TOKEN_SET_INVALID */, {
|
|
4699
4944
|
data: { setName: key }
|
|
4700
4945
|
});
|
|
4701
4946
|
}
|
|
@@ -4707,29 +4952,29 @@ function flattenToTokens(sets, setNames) {
|
|
|
4707
4952
|
}
|
|
4708
4953
|
return tokens;
|
|
4709
4954
|
}
|
|
4710
|
-
|
|
4955
|
+
chunkLEYHQJTL_cjs.__name(flattenToTokens, "flattenToTokens");
|
|
4711
4956
|
|
|
4712
4957
|
// src/processor/process.ts
|
|
4713
4958
|
function processTokens(tokens, options) {
|
|
4714
4959
|
const tokenDataMap = tokens instanceof Map ? flattenToTokens(tokens, []) : flattenToTokens({ tokens }, ["tokens"]);
|
|
4715
4960
|
return buildTokens(tokenDataMap, options);
|
|
4716
4961
|
}
|
|
4717
|
-
|
|
4962
|
+
chunkLEYHQJTL_cjs.__name(processTokens, "processTokens");
|
|
4718
4963
|
function processTokenSets(normalizedFiles, options) {
|
|
4719
4964
|
const { activeSets, activeTheme } = options ?? {};
|
|
4720
4965
|
const setNames = determineSets(normalizedFiles, activeSets, activeTheme);
|
|
4721
4966
|
const tokens = flattenToTokens(normalizedFiles, setNames);
|
|
4722
4967
|
return buildTokens(tokens, options);
|
|
4723
4968
|
}
|
|
4724
|
-
|
|
4969
|
+
chunkLEYHQJTL_cjs.__name(processTokenSets, "processTokenSets");
|
|
4725
4970
|
|
|
4726
4971
|
// src/lib/errors.ts
|
|
4727
4972
|
var errorClasses = {
|
|
4728
|
-
LanguageError:
|
|
4729
|
-
LexerError:
|
|
4730
|
-
ParserError:
|
|
4731
|
-
InterpreterError:
|
|
4732
|
-
ProcessorError:
|
|
4973
|
+
LanguageError: chunkLMGHS2NP_cjs.LanguageError,
|
|
4974
|
+
LexerError: chunkLMGHS2NP_cjs.LexerError,
|
|
4975
|
+
ParserError: chunkLMGHS2NP_cjs.ParserError,
|
|
4976
|
+
InterpreterError: chunkLMGHS2NP_cjs.InterpreterError,
|
|
4977
|
+
ProcessorError: chunkLMGHS2NP_cjs.ProcessorError
|
|
4733
4978
|
};
|
|
4734
4979
|
var errorHelpers = {
|
|
4735
4980
|
createDependencyError
|
|
@@ -4746,16 +4991,16 @@ schemaValidation.Fn.specName;
|
|
|
4746
4991
|
function isPlainObject(v) {
|
|
4747
4992
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
4748
4993
|
}
|
|
4749
|
-
|
|
4994
|
+
chunkLEYHQJTL_cjs.__name(isPlainObject, "isPlainObject");
|
|
4750
4995
|
function summarizeZodError(err) {
|
|
4751
4996
|
return err.issues.map((i) => `${i.path.join(".") || "<root>"}: ${i.message}`).join("; ");
|
|
4752
4997
|
}
|
|
4753
|
-
|
|
4998
|
+
chunkLEYHQJTL_cjs.__name(summarizeZodError, "summarizeZodError");
|
|
4754
4999
|
function parseTokenScriptSchemaResponse(data) {
|
|
4755
5000
|
if (!isPlainObject(data)) {
|
|
4756
5001
|
throw new Error("Invalid schema structure: expected an object");
|
|
4757
5002
|
}
|
|
4758
|
-
const requireString = /* @__PURE__ */
|
|
5003
|
+
const requireString = /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((key) => {
|
|
4759
5004
|
const value = data[key];
|
|
4760
5005
|
if (typeof value !== "string") {
|
|
4761
5006
|
throw new Error(`Invalid schema structure: missing or non-string field "${key}"`);
|
|
@@ -4800,7 +5045,7 @@ function parseTokenScriptSchemaResponse(data) {
|
|
|
4800
5045
|
}
|
|
4801
5046
|
return { id, type, schema, slug, version, content, license_name };
|
|
4802
5047
|
}
|
|
4803
|
-
|
|
5048
|
+
chunkLEYHQJTL_cjs.__name(parseTokenScriptSchemaResponse, "parseTokenScriptSchemaResponse");
|
|
4804
5049
|
async function fetchTokenScriptSchema(schemaUri, options = {}) {
|
|
4805
5050
|
const { timeout = 1e4, headers = {}, signal } = options;
|
|
4806
5051
|
const controller = signal ? new AbortController() : new AbortController();
|
|
@@ -4837,7 +5082,7 @@ async function fetchTokenScriptSchema(schemaUri, options = {}) {
|
|
|
4837
5082
|
throw new Error("Unknown error occurred while fetching schema");
|
|
4838
5083
|
}
|
|
4839
5084
|
}
|
|
4840
|
-
|
|
5085
|
+
chunkLEYHQJTL_cjs.__name(fetchTokenScriptSchema, "fetchTokenScriptSchema");
|
|
4841
5086
|
async function fetchAndRegisterSchemas(schemaUris, config) {
|
|
4842
5087
|
const configInstance = config || new Config();
|
|
4843
5088
|
if (!schemaUris || schemaUris.length === 0) {
|
|
@@ -4854,7 +5099,7 @@ async function fetchAndRegisterSchemas(schemaUris, config) {
|
|
|
4854
5099
|
);
|
|
4855
5100
|
return configInstance.registerSchemas(schemas);
|
|
4856
5101
|
}
|
|
4857
|
-
|
|
5102
|
+
chunkLEYHQJTL_cjs.__name(fetchAndRegisterSchemas, "fetchAndRegisterSchemas");
|
|
4858
5103
|
|
|
4859
5104
|
// src/utils/schema-uri.ts
|
|
4860
5105
|
var DEFAULT_REGISTRY_URL = "https://schema.tokenscript.dev.gcp.tokens.studio";
|
|
@@ -4863,7 +5108,7 @@ function parseSemverFromString(versionString) {
|
|
|
4863
5108
|
const parts = versionString.split(".");
|
|
4864
5109
|
const numbers = [];
|
|
4865
5110
|
for (const part of parts) {
|
|
4866
|
-
const num =
|
|
5111
|
+
const num = chunkLMGHS2NP_cjs.safeParseInt(part);
|
|
4867
5112
|
if (num === null) return null;
|
|
4868
5113
|
numbers.push(num);
|
|
4869
5114
|
}
|
|
@@ -4879,23 +5124,23 @@ function parseSemverFromString(versionString) {
|
|
|
4879
5124
|
}
|
|
4880
5125
|
return null;
|
|
4881
5126
|
}
|
|
4882
|
-
|
|
5127
|
+
chunkLEYHQJTL_cjs.__name(parseSemverFromString, "parseSemverFromString");
|
|
4883
5128
|
function parseVersionString(versionString) {
|
|
4884
5129
|
return versionString === "latest" ? "latest" : parseSemverFromString(versionString);
|
|
4885
5130
|
}
|
|
4886
|
-
|
|
5131
|
+
chunkLEYHQJTL_cjs.__name(parseVersionString, "parseVersionString");
|
|
4887
5132
|
function semverToString(version) {
|
|
4888
5133
|
if (version === void 0) {
|
|
4889
5134
|
return "latest";
|
|
4890
5135
|
}
|
|
4891
|
-
if (
|
|
5136
|
+
if (chunkLMGHS2NP_cjs.isObject(version)) {
|
|
4892
5137
|
if ("patch" in version) return `${version.major}.${version.minor}.${version.patch}`;
|
|
4893
5138
|
if ("minor" in version) return `${version.major}.${version.minor}`;
|
|
4894
5139
|
return `${version.major}`;
|
|
4895
5140
|
}
|
|
4896
5141
|
return "latest";
|
|
4897
5142
|
}
|
|
4898
|
-
|
|
5143
|
+
chunkLEYHQJTL_cjs.__name(semverToString, "semverToString");
|
|
4899
5144
|
function buildSchemaUri(params) {
|
|
4900
5145
|
const { baseUrl, category, name, version } = params;
|
|
4901
5146
|
const versionString = semverToString(version);
|
|
@@ -4905,7 +5150,7 @@ function buildSchemaUri(params) {
|
|
|
4905
5150
|
}
|
|
4906
5151
|
return `${effectiveBaseUrl}${DEFAULT_API_PATH}/${category}/${name}/${versionString}/`;
|
|
4907
5152
|
}
|
|
4908
|
-
|
|
5153
|
+
chunkLEYHQJTL_cjs.__name(buildSchemaUri, "buildSchemaUri");
|
|
4909
5154
|
function parseSchemaUri(uri) {
|
|
4910
5155
|
let baseUrl = "";
|
|
4911
5156
|
let pathname = uri;
|
|
@@ -4939,7 +5184,7 @@ function parseSchemaUri(uri) {
|
|
|
4939
5184
|
version
|
|
4940
5185
|
};
|
|
4941
5186
|
}
|
|
4942
|
-
|
|
5187
|
+
chunkLEYHQJTL_cjs.__name(parseSchemaUri, "parseSchemaUri");
|
|
4943
5188
|
function getBaseUri(uri) {
|
|
4944
5189
|
const components = parseSchemaUri(uri);
|
|
4945
5190
|
if (!components) {
|
|
@@ -4951,7 +5196,7 @@ function getBaseUri(uri) {
|
|
|
4951
5196
|
}
|
|
4952
5197
|
return `${baseUrl}${DEFAULT_API_PATH}/${category}/${name}/`;
|
|
4953
5198
|
}
|
|
4954
|
-
|
|
5199
|
+
chunkLEYHQJTL_cjs.__name(getBaseUri, "getBaseUri");
|
|
4955
5200
|
function parseSemverFromUri(uri) {
|
|
4956
5201
|
const components = parseSchemaUri(uri);
|
|
4957
5202
|
if (!components || components.version === "latest" || components.version === null) {
|
|
@@ -4959,7 +5204,7 @@ function parseSemverFromUri(uri) {
|
|
|
4959
5204
|
}
|
|
4960
5205
|
return components.version;
|
|
4961
5206
|
}
|
|
4962
|
-
|
|
5207
|
+
chunkLEYHQJTL_cjs.__name(parseSemverFromUri, "parseSemverFromUri");
|
|
4963
5208
|
function generateVersionCandidates(uri) {
|
|
4964
5209
|
const components = parseSchemaUri(uri);
|
|
4965
5210
|
if (!components) {
|
|
@@ -4994,7 +5239,7 @@ function generateVersionCandidates(uri) {
|
|
|
4994
5239
|
);
|
|
4995
5240
|
return candidates;
|
|
4996
5241
|
}
|
|
4997
|
-
|
|
5242
|
+
chunkLEYHQJTL_cjs.__name(generateVersionCandidates, "generateVersionCandidates");
|
|
4998
5243
|
function compareVersions(v1, v2) {
|
|
4999
5244
|
if (v1.major !== v2.major) return v1.major - v2.major;
|
|
5000
5245
|
const v1Minor = "minor" in v1 ? v1.minor : 0;
|
|
@@ -5004,7 +5249,7 @@ function compareVersions(v1, v2) {
|
|
|
5004
5249
|
const v2Patch = "patch" in v2 ? v2.patch : 0;
|
|
5005
5250
|
return v1Patch - v2Patch;
|
|
5006
5251
|
}
|
|
5007
|
-
|
|
5252
|
+
chunkLEYHQJTL_cjs.__name(compareVersions, "compareVersions");
|
|
5008
5253
|
function isSameSchema(uri1, uri2) {
|
|
5009
5254
|
const components1 = parseSchemaUri(uri1);
|
|
5010
5255
|
const components2 = parseSchemaUri(uri2);
|
|
@@ -5015,7 +5260,7 @@ function isSameSchema(uri1, uri2) {
|
|
|
5015
5260
|
}
|
|
5016
5261
|
return components1.baseUrl === components2.baseUrl && components1.category === components2.category && components1.name === components2.name;
|
|
5017
5262
|
}
|
|
5018
|
-
|
|
5263
|
+
chunkLEYHQJTL_cjs.__name(isSameSchema, "isSameSchema");
|
|
5019
5264
|
|
|
5020
5265
|
// src/interpreter/config/managers/base-manager.ts
|
|
5021
5266
|
var _BaseManager = class _BaseManager {
|
|
@@ -5281,7 +5526,7 @@ var _BaseManager = class _BaseManager {
|
|
|
5281
5526
|
};
|
|
5282
5527
|
}
|
|
5283
5528
|
};
|
|
5284
|
-
|
|
5529
|
+
chunkLEYHQJTL_cjs.__name(_BaseManager, "BaseManager");
|
|
5285
5530
|
var BaseManager = _BaseManager;
|
|
5286
5531
|
|
|
5287
5532
|
// src/interpreter/config/managers/color/manager.ts
|
|
@@ -5341,19 +5586,19 @@ var _ColorManager = class _ColorManager extends BaseManager {
|
|
|
5341
5586
|
spec.initializers.forEach((spec2) => {
|
|
5342
5587
|
try {
|
|
5343
5588
|
const { ast } = parseExpression(spec2.script.script);
|
|
5344
|
-
const fn = /* @__PURE__ */
|
|
5589
|
+
const fn = /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((args) => {
|
|
5345
5590
|
const config = this.createInterpreterConfig({ input: args });
|
|
5346
5591
|
const result = new Interpreter(ast, config).interpret();
|
|
5347
|
-
if (!(result instanceof
|
|
5348
|
-
throw new
|
|
5592
|
+
if (!(result instanceof chunkLMGHS2NP_cjs.ColorSymbol)) {
|
|
5593
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("COLOR_INITIALIZER_CRASHED" /* INITIALIZER_CRASHED */);
|
|
5349
5594
|
}
|
|
5350
5595
|
return result;
|
|
5351
5596
|
}, "fn");
|
|
5352
5597
|
this.initializers.set(spec2.keyword.toLowerCase(), fn);
|
|
5353
5598
|
} catch (error) {
|
|
5354
|
-
throw new
|
|
5599
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("COLOR_INITIALIZER_CONSTRUCT_FAILED" /* INITIALIZER_CONSTRUCT_FAILED */, {
|
|
5355
5600
|
data: {
|
|
5356
|
-
error:
|
|
5601
|
+
error: chunkLMGHS2NP_cjs.isLanguageError(error) ? error : chunkLMGHS2NP_cjs.serializeError(error)
|
|
5357
5602
|
}
|
|
5358
5603
|
});
|
|
5359
5604
|
}
|
|
@@ -5364,18 +5609,18 @@ var _ColorManager = class _ColorManager extends BaseManager {
|
|
|
5364
5609
|
const sourceUri = conversion.source === "$self" ? uri : conversion.source;
|
|
5365
5610
|
const targetUri = conversion.target === "$self" ? uri : conversion.target;
|
|
5366
5611
|
const { ast } = parseExpression(conversion.script.script);
|
|
5367
|
-
const fn = /* @__PURE__ */
|
|
5612
|
+
const fn = /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((color) => {
|
|
5368
5613
|
const interpreterConfig = this.createInterpreterConfig({ input: color });
|
|
5369
5614
|
const result = new Interpreter(ast, interpreterConfig).interpret();
|
|
5370
|
-
if (!(result instanceof
|
|
5615
|
+
if (!(result instanceof chunkLMGHS2NP_cjs.ColorSymbol)) {
|
|
5371
5616
|
const targetSpec = this.getSpec(targetUri);
|
|
5372
5617
|
if (!targetSpec) {
|
|
5373
|
-
throw new
|
|
5618
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("COLOR_CONVERSION_TARGET_NOT_FOUND" /* CONVERSION_TARGET_NOT_FOUND */, {
|
|
5374
5619
|
data: { targetUri }
|
|
5375
5620
|
});
|
|
5376
5621
|
}
|
|
5377
5622
|
const value = typeof result === "string" ? result : result?.value ?? null;
|
|
5378
|
-
return new
|
|
5623
|
+
return new chunkLMGHS2NP_cjs.ColorSymbol(value, targetSpec.name, null, this.parentConfig);
|
|
5379
5624
|
}
|
|
5380
5625
|
return result;
|
|
5381
5626
|
}, "fn");
|
|
@@ -5418,7 +5663,7 @@ ${spec}` : "";
|
|
|
5418
5663
|
executeInitializer(keyword, args) {
|
|
5419
5664
|
const initFn = this.initializers.get(keyword.toLowerCase());
|
|
5420
5665
|
if (!initFn) {
|
|
5421
|
-
throw new
|
|
5666
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("COLOR_INITIALIZER_NOT_FOUND" /* INITIALIZER_NOT_FOUND */, {
|
|
5422
5667
|
data: { keyword }
|
|
5423
5668
|
});
|
|
5424
5669
|
}
|
|
@@ -5435,7 +5680,7 @@ ${spec}` : "";
|
|
|
5435
5680
|
convertTo(color, targetUri) {
|
|
5436
5681
|
const sourceUri = this.specTypes.get(color.subType?.toLowerCase() || "");
|
|
5437
5682
|
if (!sourceUri) {
|
|
5438
|
-
throw new
|
|
5683
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("COLOR_SOURCE_URI_NOT_FOUND" /* SOURCE_URI_NOT_FOUND */, {
|
|
5439
5684
|
data: { colorType: color.subType || "unknown" }
|
|
5440
5685
|
});
|
|
5441
5686
|
}
|
|
@@ -5444,9 +5689,9 @@ ${spec}` : "";
|
|
|
5444
5689
|
result.alpha = color.alpha;
|
|
5445
5690
|
return result;
|
|
5446
5691
|
} catch (error) {
|
|
5447
|
-
throw new
|
|
5692
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("COLOR_CONVERSION_ERROR" /* CONVERSION_ERROR */, {
|
|
5448
5693
|
data: {
|
|
5449
|
-
error:
|
|
5694
|
+
error: chunkLMGHS2NP_cjs.isLanguageError(error) ? error : chunkLMGHS2NP_cjs.serializeError(error)
|
|
5450
5695
|
}
|
|
5451
5696
|
});
|
|
5452
5697
|
}
|
|
@@ -5457,7 +5702,7 @@ ${spec}` : "";
|
|
|
5457
5702
|
}
|
|
5458
5703
|
const targetUri = this.specTypes.get(targetType.toLowerCase());
|
|
5459
5704
|
if (!targetUri) {
|
|
5460
|
-
throw new
|
|
5705
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("COLOR_TARGET_URI_NOT_FOUND" /* TARGET_URI_NOT_FOUND */, {
|
|
5461
5706
|
data: { colorType: targetType }
|
|
5462
5707
|
});
|
|
5463
5708
|
}
|
|
@@ -5466,7 +5711,7 @@ ${spec}` : "";
|
|
|
5466
5711
|
setAttribute(color, node, attributeValue) {
|
|
5467
5712
|
const attributes = node.attributesStringChain();
|
|
5468
5713
|
if (attributes.length !== 1) {
|
|
5469
|
-
throw new
|
|
5714
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("COLOR_ATTRIBUTE_CHAIN_TOO_LONG" /* ATTRIBUTE_CHAIN_TOO_LONG */, {
|
|
5470
5715
|
token: node.token,
|
|
5471
5716
|
data: {
|
|
5472
5717
|
attributes: attributesToString(attributes),
|
|
@@ -5478,7 +5723,7 @@ ${spec}` : "";
|
|
|
5478
5723
|
const attr = attributes[0];
|
|
5479
5724
|
if (attr === "alpha") {
|
|
5480
5725
|
if (attributeValue.type !== "Number" && attributeValue.type !== "Null") {
|
|
5481
|
-
throw new
|
|
5726
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("COLOR_INVALID_ATTRIBUTE_TYPE" /* INVALID_ATTRIBUTE_TYPE */, {
|
|
5482
5727
|
token: node.token,
|
|
5483
5728
|
data: {
|
|
5484
5729
|
attributeType: attributeValue.type,
|
|
@@ -5487,12 +5732,12 @@ ${spec}` : "";
|
|
|
5487
5732
|
});
|
|
5488
5733
|
}
|
|
5489
5734
|
const alphaValue = attributeValue.value;
|
|
5490
|
-
|
|
5735
|
+
chunkLMGHS2NP_cjs.ensureValidAlpha(alphaValue);
|
|
5491
5736
|
color.alpha = alphaValue;
|
|
5492
5737
|
return color;
|
|
5493
5738
|
}
|
|
5494
5739
|
if (typeof color.value === "string") {
|
|
5495
|
-
throw new
|
|
5740
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("COLOR_STRING_VALUE_ASSIGNMENT" /* STRING_VALUE_ASSIGNMENT */, {
|
|
5496
5741
|
token: node.token,
|
|
5497
5742
|
data: {
|
|
5498
5743
|
attributes: attributesToString(attributes),
|
|
@@ -5503,7 +5748,7 @@ ${spec}` : "";
|
|
|
5503
5748
|
}
|
|
5504
5749
|
const spec = this.getSpecFromColor(color);
|
|
5505
5750
|
if (!spec) {
|
|
5506
|
-
throw new
|
|
5751
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("COLOR_MISSING_SPEC" /* MISSING_SPEC */, {
|
|
5507
5752
|
token: node.token,
|
|
5508
5753
|
data: {
|
|
5509
5754
|
identifier: node.identifierToString(),
|
|
@@ -5512,14 +5757,14 @@ ${spec}` : "";
|
|
|
5512
5757
|
});
|
|
5513
5758
|
}
|
|
5514
5759
|
if (!spec.schema) {
|
|
5515
|
-
throw new
|
|
5760
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("COLOR_MISSING_SCHEMA" /* MISSING_SCHEMA */, {
|
|
5516
5761
|
token: node.token,
|
|
5517
5762
|
data: { colorType: color.subType || "unknown" }
|
|
5518
5763
|
});
|
|
5519
5764
|
}
|
|
5520
5765
|
const attrSchema = spec.schema.properties[attr];
|
|
5521
5766
|
if (!attrSchema) {
|
|
5522
|
-
throw new
|
|
5767
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("COLOR_MISSING_ATTRIBUTE_SCHEMA" /* MISSING_ATTRIBUTE_SCHEMA */, {
|
|
5523
5768
|
token: node.token,
|
|
5524
5769
|
data: {
|
|
5525
5770
|
attribute: attr,
|
|
@@ -5528,8 +5773,8 @@ ${spec}` : "";
|
|
|
5528
5773
|
}
|
|
5529
5774
|
});
|
|
5530
5775
|
}
|
|
5531
|
-
if (!
|
|
5532
|
-
throw new
|
|
5776
|
+
if (!chunkLMGHS2NP_cjs.typeEquals(attrSchema.type, attributeValue.type)) {
|
|
5777
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("COLOR_INVALID_ATTRIBUTE_TYPE" /* INVALID_ATTRIBUTE_TYPE */, {
|
|
5533
5778
|
token: node.token,
|
|
5534
5779
|
data: {
|
|
5535
5780
|
attributeType: attributeValue.type,
|
|
@@ -5589,7 +5834,7 @@ ${spec}` : "";
|
|
|
5589
5834
|
const { decimalPlaces = 2, removeTrailingZeros = true } = opts;
|
|
5590
5835
|
if (typeof color.value === "string") {
|
|
5591
5836
|
if (color.alpha !== null) {
|
|
5592
|
-
return
|
|
5837
|
+
return chunkLMGHS2NP_cjs.formatHex8(color.value, color.alpha);
|
|
5593
5838
|
}
|
|
5594
5839
|
return color.value;
|
|
5595
5840
|
}
|
|
@@ -5607,7 +5852,7 @@ ${spec}` : "";
|
|
|
5607
5852
|
}
|
|
5608
5853
|
return value?.toString() || "0";
|
|
5609
5854
|
});
|
|
5610
|
-
if (
|
|
5855
|
+
if (chunkLMGHS2NP_cjs.isTransparent(color.alpha)) {
|
|
5611
5856
|
values.push(this.formatNumber(color.alpha, decimalPlaces, removeTrailingZeros));
|
|
5612
5857
|
}
|
|
5613
5858
|
const functionName = color.subType.toLowerCase();
|
|
@@ -5619,74 +5864,74 @@ ${spec}` : "";
|
|
|
5619
5864
|
return this.specs;
|
|
5620
5865
|
}
|
|
5621
5866
|
};
|
|
5622
|
-
|
|
5867
|
+
chunkLEYHQJTL_cjs.__name(_ColorManager, "ColorManager");
|
|
5623
5868
|
var ColorManager = _ColorManager;
|
|
5624
5869
|
|
|
5625
5870
|
// src/interpreter/config/managers/functions/builtin/math.ts
|
|
5626
5871
|
function extractNumber(arg, functionName) {
|
|
5627
5872
|
if (arg === void 0 || arg === null) {
|
|
5628
|
-
throw new
|
|
5873
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_EXPECTS_NUMBER_ARGUMENTS" /* EXPECTS_NUMBER_ARGUMENTS */, {
|
|
5629
5874
|
data: { functionName }
|
|
5630
5875
|
});
|
|
5631
5876
|
}
|
|
5632
|
-
if (arg instanceof
|
|
5633
|
-
if (arg instanceof
|
|
5877
|
+
if (arg instanceof chunkLMGHS2NP_cjs.NumberSymbol) return arg.value;
|
|
5878
|
+
if (arg instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol) return arg.value;
|
|
5634
5879
|
if (typeof arg.value === "number") return arg.value;
|
|
5635
|
-
throw new
|
|
5880
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_EXPECTS_NUMBER_ARGUMENTS" /* EXPECTS_NUMBER_ARGUMENTS */, {
|
|
5636
5881
|
data: { functionName }
|
|
5637
5882
|
});
|
|
5638
5883
|
}
|
|
5639
|
-
|
|
5884
|
+
chunkLEYHQJTL_cjs.__name(extractNumber, "extractNumber");
|
|
5640
5885
|
function over(arg, fn, functionName) {
|
|
5641
5886
|
const value = extractNumber(arg, functionName);
|
|
5642
5887
|
const result = fn(value);
|
|
5643
|
-
if (arg instanceof
|
|
5644
|
-
return new
|
|
5888
|
+
if (arg instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol) {
|
|
5889
|
+
return new chunkLMGHS2NP_cjs.NumberWithUnitSymbol(result, arg.unit);
|
|
5645
5890
|
}
|
|
5646
|
-
return new
|
|
5891
|
+
return new chunkLMGHS2NP_cjs.NumberSymbol(result);
|
|
5647
5892
|
}
|
|
5648
|
-
|
|
5893
|
+
chunkLEYHQJTL_cjs.__name(over, "over");
|
|
5649
5894
|
function overTwo(a, b, fn, functionName) {
|
|
5650
5895
|
const aVal = extractNumber(a, functionName);
|
|
5651
5896
|
const bVal = extractNumber(b, functionName);
|
|
5652
5897
|
const result = fn(aVal, bVal);
|
|
5653
|
-
if (a instanceof
|
|
5654
|
-
return new
|
|
5898
|
+
if (a instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol) {
|
|
5899
|
+
return new chunkLMGHS2NP_cjs.NumberWithUnitSymbol(result, a.unit);
|
|
5655
5900
|
}
|
|
5656
|
-
return new
|
|
5901
|
+
return new chunkLMGHS2NP_cjs.NumberSymbol(result);
|
|
5657
5902
|
}
|
|
5658
|
-
|
|
5903
|
+
chunkLEYHQJTL_cjs.__name(overTwo, "overTwo");
|
|
5659
5904
|
function overMany(args, fn, functionName, minArgs) {
|
|
5660
5905
|
if (minArgs !== void 0 && args.length < minArgs) {
|
|
5661
|
-
throw new
|
|
5906
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_REQUIRES_MIN_ARGUMENTS" /* REQUIRES_MIN_ARGUMENTS */, {
|
|
5662
5907
|
data: { functionName, minArgs }
|
|
5663
5908
|
});
|
|
5664
5909
|
}
|
|
5665
5910
|
const nums = args.map((arg) => extractNumber(arg, functionName));
|
|
5666
5911
|
const result = fn(nums);
|
|
5667
|
-
const firstUnitArg = args.find((arg) => arg instanceof
|
|
5912
|
+
const firstUnitArg = args.find((arg) => arg instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol);
|
|
5668
5913
|
if (firstUnitArg) {
|
|
5669
|
-
return new
|
|
5914
|
+
return new chunkLMGHS2NP_cjs.NumberWithUnitSymbol(result, firstUnitArg.unit);
|
|
5670
5915
|
}
|
|
5671
|
-
return new
|
|
5916
|
+
return new chunkLMGHS2NP_cjs.NumberSymbol(result);
|
|
5672
5917
|
}
|
|
5673
|
-
|
|
5918
|
+
chunkLEYHQJTL_cjs.__name(overMany, "overMany");
|
|
5674
5919
|
function createSumFunction(getUnitManager) {
|
|
5675
5920
|
return (...args) => {
|
|
5676
5921
|
if (args.length < 2)
|
|
5677
|
-
throw new
|
|
5922
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_REQUIRES_MIN_ARGUMENTS" /* REQUIRES_MIN_ARGUMENTS */, {
|
|
5678
5923
|
data: { functionName: "sum", minArgs: 2 }
|
|
5679
5924
|
});
|
|
5680
|
-
const hasUnits = args.some((arg) => arg instanceof
|
|
5925
|
+
const hasUnits = args.some((arg) => arg instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol);
|
|
5681
5926
|
if (!hasUnits) {
|
|
5682
5927
|
const nums2 = args.map((arg) => extractNumber(arg, "sum"));
|
|
5683
|
-
return new
|
|
5928
|
+
return new chunkLMGHS2NP_cjs.NumberSymbol(nums2.reduce((acc, val) => acc + val, 0));
|
|
5684
5929
|
}
|
|
5685
5930
|
const numericArgs = args.filter(
|
|
5686
|
-
(arg) => arg instanceof
|
|
5931
|
+
(arg) => arg instanceof chunkLMGHS2NP_cjs.NumberSymbol || arg instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol
|
|
5687
5932
|
);
|
|
5688
5933
|
if (numericArgs.length !== args.length) {
|
|
5689
|
-
throw new
|
|
5934
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_EXPECTS_NUMBER_ARGUMENTS" /* EXPECTS_NUMBER_ARGUMENTS */, {
|
|
5690
5935
|
data: { functionName: "sum" }
|
|
5691
5936
|
});
|
|
5692
5937
|
}
|
|
@@ -5696,61 +5941,61 @@ function createSumFunction(getUnitManager) {
|
|
|
5696
5941
|
const converted = unitManager.convertToCommonFormat(numericArgs);
|
|
5697
5942
|
const sum2 = converted.reduce((acc, arg) => acc + arg.value, 0);
|
|
5698
5943
|
const firstUnitArg2 = converted.find(
|
|
5699
|
-
(arg) => arg instanceof
|
|
5944
|
+
(arg) => arg instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol
|
|
5700
5945
|
);
|
|
5701
5946
|
if (firstUnitArg2) {
|
|
5702
|
-
return new
|
|
5947
|
+
return new chunkLMGHS2NP_cjs.NumberWithUnitSymbol(sum2, firstUnitArg2.unit);
|
|
5703
5948
|
}
|
|
5704
|
-
return new
|
|
5949
|
+
return new chunkLMGHS2NP_cjs.NumberSymbol(sum2);
|
|
5705
5950
|
} catch (error) {
|
|
5706
|
-
throw new
|
|
5951
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_UNIT_CONVERSION_FAILED" /* UNIT_CONVERSION_FAILED */, {
|
|
5707
5952
|
data: {
|
|
5708
5953
|
functionName: "sum",
|
|
5709
|
-
error:
|
|
5954
|
+
error: chunkLMGHS2NP_cjs.isLanguageError(error) ? error : chunkLMGHS2NP_cjs.serializeError(error)
|
|
5710
5955
|
}
|
|
5711
5956
|
});
|
|
5712
5957
|
}
|
|
5713
5958
|
}
|
|
5714
5959
|
const firstUnitArg = args.find(
|
|
5715
|
-
(arg) => arg instanceof
|
|
5960
|
+
(arg) => arg instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol
|
|
5716
5961
|
);
|
|
5717
5962
|
const nums = args.map((arg) => extractNumber(arg, "sum"));
|
|
5718
5963
|
const sum = nums.reduce((acc, val) => acc + val, 0);
|
|
5719
5964
|
if (firstUnitArg) {
|
|
5720
|
-
return new
|
|
5965
|
+
return new chunkLMGHS2NP_cjs.NumberWithUnitSymbol(sum, firstUnitArg.unit);
|
|
5721
5966
|
}
|
|
5722
|
-
return new
|
|
5967
|
+
return new chunkLMGHS2NP_cjs.NumberSymbol(sum);
|
|
5723
5968
|
};
|
|
5724
5969
|
}
|
|
5725
|
-
|
|
5970
|
+
chunkLEYHQJTL_cjs.__name(createSumFunction, "createSumFunction");
|
|
5726
5971
|
var mathFunctions = {
|
|
5727
|
-
min: /* @__PURE__ */
|
|
5728
|
-
max: /* @__PURE__ */
|
|
5729
|
-
mod: /* @__PURE__ */
|
|
5972
|
+
min: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((...args) => overMany(args, (nums) => Math.min(...nums), "min", 1), "min"),
|
|
5973
|
+
max: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((...args) => overMany(args, (nums) => Math.max(...nums), "max", 1), "max"),
|
|
5974
|
+
mod: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((a, b) => overTwo(
|
|
5730
5975
|
a,
|
|
5731
5976
|
b,
|
|
5732
5977
|
(aVal, bVal) => {
|
|
5733
5978
|
if (bVal === 0)
|
|
5734
|
-
throw new
|
|
5979
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_DIVISION_BY_ZERO" /* DIVISION_BY_ZERO */, {
|
|
5735
5980
|
data: { functionName: "mod" }
|
|
5736
5981
|
});
|
|
5737
5982
|
return (aVal % bVal + bVal) % bVal;
|
|
5738
5983
|
},
|
|
5739
5984
|
"mod"
|
|
5740
5985
|
), "mod"),
|
|
5741
|
-
average: /* @__PURE__ */
|
|
5742
|
-
round: /* @__PURE__ */
|
|
5743
|
-
abs: /* @__PURE__ */
|
|
5744
|
-
sqrt: /* @__PURE__ */
|
|
5745
|
-
floor: /* @__PURE__ */
|
|
5746
|
-
ceil: /* @__PURE__ */
|
|
5747
|
-
cbrt: /* @__PURE__ */
|
|
5748
|
-
sign: /* @__PURE__ */
|
|
5749
|
-
trunc: /* @__PURE__ */
|
|
5750
|
-
exp: /* @__PURE__ */
|
|
5751
|
-
expm1: /* @__PURE__ */
|
|
5752
|
-
pow: /* @__PURE__ */
|
|
5753
|
-
round_to: /* @__PURE__ */
|
|
5986
|
+
average: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((...args) => overMany(args, (nums) => nums.reduce((acc, val) => acc + val, 0) / nums.length, "average", 1), "average"),
|
|
5987
|
+
round: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => over(arg, Math.round, "round"), "round"),
|
|
5988
|
+
abs: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => over(arg, Math.abs, "abs"), "abs"),
|
|
5989
|
+
sqrt: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => over(arg, Math.sqrt, "sqrt"), "sqrt"),
|
|
5990
|
+
floor: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => over(arg, Math.floor, "floor"), "floor"),
|
|
5991
|
+
ceil: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => over(arg, Math.ceil, "ceil"), "ceil"),
|
|
5992
|
+
cbrt: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => over(arg, Math.cbrt, "cbrt"), "cbrt"),
|
|
5993
|
+
sign: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => new chunkLMGHS2NP_cjs.NumberSymbol(Math.sign(extractNumber(arg, "sign"))), "sign"),
|
|
5994
|
+
trunc: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => over(arg, Math.trunc, "trunc"), "trunc"),
|
|
5995
|
+
exp: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => over(arg, Math.exp, "exp"), "exp"),
|
|
5996
|
+
expm1: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => over(arg, Math.expm1, "expm1"), "expm1"),
|
|
5997
|
+
pow: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((base, exp) => overTwo(base, exp, (b, e) => b ** e, "pow"), "pow"),
|
|
5998
|
+
round_to: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((value, precision) => {
|
|
5754
5999
|
const precisionValue = precision !== void 0 ? extractNumber(precision, "round_to") : 0;
|
|
5755
6000
|
const fn = precisionValue === 0 ? Math.round : (v) => {
|
|
5756
6001
|
const factor = 10 ** precisionValue;
|
|
@@ -5758,13 +6003,13 @@ var mathFunctions = {
|
|
|
5758
6003
|
};
|
|
5759
6004
|
return over(value, fn, "round_to");
|
|
5760
6005
|
}, "round_to"),
|
|
5761
|
-
hypot: /* @__PURE__ */
|
|
5762
|
-
remainder: /* @__PURE__ */
|
|
6006
|
+
hypot: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((...args) => overMany(args, (nums) => Math.hypot(...nums), "hypot", 1), "hypot"),
|
|
6007
|
+
remainder: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((a, b) => overTwo(
|
|
5763
6008
|
a,
|
|
5764
6009
|
b,
|
|
5765
6010
|
(aVal, bVal) => {
|
|
5766
6011
|
if (bVal === 0)
|
|
5767
|
-
throw new
|
|
6012
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_DIVISION_BY_ZERO" /* DIVISION_BY_ZERO */, {
|
|
5768
6013
|
data: { functionName: "remainder" }
|
|
5769
6014
|
});
|
|
5770
6015
|
return aVal % bVal;
|
|
@@ -5772,40 +6017,40 @@ var mathFunctions = {
|
|
|
5772
6017
|
"remainder"
|
|
5773
6018
|
), "remainder"),
|
|
5774
6019
|
// Trigonometric functions
|
|
5775
|
-
sin: /* @__PURE__ */
|
|
5776
|
-
cos: /* @__PURE__ */
|
|
5777
|
-
tan: /* @__PURE__ */
|
|
5778
|
-
atan: /* @__PURE__ */
|
|
5779
|
-
asin: /* @__PURE__ */
|
|
6020
|
+
sin: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => over(arg, Math.sin, "sin"), "sin"),
|
|
6021
|
+
cos: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => over(arg, Math.cos, "cos"), "cos"),
|
|
6022
|
+
tan: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => over(arg, Math.tan, "tan"), "tan"),
|
|
6023
|
+
atan: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => over(arg, Math.atan, "atan"), "atan"),
|
|
6024
|
+
asin: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => {
|
|
5780
6025
|
const value = extractNumber(arg, "asin");
|
|
5781
6026
|
if (value < -1 || value > 1)
|
|
5782
|
-
throw new
|
|
6027
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_ARGUMENT_OUT_OF_RANGE" /* ARGUMENT_OUT_OF_RANGE */, {
|
|
5783
6028
|
data: { functionName: "asin", constraint: "between -1 and 1" }
|
|
5784
6029
|
});
|
|
5785
6030
|
return over(arg, Math.asin, "asin");
|
|
5786
6031
|
}, "asin"),
|
|
5787
|
-
acos: /* @__PURE__ */
|
|
6032
|
+
acos: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => {
|
|
5788
6033
|
const value = extractNumber(arg, "acos");
|
|
5789
6034
|
if (value < -1 || value > 1)
|
|
5790
|
-
throw new
|
|
6035
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_ARGUMENT_OUT_OF_RANGE" /* ARGUMENT_OUT_OF_RANGE */, {
|
|
5791
6036
|
data: { functionName: "acos", constraint: "between -1 and 1" }
|
|
5792
6037
|
});
|
|
5793
6038
|
return over(arg, Math.acos, "acos");
|
|
5794
6039
|
}, "acos"),
|
|
5795
|
-
atan2: /* @__PURE__ */
|
|
6040
|
+
atan2: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((y, x) => {
|
|
5796
6041
|
const yVal = extractNumber(y, "atan2");
|
|
5797
6042
|
const xVal = extractNumber(x, "atan2");
|
|
5798
|
-
return new
|
|
6043
|
+
return new chunkLMGHS2NP_cjs.NumberSymbol(Math.atan2(yVal, xVal));
|
|
5799
6044
|
}, "atan2"),
|
|
5800
6045
|
// Hyperbolic functions
|
|
5801
|
-
sinh: /* @__PURE__ */
|
|
5802
|
-
cosh: /* @__PURE__ */
|
|
5803
|
-
tanh: /* @__PURE__ */
|
|
5804
|
-
asinh: /* @__PURE__ */
|
|
5805
|
-
acosh: /* @__PURE__ */
|
|
6046
|
+
sinh: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => over(arg, Math.sinh, "sinh"), "sinh"),
|
|
6047
|
+
cosh: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => over(arg, Math.cosh, "cosh"), "cosh"),
|
|
6048
|
+
tanh: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => over(arg, Math.tanh, "tanh"), "tanh"),
|
|
6049
|
+
asinh: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => over(arg, Math.asinh, "asinh"), "asinh"),
|
|
6050
|
+
acosh: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => {
|
|
5806
6051
|
const value = extractNumber(arg, "acosh");
|
|
5807
6052
|
if (value < 1) {
|
|
5808
|
-
throw new
|
|
6053
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_ARGUMENT_OUT_OF_RANGE" /* ARGUMENT_OUT_OF_RANGE */, {
|
|
5809
6054
|
data: {
|
|
5810
6055
|
functionName: "acosh",
|
|
5811
6056
|
constraint: "greater than or equal to 1"
|
|
@@ -5814,10 +6059,10 @@ var mathFunctions = {
|
|
|
5814
6059
|
}
|
|
5815
6060
|
return over(arg, Math.acosh, "acosh");
|
|
5816
6061
|
}, "acosh"),
|
|
5817
|
-
atanh: /* @__PURE__ */
|
|
6062
|
+
atanh: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => {
|
|
5818
6063
|
const value = extractNumber(arg, "atanh");
|
|
5819
6064
|
if (value <= -1 || value >= 1) {
|
|
5820
|
-
throw new
|
|
6065
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_ARGUMENT_OUT_OF_RANGE" /* ARGUMENT_OUT_OF_RANGE */, {
|
|
5821
6066
|
data: {
|
|
5822
6067
|
functionName: "atanh",
|
|
5823
6068
|
constraint: "between -1 and 1 (exclusive)"
|
|
@@ -5827,10 +6072,10 @@ var mathFunctions = {
|
|
|
5827
6072
|
return over(arg, Math.atanh, "atanh");
|
|
5828
6073
|
}, "atanh"),
|
|
5829
6074
|
// Logarithmic functions
|
|
5830
|
-
log: /* @__PURE__ */
|
|
6075
|
+
log: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg, base) => {
|
|
5831
6076
|
const value = extractNumber(arg, "log");
|
|
5832
6077
|
if (value <= 0)
|
|
5833
|
-
throw new
|
|
6078
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_ARGUMENT_OUT_OF_RANGE" /* ARGUMENT_OUT_OF_RANGE */, {
|
|
5834
6079
|
data: { functionName: "log", constraint: "positive" }
|
|
5835
6080
|
});
|
|
5836
6081
|
if (base === void 0) {
|
|
@@ -5838,7 +6083,7 @@ var mathFunctions = {
|
|
|
5838
6083
|
}
|
|
5839
6084
|
const baseValue = extractNumber(base, "log");
|
|
5840
6085
|
if (baseValue <= 0 || baseValue === 1)
|
|
5841
|
-
throw new
|
|
6086
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_INVALID_BASE" /* INVALID_BASE */, {
|
|
5842
6087
|
data: {
|
|
5843
6088
|
functionName: "log",
|
|
5844
6089
|
constraint: "positive and not equal to 1"
|
|
@@ -5846,37 +6091,37 @@ var mathFunctions = {
|
|
|
5846
6091
|
});
|
|
5847
6092
|
return over(arg, (v) => Math.log(v) / Math.log(baseValue), "log");
|
|
5848
6093
|
}, "log"),
|
|
5849
|
-
ln: /* @__PURE__ */
|
|
6094
|
+
ln: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => {
|
|
5850
6095
|
const value = extractNumber(arg, "ln");
|
|
5851
6096
|
if (value <= 0) {
|
|
5852
|
-
throw new
|
|
6097
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_ARGUMENT_OUT_OF_RANGE" /* ARGUMENT_OUT_OF_RANGE */, {
|
|
5853
6098
|
data: { functionName: "ln", constraint: "positive" }
|
|
5854
6099
|
});
|
|
5855
6100
|
}
|
|
5856
6101
|
return over(arg, Math.log, "ln");
|
|
5857
6102
|
}, "ln"),
|
|
5858
|
-
log10: /* @__PURE__ */
|
|
6103
|
+
log10: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => {
|
|
5859
6104
|
const value = extractNumber(arg, "log10");
|
|
5860
6105
|
if (value <= 0) {
|
|
5861
|
-
throw new
|
|
6106
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_ARGUMENT_OUT_OF_RANGE" /* ARGUMENT_OUT_OF_RANGE */, {
|
|
5862
6107
|
data: { functionName: "log10", constraint: "positive" }
|
|
5863
6108
|
});
|
|
5864
6109
|
}
|
|
5865
6110
|
return over(arg, Math.log10, "log10");
|
|
5866
6111
|
}, "log10"),
|
|
5867
|
-
log2: /* @__PURE__ */
|
|
6112
|
+
log2: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => {
|
|
5868
6113
|
const value = extractNumber(arg, "log2");
|
|
5869
6114
|
if (value <= 0) {
|
|
5870
|
-
throw new
|
|
6115
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_ARGUMENT_OUT_OF_RANGE" /* ARGUMENT_OUT_OF_RANGE */, {
|
|
5871
6116
|
data: { functionName: "log2", constraint: "positive" }
|
|
5872
6117
|
});
|
|
5873
6118
|
}
|
|
5874
6119
|
return over(arg, Math.log2, "log2");
|
|
5875
6120
|
}, "log2"),
|
|
5876
|
-
log1p: /* @__PURE__ */
|
|
6121
|
+
log1p: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((arg) => {
|
|
5877
6122
|
const value = extractNumber(arg, "log1p");
|
|
5878
6123
|
if (value < -1) {
|
|
5879
|
-
throw new
|
|
6124
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_ARGUMENT_OUT_OF_RANGE" /* ARGUMENT_OUT_OF_RANGE */, {
|
|
5880
6125
|
data: {
|
|
5881
6126
|
functionName: "log1p",
|
|
5882
6127
|
constraint: "greater than or equal to -1"
|
|
@@ -5886,7 +6131,7 @@ var mathFunctions = {
|
|
|
5886
6131
|
return over(arg, Math.log1p, "log1p");
|
|
5887
6132
|
}, "log1p"),
|
|
5888
6133
|
// Constants
|
|
5889
|
-
pi: /* @__PURE__ */
|
|
6134
|
+
pi: /* @__PURE__ */ chunkLEYHQJTL_cjs.__name(() => new chunkLMGHS2NP_cjs.NumberSymbol(Math.PI), "pi")
|
|
5890
6135
|
};
|
|
5891
6136
|
|
|
5892
6137
|
// src/interpreter/config/managers/functions/manager.ts
|
|
@@ -5933,75 +6178,75 @@ var _FunctionsManager = class _FunctionsManager extends BaseManager {
|
|
|
5933
6178
|
this.registerFunction(
|
|
5934
6179
|
"parse_int",
|
|
5935
6180
|
(strSymbol, baseSymbol) => {
|
|
5936
|
-
if (!(strSymbol instanceof
|
|
5937
|
-
throw new
|
|
6181
|
+
if (!(strSymbol instanceof chunkLMGHS2NP_cjs.StringSymbol))
|
|
6182
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_EXPECTS_TYPE_ARGUMENT" /* EXPECTS_TYPE_ARGUMENT */, {
|
|
5938
6183
|
data: { functionName: "parse_int", expectedType: "string", argumentPosition: "first" }
|
|
5939
6184
|
});
|
|
5940
|
-
const base = baseSymbol instanceof
|
|
6185
|
+
const base = baseSymbol instanceof chunkLMGHS2NP_cjs.NumberSymbol ? baseSymbol.value : 10;
|
|
5941
6186
|
const parsed = Number.parseInt(strSymbol.value, base);
|
|
5942
6187
|
if (Number.isNaN(parsed))
|
|
5943
|
-
throw new
|
|
6188
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_PARSE_ERROR" /* PARSE_ERROR */, {
|
|
5944
6189
|
data: { functionName: "parse_int", value: String(strSymbol.value), base }
|
|
5945
6190
|
});
|
|
5946
|
-
return new
|
|
6191
|
+
return new chunkLMGHS2NP_cjs.NumberSymbol(parsed);
|
|
5947
6192
|
}
|
|
5948
6193
|
);
|
|
5949
6194
|
this.registerFunction("linear-gradient", (...args) => {
|
|
5950
6195
|
const stringArgs = args.map((arg) => arg.toString()).join(", ");
|
|
5951
|
-
return new
|
|
6196
|
+
return new chunkLMGHS2NP_cjs.StringSymbol(`linear-gradient(${stringArgs})`);
|
|
5952
6197
|
});
|
|
5953
6198
|
this.registerFunction("type", (arg) => {
|
|
5954
6199
|
const typeName2 = arg.getTypeName();
|
|
5955
6200
|
if (typeName2.includes(".")) {
|
|
5956
6201
|
const parts = typeName2.split(".");
|
|
5957
|
-
return new
|
|
6202
|
+
return new chunkLMGHS2NP_cjs.StringSymbol(parts[parts.length - 1].toLowerCase());
|
|
5958
6203
|
}
|
|
5959
|
-
return new
|
|
6204
|
+
return new chunkLMGHS2NP_cjs.StringSymbol(typeName2.toLowerCase());
|
|
5960
6205
|
});
|
|
5961
6206
|
this.registerFunction("is_null", (arg) => {
|
|
5962
|
-
return new
|
|
6207
|
+
return new chunkLMGHS2NP_cjs.BooleanSymbol(arg.type === "Null");
|
|
5963
6208
|
});
|
|
5964
6209
|
this.registerFunction("is_number", (arg) => {
|
|
5965
|
-
return new
|
|
6210
|
+
return new chunkLMGHS2NP_cjs.BooleanSymbol(arg.type === "Number");
|
|
5966
6211
|
});
|
|
5967
6212
|
this.registerFunction("is_string", (arg) => {
|
|
5968
|
-
return new
|
|
6213
|
+
return new chunkLMGHS2NP_cjs.BooleanSymbol(arg.type === "String");
|
|
5969
6214
|
});
|
|
5970
6215
|
this.registerFunction("is_boolean", (arg) => {
|
|
5971
|
-
return new
|
|
6216
|
+
return new chunkLMGHS2NP_cjs.BooleanSymbol(arg.type === "Boolean");
|
|
5972
6217
|
});
|
|
5973
6218
|
this.registerFunction("is_list", (arg) => {
|
|
5974
|
-
return new
|
|
6219
|
+
return new chunkLMGHS2NP_cjs.BooleanSymbol(arg.type === "List");
|
|
5975
6220
|
});
|
|
5976
6221
|
this.registerFunction("is_number_with_unit", (arg) => {
|
|
5977
|
-
return new
|
|
6222
|
+
return new chunkLMGHS2NP_cjs.BooleanSymbol(arg.type === "NumberWithUnit");
|
|
5978
6223
|
});
|
|
5979
6224
|
this.registerFunction("is_dictionary", (arg) => {
|
|
5980
|
-
return new
|
|
6225
|
+
return new chunkLMGHS2NP_cjs.BooleanSymbol(arg.type === "Dictionary");
|
|
5981
6226
|
});
|
|
5982
6227
|
this.registerFunction("is_token", (arg) => {
|
|
5983
|
-
return new
|
|
6228
|
+
return new chunkLMGHS2NP_cjs.BooleanSymbol(arg.type === "Token");
|
|
5984
6229
|
});
|
|
5985
6230
|
this.registerFunction("is_color", (arg) => {
|
|
5986
|
-
return new
|
|
6231
|
+
return new chunkLMGHS2NP_cjs.BooleanSymbol(arg.type === "Color");
|
|
5987
6232
|
});
|
|
5988
6233
|
this.registerFunction("range", (...args) => {
|
|
5989
6234
|
if (args.length < 1 || args.length > 2) {
|
|
5990
|
-
throw new
|
|
6235
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_REQUIRES_MIN_ARGUMENTS" /* REQUIRES_MIN_ARGUMENTS */, {
|
|
5991
6236
|
data: { functionName: "range", minArgs: 1 }
|
|
5992
6237
|
});
|
|
5993
6238
|
}
|
|
5994
6239
|
let start;
|
|
5995
6240
|
let end;
|
|
5996
6241
|
if (args.length === 1) {
|
|
5997
|
-
if (!(args[0] instanceof
|
|
5998
|
-
throw new
|
|
6242
|
+
if (!(args[0] instanceof chunkLMGHS2NP_cjs.NumberSymbol)) {
|
|
6243
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_EXPECTS_TYPE_ARGUMENT" /* EXPECTS_TYPE_ARGUMENT */, {
|
|
5999
6244
|
data: { functionName: "range", expectedType: "Number", argumentPosition: "first" }
|
|
6000
6245
|
});
|
|
6001
6246
|
}
|
|
6002
6247
|
const v = args[0].value;
|
|
6003
6248
|
if (v !== Math.trunc(v) || Number.isNaN(v) || !Number.isFinite(v) || v < 0 || v > 1e6) {
|
|
6004
|
-
throw new
|
|
6249
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_ARGUMENT_OUT_OF_RANGE" /* ARGUMENT_OUT_OF_RANGE */, {
|
|
6005
6250
|
data: {
|
|
6006
6251
|
functionName: "range",
|
|
6007
6252
|
constraint: `count must be a non-negative integer <= 1000000, got ${v}`
|
|
@@ -6011,20 +6256,20 @@ var _FunctionsManager = class _FunctionsManager extends BaseManager {
|
|
|
6011
6256
|
start = 0;
|
|
6012
6257
|
end = v;
|
|
6013
6258
|
} else {
|
|
6014
|
-
if (!(args[0] instanceof
|
|
6015
|
-
throw new
|
|
6259
|
+
if (!(args[0] instanceof chunkLMGHS2NP_cjs.NumberSymbol)) {
|
|
6260
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_EXPECTS_TYPE_ARGUMENT" /* EXPECTS_TYPE_ARGUMENT */, {
|
|
6016
6261
|
data: { functionName: "range", expectedType: "Number", argumentPosition: "first" }
|
|
6017
6262
|
});
|
|
6018
6263
|
}
|
|
6019
|
-
if (!(args[1] instanceof
|
|
6020
|
-
throw new
|
|
6264
|
+
if (!(args[1] instanceof chunkLMGHS2NP_cjs.NumberSymbol)) {
|
|
6265
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_EXPECTS_TYPE_ARGUMENT" /* EXPECTS_TYPE_ARGUMENT */, {
|
|
6021
6266
|
data: { functionName: "range", expectedType: "Number", argumentPosition: "second" }
|
|
6022
6267
|
});
|
|
6023
6268
|
}
|
|
6024
6269
|
const sv = args[0].value;
|
|
6025
6270
|
const ev = args[1].value;
|
|
6026
6271
|
if (sv !== Math.trunc(sv) || ev !== Math.trunc(ev) || Number.isNaN(sv) || Number.isNaN(ev) || !Number.isFinite(sv) || !Number.isFinite(ev)) {
|
|
6027
|
-
throw new
|
|
6272
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_ARGUMENT_OUT_OF_RANGE" /* ARGUMENT_OUT_OF_RANGE */, {
|
|
6028
6273
|
data: {
|
|
6029
6274
|
functionName: "range",
|
|
6030
6275
|
constraint: `arguments must be integers, got ${sv} and ${ev}`
|
|
@@ -6032,7 +6277,7 @@ var _FunctionsManager = class _FunctionsManager extends BaseManager {
|
|
|
6032
6277
|
});
|
|
6033
6278
|
}
|
|
6034
6279
|
if (ev - sv > 1e6) {
|
|
6035
|
-
throw new
|
|
6280
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_ARGUMENT_OUT_OF_RANGE" /* ARGUMENT_OUT_OF_RANGE */, {
|
|
6036
6281
|
data: {
|
|
6037
6282
|
functionName: "range",
|
|
6038
6283
|
constraint: `size exceeds limit (1000000), got ${ev - sv}`
|
|
@@ -6043,13 +6288,13 @@ var _FunctionsManager = class _FunctionsManager extends BaseManager {
|
|
|
6043
6288
|
end = ev;
|
|
6044
6289
|
}
|
|
6045
6290
|
if (end < start) {
|
|
6046
|
-
return new
|
|
6291
|
+
return new chunkLMGHS2NP_cjs.ListSymbol([], false);
|
|
6047
6292
|
}
|
|
6048
6293
|
const elements = [];
|
|
6049
6294
|
for (let i = start; i < end; i++) {
|
|
6050
|
-
elements.push(new
|
|
6295
|
+
elements.push(new chunkLMGHS2NP_cjs.NumberSymbol(i));
|
|
6051
6296
|
}
|
|
6052
|
-
return new
|
|
6297
|
+
return new chunkLMGHS2NP_cjs.ListSymbol(elements, false);
|
|
6053
6298
|
});
|
|
6054
6299
|
}
|
|
6055
6300
|
registerFunction(name, impl) {
|
|
@@ -6058,11 +6303,11 @@ var _FunctionsManager = class _FunctionsManager extends BaseManager {
|
|
|
6058
6303
|
registerDynamicFunction(spec) {
|
|
6059
6304
|
const functionName = spec.keyword.toLowerCase();
|
|
6060
6305
|
const script = spec.script.script;
|
|
6061
|
-
const impl = /* @__PURE__ */
|
|
6306
|
+
const impl = /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((...args) => {
|
|
6062
6307
|
try {
|
|
6063
6308
|
const config = this.parentConfig?.clone();
|
|
6064
6309
|
if (!config) {
|
|
6065
|
-
throw new
|
|
6310
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_NO_CONFIG_AVAILABLE" /* NO_CONFIG_AVAILABLE */, {
|
|
6066
6311
|
data: { functionName }
|
|
6067
6312
|
});
|
|
6068
6313
|
}
|
|
@@ -6074,19 +6319,19 @@ var _FunctionsManager = class _FunctionsManager extends BaseManager {
|
|
|
6074
6319
|
});
|
|
6075
6320
|
const result = interpreter.interpret();
|
|
6076
6321
|
if (result === null) {
|
|
6077
|
-
throw new
|
|
6322
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_FUNCTION_RETURNED_NULL" /* FUNCTION_RETURNED_NULL */, {
|
|
6078
6323
|
data: { functionName }
|
|
6079
6324
|
});
|
|
6080
6325
|
}
|
|
6081
6326
|
if (typeof result === "string") {
|
|
6082
|
-
return new
|
|
6327
|
+
return new chunkLMGHS2NP_cjs.StringSymbol(result);
|
|
6083
6328
|
}
|
|
6084
6329
|
return result;
|
|
6085
6330
|
} catch (error) {
|
|
6086
|
-
throw new
|
|
6331
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_EXECUTION_ERROR" /* EXECUTION_ERROR */, {
|
|
6087
6332
|
data: {
|
|
6088
6333
|
functionName,
|
|
6089
|
-
error:
|
|
6334
|
+
error: chunkLMGHS2NP_cjs.isLanguageError(error) ? error : chunkLMGHS2NP_cjs.serializeError(error)
|
|
6090
6335
|
}
|
|
6091
6336
|
});
|
|
6092
6337
|
}
|
|
@@ -6118,14 +6363,14 @@ var _FunctionsManager = class _FunctionsManager extends BaseManager {
|
|
|
6118
6363
|
(prop) => !prop?.optional
|
|
6119
6364
|
).length;
|
|
6120
6365
|
if (args.length < requiredCount) {
|
|
6121
|
-
throw new
|
|
6366
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("FN_REQUIRES_MIN_ARGUMENTS" /* REQUIRES_MIN_ARGUMENTS */, {
|
|
6122
6367
|
token,
|
|
6123
6368
|
data: { functionName: name, minArgs: requiredCount }
|
|
6124
6369
|
});
|
|
6125
6370
|
}
|
|
6126
6371
|
}
|
|
6127
6372
|
};
|
|
6128
|
-
|
|
6373
|
+
chunkLEYHQJTL_cjs.__name(_FunctionsManager, "FunctionsManager");
|
|
6129
6374
|
var FunctionsManager = _FunctionsManager;
|
|
6130
6375
|
var parseTokenSpec = schemaValidation.Token.parseTokenSpec;
|
|
6131
6376
|
schemaValidation.Token.safeParseTokenSpec;
|
|
@@ -6331,7 +6576,7 @@ ${spec}` : "";
|
|
|
6331
6576
|
*/
|
|
6332
6577
|
validateListItems(value, itemsSpec, visitedUrls, basePath, depth) {
|
|
6333
6578
|
const results = [];
|
|
6334
|
-
if (!(value instanceof
|
|
6579
|
+
if (!(value instanceof chunkLMGHS2NP_cjs.ListSymbol)) {
|
|
6335
6580
|
return results;
|
|
6336
6581
|
}
|
|
6337
6582
|
const items = value.value;
|
|
@@ -6444,10 +6689,10 @@ ${spec}` : "";
|
|
|
6444
6689
|
interpreter.resetSymbolTable();
|
|
6445
6690
|
interpreter.setReference("input", value);
|
|
6446
6691
|
const result = interpreter.interpret();
|
|
6447
|
-
if (result instanceof
|
|
6692
|
+
if (result instanceof chunkLMGHS2NP_cjs.BooleanSymbol && result.value === true) {
|
|
6448
6693
|
return { valid: true, tokenType };
|
|
6449
6694
|
}
|
|
6450
|
-
if (result instanceof
|
|
6695
|
+
if (result instanceof chunkLMGHS2NP_cjs.StringSymbol) {
|
|
6451
6696
|
return {
|
|
6452
6697
|
valid: false,
|
|
6453
6698
|
error: result.value,
|
|
@@ -6474,16 +6719,16 @@ ${spec}` : "";
|
|
|
6474
6719
|
* Extract a Map from various symbol types that can contain key-value pairs.
|
|
6475
6720
|
*/
|
|
6476
6721
|
getValueMap(value) {
|
|
6477
|
-
if (value instanceof
|
|
6722
|
+
if (value instanceof chunkLMGHS2NP_cjs.DictionarySymbol) {
|
|
6478
6723
|
return value.value;
|
|
6479
6724
|
}
|
|
6480
|
-
if (value instanceof
|
|
6725
|
+
if (value instanceof chunkLMGHS2NP_cjs.TokenSymbol && value.value instanceof Map) {
|
|
6481
6726
|
return value.value;
|
|
6482
6727
|
}
|
|
6483
6728
|
return null;
|
|
6484
6729
|
}
|
|
6485
6730
|
};
|
|
6486
|
-
|
|
6731
|
+
chunkLEYHQJTL_cjs.__name(_TokenManager, "TokenManager");
|
|
6487
6732
|
var TokenManager = _TokenManager;
|
|
6488
6733
|
var parseUnitSpec = schemaValidation.Unit.parseUnitSpec;
|
|
6489
6734
|
schemaValidation.Unit.safeParseUnitSpec;
|
|
@@ -6586,11 +6831,11 @@ var _UnitManager = class _UnitManager extends BaseManager {
|
|
|
6586
6831
|
const sourceUri = conversion.source === "$self" ? uri : conversion.source;
|
|
6587
6832
|
const targetUri = conversion.target === "$self" ? uri : conversion.target;
|
|
6588
6833
|
const { ast } = parseExpression(conversion.script.script);
|
|
6589
|
-
const fn = /* @__PURE__ */
|
|
6834
|
+
const fn = /* @__PURE__ */ chunkLEYHQJTL_cjs.__name((unit) => {
|
|
6590
6835
|
const config = this.createInterpreterConfig({ input: unit });
|
|
6591
6836
|
const result = new Interpreter(ast, config).interpret();
|
|
6592
|
-
if (!(result instanceof
|
|
6593
|
-
throw new
|
|
6837
|
+
if (!(result instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol)) {
|
|
6838
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("UNIT_CONVERSION_CRASHED" /* CONVERSION_CRASHED */, {
|
|
6594
6839
|
data: { error: "Unit conversion function must return a NumberWithUnitSymbol" }
|
|
6595
6840
|
});
|
|
6596
6841
|
}
|
|
@@ -6629,16 +6874,16 @@ ${spec}` : "";
|
|
|
6629
6874
|
convertTo(unit, targetUri) {
|
|
6630
6875
|
const sourceUri = this.getUriByKeyword(unit.unit);
|
|
6631
6876
|
if (!sourceUri) {
|
|
6632
|
-
throw new
|
|
6877
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("UNIT_SOURCE_URI_NOT_FOUND" /* SOURCE_URI_NOT_FOUND */, {
|
|
6633
6878
|
data: { unit: unit.unit }
|
|
6634
6879
|
});
|
|
6635
6880
|
}
|
|
6636
6881
|
try {
|
|
6637
6882
|
return this.convertThroughPath(unit, sourceUri, targetUri);
|
|
6638
6883
|
} catch (error) {
|
|
6639
|
-
throw new
|
|
6884
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("UNIT_CONVERSION_CRASHED" /* CONVERSION_CRASHED */, {
|
|
6640
6885
|
data: {
|
|
6641
|
-
error:
|
|
6886
|
+
error: chunkLMGHS2NP_cjs.isLanguageError(error) ? error : chunkLMGHS2NP_cjs.serializeError(error)
|
|
6642
6887
|
}
|
|
6643
6888
|
});
|
|
6644
6889
|
}
|
|
@@ -6646,7 +6891,7 @@ ${spec}` : "";
|
|
|
6646
6891
|
isOneNumberRelative(inputs) {
|
|
6647
6892
|
let relativeCount = 0;
|
|
6648
6893
|
for (const input of inputs) {
|
|
6649
|
-
if (input instanceof
|
|
6894
|
+
if (input instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol) {
|
|
6650
6895
|
const spec = this.getSpecByKeyword(input.unit);
|
|
6651
6896
|
if (spec?.type === "relative") {
|
|
6652
6897
|
relativeCount++;
|
|
@@ -6657,14 +6902,14 @@ ${spec}` : "";
|
|
|
6657
6902
|
}
|
|
6658
6903
|
convertRelative(numbers) {
|
|
6659
6904
|
if (numbers.length !== 2) {
|
|
6660
|
-
throw new
|
|
6905
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("UNIT_RELATIVE_REQUIRES_TWO_NUMBERS" /* RELATIVE_REQUIRES_TWO_NUMBERS */);
|
|
6661
6906
|
}
|
|
6662
6907
|
let relativeNum = null;
|
|
6663
6908
|
let baseNum = null;
|
|
6664
6909
|
let relativeIndex = -1;
|
|
6665
6910
|
for (let i = 0; i < numbers.length; i++) {
|
|
6666
6911
|
const num = numbers[i];
|
|
6667
|
-
if (num instanceof
|
|
6912
|
+
if (num instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol) {
|
|
6668
6913
|
const spec2 = this.getSpecByKeyword(num.unit);
|
|
6669
6914
|
if (spec2?.type === "relative") {
|
|
6670
6915
|
if (relativeNum !== null) {
|
|
@@ -6684,13 +6929,13 @@ ${spec}` : "";
|
|
|
6684
6929
|
}
|
|
6685
6930
|
const spec = this.getSpecByKeyword(relativeNum.unit);
|
|
6686
6931
|
if (!spec?.to_absolute) {
|
|
6687
|
-
throw new
|
|
6932
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("UNIT_NO_TO_ABSOLUTE_SCRIPT" /* NO_TO_ABSOLUTE_SCRIPT */, {
|
|
6688
6933
|
data: { unit: relativeNum.unit }
|
|
6689
6934
|
});
|
|
6690
6935
|
}
|
|
6691
6936
|
const { ast } = parseExpression(spec.to_absolute.script);
|
|
6692
|
-
const relativeValueSymbol = new
|
|
6693
|
-
const otherValueSymbol = new
|
|
6937
|
+
const relativeValueSymbol = new chunkLMGHS2NP_cjs.NumberSymbol(relativeNum.value);
|
|
6938
|
+
const otherValueSymbol = new chunkLMGHS2NP_cjs.NumberSymbol(baseNum.value);
|
|
6694
6939
|
const result = new Interpreter(ast, {
|
|
6695
6940
|
references: {
|
|
6696
6941
|
relative_value: relativeValueSymbol,
|
|
@@ -6698,21 +6943,21 @@ ${spec}` : "";
|
|
|
6698
6943
|
}
|
|
6699
6944
|
}).interpret();
|
|
6700
6945
|
let convertedValue;
|
|
6701
|
-
if (result instanceof
|
|
6946
|
+
if (result instanceof chunkLMGHS2NP_cjs.NumberSymbol) {
|
|
6702
6947
|
convertedValue = result.value;
|
|
6703
6948
|
} else if (typeof result === "number") {
|
|
6704
6949
|
convertedValue = result;
|
|
6705
6950
|
} else {
|
|
6706
|
-
throw new
|
|
6951
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("UNIT_TO_ABSOLUTE_MUST_RETURN_NUMBER" /* TO_ABSOLUTE_MUST_RETURN_NUMBER */);
|
|
6707
6952
|
}
|
|
6708
6953
|
if (Number.isInteger(convertedValue)) {
|
|
6709
6954
|
convertedValue = Math.trunc(convertedValue);
|
|
6710
6955
|
}
|
|
6711
6956
|
let convertedNum;
|
|
6712
|
-
if (baseNum instanceof
|
|
6713
|
-
convertedNum = new
|
|
6957
|
+
if (baseNum instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol) {
|
|
6958
|
+
convertedNum = new chunkLMGHS2NP_cjs.NumberWithUnitSymbol(convertedValue, baseNum.unit);
|
|
6714
6959
|
} else {
|
|
6715
|
-
convertedNum = new
|
|
6960
|
+
convertedNum = new chunkLMGHS2NP_cjs.NumberSymbol(convertedValue);
|
|
6716
6961
|
}
|
|
6717
6962
|
const resultNumbers = [...numbers];
|
|
6718
6963
|
resultNumbers[relativeIndex] = convertedNum;
|
|
@@ -6723,7 +6968,7 @@ ${spec}` : "";
|
|
|
6723
6968
|
return [];
|
|
6724
6969
|
}
|
|
6725
6970
|
const numberWithUnits = inputs.filter(
|
|
6726
|
-
(inp) => inp instanceof
|
|
6971
|
+
(inp) => inp instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol
|
|
6727
6972
|
);
|
|
6728
6973
|
if (numberWithUnits.length < 1) {
|
|
6729
6974
|
return inputs;
|
|
@@ -6731,7 +6976,7 @@ ${spec}` : "";
|
|
|
6731
6976
|
const isRelative = this.isOneNumberRelative(inputs);
|
|
6732
6977
|
if (isRelative) {
|
|
6733
6978
|
if (inputs.length > 2) {
|
|
6734
|
-
throw new
|
|
6979
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("UNIT_CANNOT_CONVERT_MULTIPLE_RELATIVE" /* CANNOT_CONVERT_MULTIPLE_RELATIVE */);
|
|
6735
6980
|
}
|
|
6736
6981
|
return this.convertRelative(inputs);
|
|
6737
6982
|
}
|
|
@@ -6743,7 +6988,7 @@ ${spec}` : "";
|
|
|
6743
6988
|
conversionResults[unitUri] = [];
|
|
6744
6989
|
let canConvert = true;
|
|
6745
6990
|
for (const inp of inputs) {
|
|
6746
|
-
if (!(inp instanceof
|
|
6991
|
+
if (!(inp instanceof chunkLMGHS2NP_cjs.NumberWithUnitSymbol)) {
|
|
6747
6992
|
conversionResults[unitUri].push(inp);
|
|
6748
6993
|
continue;
|
|
6749
6994
|
}
|
|
@@ -6777,7 +7022,7 @@ ${spec}` : "";
|
|
|
6777
7022
|
maxPerUri[uri] = maxValue;
|
|
6778
7023
|
}
|
|
6779
7024
|
if (Object.keys(maxPerUri).length === 0) {
|
|
6780
|
-
throw new
|
|
7025
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("UNIT_NO_VALID_CONVERSION_PATH" /* NO_VALID_CONVERSION_PATH */);
|
|
6781
7026
|
}
|
|
6782
7027
|
const commonUnitUri = Object.keys(maxPerUri).reduce(
|
|
6783
7028
|
(a, b) => maxPerUri[a] > maxPerUri[b] ? a : b
|
|
@@ -6785,7 +7030,7 @@ ${spec}` : "";
|
|
|
6785
7030
|
return conversionResults[commonUnitUri] || [];
|
|
6786
7031
|
}
|
|
6787
7032
|
};
|
|
6788
|
-
|
|
7033
|
+
chunkLEYHQJTL_cjs.__name(_UnitManager, "UnitManager");
|
|
6789
7034
|
var UnitManager = _UnitManager;
|
|
6790
7035
|
|
|
6791
7036
|
// src/interpreter/config/config.ts
|
|
@@ -6821,17 +7066,17 @@ var _Config = class _Config {
|
|
|
6821
7066
|
if (lowerBaseType === "color") {
|
|
6822
7067
|
if (subType) {
|
|
6823
7068
|
if (!this.colorManager.getSpecByType(subType)) {
|
|
6824
|
-
throw new
|
|
7069
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("CFG_NO_SPEC_FOUND" /* NO_SPEC_FOUND */, {
|
|
6825
7070
|
data: { specName: subType }
|
|
6826
7071
|
});
|
|
6827
7072
|
}
|
|
6828
|
-
return new
|
|
7073
|
+
return new chunkLMGHS2NP_cjs.ColorSymbol(null, subType, null, this);
|
|
6829
7074
|
}
|
|
6830
|
-
return new
|
|
7075
|
+
return new chunkLMGHS2NP_cjs.ColorSymbol(null, void 0, null, this);
|
|
6831
7076
|
}
|
|
6832
|
-
const basicSymbolConstructor =
|
|
7077
|
+
const basicSymbolConstructor = chunkLMGHS2NP_cjs.basicSymbolTypes[baseType.toLowerCase()];
|
|
6833
7078
|
if (!basicSymbolConstructor) {
|
|
6834
|
-
throw new
|
|
7079
|
+
throw new chunkLMGHS2NP_cjs.InterpreterError("CFG_NO_TYPE_FOUND" /* NO_TYPE_FOUND */, {
|
|
6835
7080
|
data: { typeName: baseType }
|
|
6836
7081
|
});
|
|
6837
7082
|
}
|
|
@@ -6844,7 +7089,7 @@ var _Config = class _Config {
|
|
|
6844
7089
|
return true;
|
|
6845
7090
|
}
|
|
6846
7091
|
if (subType) return false;
|
|
6847
|
-
return !!
|
|
7092
|
+
return !!chunkLMGHS2NP_cjs.basicSymbolTypes[lowerBaseType];
|
|
6848
7093
|
}
|
|
6849
7094
|
get inlineConstants() {
|
|
6850
7095
|
return this._inlineConstants;
|
|
@@ -6886,7 +7131,7 @@ var _Config = class _Config {
|
|
|
6886
7131
|
return this;
|
|
6887
7132
|
}
|
|
6888
7133
|
};
|
|
6889
|
-
|
|
7134
|
+
chunkLEYHQJTL_cjs.__name(_Config, "Config");
|
|
6890
7135
|
var Config = _Config;
|
|
6891
7136
|
schemaValidation.Constants.parseConstantsSpec;
|
|
6892
7137
|
schemaValidation.Constants.safeParseConstantsSpec;
|
|
@@ -6914,9 +7159,9 @@ function evaluateExpression(expression, options = {}) {
|
|
|
6914
7159
|
const result = interpreter.interpret();
|
|
6915
7160
|
return {
|
|
6916
7161
|
success: true,
|
|
6917
|
-
result:
|
|
6918
|
-
resultString:
|
|
6919
|
-
type:
|
|
7162
|
+
result: chunkLMGHS2NP_cjs.serializeInterpreterResult(result),
|
|
7163
|
+
resultString: chunkLMGHS2NP_cjs.stringifyInterpreterResult(result),
|
|
7164
|
+
type: chunkLMGHS2NP_cjs.isTokenscriptSymbol(result) ? result.getTypeName() : chunkLMGHS2NP_cjs.getResultTypeName(result),
|
|
6920
7165
|
executionTime: performance.now() - startTime
|
|
6921
7166
|
};
|
|
6922
7167
|
} catch (error) {
|
|
@@ -6927,7 +7172,7 @@ function evaluateExpression(expression, options = {}) {
|
|
|
6927
7172
|
};
|
|
6928
7173
|
}
|
|
6929
7174
|
}
|
|
6930
|
-
|
|
7175
|
+
chunkLEYHQJTL_cjs.__name(evaluateExpression, "evaluateExpression");
|
|
6931
7176
|
|
|
6932
7177
|
// src/interpreter/tolerant/index.ts
|
|
6933
7178
|
function parseTolerantly(text) {
|
|
@@ -6952,12 +7197,12 @@ function parseTolerantly(text) {
|
|
|
6952
7197
|
};
|
|
6953
7198
|
}
|
|
6954
7199
|
}
|
|
6955
|
-
|
|
7200
|
+
chunkLEYHQJTL_cjs.__name(parseTolerantly, "parseTolerantly");
|
|
6956
7201
|
function tokenizeTolerantly(text) {
|
|
6957
7202
|
const lexer = new Lexer(text, { tolerant: true });
|
|
6958
7203
|
return lexer.tokenizeAll();
|
|
6959
7204
|
}
|
|
6960
|
-
|
|
7205
|
+
chunkLEYHQJTL_cjs.__name(tokenizeTolerantly, "tokenizeTolerantly");
|
|
6961
7206
|
function collectAllReferences(ast) {
|
|
6962
7207
|
if (!ast) return [];
|
|
6963
7208
|
const refs = [];
|
|
@@ -6970,7 +7215,7 @@ function collectAllReferences(ast) {
|
|
|
6970
7215
|
});
|
|
6971
7216
|
return refs;
|
|
6972
7217
|
}
|
|
6973
|
-
|
|
7218
|
+
chunkLEYHQJTL_cjs.__name(collectAllReferences, "collectAllReferences");
|
|
6974
7219
|
var PARTIAL_FOUND = Symbol("PARTIAL_FOUND");
|
|
6975
7220
|
function hasPartialNodes(ast) {
|
|
6976
7221
|
if (!ast) return false;
|
|
@@ -6986,7 +7231,7 @@ function hasPartialNodes(ast) {
|
|
|
6986
7231
|
throw e;
|
|
6987
7232
|
}
|
|
6988
7233
|
}
|
|
6989
|
-
|
|
7234
|
+
chunkLEYHQJTL_cjs.__name(hasPartialNodes, "hasPartialNodes");
|
|
6990
7235
|
|
|
6991
7236
|
// src/lib/interpreter.ts
|
|
6992
7237
|
var ASTNodes = {
|
|
@@ -7047,6 +7292,8 @@ exports.processTokenSets = processTokenSets;
|
|
|
7047
7292
|
exports.processTokens = processTokens;
|
|
7048
7293
|
exports.renameReferences = renameReferences;
|
|
7049
7294
|
exports.tokenizeTolerantly = tokenizeTolerantly;
|
|
7295
|
+
exports.validateTokenName = validateTokenName;
|
|
7296
|
+
exports.validateTokenPath = validateTokenPath;
|
|
7050
7297
|
exports.walkAST = walkAST;
|
|
7051
|
-
//# sourceMappingURL=chunk-
|
|
7052
|
-
//# sourceMappingURL=chunk-
|
|
7298
|
+
//# sourceMappingURL=chunk-YCIBJDRB.cjs.map
|
|
7299
|
+
//# sourceMappingURL=chunk-YCIBJDRB.cjs.map
|