@jplorg/jpl 2.1.1 → 2.1.3
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/esm/main.js +704 -853
- package/dist/types/main.d.ts +3 -3
- package/package.json +17 -17
package/dist/esm/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// \0rolldown/runtime.js
|
|
2
2
|
var e = Object.defineProperty, t = (t, n) => {
|
|
3
3
|
let r = {};
|
|
4
4
|
for (var i in t) e(r, i, {
|
|
@@ -7,14 +7,12 @@ var e = Object.defineProperty, t = (t, n) => {
|
|
|
7
7
|
});
|
|
8
8
|
return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
//#region lib/createSingleton.ts
|
|
10
|
+
// lib/createSingleton.ts
|
|
12
11
|
function n(e) {
|
|
13
12
|
let t;
|
|
14
13
|
return () => (t ??= e(), t);
|
|
15
14
|
}
|
|
16
|
-
|
|
17
|
-
//#region lib/applyDefaults.ts
|
|
15
|
+
// lib/applyDefaults.ts
|
|
18
16
|
function r(e, t, ...n) {
|
|
19
17
|
let r = (e, t, n) => {
|
|
20
18
|
if (Array.isArray(e)) return e;
|
|
@@ -32,8 +30,7 @@ function r(e, t, ...n) {
|
|
|
32
30
|
};
|
|
33
31
|
return r(e, t, n.map((e) => typeof e == "string" ? e.split(".") : e));
|
|
34
32
|
}
|
|
35
|
-
|
|
36
|
-
//#region lib/library/apply.ts
|
|
33
|
+
// lib/library/apply.ts
|
|
37
34
|
function i(e, t) {
|
|
38
35
|
let n = e, r = !0;
|
|
39
36
|
return t.forEach((e) => {
|
|
@@ -44,9 +41,7 @@ function i(e, t) {
|
|
|
44
41
|
let { [t]: e, ...i } = n;
|
|
45
42
|
n = i, r = !1;
|
|
46
43
|
} else delete n[t];
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
Object.hasOwn(n, t) && n[t] === i || (r ? (n = {
|
|
44
|
+
} else Object.hasOwn(n, t) && n[t] === i || (r ? (n = {
|
|
50
45
|
...n,
|
|
51
46
|
[t]: i
|
|
52
47
|
}, r = !1) : n[t] = i);
|
|
@@ -98,16 +93,15 @@ function o(e, t) {
|
|
|
98
93
|
}
|
|
99
94
|
return s;
|
|
100
95
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
var s = "$.", c = "and", l = "[]", u = "$=", d = "clc", f = "cmp", p = "cnt", ee = "fls", te = "nul", ne = "tru", re = "fun", ie = "if", ae = "\"$\"", oe = "neg", se = "not", ce = "??", le = "nbr", ue = "{}", de = "or", fe = ",", pe = "\"\"", me = "try", he = "var", ge = "va=", _e = "vod", ve = "$.$", ye = "$()", be = "$[]", xe = "[:]", Se = "==", Ce = ">", we = ">=", Te = "<", Ee = "<=", De = "!=", Oe = "+", ke = "/", Ae = "*", je = "%", Me = "-", Ne = "+=", Pe = "/=", Fe = "*=", Ie = "?=", Le = "%=", Re = "=", ze = "-=", Be = "|=", Ve = 1, He = 0, m = "1.0", h = class extends Error {
|
|
96
|
+
// lib/library/ops/op.ts
|
|
97
|
+
var s = "$.", c = "and", l = "[]", u = "$=", d = "clc", f = "cmp", p = "cnt", ee = "fls", te = "nul", ne = "tru", re = "fun", ie = "if", ae = "\"$\"", oe = "neg", se = "not", ce = "??", le = "nbr", ue = "{}", de = "or", fe = ",", pe = "\"\"", me = "try", he = "var", ge = "va=", _e = "vod", ve = "$.$", ye = "$()", be = "$[]", xe = "[:]", Se = "==", Ce = ">", we = ">=", Te = "<", Ee = "<=", De = "!=", Oe = "+", ke = "/", Ae = "*", je = "%", Me = "-", Ne = "+=", Pe = "/=", Fe = "*=", Ie = "?=", Le = "%=", Re = "=", ze = "-=", Be = "|=", Ve = 1, He = 0, Ue = "1.0", m = class extends Error {
|
|
104
98
|
static is(e) {
|
|
105
99
|
return e instanceof this;
|
|
106
100
|
}
|
|
107
101
|
constructor(e, t = "JPLError") {
|
|
108
102
|
super(e), this.name = t;
|
|
109
103
|
}
|
|
110
|
-
},
|
|
104
|
+
}, h = class extends m {
|
|
111
105
|
#e;
|
|
112
106
|
constructor(e, t = "JPLExecutionError") {
|
|
113
107
|
super(e, t), this.#e = typeof e == "string" && e ? e : null;
|
|
@@ -119,43 +113,41 @@ var s = "$.", c = "and", l = "[]", u = "$=", d = "clc", f = "cmp", p = "cnt", ee
|
|
|
119
113
|
return this.#e;
|
|
120
114
|
}
|
|
121
115
|
};
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
function Ue(e) {
|
|
116
|
+
// lib/library/errors/adaptErrors.ts
|
|
117
|
+
function We(e) {
|
|
125
118
|
try {
|
|
126
119
|
return e();
|
|
127
120
|
} catch (e) {
|
|
128
|
-
throw
|
|
121
|
+
throw g(e);
|
|
129
122
|
}
|
|
130
123
|
}
|
|
131
|
-
async function
|
|
124
|
+
async function Ge(e) {
|
|
132
125
|
try {
|
|
133
126
|
return await e();
|
|
134
127
|
} catch (e) {
|
|
135
|
-
throw
|
|
128
|
+
throw g(e);
|
|
136
129
|
}
|
|
137
130
|
}
|
|
138
|
-
function
|
|
139
|
-
return
|
|
131
|
+
function g(e) {
|
|
132
|
+
return m.is(e) ? e : new h(e?.message);
|
|
140
133
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
var v = class extends h {
|
|
134
|
+
// lib/library/errors/enclosure.ts
|
|
135
|
+
var _ = class extends m {
|
|
144
136
|
inner;
|
|
145
137
|
constructor(e) {
|
|
146
138
|
super(e?.toString(), "JPLErrorEnclosure"), this.inner = e;
|
|
147
139
|
}
|
|
148
|
-
},
|
|
140
|
+
}, v = class extends m {
|
|
149
141
|
constructor(e) {
|
|
150
142
|
super(e, "JPLFatalError");
|
|
151
143
|
}
|
|
152
|
-
},
|
|
144
|
+
}, y = class {
|
|
153
145
|
static is(e) {
|
|
154
146
|
return e instanceof this;
|
|
155
147
|
}
|
|
156
148
|
#e;
|
|
157
149
|
constructor(e) {
|
|
158
|
-
this.#e =
|
|
150
|
+
this.#e = Ke(e);
|
|
159
151
|
}
|
|
160
152
|
get value() {
|
|
161
153
|
return this.#e;
|
|
@@ -164,26 +156,26 @@ var v = class extends h {
|
|
|
164
156
|
return this.#e;
|
|
165
157
|
}
|
|
166
158
|
async alter(e) {
|
|
167
|
-
return
|
|
159
|
+
return b(await e(this.value));
|
|
168
160
|
}
|
|
169
161
|
toJSON() {
|
|
170
162
|
try {
|
|
171
163
|
return this.json;
|
|
172
164
|
} catch (e) {
|
|
173
|
-
throw
|
|
165
|
+
throw g(e);
|
|
174
166
|
}
|
|
175
167
|
}
|
|
176
168
|
};
|
|
177
|
-
function
|
|
178
|
-
return
|
|
169
|
+
function Ke(e) {
|
|
170
|
+
return y.is(e) ? e.value : b(e);
|
|
179
171
|
}
|
|
180
|
-
function
|
|
181
|
-
return
|
|
172
|
+
function b(e) {
|
|
173
|
+
return T(e, void 0, Ze);
|
|
182
174
|
}
|
|
183
|
-
function
|
|
184
|
-
return
|
|
175
|
+
function x(e) {
|
|
176
|
+
return y.is(e) ? We(() => e.value) : e;
|
|
185
177
|
}
|
|
186
|
-
var
|
|
178
|
+
var qe = [
|
|
187
179
|
"null",
|
|
188
180
|
"function",
|
|
189
181
|
"boolean",
|
|
@@ -192,8 +184,8 @@ var Ke = [
|
|
|
192
184
|
"array",
|
|
193
185
|
"object"
|
|
194
186
|
];
|
|
195
|
-
function
|
|
196
|
-
let t =
|
|
187
|
+
function Je(e) {
|
|
188
|
+
let t = x(e);
|
|
197
189
|
if (t === null) return "null";
|
|
198
190
|
if (Array.isArray(t)) return "array";
|
|
199
191
|
let n = typeof t;
|
|
@@ -203,37 +195,34 @@ function C(e) {
|
|
|
203
195
|
case "number":
|
|
204
196
|
case "string":
|
|
205
197
|
case "object": return n;
|
|
206
|
-
default: throw new
|
|
198
|
+
default: throw new v(`invalid type ${n} (${e})`);
|
|
207
199
|
}
|
|
208
200
|
}
|
|
209
|
-
function
|
|
210
|
-
if (
|
|
211
|
-
let n =
|
|
212
|
-
if (n !== t) throw new
|
|
201
|
+
function Ye(e, t) {
|
|
202
|
+
if (y.is(e)) throw new v(C("unexpected type: JPLTypes (%*<100v) are not allowed here", e));
|
|
203
|
+
let n = Je(e);
|
|
204
|
+
if (n !== t) throw new v(C("unexpected type: %s (%*<100v) cannot be used as %s", n, e, t));
|
|
213
205
|
return e;
|
|
214
206
|
}
|
|
215
|
-
function
|
|
216
|
-
let r = n ?
|
|
207
|
+
function S(e, t, n) {
|
|
208
|
+
let r = n ? T(e, (e, t) => typeof x(t) == "function" ? "<function>" : t) : T(e);
|
|
217
209
|
return t && typeof r == "string" ? r : JSON.stringify(r);
|
|
218
210
|
}
|
|
219
|
-
function
|
|
211
|
+
function C(e, ...t) {
|
|
220
212
|
let n = 0;
|
|
221
|
-
return
|
|
222
|
-
|
|
223
|
-
case "%": return "%";
|
|
224
|
-
default:
|
|
225
|
-
}
|
|
213
|
+
return w(e).replace(/%([*\-<]+)?([1-9][0-9]*)?(.)/g, (e, r, i, a) => {
|
|
214
|
+
if (a === "%") return "%";
|
|
226
215
|
let o = t[n] ?? null;
|
|
227
216
|
n += 1;
|
|
228
217
|
let s;
|
|
229
218
|
switch (a) {
|
|
230
219
|
case "s":
|
|
231
|
-
s =
|
|
220
|
+
s = w(o);
|
|
232
221
|
break;
|
|
233
222
|
case "v":
|
|
234
|
-
s =
|
|
223
|
+
s = Xe(o);
|
|
235
224
|
break;
|
|
236
|
-
default: throw new
|
|
225
|
+
default: throw new v(`format ${e} has unknown verb ${a}`);
|
|
237
226
|
}
|
|
238
227
|
let c = !0, l = !1, u = !1;
|
|
239
228
|
[...r ?? []].forEach((t) => {
|
|
@@ -247,7 +236,7 @@ function T(e, ...t) {
|
|
|
247
236
|
case "<":
|
|
248
237
|
u = !0;
|
|
249
238
|
break;
|
|
250
|
-
default: throw new
|
|
239
|
+
default: throw new v(`format ${e} has unknown flag ${t}`);
|
|
251
240
|
}
|
|
252
241
|
});
|
|
253
242
|
let d = +(i ?? 0);
|
|
@@ -261,35 +250,35 @@ function T(e, ...t) {
|
|
|
261
250
|
return s;
|
|
262
251
|
});
|
|
263
252
|
}
|
|
264
|
-
function
|
|
265
|
-
return
|
|
253
|
+
function w(e) {
|
|
254
|
+
return S(e, !0, !0);
|
|
266
255
|
}
|
|
267
|
-
function
|
|
268
|
-
return
|
|
256
|
+
function Xe(e) {
|
|
257
|
+
return S(e, !1, !0);
|
|
269
258
|
}
|
|
270
|
-
function
|
|
259
|
+
function T(e, t, n = $e) {
|
|
271
260
|
let r = (e, i) => {
|
|
272
261
|
let a = i;
|
|
273
262
|
return t && (a = t(e ?? "", a)), n(e, a, r);
|
|
274
263
|
};
|
|
275
264
|
return r(null, e);
|
|
276
265
|
}
|
|
277
|
-
function
|
|
278
|
-
return
|
|
266
|
+
function Ze(e, t, n) {
|
|
267
|
+
return y.is(t) || typeof t == "function" ? t : E(e, t, n);
|
|
279
268
|
}
|
|
280
|
-
function
|
|
269
|
+
function Qe(e, t, n) {
|
|
281
270
|
let r = t;
|
|
282
|
-
return
|
|
271
|
+
return y.is(r) && (r = r.toJSON()), typeof r == "function" ? r : E(e, r, n);
|
|
283
272
|
}
|
|
284
|
-
function
|
|
273
|
+
function $e(e, t, n) {
|
|
285
274
|
let r = t;
|
|
286
|
-
return
|
|
275
|
+
return y.is(r) && (r = r.toJSON()), E(e, r, n);
|
|
287
276
|
}
|
|
288
|
-
function
|
|
277
|
+
function et(e, t, n) {
|
|
289
278
|
let r = t;
|
|
290
|
-
return typeof r?.toJSON == "function" && (r = r.toJSON()),
|
|
279
|
+
return typeof r?.toJSON == "function" && (r = r.toJSON()), E(e, r, n);
|
|
291
280
|
}
|
|
292
|
-
function
|
|
281
|
+
function E(e, t, n) {
|
|
293
282
|
let r = e == null;
|
|
294
283
|
switch (typeof t) {
|
|
295
284
|
case "string":
|
|
@@ -301,36 +290,35 @@ function O(e, t, n) {
|
|
|
301
290
|
let r = n(e, t);
|
|
302
291
|
return r === void 0 ? [e] : [e, r];
|
|
303
292
|
}));
|
|
304
|
-
default: throw new
|
|
293
|
+
default: throw new v(`unexpected ${typeof t}`);
|
|
305
294
|
}
|
|
306
295
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
return t.length > 0 ? T(e, ...t) : E(e);
|
|
296
|
+
// lib/library/errors/runtime.ts
|
|
297
|
+
function D(e, t) {
|
|
298
|
+
return t.length > 0 ? C(e, ...t) : w(e);
|
|
311
299
|
}
|
|
312
|
-
var
|
|
300
|
+
var O = class extends h {
|
|
313
301
|
constructor(e, ...t) {
|
|
314
|
-
let n =
|
|
315
|
-
super(n, "JPLRuntimeError"), this.value = t.length > 0 ? n :
|
|
302
|
+
let n = D(e, t);
|
|
303
|
+
super(n, "JPLRuntimeError"), this.value = t.length > 0 ? n : b(e);
|
|
316
304
|
}
|
|
317
|
-
},
|
|
305
|
+
}, k = class extends O {
|
|
318
306
|
constructor(e, ...t) {
|
|
319
|
-
super(`TypeError - ${
|
|
307
|
+
super(`TypeError - ${D(e, t)}`);
|
|
320
308
|
}
|
|
321
|
-
},
|
|
309
|
+
}, tt = class extends O {
|
|
322
310
|
constructor(e, ...t) {
|
|
323
|
-
super(`ReferenceError - ${
|
|
311
|
+
super(`ReferenceError - ${D(e, t)}`);
|
|
324
312
|
}
|
|
325
|
-
},
|
|
313
|
+
}, A = class extends O {
|
|
326
314
|
constructor(e, ...t) {
|
|
327
|
-
super(`ZeroDivisionError - ${
|
|
315
|
+
super(`ZeroDivisionError - ${D(e, t)}`);
|
|
328
316
|
}
|
|
329
|
-
},
|
|
317
|
+
}, nt = class extends O {
|
|
330
318
|
constructor(e, ...t) {
|
|
331
|
-
super(`TypeConversionError - ${
|
|
319
|
+
super(`TypeConversionError - ${D(e, t)}`);
|
|
332
320
|
}
|
|
333
|
-
},
|
|
321
|
+
}, j = class extends m {
|
|
334
322
|
src;
|
|
335
323
|
at;
|
|
336
324
|
constructor(e, t = "", n = 0) {
|
|
@@ -351,7 +339,7 @@ var A = class extends g {
|
|
|
351
339
|
return this.#t ||= this.parent?.exited ?? !1, this.#t;
|
|
352
340
|
}
|
|
353
341
|
checkHealth() {
|
|
354
|
-
if (this.exited) throw new
|
|
342
|
+
if (this.exited) throw new v("execution aborted");
|
|
355
343
|
}
|
|
356
344
|
exit = () => {
|
|
357
345
|
this.exited || (this.#t = !0, Object.values(this.#n).forEach((e) => {
|
|
@@ -368,7 +356,7 @@ var A = class extends g {
|
|
|
368
356
|
};
|
|
369
357
|
};
|
|
370
358
|
next = () => new e(this);
|
|
371
|
-
},
|
|
359
|
+
}, M = class e {
|
|
372
360
|
#e;
|
|
373
361
|
#t;
|
|
374
362
|
constructor(e = {}) {
|
|
@@ -387,34 +375,32 @@ var A = class extends g {
|
|
|
387
375
|
});
|
|
388
376
|
}
|
|
389
377
|
};
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
function at(e, t, n, r, ...i) {
|
|
378
|
+
// lib/library/functions.ts
|
|
379
|
+
function it(e, t, n, r, ...i) {
|
|
393
380
|
let { argNames: a, pipe: o, scope: s } = this;
|
|
394
381
|
return e.executeInstructions(o, [r], s.next({
|
|
395
382
|
signal: t,
|
|
396
383
|
vars: Object.fromEntries(a.map((e, t) => [e, i[t] ?? null]))
|
|
397
384
|
}), n);
|
|
398
385
|
}
|
|
399
|
-
function
|
|
400
|
-
return
|
|
386
|
+
function N(e, t, n) {
|
|
387
|
+
return it.bind({
|
|
401
388
|
argNames: e,
|
|
402
389
|
pipe: t,
|
|
403
390
|
scope: n
|
|
404
391
|
});
|
|
405
392
|
}
|
|
406
|
-
function
|
|
407
|
-
return
|
|
393
|
+
function at(e, t, n) {
|
|
394
|
+
return N(e, t, new M(n));
|
|
408
395
|
}
|
|
409
|
-
function
|
|
396
|
+
function ot(e) {
|
|
410
397
|
return async (t, n, r, i, ...a) => {
|
|
411
398
|
let o = await e(t, i, ...a);
|
|
412
399
|
return t.muxAll([o], r);
|
|
413
400
|
};
|
|
414
401
|
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
function lt(e, t) {
|
|
402
|
+
// lib/library/mux.ts
|
|
403
|
+
function st(e, t) {
|
|
418
404
|
let n = e.length;
|
|
419
405
|
if (n === 1) {
|
|
420
406
|
e[0].forEach((e) => t(e));
|
|
@@ -439,7 +425,7 @@ function lt(e, t) {
|
|
|
439
425
|
t[1] = 0, [a[e]] = o;
|
|
440
426
|
}
|
|
441
427
|
}
|
|
442
|
-
function
|
|
428
|
+
function P(e, t) {
|
|
443
429
|
let n = e.length;
|
|
444
430
|
if (n === 1) return e[0].map((e) => t(e));
|
|
445
431
|
let r = 1, i = e.map((e) => {
|
|
@@ -462,26 +448,25 @@ function M(e, t) {
|
|
|
462
448
|
}
|
|
463
449
|
return a;
|
|
464
450
|
}
|
|
465
|
-
function
|
|
466
|
-
return Promise.all(
|
|
451
|
+
function F(e, t) {
|
|
452
|
+
return Promise.all(P(e, t));
|
|
467
453
|
}
|
|
468
|
-
async function
|
|
469
|
-
return
|
|
454
|
+
async function ct(e, t) {
|
|
455
|
+
return lt(await F(e, t));
|
|
470
456
|
}
|
|
471
|
-
function
|
|
457
|
+
function lt(e) {
|
|
472
458
|
return e.length === 0 ? e : e.length === 1 ? e[0] : e.flat(1);
|
|
473
459
|
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
function N(e = {}, t = {}) {
|
|
460
|
+
// lib/runtime/index.ts
|
|
461
|
+
var ut = { vars: {} };
|
|
462
|
+
function I(e = {}, t = {}) {
|
|
478
463
|
return r(e, t, "vars");
|
|
479
464
|
}
|
|
480
|
-
var
|
|
465
|
+
var dt = class {
|
|
481
466
|
#e;
|
|
482
467
|
#t;
|
|
483
468
|
constructor(e, t) {
|
|
484
|
-
this.#e =
|
|
469
|
+
this.#e = I(t?.runtime, ut), this.#t = e;
|
|
485
470
|
}
|
|
486
471
|
get options() {
|
|
487
472
|
return this.#e;
|
|
@@ -489,7 +474,7 @@ var mt = class {
|
|
|
489
474
|
get program() {
|
|
490
475
|
return this.#t;
|
|
491
476
|
}
|
|
492
|
-
createScope = (e) => new
|
|
477
|
+
createScope = (e) => new M(e);
|
|
493
478
|
execute = async (e) => {
|
|
494
479
|
let t = this.createScope({ vars: Object.fromEntries(this.muxOne([Object.entries(this.options.vars)], ([e, t]) => [e, this.normalizeValue(t)])) });
|
|
495
480
|
try {
|
|
@@ -502,86 +487,86 @@ var mt = class {
|
|
|
502
487
|
let i = async (t, n, a) => {
|
|
503
488
|
if (await void 0, a.signal.checkHealth(), t >= e.length) return r(n, a);
|
|
504
489
|
let { op: o, params: s } = e[t], c = this.program.ops[o];
|
|
505
|
-
if (!c) throw new
|
|
490
|
+
if (!c) throw new v(`invalid OP '${o}'`);
|
|
506
491
|
return c.op(this, n, s ?? {}, a, (e, n) => i(t + 1, e, n));
|
|
507
492
|
};
|
|
508
493
|
return this.muxAll([t], (e) => i(0, e, n));
|
|
509
494
|
};
|
|
510
495
|
op(e, t, n, r, i = (e) => [e]) {
|
|
511
496
|
let a = this.program.ops[e];
|
|
512
|
-
if (!a) throw new
|
|
497
|
+
if (!a) throw new v(`invalid OP '${e}'`);
|
|
513
498
|
let o = a.map(this, t);
|
|
514
499
|
return this.muxAll([n], (e) => a.op(this, e, o ?? {}, r, i));
|
|
515
500
|
}
|
|
516
|
-
normalizeValue =
|
|
501
|
+
normalizeValue = b;
|
|
517
502
|
normalizeValues = (e = [], t = "values") => {
|
|
518
|
-
if (!Array.isArray(e)) throw new
|
|
503
|
+
if (!Array.isArray(e)) throw new v(`expected ${t} to be an array`);
|
|
519
504
|
return this.normalizeValue(e);
|
|
520
505
|
};
|
|
521
|
-
unwrapValue =
|
|
506
|
+
unwrapValue = x;
|
|
522
507
|
unwrapValues = (e = [], t = "values") => {
|
|
523
|
-
if (!Array.isArray(e)) throw new
|
|
508
|
+
if (!Array.isArray(e)) throw new v(`expected ${t} to be an array`);
|
|
524
509
|
return this.muxOne([e], (e) => this.unwrapValue(e));
|
|
525
510
|
};
|
|
526
|
-
stripValue = (e) =>
|
|
511
|
+
stripValue = (e) => T(e, (e, t) => this.unwrapValue(t));
|
|
527
512
|
stripValues = (e = [], t = "values") => {
|
|
528
|
-
if (!Array.isArray(e)) throw new
|
|
513
|
+
if (!Array.isArray(e)) throw new v(`expected ${t} to be an array`);
|
|
529
514
|
return this.muxOne([e], (e) => this.stripValue(e));
|
|
530
515
|
};
|
|
531
|
-
alterValue = async (e, t) =>
|
|
532
|
-
type =
|
|
533
|
-
assertType =
|
|
516
|
+
alterValue = async (e, t) => y.is(e) ? Ge(() => e.alter(t)) : this.normalizeValue(await t(e));
|
|
517
|
+
type = Je;
|
|
518
|
+
assertType = Ye;
|
|
534
519
|
truthy = (e) => {
|
|
535
520
|
let t = this.unwrapValue(e);
|
|
536
521
|
return t !== null && t !== !1;
|
|
537
522
|
};
|
|
538
|
-
compare =
|
|
523
|
+
compare = L.bind(this);
|
|
539
524
|
compareStrings = (e, t) => {
|
|
540
525
|
let n = this.type(e);
|
|
541
|
-
if (n !== "string") throw new
|
|
526
|
+
if (n !== "string") throw new v(`unexpected type ${n}`);
|
|
542
527
|
let r = this.type(t);
|
|
543
|
-
if (r !== "string") throw new
|
|
544
|
-
return
|
|
528
|
+
if (r !== "string") throw new v(`unexpected type ${r}`);
|
|
529
|
+
return R(this.unwrapValue(e), this.unwrapValue(t));
|
|
545
530
|
};
|
|
546
531
|
compareArrays = (e, t) => {
|
|
547
532
|
let n = this.type(e);
|
|
548
|
-
if (n !== "array") throw new
|
|
533
|
+
if (n !== "array") throw new v(`unexpected type ${n}`);
|
|
549
534
|
let r = this.type(t);
|
|
550
|
-
if (r !== "array") throw new
|
|
551
|
-
return
|
|
535
|
+
if (r !== "array") throw new v(`unexpected type ${r}`);
|
|
536
|
+
return ft.call(this, this.unwrapValue(e), this.unwrapValue(t));
|
|
552
537
|
};
|
|
553
538
|
compareObjects = (e, t) => {
|
|
554
539
|
let n = this.type(e);
|
|
555
|
-
if (n !== "object") throw new
|
|
540
|
+
if (n !== "object") throw new v(`unexpected type ${n}`);
|
|
556
541
|
let r = this.type(t);
|
|
557
|
-
if (r !== "object") throw new
|
|
558
|
-
return
|
|
542
|
+
if (r !== "object") throw new v(`unexpected type ${r}`);
|
|
543
|
+
return pt.call(this, this.unwrapValue(e), this.unwrapValue(t));
|
|
559
544
|
};
|
|
560
545
|
equals = (e, t) => this.compare(e, t) === 0;
|
|
561
546
|
merge = async (e, t) => (await void 0, this.type(e) !== "object" || this.type(t) !== "object" ? t : this.alterValue(e, async (e) => i(e, await Promise.all(Object.entries(this.unwrapValue(t)).map(async ([t, n]) => [t, await this.merge(e[t] ?? null, n)])))));
|
|
562
|
-
stringifyJSON = (e, t) =>
|
|
563
|
-
stripJSON = (e) =>
|
|
564
|
-
mux =
|
|
565
|
-
muxOne =
|
|
566
|
-
muxAsync =
|
|
567
|
-
muxAll =
|
|
547
|
+
stringifyJSON = (e, t) => S(e, t);
|
|
548
|
+
stripJSON = (e) => T(e);
|
|
549
|
+
mux = st;
|
|
550
|
+
muxOne = P;
|
|
551
|
+
muxAsync = F;
|
|
552
|
+
muxAll = ct;
|
|
568
553
|
};
|
|
569
|
-
function
|
|
554
|
+
function L(e, t) {
|
|
570
555
|
let n = this.type(e), r = this.type(t);
|
|
571
|
-
if (n !== r) return
|
|
556
|
+
if (n !== r) return qe.indexOf(n) - qe.indexOf(r);
|
|
572
557
|
let i = this.unwrapValue(e), a = this.unwrapValue(t);
|
|
573
558
|
switch (n) {
|
|
574
559
|
case "null":
|
|
575
560
|
case "function": return 0;
|
|
576
561
|
case "boolean":
|
|
577
|
-
case "number": return i -
|
|
578
|
-
case "string": return
|
|
579
|
-
case "array": return
|
|
580
|
-
case "object": return
|
|
581
|
-
default: throw new
|
|
562
|
+
case "number": return +i - a;
|
|
563
|
+
case "string": return R(i, a);
|
|
564
|
+
case "array": return ft.call(this, i, a);
|
|
565
|
+
case "object": return pt.call(this, i, a);
|
|
566
|
+
default: throw new v(`unexpected type ${n}`);
|
|
582
567
|
}
|
|
583
568
|
}
|
|
584
|
-
function
|
|
569
|
+
function R(e, t) {
|
|
585
570
|
let n = Math.min(e.length, t.length), r = 0;
|
|
586
571
|
for (let i of e) {
|
|
587
572
|
if (r >= n) break;
|
|
@@ -591,33 +576,32 @@ function F(e, t) {
|
|
|
591
576
|
}
|
|
592
577
|
return e.length - t.length;
|
|
593
578
|
}
|
|
594
|
-
function
|
|
579
|
+
function ft(e, t) {
|
|
595
580
|
let n = Math.min(e.length, t.length);
|
|
596
581
|
for (let r = 0; r < n; r += 1) {
|
|
597
|
-
let n =
|
|
582
|
+
let n = L.call(this, e[r], t[r]);
|
|
598
583
|
if (n !== 0) return n;
|
|
599
584
|
}
|
|
600
585
|
return e.length - t.length;
|
|
601
586
|
}
|
|
602
|
-
function
|
|
603
|
-
let n = Object.keys(e).sort(
|
|
587
|
+
function pt(e, t) {
|
|
588
|
+
let n = Object.keys(e).sort(R), r = Object.keys(t).sort(R), i = ft.call(this, n, r);
|
|
604
589
|
if (i !== 0) return i;
|
|
605
|
-
for (let r of n) if (i =
|
|
590
|
+
for (let r of n) if (i = L.call(this, e[r], t[r]), i !== 0) return i;
|
|
606
591
|
return 0;
|
|
607
592
|
}
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
function L(e) {
|
|
593
|
+
// lib/program/ops/utils.ts
|
|
594
|
+
function z(e) {
|
|
611
595
|
return [{
|
|
612
596
|
op: "cnt",
|
|
613
597
|
params: { value: e ?? null }
|
|
614
598
|
}];
|
|
615
599
|
}
|
|
616
|
-
function
|
|
600
|
+
function B(e) {
|
|
617
601
|
return [{
|
|
618
602
|
op: "$.",
|
|
619
603
|
params: {
|
|
620
|
-
pipe:
|
|
604
|
+
pipe: z(Ye(e, "function")),
|
|
621
605
|
selectors: [{
|
|
622
606
|
op: "$()",
|
|
623
607
|
params: {
|
|
@@ -629,9 +613,8 @@ function R(e) {
|
|
|
629
613
|
}
|
|
630
614
|
}];
|
|
631
615
|
}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
var gt = {
|
|
616
|
+
// lib/program/ops/opAccess/opaField.ts
|
|
617
|
+
var mt = {
|
|
635
618
|
op(e, t, n, r, i, a) {
|
|
636
619
|
let o = e.unwrapValue(n), s = e.type(o);
|
|
637
620
|
return e.executeInstructions(r.pipe ?? [], [t], i, (t) => {
|
|
@@ -649,58 +632,52 @@ var gt = {
|
|
|
649
632
|
return a(o[e >= 0 ? e : o.length + e] ?? null);
|
|
650
633
|
}
|
|
651
634
|
break;
|
|
652
|
-
case "string":
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
}
|
|
657
|
-
break;
|
|
658
|
-
default:
|
|
635
|
+
case "string": if (i === "number") {
|
|
636
|
+
let e = Math.trunc(n), t = [...o];
|
|
637
|
+
return a(t[e >= 0 ? e : t.length + e] ?? null);
|
|
638
|
+
}
|
|
659
639
|
}
|
|
660
640
|
if (r.optional) return [];
|
|
661
|
-
throw new
|
|
641
|
+
throw new k("cannot access field of %s (%*<100v) with %s (%*<100v)", s, o, i, n);
|
|
662
642
|
});
|
|
663
643
|
},
|
|
664
644
|
map(e, t) {
|
|
665
645
|
return {
|
|
666
|
-
pipe:
|
|
646
|
+
pipe: B(t.pipe),
|
|
667
647
|
optional: e.assertType(t.optional, "boolean")
|
|
668
648
|
};
|
|
669
649
|
}
|
|
670
|
-
},
|
|
650
|
+
}, ht = {
|
|
671
651
|
async op(e, t, n, r, i, a) {
|
|
672
652
|
let o = e.unwrapValue(n), s = e.type(o);
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
});
|
|
690
|
-
}
|
|
691
|
-
default:
|
|
653
|
+
if (s === "function") {
|
|
654
|
+
let n = await e.muxAsync([r.args ?? []], (n) => e.executeInstructions(n ?? [], [t], i));
|
|
655
|
+
return e.muxAll(n, async (...n) => {
|
|
656
|
+
try {
|
|
657
|
+
let s = async (e) => {
|
|
658
|
+
try {
|
|
659
|
+
return await a(e);
|
|
660
|
+
} catch (e) {
|
|
661
|
+
throw new _(e);
|
|
662
|
+
}
|
|
663
|
+
};
|
|
664
|
+
return r.bound ? await o(e, i.signal, s, n[0] ?? null, ...n.slice(1)) : await o(e, i.signal, s, t, ...n);
|
|
665
|
+
} catch (e) {
|
|
666
|
+
throw _.is(e) ? e.inner : g(e);
|
|
667
|
+
}
|
|
668
|
+
});
|
|
692
669
|
}
|
|
693
670
|
if (r.optional) return [];
|
|
694
|
-
throw new
|
|
671
|
+
throw new k("cannot execute %s (%*<100v)", s, o);
|
|
695
672
|
},
|
|
696
673
|
map(e, t) {
|
|
697
674
|
return {
|
|
698
|
-
args: e.muxOne([t.args], (e) =>
|
|
675
|
+
args: e.muxOne([t.args], (e) => B(e)),
|
|
699
676
|
bound: e.assertType(t.bound, "boolean"),
|
|
700
677
|
optional: e.assertType(t.optional, "boolean")
|
|
701
678
|
};
|
|
702
679
|
}
|
|
703
|
-
},
|
|
680
|
+
}, gt = {
|
|
704
681
|
op(e, t, n, r, i, a) {
|
|
705
682
|
let o = e.unwrapValue(n), s = e.type(o);
|
|
706
683
|
switch (s) {
|
|
@@ -708,15 +685,14 @@ var gt = {
|
|
|
708
685
|
case "object": return e.muxAll([Object.values(o)], a);
|
|
709
686
|
case "array": return e.muxAll([o], a);
|
|
710
687
|
case "string": return e.muxAll([[...o]], a);
|
|
711
|
-
default:
|
|
712
688
|
}
|
|
713
689
|
if (r.optional) return [];
|
|
714
|
-
throw new
|
|
690
|
+
throw new k("cannot iterate over %s (%*<100v)", s, o);
|
|
715
691
|
},
|
|
716
692
|
map(e, t) {
|
|
717
693
|
return { optional: e.assertType(t.optional, "boolean") };
|
|
718
694
|
}
|
|
719
|
-
},
|
|
695
|
+
}, _t = {
|
|
720
696
|
async op(e, t, n, r, i, a) {
|
|
721
697
|
let o = e.unwrapValue(n), s = e.type(o), [c, l] = await Promise.all([e.executeInstructions(r.from ?? [], [t], i), e.executeInstructions(r.to ?? [], [t], i)]);
|
|
722
698
|
return e.muxAll([e.unwrapValues(c), e.unwrapValues(l)], (t, n) => {
|
|
@@ -726,41 +702,38 @@ var gt = {
|
|
|
726
702
|
case "array":
|
|
727
703
|
if (["number", "null"].includes(i) && ["number", "null"].includes(c)) return a(o.slice(Math.trunc(t ?? 0), Math.trunc(n ?? o.length)));
|
|
728
704
|
break;
|
|
729
|
-
case "string":
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
}
|
|
734
|
-
break;
|
|
735
|
-
default:
|
|
705
|
+
case "string": if (["number", "null"].includes(i) && ["number", "null"].includes(c)) {
|
|
706
|
+
let e = [...o];
|
|
707
|
+
return a(e.slice(Math.trunc(t ?? 0), Math.trunc(n ?? e.length)).join(""));
|
|
708
|
+
}
|
|
736
709
|
}
|
|
737
710
|
if (r.optional) return [];
|
|
738
|
-
throw new
|
|
711
|
+
throw new k("cannot slice %s (%*<100v) with %s (%*<100v) and %s (%*<100v)", s, o, i, t, c, n);
|
|
739
712
|
});
|
|
740
713
|
},
|
|
741
714
|
map(e, t) {
|
|
742
715
|
return {
|
|
743
|
-
from:
|
|
744
|
-
to:
|
|
716
|
+
from: B(t.from),
|
|
717
|
+
to: B(t.to),
|
|
745
718
|
optional: e.assertType(t.optional, "boolean")
|
|
746
719
|
};
|
|
747
720
|
}
|
|
748
|
-
},
|
|
721
|
+
}, vt = {
|
|
749
722
|
op(e, t, n, r, i) {
|
|
750
723
|
let a = async (o, s) => {
|
|
751
724
|
if (await void 0, r.signal.checkHealth(), o >= (n.selectors?.length ?? 0)) return i(s, r);
|
|
752
|
-
let { op: c, params: l } = n.selectors[o], u =
|
|
753
|
-
if (!u) throw new
|
|
725
|
+
let { op: c, params: l } = n.selectors[o], u = yt[c];
|
|
726
|
+
if (!u) throw new v(`invalid OPA '${c}'`);
|
|
754
727
|
return u.op(e, t, s, l ?? {}, r, (e) => a(o + 1, e));
|
|
755
728
|
};
|
|
756
729
|
return e.executeInstructions(n.pipe ?? [], [t], r, (e) => a(0, e));
|
|
757
730
|
},
|
|
758
731
|
map(e, t) {
|
|
759
732
|
return {
|
|
760
|
-
pipe:
|
|
733
|
+
pipe: B(t.pipe),
|
|
761
734
|
selectors: e.muxOne([t.selectors], ({ op: t, params: n }) => {
|
|
762
|
-
let r =
|
|
763
|
-
if (!r) throw new
|
|
735
|
+
let r = yt[t];
|
|
736
|
+
if (!r) throw new v(`invalid OPA '${t}'`);
|
|
764
737
|
return {
|
|
765
738
|
op: e.assertType(t, "string"),
|
|
766
739
|
params: r.map(e, n)
|
|
@@ -768,12 +741,12 @@ var gt = {
|
|
|
768
741
|
})
|
|
769
742
|
};
|
|
770
743
|
}
|
|
771
|
-
},
|
|
772
|
-
"$.$":
|
|
773
|
-
"$()":
|
|
774
|
-
"$[]":
|
|
775
|
-
"[:]":
|
|
776
|
-
},
|
|
744
|
+
}, yt = {
|
|
745
|
+
"$.$": mt,
|
|
746
|
+
"$()": ht,
|
|
747
|
+
"$[]": gt,
|
|
748
|
+
"[:]": _t
|
|
749
|
+
}, bt = {
|
|
777
750
|
op(e, t, n, r, i) {
|
|
778
751
|
let a = async (o) => {
|
|
779
752
|
if (await void 0, r.signal.checkHealth(), o >= (n.pipes?.length ?? 0)) return i(!0, r);
|
|
@@ -783,16 +756,16 @@ var gt = {
|
|
|
783
756
|
return a(0);
|
|
784
757
|
},
|
|
785
758
|
map(e, t) {
|
|
786
|
-
return { pipes: e.muxOne([t.pipes], (e) =>
|
|
759
|
+
return { pipes: e.muxOne([t.pipes], (e) => B(e)) };
|
|
787
760
|
}
|
|
788
|
-
},
|
|
761
|
+
}, xt = {
|
|
789
762
|
async op(e, t, n, r, i) {
|
|
790
763
|
return i(await e.executeInstructions(n.pipe ?? [], [t], r), r);
|
|
791
764
|
},
|
|
792
765
|
map(e, t) {
|
|
793
|
-
return { pipe:
|
|
766
|
+
return { pipe: B(t.pipe) };
|
|
794
767
|
}
|
|
795
|
-
},
|
|
768
|
+
}, St = {
|
|
796
769
|
async op(e, t, n, r, o, s) {
|
|
797
770
|
let c, l = e.unwrapValue(n), u = e.type(n);
|
|
798
771
|
switch (u) {
|
|
@@ -806,7 +779,7 @@ var gt = {
|
|
|
806
779
|
break;
|
|
807
780
|
default:
|
|
808
781
|
if (r.optional) return [void 0];
|
|
809
|
-
throw new
|
|
782
|
+
throw new k("cannot access fields of %s (%*<100v) (assignment)", u, l);
|
|
810
783
|
}
|
|
811
784
|
let d = await e.executeInstructions(r.pipe ?? [], [t], o, (e) => [e]), f = async (t, n) => {
|
|
812
785
|
if (await void 0, o.signal.checkHealth(), t >= d.length) return [n];
|
|
@@ -819,7 +792,6 @@ var gt = {
|
|
|
819
792
|
let r = Math.trunc(l);
|
|
820
793
|
return e.muxAll([await s(null)], (e) => e === void 0 ? f(t + 1, n) : f(t + 1, a([], [[r, e]])));
|
|
821
794
|
}
|
|
822
|
-
default:
|
|
823
795
|
}
|
|
824
796
|
break;
|
|
825
797
|
case "object":
|
|
@@ -834,25 +806,21 @@ var gt = {
|
|
|
834
806
|
return e.muxAll([await s(i ?? null)], (e) => e === void 0 ? f(t + 1, n) : f(t + 1, a(n, [[r, e]])));
|
|
835
807
|
}
|
|
836
808
|
break;
|
|
837
|
-
case "string":
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
});
|
|
850
|
-
}
|
|
851
|
-
break;
|
|
852
|
-
default:
|
|
809
|
+
case "string": if (p === "number") {
|
|
810
|
+
let r = Math.trunc(l), i = n[r >= 0 ? r : n.length + r];
|
|
811
|
+
return e.muxAll([await s(i ?? null)], (i) => {
|
|
812
|
+
if (i === void 0) return f(t + 1, n);
|
|
813
|
+
let o = e.unwrapValue(i), s = e.type(o);
|
|
814
|
+
switch (s) {
|
|
815
|
+
case "null":
|
|
816
|
+
case "string": return f(t + 1, a(n, [[r, i ?? " "]], " "));
|
|
817
|
+
}
|
|
818
|
+
throw new k("cannot assign %s (%*<100v) to string (%*<100v)", s, o, n.join(""));
|
|
819
|
+
});
|
|
820
|
+
}
|
|
853
821
|
}
|
|
854
822
|
if (r.optional) return f(t + 1, n);
|
|
855
|
-
throw new
|
|
823
|
+
throw new k("cannot access field of %s (%*<100v) with %s (%*<100v) (assignment)", c, c === "string" ? n.join("") : n, p, l);
|
|
856
824
|
};
|
|
857
825
|
return e.muxAsync([await f(0, c)], (t) => {
|
|
858
826
|
if (c === t) return n;
|
|
@@ -861,17 +829,16 @@ var gt = {
|
|
|
861
829
|
case "object":
|
|
862
830
|
case "array": return e.alterValue(n, () => t);
|
|
863
831
|
case "string": return e.alterValue(n, () => t.join(""));
|
|
864
|
-
default:
|
|
865
832
|
}
|
|
866
833
|
});
|
|
867
834
|
},
|
|
868
835
|
map(e, t) {
|
|
869
836
|
return {
|
|
870
|
-
pipe:
|
|
837
|
+
pipe: B(t.pipe),
|
|
871
838
|
optional: e.assertType(t.optional, "boolean")
|
|
872
839
|
};
|
|
873
840
|
}
|
|
874
|
-
},
|
|
841
|
+
}, Ct = {
|
|
875
842
|
async op(e, t, n, r, i, a) {
|
|
876
843
|
let s = e.unwrapValue(n), c = e.type(s);
|
|
877
844
|
switch (c) {
|
|
@@ -891,27 +858,24 @@ var gt = {
|
|
|
891
858
|
switch (i) {
|
|
892
859
|
case "null":
|
|
893
860
|
case "string": return r ?? " ";
|
|
894
|
-
default:
|
|
895
861
|
}
|
|
896
|
-
throw new
|
|
862
|
+
throw new k("cannot assign %s (%*<100v) to string (%*<100v)", i, r, s);
|
|
897
863
|
}));
|
|
898
864
|
return e.muxAsync([o(t, r)], (r) => t === r ? n : e.alterValue(n, () => r.join("")));
|
|
899
865
|
}
|
|
900
|
-
default:
|
|
901
866
|
}
|
|
902
867
|
if (r.optional) return [void 0];
|
|
903
|
-
throw new
|
|
868
|
+
throw new k("cannot iterate over %s (%*<100v) (assignment)", c, s);
|
|
904
869
|
},
|
|
905
870
|
map(e, t) {
|
|
906
871
|
return { optional: e.assertType(t.optional, "boolean") };
|
|
907
872
|
}
|
|
908
873
|
};
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
return e.length === t.length ? e.every((e, n) => e === t[n]) : !1;
|
|
874
|
+
// lib/program/ops/opAssignment/opaAssignSlice.ts
|
|
875
|
+
function wt(e, t) {
|
|
876
|
+
return e.length === t.length && e.every((e, n) => e === t[n]);
|
|
913
877
|
}
|
|
914
|
-
var
|
|
878
|
+
var Tt = {
|
|
915
879
|
async op(e, t, n, r, i, a) {
|
|
916
880
|
let [o, s] = await Promise.all([e.executeInstructions(r.from ?? [], [t], i), e.executeInstructions(r.to ?? [], [t], i)]), c = e.muxOne([e.unwrapValues(o), e.unwrapValues(s)], (e, t) => [e, t]), l = async (t, n) => {
|
|
917
881
|
if (await void 0, i.signal.checkHealth(), t >= c.length) return [n];
|
|
@@ -925,52 +889,47 @@ var Dt = {
|
|
|
925
889
|
case "null":
|
|
926
890
|
case "array": {
|
|
927
891
|
let e = Math.trunc(u ?? 0), r = Math.trunc(d ?? t.length);
|
|
928
|
-
if (e = e >= 0 ? Math.min(t.length, e) : Math.max(0, t.length + e), r = Math.max(e, r >= 0 ? Math.min(t.length, r) : Math.max(0, t.length + r)),
|
|
892
|
+
if (e = e >= 0 ? Math.min(t.length, e) : Math.max(0, t.length + e), r = Math.max(e, r >= 0 ? Math.min(t.length, r) : Math.max(0, t.length + r)), wt(t.slice(e, r), n ?? [])) return t;
|
|
929
893
|
let i = [...t];
|
|
930
894
|
return i.splice(e, r - e, ...n ?? []), i;
|
|
931
895
|
}
|
|
932
|
-
default:
|
|
933
896
|
}
|
|
934
|
-
throw new
|
|
897
|
+
throw new k("cannot assign %s (%*<100v) to slice of %s (%*<100v)", i, n, s, t);
|
|
935
898
|
})));
|
|
936
899
|
break;
|
|
937
|
-
case "string":
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
return r = r >= 0 ? Math.min(e.length, r) : Math.max(0, e.length + r), i = Math.max(r, i >= 0 ? Math.min(e.length, i) : Math.max(0, e.length + i)), Et(e.slice(r, i), n ?? []) ? t : (e.splice(r, i - r, ...n ?? []), e.join(""));
|
|
947
|
-
}
|
|
948
|
-
default:
|
|
900
|
+
case "string": if (["number", "null"].includes(f) && ["number", "null"].includes(p)) {
|
|
901
|
+
let r = [...o];
|
|
902
|
+
return e.muxAll([await a(r.slice(Math.trunc(u ?? 0), Math.trunc(d ?? r.length)).join(""))], async (r) => r === void 0 ? l(t + 1, n) : l(t + 1, await e.alterValue(n, (t) => {
|
|
903
|
+
let n = e.unwrapValue(r), i = e.type(n);
|
|
904
|
+
switch (i) {
|
|
905
|
+
case "null":
|
|
906
|
+
case "string": {
|
|
907
|
+
let e = [...t], r = Math.trunc(u ?? 0), i = Math.trunc(d ?? e.length);
|
|
908
|
+
return r = r >= 0 ? Math.min(e.length, r) : Math.max(0, e.length + r), i = Math.max(r, i >= 0 ? Math.min(e.length, i) : Math.max(0, e.length + i)), wt(e.slice(r, i), n ?? []) ? t : (e.splice(r, i - r, ...n ?? []), e.join(""));
|
|
949
909
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
default:
|
|
910
|
+
}
|
|
911
|
+
throw new k("cannot assign %s (%*<100v) to slice of %s (%*<100v)", i, n, s, t);
|
|
912
|
+
})));
|
|
913
|
+
}
|
|
955
914
|
}
|
|
956
915
|
if (r.optional) return l(t + 1, n);
|
|
957
|
-
throw new
|
|
916
|
+
throw new k("cannot slice %s (%*<100v) with %s (%*<100v) and %s (%*<100v) (assignment)", s, o, f, u, p, d);
|
|
958
917
|
};
|
|
959
918
|
return e.muxOne([await l(0, n)], (t) => e.type(t) === "null" ? void 0 : t);
|
|
960
919
|
},
|
|
961
920
|
map(e, t) {
|
|
962
921
|
return {
|
|
963
|
-
from:
|
|
964
|
-
to:
|
|
922
|
+
from: B(t.from),
|
|
923
|
+
to: B(t.to),
|
|
965
924
|
optional: e.assertType(t.optional, "boolean")
|
|
966
925
|
};
|
|
967
926
|
}
|
|
968
|
-
},
|
|
927
|
+
}, Et = {
|
|
969
928
|
op(e, t, n, r, i, a) {
|
|
970
929
|
return e.executeInstructions([{
|
|
971
930
|
op: "clc",
|
|
972
931
|
params: {
|
|
973
|
-
pipe:
|
|
932
|
+
pipe: z(n),
|
|
974
933
|
operations: [{
|
|
975
934
|
op: "+",
|
|
976
935
|
params: { by: r.pipe ?? [] }
|
|
@@ -979,14 +938,14 @@ var Dt = {
|
|
|
979
938
|
}], [t], i, a);
|
|
980
939
|
},
|
|
981
940
|
map(e, t) {
|
|
982
|
-
return { pipe:
|
|
941
|
+
return { pipe: B(t.pipe) };
|
|
983
942
|
}
|
|
984
|
-
},
|
|
943
|
+
}, Dt = {
|
|
985
944
|
op(e, t, n, r, i, a) {
|
|
986
945
|
return e.executeInstructions([{
|
|
987
946
|
op: "clc",
|
|
988
947
|
params: {
|
|
989
|
-
pipe:
|
|
948
|
+
pipe: z(n),
|
|
990
949
|
operations: [{
|
|
991
950
|
op: "/",
|
|
992
951
|
params: { by: r.pipe ?? [] }
|
|
@@ -995,14 +954,14 @@ var Dt = {
|
|
|
995
954
|
}], [t], i, a);
|
|
996
955
|
},
|
|
997
956
|
map(e, t) {
|
|
998
|
-
return { pipe:
|
|
957
|
+
return { pipe: B(t.pipe) };
|
|
999
958
|
}
|
|
1000
|
-
},
|
|
959
|
+
}, Ot = {
|
|
1001
960
|
op(e, t, n, r, i, a) {
|
|
1002
961
|
return e.executeInstructions([{
|
|
1003
962
|
op: "clc",
|
|
1004
963
|
params: {
|
|
1005
|
-
pipe:
|
|
964
|
+
pipe: z(n),
|
|
1006
965
|
operations: [{
|
|
1007
966
|
op: "*",
|
|
1008
967
|
params: { by: r.pipe ?? [] }
|
|
@@ -1011,24 +970,24 @@ var Dt = {
|
|
|
1011
970
|
}], [t], i, a);
|
|
1012
971
|
},
|
|
1013
972
|
map(e, t) {
|
|
1014
|
-
return { pipe:
|
|
973
|
+
return { pipe: B(t.pipe) };
|
|
1015
974
|
}
|
|
1016
|
-
},
|
|
975
|
+
}, kt = {
|
|
1017
976
|
op(e, t, n, r, i, a) {
|
|
1018
977
|
return e.executeInstructions([{
|
|
1019
978
|
op: "??",
|
|
1020
|
-
params: { pipes: [
|
|
979
|
+
params: { pipes: [z(n), r.pipe ?? []] }
|
|
1021
980
|
}], [t], i, a);
|
|
1022
981
|
},
|
|
1023
982
|
map(e, t) {
|
|
1024
|
-
return { pipe:
|
|
983
|
+
return { pipe: B(t.pipe) };
|
|
1025
984
|
}
|
|
1026
|
-
},
|
|
985
|
+
}, At = {
|
|
1027
986
|
op(e, t, n, r, i, a) {
|
|
1028
987
|
return e.executeInstructions([{
|
|
1029
988
|
op: "clc",
|
|
1030
989
|
params: {
|
|
1031
|
-
pipe:
|
|
990
|
+
pipe: z(n),
|
|
1032
991
|
operations: [{
|
|
1033
992
|
op: "%",
|
|
1034
993
|
params: { by: r.pipe ?? [] }
|
|
@@ -1037,21 +996,21 @@ var Dt = {
|
|
|
1037
996
|
}], [t], i, a);
|
|
1038
997
|
},
|
|
1039
998
|
map(e, t) {
|
|
1040
|
-
return { pipe:
|
|
999
|
+
return { pipe: B(t.pipe) };
|
|
1041
1000
|
}
|
|
1042
|
-
},
|
|
1001
|
+
}, jt = {
|
|
1043
1002
|
op(e, t, n, r, i, a) {
|
|
1044
1003
|
return e.executeInstructions(r.pipe ?? [], [t], i, a);
|
|
1045
1004
|
},
|
|
1046
1005
|
map(e, t) {
|
|
1047
|
-
return { pipe:
|
|
1006
|
+
return { pipe: B(t.pipe) };
|
|
1048
1007
|
}
|
|
1049
|
-
},
|
|
1008
|
+
}, Mt = {
|
|
1050
1009
|
op(e, t, n, r, i, a) {
|
|
1051
1010
|
return e.executeInstructions([{
|
|
1052
1011
|
op: "clc",
|
|
1053
1012
|
params: {
|
|
1054
|
-
pipe:
|
|
1013
|
+
pipe: z(n),
|
|
1055
1014
|
operations: [{
|
|
1056
1015
|
op: "-",
|
|
1057
1016
|
params: { by: r.pipe ?? [] }
|
|
@@ -1060,43 +1019,43 @@ var Dt = {
|
|
|
1060
1019
|
}], [t], i, a);
|
|
1061
1020
|
},
|
|
1062
1021
|
map(e, t) {
|
|
1063
|
-
return { pipe:
|
|
1022
|
+
return { pipe: B(t.pipe) };
|
|
1064
1023
|
}
|
|
1065
|
-
},
|
|
1024
|
+
}, Nt = {
|
|
1066
1025
|
op(e, t, n, r, i, a) {
|
|
1067
1026
|
return e.executeInstructions(r.pipe ?? [], [n], i, a);
|
|
1068
1027
|
},
|
|
1069
1028
|
map(e, t) {
|
|
1070
|
-
return { pipe:
|
|
1029
|
+
return { pipe: B(t.pipe) };
|
|
1071
1030
|
}
|
|
1072
|
-
},
|
|
1031
|
+
}, Pt = {
|
|
1073
1032
|
op(e, t, n, r, i) {
|
|
1074
1033
|
let a = async (i, o) => {
|
|
1075
1034
|
if (await void 0, r.signal.checkHealth(), i >= (n.selectors?.length ?? 0)) {
|
|
1076
|
-
let { op: i, params: a } = n.assignment ?? {}, s =
|
|
1077
|
-
if (!s) throw new
|
|
1035
|
+
let { op: i, params: a } = n.assignment ?? {}, s = It[i];
|
|
1036
|
+
if (!s) throw new v(`invalid OPU '${i}'`);
|
|
1078
1037
|
return s.op(e, t, o, a ?? {}, r, (e) => [e]);
|
|
1079
1038
|
}
|
|
1080
|
-
let { op: s, params: c } = n.selectors[i], l =
|
|
1081
|
-
if (!l) throw new
|
|
1039
|
+
let { op: s, params: c } = n.selectors[i], l = Ft[s];
|
|
1040
|
+
if (!l) throw new v(`invalid OPA '${s}' (assignment)`);
|
|
1082
1041
|
return l.op(e, t, o, c ?? {}, r, (e) => a(i + 1, e));
|
|
1083
1042
|
};
|
|
1084
1043
|
return e.executeInstructions(n.pipe ?? [], [t], r, async (t) => e.muxAll([await a(0, t)], (e) => i(e === void 0 ? t : e, r)));
|
|
1085
1044
|
},
|
|
1086
1045
|
map(e, t) {
|
|
1087
1046
|
return {
|
|
1088
|
-
pipe:
|
|
1047
|
+
pipe: B(t.pipe),
|
|
1089
1048
|
selectors: e.muxOne([t.selectors], ({ op: t, params: n }) => {
|
|
1090
|
-
let r =
|
|
1091
|
-
if (!r) throw new
|
|
1049
|
+
let r = Ft[t];
|
|
1050
|
+
if (!r) throw new v(`invalid OPA '${t}' (assignment)`);
|
|
1092
1051
|
return {
|
|
1093
1052
|
op: e.assertType(t, "string"),
|
|
1094
1053
|
params: r.map(e, n)
|
|
1095
1054
|
};
|
|
1096
1055
|
}),
|
|
1097
1056
|
assignment: (({ op: t, params: n }) => {
|
|
1098
|
-
let r =
|
|
1099
|
-
if (!r) throw new
|
|
1057
|
+
let r = It[t];
|
|
1058
|
+
if (!r) throw new v(`invalid OPU '${t}'`);
|
|
1100
1059
|
return {
|
|
1101
1060
|
op: e.assertType(t, "string"),
|
|
1102
1061
|
params: r.map(e, n)
|
|
@@ -1104,20 +1063,20 @@ var Dt = {
|
|
|
1104
1063
|
})(t.assignment)
|
|
1105
1064
|
};
|
|
1106
1065
|
}
|
|
1066
|
+
}, Ft = {
|
|
1067
|
+
"$.$": St,
|
|
1068
|
+
"$[]": Ct,
|
|
1069
|
+
"[:]": Tt
|
|
1070
|
+
}, It = {
|
|
1071
|
+
"+=": Et,
|
|
1072
|
+
"/=": Dt,
|
|
1073
|
+
"*=": Ot,
|
|
1074
|
+
"?=": kt,
|
|
1075
|
+
"%=": At,
|
|
1076
|
+
"=": jt,
|
|
1077
|
+
"-=": Mt,
|
|
1078
|
+
"|=": Nt
|
|
1107
1079
|
}, Lt = {
|
|
1108
|
-
"$.$": wt,
|
|
1109
|
-
"$[]": Tt,
|
|
1110
|
-
"[:]": Dt
|
|
1111
|
-
}, Rt = {
|
|
1112
|
-
"+=": Ot,
|
|
1113
|
-
"/=": kt,
|
|
1114
|
-
"*=": At,
|
|
1115
|
-
"?=": jt,
|
|
1116
|
-
"%=": Mt,
|
|
1117
|
-
"=": Nt,
|
|
1118
|
-
"-=": Pt,
|
|
1119
|
-
"|=": Ft
|
|
1120
|
-
}, zt = {
|
|
1121
1080
|
op(e, t, n, r, a, o) {
|
|
1122
1081
|
return e.executeInstructions(r.by ?? [], [t], a, async (t) => o(await e.alterValue(n, (n) => {
|
|
1123
1082
|
let r = e.unwrapValue(t), a = e.type(n), o = e.type(r);
|
|
@@ -1132,40 +1091,34 @@ var Dt = {
|
|
|
1132
1091
|
case "string":
|
|
1133
1092
|
if (o === "string") return n + r;
|
|
1134
1093
|
break;
|
|
1135
|
-
case "object":
|
|
1136
|
-
if (o === "object") return i(n, Object.entries(r));
|
|
1137
|
-
break;
|
|
1138
|
-
default:
|
|
1094
|
+
case "object": if (o === "object") return i(n, Object.entries(r));
|
|
1139
1095
|
}
|
|
1140
|
-
throw new
|
|
1096
|
+
throw new k("%s (%*<100v) and %s (%*<100v) cannot be added together", a, n, o, r);
|
|
1141
1097
|
})));
|
|
1142
1098
|
},
|
|
1143
1099
|
map(e, t) {
|
|
1144
|
-
return { by:
|
|
1100
|
+
return { by: B(t.by) };
|
|
1145
1101
|
}
|
|
1146
|
-
},
|
|
1102
|
+
}, Rt = {
|
|
1147
1103
|
op(e, t, n, r, i, a) {
|
|
1148
1104
|
return e.executeInstructions(r.by ?? [], [t], i, async (t) => a(await e.alterValue(n, (n) => {
|
|
1149
1105
|
let r = e.unwrapValue(t), i = e.type(n), a = e.type(r);
|
|
1150
1106
|
switch (i) {
|
|
1151
1107
|
case "number":
|
|
1152
1108
|
if (a === "number") {
|
|
1153
|
-
if (r === 0) throw new
|
|
1109
|
+
if (r === 0) throw new A("%s (%*<100v) cannot be divided by zero", i, n);
|
|
1154
1110
|
return n / r;
|
|
1155
1111
|
}
|
|
1156
1112
|
break;
|
|
1157
|
-
case "string":
|
|
1158
|
-
if (a === "string") return r === "" ? [...n] : n.split(r);
|
|
1159
|
-
break;
|
|
1160
|
-
default:
|
|
1113
|
+
case "string": if (a === "string") return r === "" ? [...n] : n.split(r);
|
|
1161
1114
|
}
|
|
1162
|
-
throw new
|
|
1115
|
+
throw new k("%s (%*<100v) cannot be divided by %s (%*<100v)", i, n, a, r);
|
|
1163
1116
|
})));
|
|
1164
1117
|
},
|
|
1165
1118
|
map(e, t) {
|
|
1166
|
-
return { by:
|
|
1119
|
+
return { by: B(t.by) };
|
|
1167
1120
|
}
|
|
1168
|
-
},
|
|
1121
|
+
}, zt = {
|
|
1169
1122
|
op(e, t, n, r, i, a) {
|
|
1170
1123
|
return e.executeInstructions(r.by ?? [], [t], i, async (t) => a(await e.alterValue(n, (n) => {
|
|
1171
1124
|
let r = e.unwrapValue(t), i = e.type(n), a = e.type(r);
|
|
@@ -1176,37 +1129,29 @@ var Dt = {
|
|
|
1176
1129
|
case "string":
|
|
1177
1130
|
if (a === "number") return r < 1 ? null : n.repeat(r);
|
|
1178
1131
|
break;
|
|
1179
|
-
case "object":
|
|
1180
|
-
if (a === "object") return e.merge(n, r);
|
|
1181
|
-
break;
|
|
1182
|
-
default:
|
|
1132
|
+
case "object": if (a === "object") return e.merge(n, r);
|
|
1183
1133
|
}
|
|
1184
|
-
throw new
|
|
1134
|
+
throw new k("%s (%*<100v) and %s (%*<100v) cannot be multiplied together", i, n, a, r);
|
|
1185
1135
|
})));
|
|
1186
1136
|
},
|
|
1187
1137
|
map(e, t) {
|
|
1188
|
-
return { by:
|
|
1138
|
+
return { by: B(t.by) };
|
|
1189
1139
|
}
|
|
1190
|
-
},
|
|
1140
|
+
}, Bt = {
|
|
1191
1141
|
op(e, t, n, r, i, a) {
|
|
1192
1142
|
return e.executeInstructions(r.by ?? [], [t], i, async (t) => a(await e.alterValue(n, (n) => {
|
|
1193
1143
|
let r = e.unwrapValue(t), i = e.type(n), a = e.type(r);
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
if (r === 0) throw new et("%s (%*<100v) cannot be divided by zero (remainder)", i, n);
|
|
1198
|
-
return n % r;
|
|
1199
|
-
}
|
|
1200
|
-
break;
|
|
1201
|
-
default:
|
|
1144
|
+
if (i === "number" && a === "number") {
|
|
1145
|
+
if (r === 0) throw new A("%s (%*<100v) cannot be divided by zero (remainder)", i, n);
|
|
1146
|
+
return n % r;
|
|
1202
1147
|
}
|
|
1203
|
-
throw new
|
|
1148
|
+
throw new k("%s (%*<100v) cannot be divided by %s (%*<100v) (remainder)", i, n, a, r);
|
|
1204
1149
|
})));
|
|
1205
1150
|
},
|
|
1206
1151
|
map(e, t) {
|
|
1207
|
-
return { by:
|
|
1152
|
+
return { by: B(t.by) };
|
|
1208
1153
|
}
|
|
1209
|
-
},
|
|
1154
|
+
}, Vt = {
|
|
1210
1155
|
op(e, t, n, r, a, o) {
|
|
1211
1156
|
return e.executeInstructions(r.by ?? [], [t], a, async (t) => o(await e.alterValue(n, (n) => {
|
|
1212
1157
|
let r = e.unwrapValue(t), a = e.type(n), o = e.type(r);
|
|
@@ -1224,37 +1169,33 @@ var Dt = {
|
|
|
1224
1169
|
case "string":
|
|
1225
1170
|
if (o === "string") return n.replaceAll(r, "");
|
|
1226
1171
|
break;
|
|
1227
|
-
case "object":
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
default:
|
|
1232
|
-
}
|
|
1233
|
-
break;
|
|
1234
|
-
default:
|
|
1172
|
+
case "object": switch (o) {
|
|
1173
|
+
case "array": return r.length === 0 ? n : i(n, Object.entries(n).filter(([, t]) => r.some((n) => e.equals(t, n))).map(([e]) => [e]));
|
|
1174
|
+
case "string": return i(n, [[r]]);
|
|
1175
|
+
}
|
|
1235
1176
|
}
|
|
1236
|
-
throw new
|
|
1177
|
+
throw new k("%s (%*<100v) and %s (%*<100v) cannot be subtracted", a, n, o, r);
|
|
1237
1178
|
})));
|
|
1238
1179
|
},
|
|
1239
1180
|
map(e, t) {
|
|
1240
|
-
return { by:
|
|
1181
|
+
return { by: B(t.by) };
|
|
1241
1182
|
}
|
|
1242
|
-
},
|
|
1183
|
+
}, Ht = {
|
|
1243
1184
|
op(e, t, n, r, i) {
|
|
1244
1185
|
let a = async (o, s) => {
|
|
1245
1186
|
if (await void 0, r.signal.checkHealth(), o >= (n.operations?.length ?? 0)) return i(s, r);
|
|
1246
|
-
let { op: c, params: l } = n.operations[o], u =
|
|
1247
|
-
if (!u) throw new
|
|
1187
|
+
let { op: c, params: l } = n.operations[o], u = Ut[c];
|
|
1188
|
+
if (!u) throw new v(`invalid OPM '${c}'`);
|
|
1248
1189
|
return u.op(e, t, s, l ?? {}, r, (e) => a(o + 1, e));
|
|
1249
1190
|
};
|
|
1250
1191
|
return e.executeInstructions(n.pipe ?? [], [t], r, (e) => a(0, e));
|
|
1251
1192
|
},
|
|
1252
1193
|
map(e, t) {
|
|
1253
1194
|
return {
|
|
1254
|
-
pipe:
|
|
1195
|
+
pipe: B(t.pipe),
|
|
1255
1196
|
operations: e.muxOne([t.operations], ({ op: t, params: n }) => {
|
|
1256
|
-
let r =
|
|
1257
|
-
if (!r) throw new
|
|
1197
|
+
let r = Ut[t];
|
|
1198
|
+
if (!r) throw new v(`invalid OPM '${t}'`);
|
|
1258
1199
|
return {
|
|
1259
1200
|
op: e.assertType(t, "string"),
|
|
1260
1201
|
params: r.map(e, n)
|
|
@@ -1262,70 +1203,70 @@ var Dt = {
|
|
|
1262
1203
|
})
|
|
1263
1204
|
};
|
|
1264
1205
|
}
|
|
1265
|
-
},
|
|
1266
|
-
"+":
|
|
1267
|
-
"/":
|
|
1268
|
-
"*":
|
|
1269
|
-
"%":
|
|
1270
|
-
"-":
|
|
1271
|
-
},
|
|
1206
|
+
}, Ut = {
|
|
1207
|
+
"+": Lt,
|
|
1208
|
+
"/": Rt,
|
|
1209
|
+
"*": zt,
|
|
1210
|
+
"%": Bt,
|
|
1211
|
+
"-": Vt
|
|
1212
|
+
}, Wt = {
|
|
1272
1213
|
op(e, t, n, r, i, a) {
|
|
1273
1214
|
return e.executeInstructions(r.by ?? [], [t], i, (t) => a(e.equals(n, t)));
|
|
1274
1215
|
},
|
|
1275
1216
|
map(e, t) {
|
|
1276
|
-
return { by:
|
|
1217
|
+
return { by: B(t.by) };
|
|
1277
1218
|
}
|
|
1278
|
-
},
|
|
1219
|
+
}, Gt = {
|
|
1279
1220
|
op(e, t, n, r, i, a) {
|
|
1280
1221
|
return e.executeInstructions(r.by ?? [], [t], i, (t) => a(e.compare(n, t) > 0));
|
|
1281
1222
|
},
|
|
1282
1223
|
map(e, t) {
|
|
1283
|
-
return { by:
|
|
1224
|
+
return { by: B(t.by) };
|
|
1284
1225
|
}
|
|
1285
|
-
},
|
|
1226
|
+
}, Kt = {
|
|
1286
1227
|
op(e, t, n, r, i, a) {
|
|
1287
1228
|
return e.executeInstructions(r.by ?? [], [t], i, (t) => a(e.compare(n, t) >= 0));
|
|
1288
1229
|
},
|
|
1289
1230
|
map(e, t) {
|
|
1290
|
-
return { by:
|
|
1231
|
+
return { by: B(t.by) };
|
|
1291
1232
|
}
|
|
1292
|
-
},
|
|
1233
|
+
}, qt = {
|
|
1293
1234
|
op(e, t, n, r, i, a) {
|
|
1294
1235
|
return e.executeInstructions(r.by ?? [], [t], i, (t) => a(e.compare(n, t) < 0));
|
|
1295
1236
|
},
|
|
1296
1237
|
map(e, t) {
|
|
1297
|
-
return { by:
|
|
1238
|
+
return { by: B(t.by) };
|
|
1298
1239
|
}
|
|
1299
|
-
},
|
|
1240
|
+
}, Jt = {
|
|
1300
1241
|
op(e, t, n, r, i, a) {
|
|
1301
1242
|
return e.executeInstructions(r.by ?? [], [t], i, (t) => a(e.compare(n, t) <= 0));
|
|
1302
1243
|
},
|
|
1303
1244
|
map(e, t) {
|
|
1304
|
-
return { by:
|
|
1245
|
+
return { by: B(t.by) };
|
|
1305
1246
|
}
|
|
1306
|
-
},
|
|
1247
|
+
}, Yt = {
|
|
1307
1248
|
op(e, t, n, r, i, a) {
|
|
1308
1249
|
return e.executeInstructions(r.by ?? [], [t], i, (t) => a(!e.equals(n, t)));
|
|
1309
1250
|
},
|
|
1310
1251
|
map(e, t) {
|
|
1311
|
-
return { by:
|
|
1252
|
+
return { by: B(t.by) };
|
|
1312
1253
|
}
|
|
1313
|
-
},
|
|
1254
|
+
}, Xt = {
|
|
1314
1255
|
op(e, t, n, r, i) {
|
|
1315
1256
|
let a = async (o, s) => {
|
|
1316
1257
|
if (await void 0, r.signal.checkHealth(), o >= (n.comparisons?.length ?? 0)) return i(s, r);
|
|
1317
|
-
let { op: c, params: l } = n.comparisons[o], u =
|
|
1318
|
-
if (!u) throw new
|
|
1258
|
+
let { op: c, params: l } = n.comparisons[o], u = Zt[c];
|
|
1259
|
+
if (!u) throw new v(`invalid OPC '${c}'`);
|
|
1319
1260
|
return u.op(e, t, s, l ?? {}, r, (e) => a(o + 1, e));
|
|
1320
1261
|
};
|
|
1321
1262
|
return e.executeInstructions(n.pipe ?? [], [t], r, (e) => a(0, e));
|
|
1322
1263
|
},
|
|
1323
1264
|
map(e, t) {
|
|
1324
1265
|
return {
|
|
1325
|
-
pipe:
|
|
1266
|
+
pipe: B(t.pipe),
|
|
1326
1267
|
comparisons: e.muxOne([t.comparisons], ({ op: t, params: n }) => {
|
|
1327
|
-
let r =
|
|
1328
|
-
if (!r) throw new
|
|
1268
|
+
let r = Zt[t];
|
|
1269
|
+
if (!r) throw new v(`invalid OPC '${t}'`);
|
|
1329
1270
|
return {
|
|
1330
1271
|
op: e.assertType(t, "string"),
|
|
1331
1272
|
params: r.map(e, n)
|
|
@@ -1333,20 +1274,20 @@ var Dt = {
|
|
|
1333
1274
|
})
|
|
1334
1275
|
};
|
|
1335
1276
|
}
|
|
1336
|
-
},
|
|
1337
|
-
"==":
|
|
1338
|
-
">":
|
|
1339
|
-
">=":
|
|
1340
|
-
"<":
|
|
1341
|
-
"<=":
|
|
1342
|
-
"!=":
|
|
1343
|
-
},
|
|
1344
|
-
"$.":
|
|
1345
|
-
and:
|
|
1346
|
-
"[]":
|
|
1347
|
-
"$=":
|
|
1348
|
-
clc:
|
|
1349
|
-
cmp:
|
|
1277
|
+
}, Zt = {
|
|
1278
|
+
"==": Wt,
|
|
1279
|
+
">": Gt,
|
|
1280
|
+
">=": Kt,
|
|
1281
|
+
"<": qt,
|
|
1282
|
+
"<=": Jt,
|
|
1283
|
+
"!=": Yt
|
|
1284
|
+
}, Qt = {
|
|
1285
|
+
"$.": vt,
|
|
1286
|
+
and: bt,
|
|
1287
|
+
"[]": xt,
|
|
1288
|
+
"$=": Pt,
|
|
1289
|
+
clc: Ht,
|
|
1290
|
+
cmp: Xt,
|
|
1350
1291
|
cnt: {
|
|
1351
1292
|
op(e, t, n, r, i) {
|
|
1352
1293
|
return i(n.value ?? null, r);
|
|
@@ -1381,12 +1322,12 @@ var Dt = {
|
|
|
1381
1322
|
},
|
|
1382
1323
|
fun: {
|
|
1383
1324
|
op(e, t, n, r, i) {
|
|
1384
|
-
return i(
|
|
1325
|
+
return i(N(n.argNames ?? [], n.pipe ?? [], r), r);
|
|
1385
1326
|
},
|
|
1386
1327
|
map(e, t) {
|
|
1387
1328
|
return {
|
|
1388
1329
|
argNames: e.muxOne([t.argNames], (t) => e.assertType(t, "string")),
|
|
1389
|
-
pipe:
|
|
1330
|
+
pipe: B(t.pipe)
|
|
1390
1331
|
};
|
|
1391
1332
|
}
|
|
1392
1333
|
},
|
|
@@ -1402,10 +1343,10 @@ var Dt = {
|
|
|
1402
1343
|
map(e, t) {
|
|
1403
1344
|
return {
|
|
1404
1345
|
ifs: e.muxOne([t.ifs], (e) => ({
|
|
1405
|
-
if:
|
|
1406
|
-
then:
|
|
1346
|
+
if: B(e.if),
|
|
1347
|
+
then: B(e.then)
|
|
1407
1348
|
})),
|
|
1408
|
-
else:
|
|
1349
|
+
else: B(t.else)
|
|
1409
1350
|
};
|
|
1410
1351
|
}
|
|
1411
1352
|
},
|
|
@@ -1418,7 +1359,7 @@ var Dt = {
|
|
|
1418
1359
|
return {
|
|
1419
1360
|
interpolations: e.muxOne([t.interpolations], (t) => ({
|
|
1420
1361
|
before: e.assertType(t.before, "string"),
|
|
1421
|
-
pipe:
|
|
1362
|
+
pipe: B(t.pipe)
|
|
1422
1363
|
})),
|
|
1423
1364
|
after: e.assertType(t.after, "string")
|
|
1424
1365
|
};
|
|
@@ -1428,11 +1369,8 @@ var Dt = {
|
|
|
1428
1369
|
async op(e, t, n, r, i) {
|
|
1429
1370
|
return i(await e.alterValue(t, (t) => {
|
|
1430
1371
|
let n = e.type(t);
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
default:
|
|
1434
|
-
}
|
|
1435
|
-
throw new j("%s (%*<100v) cannot be negated", n, t);
|
|
1372
|
+
if (n === "number") return -t;
|
|
1373
|
+
throw new k("%s (%*<100v) cannot be negated", n, t);
|
|
1436
1374
|
}), r);
|
|
1437
1375
|
},
|
|
1438
1376
|
map(e, t) {
|
|
@@ -1462,7 +1400,7 @@ var Dt = {
|
|
|
1462
1400
|
return a(0);
|
|
1463
1401
|
},
|
|
1464
1402
|
map(e, t) {
|
|
1465
|
-
return { pipes: e.muxOne([t.pipes], (e) =>
|
|
1403
|
+
return { pipes: e.muxOne([t.pipes], (e) => B(e)) };
|
|
1466
1404
|
}
|
|
1467
1405
|
},
|
|
1468
1406
|
nbr: {
|
|
@@ -1479,20 +1417,17 @@ var Dt = {
|
|
|
1479
1417
|
let [i, a] = await Promise.all([e.executeInstructions(n.key ?? [], [t], r), e.executeInstructions(n.value ?? [], [t], r)]);
|
|
1480
1418
|
return e.muxAll([e.unwrapValues(i), a], (t, r) => {
|
|
1481
1419
|
let i = e.type(t);
|
|
1482
|
-
|
|
1483
|
-
case "string": return [[t, r]];
|
|
1484
|
-
default:
|
|
1485
|
-
}
|
|
1420
|
+
if (i === "string") return [[t, r]];
|
|
1486
1421
|
if (n.optional) return [];
|
|
1487
|
-
throw new
|
|
1422
|
+
throw new k("cannot use %s (%*<100v) as object key", i, t);
|
|
1488
1423
|
});
|
|
1489
1424
|
});
|
|
1490
1425
|
return e.muxAll(a, (...e) => i(Object.fromEntries(e), r));
|
|
1491
1426
|
},
|
|
1492
1427
|
map(e, t) {
|
|
1493
1428
|
return { fields: e.muxOne([t.fields], (t) => ({
|
|
1494
|
-
key:
|
|
1495
|
-
value:
|
|
1429
|
+
key: B(t.key),
|
|
1430
|
+
value: B(t.value),
|
|
1496
1431
|
optional: e.assertType(t.optional, "boolean")
|
|
1497
1432
|
})) };
|
|
1498
1433
|
}
|
|
@@ -1507,7 +1442,7 @@ var Dt = {
|
|
|
1507
1442
|
return a(0);
|
|
1508
1443
|
},
|
|
1509
1444
|
map(e, t) {
|
|
1510
|
-
return { pipes: e.muxOne([t.pipes], (e) =>
|
|
1445
|
+
return { pipes: e.muxOne([t.pipes], (e) => B(e)) };
|
|
1511
1446
|
}
|
|
1512
1447
|
},
|
|
1513
1448
|
",": {
|
|
@@ -1515,7 +1450,7 @@ var Dt = {
|
|
|
1515
1450
|
return e.muxAll([n.pipes ?? []], (n) => e.executeInstructions(n ?? [], [t], r, (e) => i(e, r)));
|
|
1516
1451
|
},
|
|
1517
1452
|
map(e, t) {
|
|
1518
|
-
return { pipes: e.muxOne([t.pipes], (e) =>
|
|
1453
|
+
return { pipes: e.muxOne([t.pipes], (e) => B(e)) };
|
|
1519
1454
|
}
|
|
1520
1455
|
},
|
|
1521
1456
|
"\"\"": {
|
|
@@ -1534,25 +1469,25 @@ var Dt = {
|
|
|
1534
1469
|
try {
|
|
1535
1470
|
return await i(e, r);
|
|
1536
1471
|
} catch (e) {
|
|
1537
|
-
throw new
|
|
1472
|
+
throw new _(e);
|
|
1538
1473
|
}
|
|
1539
1474
|
});
|
|
1540
1475
|
} catch (t) {
|
|
1541
|
-
if (
|
|
1542
|
-
if (!
|
|
1476
|
+
if (_.is(t)) throw t.inner;
|
|
1477
|
+
if (!h.is(t)) throw t;
|
|
1543
1478
|
return a.signal.exit(), e.executeInstructions(n.catch ?? [], [t.value], r, (e) => i(e, r));
|
|
1544
1479
|
}
|
|
1545
1480
|
},
|
|
1546
1481
|
map(e, t) {
|
|
1547
1482
|
return {
|
|
1548
|
-
try:
|
|
1549
|
-
catch:
|
|
1483
|
+
try: B(t.try),
|
|
1484
|
+
catch: B(t.catch)
|
|
1550
1485
|
};
|
|
1551
1486
|
}
|
|
1552
1487
|
},
|
|
1553
1488
|
var: {
|
|
1554
1489
|
op(e, t, n, r, i) {
|
|
1555
|
-
if (!Object.hasOwn(r.vars, n.name ?? "")) throw new
|
|
1490
|
+
if (!Object.hasOwn(r.vars, n.name ?? "")) throw new tt("%s is not defined", n.name ?? "");
|
|
1556
1491
|
return i(r.vars[n.name ?? ""], r);
|
|
1557
1492
|
},
|
|
1558
1493
|
map(e, t) {
|
|
@@ -1566,7 +1501,7 @@ var Dt = {
|
|
|
1566
1501
|
map(e, t) {
|
|
1567
1502
|
return {
|
|
1568
1503
|
name: e.assertType(t.name, "string"),
|
|
1569
|
-
pipe:
|
|
1504
|
+
pipe: B(t.pipe)
|
|
1570
1505
|
};
|
|
1571
1506
|
}
|
|
1572
1507
|
},
|
|
@@ -1578,22 +1513,22 @@ var Dt = {
|
|
|
1578
1513
|
return {};
|
|
1579
1514
|
}
|
|
1580
1515
|
}
|
|
1581
|
-
},
|
|
1582
|
-
function
|
|
1516
|
+
}, $t = {};
|
|
1517
|
+
function en(e = {}, t = {}) {
|
|
1583
1518
|
return r(e, t);
|
|
1584
1519
|
}
|
|
1585
|
-
function
|
|
1520
|
+
function tn(e) {
|
|
1586
1521
|
let t = e?.version, [, n, r] = typeof t == "string" ? /^(\d+)\.(\d+)?$/g.exec(t) ?? [] : [];
|
|
1587
|
-
if (!n || !r || !Array.isArray(e.instructions)) throw new
|
|
1588
|
-
if (+n != 1 || +r > 0) throw new
|
|
1522
|
+
if (!n || !r || !Array.isArray(e.instructions)) throw new v("invalid program definition");
|
|
1523
|
+
if (+n != 1 || +r > 0) throw new v(`unsupported program definition v${n}.${r} - this version of JPL only supports v1 (up to v1.0)`);
|
|
1589
1524
|
}
|
|
1590
|
-
var
|
|
1525
|
+
var nn = class e {
|
|
1591
1526
|
#e;
|
|
1592
1527
|
#t;
|
|
1593
1528
|
#n;
|
|
1594
1529
|
#r;
|
|
1595
1530
|
constructor(e, t) {
|
|
1596
|
-
|
|
1531
|
+
tn(e), this.#e = en(t?.program, $t), this.#t = t?.runtime, this.#n = e, this.#r = Qt;
|
|
1597
1532
|
}
|
|
1598
1533
|
get options() {
|
|
1599
1534
|
return this.#e;
|
|
@@ -1605,36 +1540,44 @@ var rn = class e {
|
|
|
1605
1540
|
return this.#r;
|
|
1606
1541
|
}
|
|
1607
1542
|
run = async (e, t) => {
|
|
1608
|
-
let n = new
|
|
1543
|
+
let n = new dt(this, { runtime: I(t?.runtime, this.#t) }), r = n.normalizeValues(e, "program inputs"), i = await n.execute(r);
|
|
1609
1544
|
return n.stripJSON(i);
|
|
1610
1545
|
};
|
|
1611
|
-
prepend = (t) =>
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
}
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1546
|
+
prepend = (t) => {
|
|
1547
|
+
tn(t);
|
|
1548
|
+
let n = {
|
|
1549
|
+
version: "1.0",
|
|
1550
|
+
instructions: [...t.instructions, ...this.definition.instructions]
|
|
1551
|
+
};
|
|
1552
|
+
return new e(n, {
|
|
1553
|
+
program: this.#e,
|
|
1554
|
+
runtime: this.#t
|
|
1555
|
+
});
|
|
1556
|
+
};
|
|
1557
|
+
append = (t) => {
|
|
1558
|
+
tn(t);
|
|
1559
|
+
let n = {
|
|
1560
|
+
version: "1.0",
|
|
1561
|
+
instructions: [...this.definition.instructions, ...t.instructions]
|
|
1562
|
+
};
|
|
1563
|
+
return new e(n, {
|
|
1564
|
+
program: this.#e,
|
|
1565
|
+
runtime: this.#t
|
|
1566
|
+
});
|
|
1567
|
+
};
|
|
1568
|
+
}, rn = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", an = "0123456789", on = `${rn}_$`, sn = `${on}${an}`, cn = sn, ln = " \xA0\r\n ", un = `${an}abcdefABCDEF`;
|
|
1569
|
+
function V(e, t, n) {
|
|
1627
1570
|
let r = t, i = !1;
|
|
1628
1571
|
for (;;) {
|
|
1629
|
-
let t =
|
|
1572
|
+
let t = H(e, r, n, { phrase: "#" });
|
|
1630
1573
|
if (t.is) {
|
|
1631
1574
|
for ({i: r} = t;;) {
|
|
1632
|
-
let t =
|
|
1575
|
+
let t = W(e, r, n, { set: "\r\n" });
|
|
1633
1576
|
if (t.is) {
|
|
1634
1577
|
({i: r} = t);
|
|
1635
1578
|
break;
|
|
1636
1579
|
}
|
|
1637
|
-
let i =
|
|
1580
|
+
let i = K(e, r, n);
|
|
1638
1581
|
if (i.is) {
|
|
1639
1582
|
({i: r} = i);
|
|
1640
1583
|
break;
|
|
@@ -1644,14 +1587,14 @@ function B(e, t, n) {
|
|
|
1644
1587
|
i = !0;
|
|
1645
1588
|
continue;
|
|
1646
1589
|
}
|
|
1647
|
-
if (t =
|
|
1590
|
+
if (t = H(e, r, n, { phrase: "/*" }), t.is) {
|
|
1648
1591
|
for ({i: r} = t;;) {
|
|
1649
|
-
if (t =
|
|
1592
|
+
if (t = H(e, r, n, { phrase: "*/" }), t.is) {
|
|
1650
1593
|
({i: r} = t);
|
|
1651
1594
|
break;
|
|
1652
1595
|
}
|
|
1653
|
-
let i =
|
|
1654
|
-
if (i.is) return {i: r} = i,
|
|
1596
|
+
let i = K(e, r, n);
|
|
1597
|
+
if (i.is) return {i: r} = i, q(e, r, n, {
|
|
1655
1598
|
operator: "comment",
|
|
1656
1599
|
message: "incomplete comment"
|
|
1657
1600
|
});
|
|
@@ -1660,7 +1603,7 @@ function B(e, t, n) {
|
|
|
1660
1603
|
i = !0;
|
|
1661
1604
|
continue;
|
|
1662
1605
|
}
|
|
1663
|
-
let a =
|
|
1606
|
+
let a = W(e, r, n, { set: ln });
|
|
1664
1607
|
if ({i: r} = a, !a.is) break;
|
|
1665
1608
|
i = !0;
|
|
1666
1609
|
}
|
|
@@ -1669,24 +1612,24 @@ function B(e, t, n) {
|
|
|
1669
1612
|
is: i
|
|
1670
1613
|
};
|
|
1671
1614
|
}
|
|
1672
|
-
function
|
|
1615
|
+
function H(e, t, n, { phrase: r, notBeforeSet: i, spaceBefore: a, spaceAfter: o }) {
|
|
1673
1616
|
let s = t;
|
|
1674
|
-
if (a && t > 0 && !
|
|
1675
|
-
set:
|
|
1617
|
+
if (a && t > 0 && !W(e, s - 1, n, {
|
|
1618
|
+
set: cn,
|
|
1676
1619
|
exclusive: !0
|
|
1677
1620
|
}).is) return {
|
|
1678
1621
|
i: s,
|
|
1679
1622
|
is: !1
|
|
1680
1623
|
};
|
|
1681
1624
|
for (let t = 0; t < r.length; t += 1, s += 1) {
|
|
1682
|
-
let i =
|
|
1625
|
+
let i = K(e, s, n);
|
|
1683
1626
|
if (i.is || e[s] !== r[t]) return {
|
|
1684
1627
|
i: i.i,
|
|
1685
1628
|
is: !1
|
|
1686
1629
|
};
|
|
1687
1630
|
}
|
|
1688
|
-
return !
|
|
1689
|
-
set:
|
|
1631
|
+
return !K(e, s, n).is && (i && W(e, s, n, { set: i }).is || o && !W(e, s, n, {
|
|
1632
|
+
set: cn,
|
|
1690
1633
|
exclusive: !0
|
|
1691
1634
|
}).is) ? {
|
|
1692
1635
|
i: s,
|
|
@@ -1696,14 +1639,14 @@ function V(e, t, n, { phrase: r, notBeforeSet: i, spaceBefore: a, spaceAfter: o
|
|
|
1696
1639
|
is: !0
|
|
1697
1640
|
};
|
|
1698
1641
|
}
|
|
1699
|
-
function
|
|
1700
|
-
let s = t, c =
|
|
1642
|
+
function U(e, t, n, { phrase: r, notBeforeSet: i, spaceBefore: a, spaceAfter: o }) {
|
|
1643
|
+
let s = t, c = H(e, s, n, {
|
|
1701
1644
|
phrase: r,
|
|
1702
1645
|
notBeforeSet: i,
|
|
1703
1646
|
spaceBefore: a,
|
|
1704
1647
|
spaceAfter: o
|
|
1705
1648
|
});
|
|
1706
|
-
return c.is ? ({i: s} = c, {i: s} =
|
|
1649
|
+
return c.is ? ({i: s} = c, {i: s} = V(e, s, n), {
|
|
1707
1650
|
i: s,
|
|
1708
1651
|
is: !0
|
|
1709
1652
|
}) : {
|
|
@@ -1711,11 +1654,11 @@ function H(e, t, n, { phrase: r, notBeforeSet: i, spaceBefore: a, spaceAfter: o
|
|
|
1711
1654
|
is: !1
|
|
1712
1655
|
};
|
|
1713
1656
|
}
|
|
1714
|
-
function
|
|
1715
|
-
return
|
|
1657
|
+
function dn(e, t, n) {
|
|
1658
|
+
return W(e, t, n, { set: un });
|
|
1716
1659
|
}
|
|
1717
|
-
function
|
|
1718
|
-
let a =
|
|
1660
|
+
function W(e, t, n, { set: r, exclusive: i }) {
|
|
1661
|
+
let a = K(e, t, n);
|
|
1719
1662
|
if (a.is) return {
|
|
1720
1663
|
i: a.i,
|
|
1721
1664
|
is: !1,
|
|
@@ -1732,21 +1675,21 @@ function U(e, t, n, { set: r, exclusive: i }) {
|
|
|
1732
1675
|
value: ""
|
|
1733
1676
|
};
|
|
1734
1677
|
}
|
|
1735
|
-
function
|
|
1678
|
+
function fn(e, t, n) {
|
|
1736
1679
|
let r = t, i = !1, a = "";
|
|
1737
1680
|
for (;;) {
|
|
1738
|
-
let t =
|
|
1681
|
+
let t = W(e, r, n, { set: i ? sn : on });
|
|
1739
1682
|
if ({i: r} = t, !t.is) break;
|
|
1740
1683
|
i = !0, a += t.value;
|
|
1741
1684
|
}
|
|
1742
|
-
return i && ({i: r} =
|
|
1685
|
+
return i && ({i: r} = V(e, r, n)), {
|
|
1743
1686
|
i: r,
|
|
1744
1687
|
is: i,
|
|
1745
1688
|
value: a
|
|
1746
1689
|
};
|
|
1747
1690
|
}
|
|
1748
|
-
function
|
|
1749
|
-
let r =
|
|
1691
|
+
function G(e, t, n) {
|
|
1692
|
+
let r = fn(e, t, n);
|
|
1750
1693
|
if (!r.is) return r;
|
|
1751
1694
|
switch (r.value) {
|
|
1752
1695
|
case "and":
|
|
@@ -1771,7 +1714,7 @@ function W(e, t, n) {
|
|
|
1771
1714
|
default: return r;
|
|
1772
1715
|
}
|
|
1773
1716
|
}
|
|
1774
|
-
function
|
|
1717
|
+
function K(e, t, n) {
|
|
1775
1718
|
return t >= e.length ? {
|
|
1776
1719
|
i: e.length,
|
|
1777
1720
|
is: !0
|
|
@@ -1780,7 +1723,7 @@ function G(e, t, n) {
|
|
|
1780
1723
|
is: !1
|
|
1781
1724
|
};
|
|
1782
1725
|
}
|
|
1783
|
-
function
|
|
1726
|
+
function pn(e, t, n) {
|
|
1784
1727
|
let r = e.substring(0, t).split(/\r?\n|\r/), i = r[r.length - 1];
|
|
1785
1728
|
return {
|
|
1786
1729
|
i: t,
|
|
@@ -1788,7 +1731,7 @@ function mn(e, t, n) {
|
|
|
1788
1731
|
column: i.length
|
|
1789
1732
|
};
|
|
1790
1733
|
}
|
|
1791
|
-
function
|
|
1734
|
+
function mn(e, t, n, { area: r = 25 } = {}) {
|
|
1792
1735
|
let i = Math.max(Math.min(t, e.length - 1 - r), r) - r, a = Math.min(i + r + 1 + r, e.length), o = e.substring(i, a).replaceAll(/\r?\n|\r/g, "⏎").replaceAll(" ", "→"), s = " > ";
|
|
1793
1736
|
i > 0 && (s += "…");
|
|
1794
1737
|
let c = "";
|
|
@@ -1797,79 +1740,78 @@ function hn(e, t, n, { area: r = 25 } = {}) {
|
|
|
1797
1740
|
value: `${s}${o}${c}\n${" ".repeat(s.length + (t - i))}^ here`
|
|
1798
1741
|
};
|
|
1799
1742
|
}
|
|
1800
|
-
function
|
|
1743
|
+
function q(e, t, n, { operator: r, message: i } = {}) {
|
|
1801
1744
|
let a;
|
|
1802
|
-
if (
|
|
1745
|
+
if (K(e, t, n).is) a = "unexpected EOT";
|
|
1803
1746
|
else {
|
|
1804
|
-
let { line: r, column: i } =
|
|
1747
|
+
let { line: r, column: i } = pn(e, t, n);
|
|
1805
1748
|
a = `unexpected token '${e[t]}' at line ${r + 1}, column ${i + 1}`;
|
|
1806
1749
|
}
|
|
1807
|
-
throw r && (a += ` while parsing ${r}`), i && (a += `: ${i}`), a += `\n${
|
|
1750
|
+
throw r && (a += ` while parsing ${r}`), i && (a += `: ${i}`), a += `\n${mn(e, t, n).value}`, new j(a, e, t);
|
|
1808
1751
|
}
|
|
1809
|
-
function
|
|
1752
|
+
function hn(e, t, n, { operator: r, message: i } = {}) {
|
|
1810
1753
|
let a = "error";
|
|
1811
|
-
throw r && (a += ` while parsing ${r}`), i && (a += `: ${i}`), a += `\n${
|
|
1754
|
+
throw r && (a += ` while parsing ${r}`), i && (a += `: ${i}`), a += `\n${mn(e, t, n).value}`, new j(a, e, t);
|
|
1812
1755
|
}
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
return {i: r} = i, G(e, r, n).is ? i : K(e, r, n, {
|
|
1756
|
+
// lib/interpreter/parse.ts
|
|
1757
|
+
async function gn(e, t, n) {
|
|
1758
|
+
let r = t, i = await _n(e, r, n);
|
|
1759
|
+
return {i: r} = i, K(e, r, n).is ? i : q(e, r, n, {
|
|
1818
1760
|
operator: "program",
|
|
1819
1761
|
message: "expected EOT"
|
|
1820
1762
|
});
|
|
1821
1763
|
}
|
|
1822
|
-
function
|
|
1764
|
+
function _n(e, t, n) {
|
|
1823
1765
|
let r = t;
|
|
1824
|
-
return {i: r} =
|
|
1766
|
+
return {i: r} = V(e, r, n), J(e, r, n);
|
|
1825
1767
|
}
|
|
1826
|
-
function
|
|
1827
|
-
let r = t, i =
|
|
1828
|
-
if ({i: r} = i, !i.is) return
|
|
1768
|
+
function vn(e, t, n) {
|
|
1769
|
+
let r = t, i = U(e, r, n, { phrase: "(" });
|
|
1770
|
+
if ({i: r} = i, !i.is) return q(e, r, n, {
|
|
1829
1771
|
operator: "function definition",
|
|
1830
1772
|
message: "expected '('"
|
|
1831
1773
|
});
|
|
1832
1774
|
let a = [];
|
|
1833
|
-
if (i =
|
|
1775
|
+
if (i = U(e, r, n, { phrase: ")" }), i.is) ({i: r} = i);
|
|
1834
1776
|
else for (;;) {
|
|
1835
|
-
let t =
|
|
1836
|
-
if (!t.is) return
|
|
1777
|
+
let t = G(e, r, n);
|
|
1778
|
+
if (!t.is) return q(e, r, n, {
|
|
1837
1779
|
operator: "function definition",
|
|
1838
1780
|
message: "expected argument name"
|
|
1839
1781
|
});
|
|
1840
1782
|
let o;
|
|
1841
|
-
if ({i: r, value: o} = t, a.push(o), i =
|
|
1783
|
+
if ({i: r, value: o} = t, a.push(o), i = U(e, r, n, { phrase: ")" }), i.is) {
|
|
1842
1784
|
({i: r} = i);
|
|
1843
1785
|
break;
|
|
1844
1786
|
}
|
|
1845
|
-
if (i =
|
|
1787
|
+
if (i = U(e, r, n, { phrase: "," }), {i: r} = i, !i.is) return q(e, r, n, {
|
|
1846
1788
|
operator: "function definition",
|
|
1847
1789
|
message: "expected ',' or ')'"
|
|
1848
1790
|
});
|
|
1849
1791
|
}
|
|
1850
|
-
return i =
|
|
1792
|
+
return i = U(e, r, n, { phrase: ":" }), {i: r} = i, i.is ? {
|
|
1851
1793
|
i: r,
|
|
1852
1794
|
argNames: a
|
|
1853
|
-
} :
|
|
1795
|
+
} : q(e, r, n, {
|
|
1854
1796
|
operator: "function definition",
|
|
1855
1797
|
message: "expected ':'"
|
|
1856
1798
|
});
|
|
1857
1799
|
}
|
|
1858
|
-
async function
|
|
1800
|
+
async function yn(e, t, n, { identity: r } = {}) {
|
|
1859
1801
|
let i = t, a = [], o = !0;
|
|
1860
1802
|
for (;;) {
|
|
1861
|
-
let t =
|
|
1803
|
+
let t = U(e, i, n, { phrase: "." });
|
|
1862
1804
|
if (!(r && a.length === 0) && t.is) {
|
|
1863
1805
|
({i: i} = t);
|
|
1864
|
-
let r =
|
|
1865
|
-
if (!r.is) return
|
|
1806
|
+
let r = G(e, i, n);
|
|
1807
|
+
if (!r.is) return q(e, i, n, {
|
|
1866
1808
|
operator: "field access operator",
|
|
1867
1809
|
message: "expected field name"
|
|
1868
1810
|
});
|
|
1869
1811
|
let o;
|
|
1870
1812
|
({i: i, value: o} = r);
|
|
1871
1813
|
let s = !1;
|
|
1872
|
-
t =
|
|
1814
|
+
t = U(e, i, n, {
|
|
1873
1815
|
phrase: "?",
|
|
1874
1816
|
notBeforeSet: "?="
|
|
1875
1817
|
}), t.is && ({i: i, is: s} = t), a.push({
|
|
@@ -1884,11 +1826,11 @@ async function bn(e, t, n, { identity: r } = {}) {
|
|
|
1884
1826
|
});
|
|
1885
1827
|
continue;
|
|
1886
1828
|
}
|
|
1887
|
-
if (t =
|
|
1888
|
-
if ({i: i} = t, t =
|
|
1829
|
+
if (t = U(e, i, n, { phrase: "[" }), t.is) {
|
|
1830
|
+
if ({i: i} = t, t = U(e, i, n, { phrase: "]" }), t.is) {
|
|
1889
1831
|
({i: i} = t);
|
|
1890
1832
|
let r = !1;
|
|
1891
|
-
t =
|
|
1833
|
+
t = U(e, i, n, {
|
|
1892
1834
|
phrase: "?",
|
|
1893
1835
|
notBeforeSet: "?="
|
|
1894
1836
|
}), t.is && ({i: i, is: r} = t), a.push({
|
|
@@ -1897,11 +1839,11 @@ async function bn(e, t, n, { identity: r } = {}) {
|
|
|
1897
1839
|
});
|
|
1898
1840
|
continue;
|
|
1899
1841
|
}
|
|
1900
|
-
if (t =
|
|
1901
|
-
if ({i: i} = t, t =
|
|
1842
|
+
if (t = U(e, i, n, { phrase: ":" }), t.is) {
|
|
1843
|
+
if ({i: i} = t, t = U(e, i, n, { phrase: "]" }), t.is) {
|
|
1902
1844
|
({i: i} = t);
|
|
1903
1845
|
let r = !1;
|
|
1904
|
-
t =
|
|
1846
|
+
t = U(e, i, n, {
|
|
1905
1847
|
phrase: "?",
|
|
1906
1848
|
notBeforeSet: "?="
|
|
1907
1849
|
}), t.is && ({i: i, is: r} = t), a.push({
|
|
@@ -1921,12 +1863,12 @@ async function bn(e, t, n, { identity: r } = {}) {
|
|
|
1921
1863
|
continue;
|
|
1922
1864
|
}
|
|
1923
1865
|
let r;
|
|
1924
|
-
if ({i: i, ops: r} = await
|
|
1866
|
+
if ({i: i, ops: r} = await J(e, i, n), t = U(e, i, n, { phrase: "]" }), {i: i} = t, !t.is) return q(e, i, n, {
|
|
1925
1867
|
operator: "array slice operator",
|
|
1926
1868
|
message: "expected ']'"
|
|
1927
1869
|
});
|
|
1928
1870
|
let o = !1;
|
|
1929
|
-
t =
|
|
1871
|
+
t = U(e, i, n, {
|
|
1930
1872
|
phrase: "?",
|
|
1931
1873
|
notBeforeSet: "?="
|
|
1932
1874
|
}), t.is && ({i: i, is: o} = t), a.push({
|
|
@@ -1943,10 +1885,10 @@ async function bn(e, t, n, { identity: r } = {}) {
|
|
|
1943
1885
|
continue;
|
|
1944
1886
|
}
|
|
1945
1887
|
let r;
|
|
1946
|
-
if ({i: i, ops: r} = await
|
|
1888
|
+
if ({i: i, ops: r} = await J(e, i, n), t = U(e, i, n, { phrase: "]" }), t.is) {
|
|
1947
1889
|
({i: i} = t);
|
|
1948
1890
|
let o = !1;
|
|
1949
|
-
t =
|
|
1891
|
+
t = U(e, i, n, {
|
|
1950
1892
|
phrase: "?",
|
|
1951
1893
|
notBeforeSet: "?="
|
|
1952
1894
|
}), t.is && ({i: i, is: o} = t), a.push({
|
|
@@ -1958,14 +1900,14 @@ async function bn(e, t, n, { identity: r } = {}) {
|
|
|
1958
1900
|
});
|
|
1959
1901
|
continue;
|
|
1960
1902
|
}
|
|
1961
|
-
if (t =
|
|
1903
|
+
if (t = U(e, i, n, { phrase: ":" }), !t.is) return q(e, i, n, {
|
|
1962
1904
|
operator: "variable access operator",
|
|
1963
1905
|
message: "expected ':' or ']'"
|
|
1964
1906
|
});
|
|
1965
|
-
if ({i: i} = t, t =
|
|
1907
|
+
if ({i: i} = t, t = U(e, i, n, { phrase: "]" }), t.is) {
|
|
1966
1908
|
({i: i} = t);
|
|
1967
1909
|
let o = !1;
|
|
1968
|
-
t =
|
|
1910
|
+
t = U(e, i, n, {
|
|
1969
1911
|
phrase: "?",
|
|
1970
1912
|
notBeforeSet: "?="
|
|
1971
1913
|
}), t.is && ({i: i, is: o} = t), a.push({
|
|
@@ -1982,12 +1924,12 @@ async function bn(e, t, n, { identity: r } = {}) {
|
|
|
1982
1924
|
continue;
|
|
1983
1925
|
}
|
|
1984
1926
|
let o;
|
|
1985
|
-
if ({i: i, ops: o} = await
|
|
1927
|
+
if ({i: i, ops: o} = await J(e, i, n), t = U(e, i, n, { phrase: "]" }), {i: i} = t, !t.is) return q(e, i, n, {
|
|
1986
1928
|
operator: "array slice operator",
|
|
1987
1929
|
message: "expected ']'"
|
|
1988
1930
|
});
|
|
1989
1931
|
let s = !1;
|
|
1990
|
-
t =
|
|
1932
|
+
t = U(e, i, n, {
|
|
1991
1933
|
phrase: "?",
|
|
1992
1934
|
notBeforeSet: "?="
|
|
1993
1935
|
}), t.is && ({i: i, is: s} = t), a.push({
|
|
@@ -2001,27 +1943,27 @@ async function bn(e, t, n, { identity: r } = {}) {
|
|
|
2001
1943
|
continue;
|
|
2002
1944
|
}
|
|
2003
1945
|
let s = !1;
|
|
2004
|
-
if (t =
|
|
1946
|
+
if (t = U(e, i, n, { phrase: "->" }), t.is && ({i: i, is: s} = t), t = U(e, i, n, { phrase: "(" }), !t.is && s) return q(e, i, n, {
|
|
2005
1947
|
operator: "bound function call",
|
|
2006
1948
|
message: "expected '('"
|
|
2007
1949
|
});
|
|
2008
1950
|
if (t.is) {
|
|
2009
1951
|
({i: i} = t);
|
|
2010
1952
|
let r = [];
|
|
2011
|
-
if (t =
|
|
1953
|
+
if (t = U(e, i, n, { phrase: ")" }), t.is) ({i: i} = t);
|
|
2012
1954
|
else for (;;) {
|
|
2013
1955
|
let a;
|
|
2014
|
-
if ({i: i, ops: a} = await
|
|
1956
|
+
if ({i: i, ops: a} = await Y(e, i, n), r.push(a), t = U(e, i, n, { phrase: ")" }), t.is) {
|
|
2015
1957
|
({i: i} = t);
|
|
2016
1958
|
break;
|
|
2017
1959
|
}
|
|
2018
|
-
if (t =
|
|
1960
|
+
if (t = U(e, i, n, { phrase: "," }), {i: i} = t, !t.is) return q(e, i, n, {
|
|
2019
1961
|
operator: "function call",
|
|
2020
1962
|
message: "expected ',' or ')'"
|
|
2021
1963
|
});
|
|
2022
1964
|
}
|
|
2023
1965
|
let c = !1;
|
|
2024
|
-
t =
|
|
1966
|
+
t = U(e, i, n, {
|
|
2025
1967
|
phrase: "?",
|
|
2026
1968
|
notBeforeSet: "?="
|
|
2027
1969
|
}), t.is && ({i: i, is: c} = t), a.push({
|
|
@@ -2032,9 +1974,7 @@ async function bn(e, t, n, { identity: r } = {}) {
|
|
|
2032
1974
|
optional: c
|
|
2033
1975
|
}
|
|
2034
1976
|
}), o = !1;
|
|
2035
|
-
|
|
2036
|
-
}
|
|
2037
|
-
break;
|
|
1977
|
+
} else break;
|
|
2038
1978
|
}
|
|
2039
1979
|
return {
|
|
2040
1980
|
i,
|
|
@@ -2043,15 +1983,15 @@ async function bn(e, t, n, { identity: r } = {}) {
|
|
|
2043
1983
|
canAssign: o
|
|
2044
1984
|
};
|
|
2045
1985
|
}
|
|
2046
|
-
async function
|
|
2047
|
-
let r = t, i =
|
|
1986
|
+
async function bn(e, t, n) {
|
|
1987
|
+
let r = t, i = U(e, r, n, {
|
|
2048
1988
|
phrase: "=",
|
|
2049
1989
|
notBeforeSet: "="
|
|
2050
1990
|
});
|
|
2051
1991
|
if (i.is) {
|
|
2052
1992
|
({i: r} = i);
|
|
2053
1993
|
let t;
|
|
2054
|
-
return {i: r, ops: t} = await
|
|
1994
|
+
return {i: r, ops: t} = await X(e, r, n), {
|
|
2055
1995
|
i: r,
|
|
2056
1996
|
is: !0,
|
|
2057
1997
|
assignment: {
|
|
@@ -2060,10 +2000,10 @@ async function xn(e, t, n) {
|
|
|
2060
2000
|
}
|
|
2061
2001
|
};
|
|
2062
2002
|
}
|
|
2063
|
-
if (i =
|
|
2003
|
+
if (i = U(e, r, n, { phrase: "|=" }), i.is) {
|
|
2064
2004
|
({i: r} = i);
|
|
2065
2005
|
let t;
|
|
2066
|
-
return {i: r, ops: t} = await
|
|
2006
|
+
return {i: r, ops: t} = await X(e, r, n), {
|
|
2067
2007
|
i: r,
|
|
2068
2008
|
is: !0,
|
|
2069
2009
|
assignment: {
|
|
@@ -2072,10 +2012,10 @@ async function xn(e, t, n) {
|
|
|
2072
2012
|
}
|
|
2073
2013
|
};
|
|
2074
2014
|
}
|
|
2075
|
-
if (i =
|
|
2015
|
+
if (i = U(e, r, n, { phrase: "+=" }), i.is) {
|
|
2076
2016
|
({i: r} = i);
|
|
2077
2017
|
let t;
|
|
2078
|
-
return {i: r, ops: t} = await
|
|
2018
|
+
return {i: r, ops: t} = await X(e, r, n), {
|
|
2079
2019
|
i: r,
|
|
2080
2020
|
is: !0,
|
|
2081
2021
|
assignment: {
|
|
@@ -2084,10 +2024,10 @@ async function xn(e, t, n) {
|
|
|
2084
2024
|
}
|
|
2085
2025
|
};
|
|
2086
2026
|
}
|
|
2087
|
-
if (i =
|
|
2027
|
+
if (i = U(e, r, n, { phrase: "-=" }), i.is) {
|
|
2088
2028
|
({i: r} = i);
|
|
2089
2029
|
let t;
|
|
2090
|
-
return {i: r, ops: t} = await
|
|
2030
|
+
return {i: r, ops: t} = await X(e, r, n), {
|
|
2091
2031
|
i: r,
|
|
2092
2032
|
is: !0,
|
|
2093
2033
|
assignment: {
|
|
@@ -2096,10 +2036,10 @@ async function xn(e, t, n) {
|
|
|
2096
2036
|
}
|
|
2097
2037
|
};
|
|
2098
2038
|
}
|
|
2099
|
-
if (i =
|
|
2039
|
+
if (i = U(e, r, n, { phrase: "*=" }), i.is) {
|
|
2100
2040
|
({i: r} = i);
|
|
2101
2041
|
let t;
|
|
2102
|
-
return {i: r, ops: t} = await
|
|
2042
|
+
return {i: r, ops: t} = await X(e, r, n), {
|
|
2103
2043
|
i: r,
|
|
2104
2044
|
is: !0,
|
|
2105
2045
|
assignment: {
|
|
@@ -2108,10 +2048,10 @@ async function xn(e, t, n) {
|
|
|
2108
2048
|
}
|
|
2109
2049
|
};
|
|
2110
2050
|
}
|
|
2111
|
-
if (i =
|
|
2051
|
+
if (i = U(e, r, n, { phrase: "/=" }), i.is) {
|
|
2112
2052
|
({i: r} = i);
|
|
2113
2053
|
let t;
|
|
2114
|
-
return {i: r, ops: t} = await
|
|
2054
|
+
return {i: r, ops: t} = await X(e, r, n), {
|
|
2115
2055
|
i: r,
|
|
2116
2056
|
is: !0,
|
|
2117
2057
|
assignment: {
|
|
@@ -2120,10 +2060,10 @@ async function xn(e, t, n) {
|
|
|
2120
2060
|
}
|
|
2121
2061
|
};
|
|
2122
2062
|
}
|
|
2123
|
-
if (i =
|
|
2063
|
+
if (i = U(e, r, n, { phrase: "%=" }), i.is) {
|
|
2124
2064
|
({i: r} = i);
|
|
2125
2065
|
let t;
|
|
2126
|
-
return {i: r, ops: t} = await
|
|
2066
|
+
return {i: r, ops: t} = await X(e, r, n), {
|
|
2127
2067
|
i: r,
|
|
2128
2068
|
is: !0,
|
|
2129
2069
|
assignment: {
|
|
@@ -2132,10 +2072,10 @@ async function xn(e, t, n) {
|
|
|
2132
2072
|
}
|
|
2133
2073
|
};
|
|
2134
2074
|
}
|
|
2135
|
-
if (i =
|
|
2075
|
+
if (i = U(e, r, n, { phrase: "?=" }), i.is) {
|
|
2136
2076
|
({i: r} = i);
|
|
2137
2077
|
let t;
|
|
2138
|
-
return {i: r, ops: t} = await
|
|
2078
|
+
return {i: r, ops: t} = await X(e, r, n), {
|
|
2139
2079
|
i: r,
|
|
2140
2080
|
is: !0,
|
|
2141
2081
|
assignment: {
|
|
@@ -2149,10 +2089,10 @@ async function xn(e, t, n) {
|
|
|
2149
2089
|
is: !1
|
|
2150
2090
|
};
|
|
2151
2091
|
}
|
|
2152
|
-
function
|
|
2092
|
+
function xn(e, t, n) {
|
|
2153
2093
|
let r = t, i = !1, a = "";
|
|
2154
2094
|
for (;;) {
|
|
2155
|
-
let t =
|
|
2095
|
+
let t = W(e, r, n, { set: "0123456789" });
|
|
2156
2096
|
if (!t.is) break;
|
|
2157
2097
|
({i: r} = t), i = !0, a += t.value;
|
|
2158
2098
|
}
|
|
@@ -2160,37 +2100,37 @@ function Sn(e, t, n) {
|
|
|
2160
2100
|
i: r,
|
|
2161
2101
|
is: !1
|
|
2162
2102
|
};
|
|
2163
|
-
let o =
|
|
2103
|
+
let o = H(e, r, n, { phrase: "." });
|
|
2164
2104
|
if (o.is) for ({i: r} = o, a += ".";;) {
|
|
2165
|
-
let t =
|
|
2105
|
+
let t = W(e, r, n, { set: "0123456789" });
|
|
2166
2106
|
if (!t.is) break;
|
|
2167
2107
|
({i: r} = t), a += t.value;
|
|
2168
2108
|
}
|
|
2169
|
-
let s =
|
|
2109
|
+
let s = W(e, r, n, { set: "eE" });
|
|
2170
2110
|
if (s.is) {
|
|
2171
|
-
({i: r} = s), a += s.value, s =
|
|
2111
|
+
({i: r} = s), a += s.value, s = W(e, r, n, { set: "+-" }), s.is && ({i: r} = s, a += s.value);
|
|
2172
2112
|
let t = !1;
|
|
2173
|
-
for (; s =
|
|
2174
|
-
if (!t) return
|
|
2113
|
+
for (; s = W(e, r, n, { set: "0123456789" }), s.is;) ({i: r} = s), t = !0, a += s.value;
|
|
2114
|
+
if (!t) return q(e, r, n, {
|
|
2175
2115
|
operator: "number",
|
|
2176
2116
|
message: "expected digit"
|
|
2177
2117
|
});
|
|
2178
2118
|
}
|
|
2179
2119
|
let c = +a;
|
|
2180
|
-
return Number.isFinite(c) ? ({i: r} =
|
|
2120
|
+
return Number.isFinite(c) ? ({i: r} = V(e, r, n), {
|
|
2181
2121
|
i: r,
|
|
2182
2122
|
is: !0,
|
|
2183
2123
|
ops: [{
|
|
2184
2124
|
op: "nbr",
|
|
2185
2125
|
params: { number: c }
|
|
2186
2126
|
}]
|
|
2187
|
-
}) :
|
|
2127
|
+
}) : hn(e, r, n, {
|
|
2188
2128
|
operator: "number",
|
|
2189
2129
|
message: `invalid number ${c}`
|
|
2190
2130
|
});
|
|
2191
2131
|
}
|
|
2192
|
-
async function
|
|
2193
|
-
let r = t, i = "", a =
|
|
2132
|
+
async function Sn(e, t, n) {
|
|
2133
|
+
let r = t, i = "", a = W(e, r, n, { set: "\"'`" });
|
|
2194
2134
|
if (!a.is) return {
|
|
2195
2135
|
i: r,
|
|
2196
2136
|
is: !1
|
|
@@ -2199,21 +2139,21 @@ async function Cn(e, t, n) {
|
|
|
2199
2139
|
({i: r, value: o} = a);
|
|
2200
2140
|
let s = o === "`", c = [];
|
|
2201
2141
|
for (;;) {
|
|
2202
|
-
let t =
|
|
2142
|
+
let t = H(e, r, n, { phrase: o });
|
|
2203
2143
|
if (t.is) {
|
|
2204
2144
|
({i: r} = t);
|
|
2205
2145
|
break;
|
|
2206
2146
|
}
|
|
2207
|
-
let a =
|
|
2208
|
-
if (a.is) return {i: r} = a,
|
|
2147
|
+
let a = K(e, r, n);
|
|
2148
|
+
if (a.is) return {i: r} = a, q(e, r, n, {
|
|
2209
2149
|
operator: "string",
|
|
2210
2150
|
message: "incomplete string literal"
|
|
2211
2151
|
});
|
|
2212
|
-
if (t =
|
|
2213
|
-
if ({i: r} = t, t =
|
|
2152
|
+
if (t = H(e, r, n, { phrase: "\\" }), t.is) {
|
|
2153
|
+
if ({i: r} = t, t = U(e, r, n, { phrase: "(" }), t.is) {
|
|
2214
2154
|
({i: r} = t);
|
|
2215
2155
|
let a;
|
|
2216
|
-
if ({i: r, ops: a} = await
|
|
2156
|
+
if ({i: r, ops: a} = await J(e, r, n), t = H(e, r, n, { phrase: ")" }), {i: r} = t, !t.is) return q(e, r, n, {
|
|
2217
2157
|
operator: "string interpolation",
|
|
2218
2158
|
message: "expected ')'"
|
|
2219
2159
|
});
|
|
@@ -2228,9 +2168,8 @@ async function Cn(e, t, n) {
|
|
|
2228
2168
|
r += 1;
|
|
2229
2169
|
continue;
|
|
2230
2170
|
case "\r":
|
|
2231
|
-
r += 1, !
|
|
2171
|
+
r += 1, !K(e, r, n).is && e[r] === "\n" && (r += 1);
|
|
2232
2172
|
continue;
|
|
2233
|
-
default:
|
|
2234
2173
|
}
|
|
2235
2174
|
switch (e[r]) {
|
|
2236
2175
|
case "\"":
|
|
@@ -2267,7 +2206,7 @@ async function Cn(e, t, n) {
|
|
|
2267
2206
|
r += 1;
|
|
2268
2207
|
let a = "";
|
|
2269
2208
|
for (let i = 0; i < 4; i += 1) {
|
|
2270
|
-
if (t =
|
|
2209
|
+
if (t = dn(e, r, n), {i: r} = t, !t.is) return q(e, r, n, {
|
|
2271
2210
|
operator: "string",
|
|
2272
2211
|
message: "incomplete unicode escape sequence: expected hex digit"
|
|
2273
2212
|
});
|
|
@@ -2276,7 +2215,7 @@ async function Cn(e, t, n) {
|
|
|
2276
2215
|
i += String.fromCodePoint(parseInt(a, 16));
|
|
2277
2216
|
continue;
|
|
2278
2217
|
}
|
|
2279
|
-
default: return
|
|
2218
|
+
default: return q(e, r, n, {
|
|
2280
2219
|
operator: "string",
|
|
2281
2220
|
message: "invalid escape sequence"
|
|
2282
2221
|
});
|
|
@@ -2288,12 +2227,11 @@ async function Cn(e, t, n) {
|
|
|
2288
2227
|
case " ":
|
|
2289
2228
|
i += e[r], r += 1;
|
|
2290
2229
|
continue;
|
|
2291
|
-
default:
|
|
2292
2230
|
}
|
|
2293
|
-
if (e.charCodeAt(r) < 32) return
|
|
2231
|
+
if (e.charCodeAt(r) < 32) return q(e, r, n, { operator: "string" });
|
|
2294
2232
|
i += e[r], r += 1;
|
|
2295
2233
|
}
|
|
2296
|
-
return {i: r} =
|
|
2234
|
+
return {i: r} = V(e, r, n), c.length === 0 ? {
|
|
2297
2235
|
i: r,
|
|
2298
2236
|
is: !0,
|
|
2299
2237
|
ops: [{
|
|
@@ -2312,13 +2250,13 @@ async function Cn(e, t, n) {
|
|
|
2312
2250
|
}]
|
|
2313
2251
|
};
|
|
2314
2252
|
}
|
|
2315
|
-
async function
|
|
2253
|
+
async function J(e, t, n) {
|
|
2316
2254
|
await void 0;
|
|
2317
2255
|
let r = t, i = [];
|
|
2318
2256
|
for (;;) {
|
|
2319
2257
|
let t;
|
|
2320
|
-
({i: r, ops: t} = await
|
|
2321
|
-
let a =
|
|
2258
|
+
({i: r, ops: t} = await Cn(e, r, n)), i.push(...t);
|
|
2259
|
+
let a = U(e, r, n, {
|
|
2322
2260
|
phrase: "|",
|
|
2323
2261
|
notBeforeSet: "="
|
|
2324
2262
|
});
|
|
@@ -2330,13 +2268,13 @@ async function q(e, t, n) {
|
|
|
2330
2268
|
ops: i
|
|
2331
2269
|
};
|
|
2332
2270
|
}
|
|
2333
|
-
async function
|
|
2271
|
+
async function Y(e, t, n) {
|
|
2334
2272
|
await void 0;
|
|
2335
2273
|
let r = t, i = [];
|
|
2336
2274
|
for (;;) {
|
|
2337
2275
|
let t;
|
|
2338
|
-
({i: r, ops: t} = await
|
|
2339
|
-
let a =
|
|
2276
|
+
({i: r, ops: t} = await wn(e, r, n)), i.push(...t);
|
|
2277
|
+
let a = U(e, r, n, {
|
|
2340
2278
|
phrase: "|",
|
|
2341
2279
|
notBeforeSet: "="
|
|
2342
2280
|
});
|
|
@@ -2348,15 +2286,15 @@ async function J(e, t, n) {
|
|
|
2348
2286
|
ops: i
|
|
2349
2287
|
};
|
|
2350
2288
|
}
|
|
2351
|
-
async function
|
|
2352
|
-
return await void 0,
|
|
2289
|
+
async function X(e, t, n) {
|
|
2290
|
+
return await void 0, wn(e, t, n);
|
|
2353
2291
|
}
|
|
2354
|
-
async function
|
|
2292
|
+
async function Cn(e, t, n) {
|
|
2355
2293
|
let r = t, i = [];
|
|
2356
2294
|
for (;;) {
|
|
2357
2295
|
let t;
|
|
2358
|
-
({i: r, ops: t} = await
|
|
2359
|
-
let a =
|
|
2296
|
+
({i: r, ops: t} = await wn(e, r, n)), i.push(t);
|
|
2297
|
+
let a = U(e, r, n, { phrase: "," });
|
|
2360
2298
|
if (!a.is) break;
|
|
2361
2299
|
({i: r} = a);
|
|
2362
2300
|
}
|
|
@@ -2371,21 +2309,21 @@ async function wn(e, t, n) {
|
|
|
2371
2309
|
}]
|
|
2372
2310
|
};
|
|
2373
2311
|
}
|
|
2374
|
-
async function
|
|
2375
|
-
let r = t, i =
|
|
2312
|
+
async function wn(e, t, n) {
|
|
2313
|
+
let r = t, i = U(e, r, n, {
|
|
2376
2314
|
phrase: "try",
|
|
2377
2315
|
spaceAfter: !0
|
|
2378
2316
|
});
|
|
2379
|
-
if (!i.is) return
|
|
2317
|
+
if (!i.is) return Tn(e, r, n);
|
|
2380
2318
|
({i: r} = i);
|
|
2381
2319
|
let a;
|
|
2382
|
-
({i: r, ops: a} = await
|
|
2320
|
+
({i: r, ops: a} = await Tn(e, r, n));
|
|
2383
2321
|
let o;
|
|
2384
|
-
return i =
|
|
2322
|
+
return i = U(e, r, n, {
|
|
2385
2323
|
spaceBefore: !0,
|
|
2386
2324
|
phrase: "catch",
|
|
2387
2325
|
spaceAfter: !0
|
|
2388
|
-
}), i.is ? ({i: r} = i, {i: r, ops: o} = await
|
|
2326
|
+
}), i.is ? ({i: r} = i, {i: r, ops: o} = await Tn(e, r, n)) : o = [{
|
|
2389
2327
|
op: "vod",
|
|
2390
2328
|
params: {}
|
|
2391
2329
|
}], {
|
|
@@ -2399,12 +2337,12 @@ async function Tn(e, t, n) {
|
|
|
2399
2337
|
}]
|
|
2400
2338
|
};
|
|
2401
2339
|
}
|
|
2402
|
-
async function
|
|
2340
|
+
async function Tn(e, t, n) {
|
|
2403
2341
|
let r = t, i = [];
|
|
2404
2342
|
for (;;) {
|
|
2405
2343
|
let t;
|
|
2406
|
-
({i: r, ops: t} = await
|
|
2407
|
-
let a =
|
|
2344
|
+
({i: r, ops: t} = await En(e, r, n)), i.push(t);
|
|
2345
|
+
let a = U(e, r, n, {
|
|
2408
2346
|
spaceBefore: !0,
|
|
2409
2347
|
phrase: "or",
|
|
2410
2348
|
spaceAfter: !0
|
|
@@ -2423,12 +2361,12 @@ async function En(e, t, n) {
|
|
|
2423
2361
|
}]
|
|
2424
2362
|
};
|
|
2425
2363
|
}
|
|
2426
|
-
async function
|
|
2364
|
+
async function En(e, t, n) {
|
|
2427
2365
|
let r = t, i = [];
|
|
2428
2366
|
for (;;) {
|
|
2429
2367
|
let t;
|
|
2430
|
-
({i: r, ops: t} = await
|
|
2431
|
-
let a =
|
|
2368
|
+
({i: r, ops: t} = await Dn(e, r, n)), i.push(t);
|
|
2369
|
+
let a = U(e, r, n, {
|
|
2432
2370
|
spaceBefore: !0,
|
|
2433
2371
|
phrase: "and",
|
|
2434
2372
|
spaceAfter: !0
|
|
@@ -2447,31 +2385,27 @@ async function Dn(e, t, n) {
|
|
|
2447
2385
|
}]
|
|
2448
2386
|
};
|
|
2449
2387
|
}
|
|
2450
|
-
async function
|
|
2388
|
+
async function Dn(e, t, n) {
|
|
2451
2389
|
let r = t, i;
|
|
2452
|
-
({i: r, ops: i} = await
|
|
2390
|
+
({i: r, ops: i} = await On(e, r, n));
|
|
2453
2391
|
let a = [];
|
|
2454
2392
|
for (;;) {
|
|
2455
|
-
let t =
|
|
2393
|
+
let t = U(e, r, n, { phrase: "==" });
|
|
2456
2394
|
if (t.is) {
|
|
2457
2395
|
({i: r} = t);
|
|
2458
2396
|
let i;
|
|
2459
|
-
({i: r, ops: i} = await
|
|
2397
|
+
({i: r, ops: i} = await On(e, r, n)), a.push({
|
|
2460
2398
|
op: "==",
|
|
2461
2399
|
params: { by: i }
|
|
2462
2400
|
});
|
|
2463
|
-
|
|
2464
|
-
}
|
|
2465
|
-
if (t = H(e, r, n, { phrase: "!=" }), t.is) {
|
|
2401
|
+
} else if (t = U(e, r, n, { phrase: "!=" }), t.is) {
|
|
2466
2402
|
({i: r} = t);
|
|
2467
2403
|
let i;
|
|
2468
|
-
({i: r, ops: i} = await
|
|
2404
|
+
({i: r, ops: i} = await On(e, r, n)), a.push({
|
|
2469
2405
|
op: "!=",
|
|
2470
2406
|
params: { by: i }
|
|
2471
2407
|
});
|
|
2472
|
-
|
|
2473
|
-
}
|
|
2474
|
-
break;
|
|
2408
|
+
} else break;
|
|
2475
2409
|
}
|
|
2476
2410
|
return a.length === 0 ? {
|
|
2477
2411
|
i: r,
|
|
@@ -2487,49 +2421,41 @@ async function On(e, t, n) {
|
|
|
2487
2421
|
}]
|
|
2488
2422
|
};
|
|
2489
2423
|
}
|
|
2490
|
-
async function
|
|
2424
|
+
async function On(e, t, n) {
|
|
2491
2425
|
let r = t, i;
|
|
2492
|
-
({i: r, ops: i} = await
|
|
2426
|
+
({i: r, ops: i} = await Z(e, r, n));
|
|
2493
2427
|
let a = [];
|
|
2494
2428
|
for (;;) {
|
|
2495
|
-
let t =
|
|
2429
|
+
let t = U(e, r, n, { phrase: "<=" });
|
|
2496
2430
|
if (t.is) {
|
|
2497
2431
|
({i: r} = t);
|
|
2498
2432
|
let i;
|
|
2499
|
-
({i: r, ops: i} = await
|
|
2433
|
+
({i: r, ops: i} = await Z(e, r, n)), a.push({
|
|
2500
2434
|
op: "<=",
|
|
2501
2435
|
params: { by: i }
|
|
2502
2436
|
});
|
|
2503
|
-
|
|
2504
|
-
}
|
|
2505
|
-
if (t = H(e, r, n, { phrase: "<" }), t.is) {
|
|
2437
|
+
} else if (t = U(e, r, n, { phrase: "<" }), t.is) {
|
|
2506
2438
|
({i: r} = t);
|
|
2507
2439
|
let i;
|
|
2508
|
-
({i: r, ops: i} = await
|
|
2440
|
+
({i: r, ops: i} = await Z(e, r, n)), a.push({
|
|
2509
2441
|
op: "<",
|
|
2510
2442
|
params: { by: i }
|
|
2511
2443
|
});
|
|
2512
|
-
|
|
2513
|
-
}
|
|
2514
|
-
if (t = H(e, r, n, { phrase: ">=" }), t.is) {
|
|
2444
|
+
} else if (t = U(e, r, n, { phrase: ">=" }), t.is) {
|
|
2515
2445
|
({i: r} = t);
|
|
2516
2446
|
let i;
|
|
2517
|
-
({i: r, ops: i} = await
|
|
2447
|
+
({i: r, ops: i} = await Z(e, r, n)), a.push({
|
|
2518
2448
|
op: ">=",
|
|
2519
2449
|
params: { by: i }
|
|
2520
2450
|
});
|
|
2521
|
-
|
|
2522
|
-
}
|
|
2523
|
-
if (t = H(e, r, n, { phrase: ">" }), t.is) {
|
|
2451
|
+
} else if (t = U(e, r, n, { phrase: ">" }), t.is) {
|
|
2524
2452
|
({i: r} = t);
|
|
2525
2453
|
let i;
|
|
2526
|
-
({i: r, ops: i} = await
|
|
2454
|
+
({i: r, ops: i} = await Z(e, r, n)), a.push({
|
|
2527
2455
|
op: ">",
|
|
2528
2456
|
params: { by: i }
|
|
2529
2457
|
});
|
|
2530
|
-
|
|
2531
|
-
}
|
|
2532
|
-
break;
|
|
2458
|
+
} else break;
|
|
2533
2459
|
}
|
|
2534
2460
|
return a.length === 0 ? {
|
|
2535
2461
|
i: r,
|
|
@@ -2545,15 +2471,15 @@ async function kn(e, t, n) {
|
|
|
2545
2471
|
}]
|
|
2546
2472
|
};
|
|
2547
2473
|
}
|
|
2548
|
-
async function
|
|
2549
|
-
let r = t, i =
|
|
2474
|
+
async function Z(e, t, n) {
|
|
2475
|
+
let r = t, i = U(e, r, n, {
|
|
2550
2476
|
phrase: "not",
|
|
2551
2477
|
spaceAfter: !0
|
|
2552
2478
|
});
|
|
2553
|
-
if (!i.is) return
|
|
2479
|
+
if (!i.is) return kn(e, r, n);
|
|
2554
2480
|
({i: r} = i);
|
|
2555
2481
|
let a;
|
|
2556
|
-
return {i: r, ops: a} = await
|
|
2482
|
+
return {i: r, ops: a} = await kn(e, r, n), {
|
|
2557
2483
|
i: r,
|
|
2558
2484
|
ops: [...a, {
|
|
2559
2485
|
op: "not",
|
|
@@ -2561,10 +2487,10 @@ async function X(e, t, n) {
|
|
|
2561
2487
|
}]
|
|
2562
2488
|
};
|
|
2563
2489
|
}
|
|
2564
|
-
async function
|
|
2565
|
-
let r = t, i = await
|
|
2490
|
+
async function kn(e, t, n) {
|
|
2491
|
+
let r = t, i = await An(e, r, n);
|
|
2566
2492
|
({i: r} = i);
|
|
2567
|
-
let a =
|
|
2493
|
+
let a = U(e, r, n, {
|
|
2568
2494
|
phrase: "?",
|
|
2569
2495
|
notBeforeSet: "?="
|
|
2570
2496
|
});
|
|
@@ -2582,37 +2508,33 @@ async function An(e, t, n) {
|
|
|
2582
2508
|
}]
|
|
2583
2509
|
}) : i;
|
|
2584
2510
|
}
|
|
2585
|
-
async function
|
|
2511
|
+
async function An(e, t, n) {
|
|
2586
2512
|
let r = t, i;
|
|
2587
|
-
({i: r, ops: i} = await
|
|
2513
|
+
({i: r, ops: i} = await jn(e, r, n));
|
|
2588
2514
|
let a = [];
|
|
2589
2515
|
for (;;) {
|
|
2590
|
-
let t =
|
|
2516
|
+
let t = U(e, r, n, {
|
|
2591
2517
|
phrase: "+",
|
|
2592
2518
|
notBeforeSet: "="
|
|
2593
2519
|
});
|
|
2594
2520
|
if (t.is) {
|
|
2595
2521
|
({i: r} = t);
|
|
2596
2522
|
let i;
|
|
2597
|
-
({i: r, ops: i} = await
|
|
2523
|
+
({i: r, ops: i} = await jn(e, r, n)), a.push({
|
|
2598
2524
|
op: "+",
|
|
2599
2525
|
params: { by: i }
|
|
2600
2526
|
});
|
|
2601
|
-
|
|
2602
|
-
}
|
|
2603
|
-
if (t = H(e, r, n, {
|
|
2527
|
+
} else if (t = U(e, r, n, {
|
|
2604
2528
|
phrase: "-",
|
|
2605
2529
|
notBeforeSet: "=>"
|
|
2606
2530
|
}), t.is) {
|
|
2607
2531
|
({i: r} = t);
|
|
2608
2532
|
let i;
|
|
2609
|
-
({i: r, ops: i} = await
|
|
2533
|
+
({i: r, ops: i} = await jn(e, r, n)), a.push({
|
|
2610
2534
|
op: "-",
|
|
2611
2535
|
params: { by: i }
|
|
2612
2536
|
});
|
|
2613
|
-
|
|
2614
|
-
}
|
|
2615
|
-
break;
|
|
2537
|
+
} else break;
|
|
2616
2538
|
}
|
|
2617
2539
|
return a.length === 0 ? {
|
|
2618
2540
|
i: r,
|
|
@@ -2628,12 +2550,12 @@ async function jn(e, t, n) {
|
|
|
2628
2550
|
}]
|
|
2629
2551
|
};
|
|
2630
2552
|
}
|
|
2631
|
-
async function
|
|
2553
|
+
async function jn(e, t, n) {
|
|
2632
2554
|
let r = t, i;
|
|
2633
2555
|
({i: r, ops: i} = await Q(e, r, n));
|
|
2634
2556
|
let a = [];
|
|
2635
2557
|
for (;;) {
|
|
2636
|
-
let t =
|
|
2558
|
+
let t = U(e, r, n, {
|
|
2637
2559
|
phrase: "*",
|
|
2638
2560
|
notBeforeSet: "="
|
|
2639
2561
|
});
|
|
@@ -2644,9 +2566,7 @@ async function Z(e, t, n) {
|
|
|
2644
2566
|
op: "*",
|
|
2645
2567
|
params: { by: i }
|
|
2646
2568
|
});
|
|
2647
|
-
|
|
2648
|
-
}
|
|
2649
|
-
if (t = H(e, r, n, {
|
|
2569
|
+
} else if (t = U(e, r, n, {
|
|
2650
2570
|
phrase: "/",
|
|
2651
2571
|
notBeforeSet: "="
|
|
2652
2572
|
}), t.is) {
|
|
@@ -2656,9 +2576,7 @@ async function Z(e, t, n) {
|
|
|
2656
2576
|
op: "/",
|
|
2657
2577
|
params: { by: i }
|
|
2658
2578
|
});
|
|
2659
|
-
|
|
2660
|
-
}
|
|
2661
|
-
if (t = H(e, r, n, {
|
|
2579
|
+
} else if (t = U(e, r, n, {
|
|
2662
2580
|
phrase: "%",
|
|
2663
2581
|
notBeforeSet: "="
|
|
2664
2582
|
}), t.is) {
|
|
@@ -2668,9 +2586,7 @@ async function Z(e, t, n) {
|
|
|
2668
2586
|
op: "%",
|
|
2669
2587
|
params: { by: i }
|
|
2670
2588
|
});
|
|
2671
|
-
|
|
2672
|
-
}
|
|
2673
|
-
break;
|
|
2589
|
+
} else break;
|
|
2674
2590
|
}
|
|
2675
2591
|
return a.length === 0 ? {
|
|
2676
2592
|
i: r,
|
|
@@ -2691,7 +2607,7 @@ async function Q(e, t, n) {
|
|
|
2691
2607
|
for (;;) {
|
|
2692
2608
|
let t;
|
|
2693
2609
|
({i: r, ops: t} = await Mn(e, r, n)), i.push(t);
|
|
2694
|
-
let a =
|
|
2610
|
+
let a = U(e, r, n, { phrase: "??" });
|
|
2695
2611
|
if (!a.is) break;
|
|
2696
2612
|
({i: r} = a);
|
|
2697
2613
|
}
|
|
@@ -2707,7 +2623,7 @@ async function Q(e, t, n) {
|
|
|
2707
2623
|
};
|
|
2708
2624
|
}
|
|
2709
2625
|
async function Mn(e, t, n) {
|
|
2710
|
-
let r = t, i =
|
|
2626
|
+
let r = t, i = U(e, r, n, {
|
|
2711
2627
|
phrase: "-",
|
|
2712
2628
|
notBeforeSet: "=>"
|
|
2713
2629
|
});
|
|
@@ -2723,7 +2639,7 @@ async function Mn(e, t, n) {
|
|
|
2723
2639
|
};
|
|
2724
2640
|
}
|
|
2725
2641
|
async function Nn(e, t, n) {
|
|
2726
|
-
let r = t, i =
|
|
2642
|
+
let r = t, i = U(e, r, n, {
|
|
2727
2643
|
phrase: "if",
|
|
2728
2644
|
spaceAfter: !0
|
|
2729
2645
|
});
|
|
@@ -2732,19 +2648,19 @@ async function Nn(e, t, n) {
|
|
|
2732
2648
|
let a = [];
|
|
2733
2649
|
for (;;) {
|
|
2734
2650
|
let t;
|
|
2735
|
-
if ({i: r, ops: t} = await
|
|
2651
|
+
if ({i: r, ops: t} = await J(e, r, n), i = U(e, r, n, {
|
|
2736
2652
|
spaceBefore: !0,
|
|
2737
2653
|
phrase: "then",
|
|
2738
2654
|
spaceAfter: !0
|
|
2739
|
-
}), {i: r} = i, !i.is) return
|
|
2655
|
+
}), {i: r} = i, !i.is) return q(e, r, n, {
|
|
2740
2656
|
operator: "if statement",
|
|
2741
2657
|
message: "expected 'then'"
|
|
2742
2658
|
});
|
|
2743
2659
|
let o;
|
|
2744
|
-
if ({i: r, ops: o} = await
|
|
2660
|
+
if ({i: r, ops: o} = await J(e, r, n), a.push({
|
|
2745
2661
|
if: t,
|
|
2746
2662
|
then: o
|
|
2747
|
-
}), i =
|
|
2663
|
+
}), i = U(e, r, n, {
|
|
2748
2664
|
spaceBefore: !0,
|
|
2749
2665
|
phrase: "elif",
|
|
2750
2666
|
spaceAfter: !0
|
|
@@ -2752,11 +2668,11 @@ async function Nn(e, t, n) {
|
|
|
2752
2668
|
({i: r} = i);
|
|
2753
2669
|
}
|
|
2754
2670
|
let o;
|
|
2755
|
-
return i =
|
|
2671
|
+
return i = U(e, r, n, {
|
|
2756
2672
|
spaceBefore: !0,
|
|
2757
2673
|
phrase: "else",
|
|
2758
2674
|
spaceAfter: !0
|
|
2759
|
-
}), i.is ? ({i: r} = i, {i: r, ops: o} = await
|
|
2675
|
+
}), i.is ? ({i: r} = i, {i: r, ops: o} = await J(e, r, n)) : o = [], i = U(e, r, n, {
|
|
2760
2676
|
spaceBefore: !0,
|
|
2761
2677
|
phrase: "end"
|
|
2762
2678
|
}), {i: r} = i, i.is ? {
|
|
@@ -2768,13 +2684,13 @@ async function Nn(e, t, n) {
|
|
|
2768
2684
|
else: o
|
|
2769
2685
|
}
|
|
2770
2686
|
}]
|
|
2771
|
-
} :
|
|
2687
|
+
} : q(e, r, n, {
|
|
2772
2688
|
operator: "if statement",
|
|
2773
2689
|
message: "expected 'end'"
|
|
2774
2690
|
});
|
|
2775
2691
|
}
|
|
2776
2692
|
function Pn(e, t, n) {
|
|
2777
|
-
let r = t, i =
|
|
2693
|
+
let r = t, i = U(e, r, n, {
|
|
2778
2694
|
phrase: "true",
|
|
2779
2695
|
spaceAfter: !0
|
|
2780
2696
|
});
|
|
@@ -2784,7 +2700,7 @@ function Pn(e, t, n) {
|
|
|
2784
2700
|
op: "tru",
|
|
2785
2701
|
params: {}
|
|
2786
2702
|
}]
|
|
2787
|
-
}) : (i =
|
|
2703
|
+
}) : (i = U(e, r, n, {
|
|
2788
2704
|
phrase: "false",
|
|
2789
2705
|
spaceAfter: !0
|
|
2790
2706
|
}), i.is ? ({i: r} = i, {
|
|
@@ -2793,7 +2709,7 @@ function Pn(e, t, n) {
|
|
|
2793
2709
|
op: "fls",
|
|
2794
2710
|
params: {}
|
|
2795
2711
|
}]
|
|
2796
|
-
}) : (i =
|
|
2712
|
+
}) : (i = U(e, r, n, {
|
|
2797
2713
|
phrase: "null",
|
|
2798
2714
|
spaceAfter: !0
|
|
2799
2715
|
}), i.is ? ({i: r} = i, {
|
|
@@ -2805,27 +2721,27 @@ function Pn(e, t, n) {
|
|
|
2805
2721
|
}) : Fn(e, r, n)));
|
|
2806
2722
|
}
|
|
2807
2723
|
async function Fn(e, t, n) {
|
|
2808
|
-
let r = t, i = await
|
|
2724
|
+
let r = t, i = await xn(e, r, n);
|
|
2809
2725
|
return i.is ? ({i: r} = i, {
|
|
2810
2726
|
i: r,
|
|
2811
2727
|
ops: i.ops
|
|
2812
2728
|
}) : In(e, r, n);
|
|
2813
2729
|
}
|
|
2814
2730
|
async function In(e, t, n) {
|
|
2815
|
-
let r = t, i =
|
|
2731
|
+
let r = t, i = U(e, r, n, {
|
|
2816
2732
|
phrase: "func",
|
|
2817
2733
|
spaceAfter: !0
|
|
2818
2734
|
});
|
|
2819
2735
|
if (!i.is) return Ln(e, r, n);
|
|
2820
2736
|
({i: r} = i);
|
|
2821
|
-
let a =
|
|
2737
|
+
let a = G(e, r, n);
|
|
2822
2738
|
if (!a.is) return Ln(e, t, n);
|
|
2823
2739
|
let o;
|
|
2824
2740
|
({i: r, value: o} = a);
|
|
2825
2741
|
let s;
|
|
2826
|
-
({i: r, argNames: s} = await
|
|
2742
|
+
({i: r, argNames: s} = await vn(e, r, n));
|
|
2827
2743
|
let c;
|
|
2828
|
-
return {i: r, ops: c} = await
|
|
2744
|
+
return {i: r, ops: c} = await X(e, r, n), {
|
|
2829
2745
|
i: r,
|
|
2830
2746
|
ops: [{
|
|
2831
2747
|
op: "va=",
|
|
@@ -2843,16 +2759,16 @@ async function In(e, t, n) {
|
|
|
2843
2759
|
};
|
|
2844
2760
|
}
|
|
2845
2761
|
async function Ln(e, t, n) {
|
|
2846
|
-
let r = t, i =
|
|
2762
|
+
let r = t, i = U(e, r, n, {
|
|
2847
2763
|
phrase: "func",
|
|
2848
2764
|
spaceAfter: !0
|
|
2849
2765
|
});
|
|
2850
2766
|
if (!i.is) return Rn(e, r, n);
|
|
2851
2767
|
({i: r} = i);
|
|
2852
2768
|
let a;
|
|
2853
|
-
({i: r, argNames: a} = await
|
|
2769
|
+
({i: r, argNames: a} = await vn(e, r, n));
|
|
2854
2770
|
let o;
|
|
2855
|
-
return {i: r, ops: o} = await
|
|
2771
|
+
return {i: r, ops: o} = await X(e, r, n), {
|
|
2856
2772
|
i: r,
|
|
2857
2773
|
ops: [{
|
|
2858
2774
|
op: "fun",
|
|
@@ -2864,11 +2780,11 @@ async function Ln(e, t, n) {
|
|
|
2864
2780
|
};
|
|
2865
2781
|
}
|
|
2866
2782
|
async function Rn(e, t, n) {
|
|
2867
|
-
let r = t, i =
|
|
2783
|
+
let r = t, i = G(e, r, n);
|
|
2868
2784
|
if (!i.is) return zn(e, r, n);
|
|
2869
2785
|
let a;
|
|
2870
2786
|
({i: r, value: a} = i);
|
|
2871
|
-
let o, s, c = await
|
|
2787
|
+
let o, s, c = await yn(e, r, n);
|
|
2872
2788
|
if (c.is ? {i: r, selectors: o, canAssign: s} = c : (o = [], s = !0), !s) {
|
|
2873
2789
|
let e = [{
|
|
2874
2790
|
op: "var",
|
|
@@ -2888,7 +2804,7 @@ async function Rn(e, t, n) {
|
|
|
2888
2804
|
}]
|
|
2889
2805
|
};
|
|
2890
2806
|
}
|
|
2891
|
-
let l = await
|
|
2807
|
+
let l = await bn(e, r, n);
|
|
2892
2808
|
if (!l.is) {
|
|
2893
2809
|
let e = [{
|
|
2894
2810
|
op: "var",
|
|
@@ -2940,16 +2856,16 @@ async function Rn(e, t, n) {
|
|
|
2940
2856
|
};
|
|
2941
2857
|
}
|
|
2942
2858
|
async function zn(e, t, n) {
|
|
2943
|
-
let r = t, i = [], a, o =
|
|
2859
|
+
let r = t, i = [], a, o = U(e, r, n, { phrase: "." });
|
|
2944
2860
|
if (!o.is) ({i: r, ops: a} = await Bn(e, r, n));
|
|
2945
2861
|
else {
|
|
2946
2862
|
({i: r} = o), a = [];
|
|
2947
|
-
let t =
|
|
2863
|
+
let t = G(e, r, n);
|
|
2948
2864
|
if (t.is) {
|
|
2949
2865
|
let a;
|
|
2950
2866
|
({i: r, value: a} = t);
|
|
2951
2867
|
let s = !1;
|
|
2952
|
-
o =
|
|
2868
|
+
o = U(e, r, n, {
|
|
2953
2869
|
phrase: "?",
|
|
2954
2870
|
notBeforeSet: "?="
|
|
2955
2871
|
}), o.is && ({i: r, is: s} = o), i.push({
|
|
@@ -2964,7 +2880,7 @@ async function zn(e, t, n) {
|
|
|
2964
2880
|
});
|
|
2965
2881
|
}
|
|
2966
2882
|
}
|
|
2967
|
-
let s = await
|
|
2883
|
+
let s = await yn(e, r, n, { identity: a.length === 0 && i.length === 0 }), c;
|
|
2968
2884
|
if (s.is ? ({i: r, canAssign: c} = s, i.push(...s.selectors)) : c = i.length > 0, i.length === 0) return {
|
|
2969
2885
|
i: r,
|
|
2970
2886
|
ops: a
|
|
@@ -2979,7 +2895,7 @@ async function zn(e, t, n) {
|
|
|
2979
2895
|
}
|
|
2980
2896
|
}]
|
|
2981
2897
|
};
|
|
2982
|
-
let l = await
|
|
2898
|
+
let l = await bn(e, r, n);
|
|
2983
2899
|
if (!l.is) return {
|
|
2984
2900
|
i: r,
|
|
2985
2901
|
ops: [{
|
|
@@ -3004,70 +2920,70 @@ async function zn(e, t, n) {
|
|
|
3004
2920
|
};
|
|
3005
2921
|
}
|
|
3006
2922
|
async function Bn(e, t, n) {
|
|
3007
|
-
let r = t, i =
|
|
2923
|
+
let r = t, i = U(e, r, n, { phrase: "{" });
|
|
3008
2924
|
if (!i.is) return Vn(e, r, n);
|
|
3009
2925
|
({i: r} = i);
|
|
3010
2926
|
let a = [];
|
|
3011
|
-
if (i =
|
|
2927
|
+
if (i = U(e, r, n, { phrase: "}" }), i.is) ({i: r} = i);
|
|
3012
2928
|
else for (;;) {
|
|
3013
|
-
if (i =
|
|
2929
|
+
if (i = U(e, r, n, { phrase: "(" }), i.is) {
|
|
3014
2930
|
({i: r} = i);
|
|
3015
2931
|
let t;
|
|
3016
|
-
if ({i: r, ops: t} = await
|
|
2932
|
+
if ({i: r, ops: t} = await J(e, r, n), i = U(e, r, n, { phrase: ")" }), {i: r} = i, !i.is) return q(e, r, n, {
|
|
3017
2933
|
operator: "object",
|
|
3018
2934
|
message: "expected ')'"
|
|
3019
2935
|
});
|
|
3020
2936
|
let o;
|
|
3021
|
-
if ({i: r, is: o} =
|
|
2937
|
+
if ({i: r, is: o} = U(e, r, n, { phrase: "?" }), i = U(e, r, n, { phrase: ":" }), {i: r} = i, !i.is) return q(e, r, n, {
|
|
3022
2938
|
operator: "object",
|
|
3023
2939
|
message: "expected ':'"
|
|
3024
2940
|
});
|
|
3025
2941
|
let s;
|
|
3026
|
-
if ({i: r, ops: s} = await
|
|
2942
|
+
if ({i: r, ops: s} = await Y(e, r, n), a.push({
|
|
3027
2943
|
key: t,
|
|
3028
2944
|
value: s,
|
|
3029
2945
|
optional: o
|
|
3030
|
-
}), i =
|
|
2946
|
+
}), i = U(e, r, n, { phrase: "}" }), i.is) {
|
|
3031
2947
|
({i: r} = i);
|
|
3032
2948
|
break;
|
|
3033
2949
|
}
|
|
3034
|
-
if (i =
|
|
2950
|
+
if (i = U(e, r, n, { phrase: "," }), {i: r} = i, !i.is) return q(e, r, n, {
|
|
3035
2951
|
operator: "object",
|
|
3036
2952
|
message: "expected ',' or '}'"
|
|
3037
2953
|
});
|
|
3038
2954
|
continue;
|
|
3039
2955
|
}
|
|
3040
|
-
let t = await
|
|
2956
|
+
let t = await Sn(e, r, n);
|
|
3041
2957
|
if (t.is) {
|
|
3042
2958
|
let o;
|
|
3043
|
-
if ({i: r, ops: o} = t, i =
|
|
2959
|
+
if ({i: r, ops: o} = t, i = U(e, r, n, { phrase: ":" }), {i: r} = i, !i.is) return q(e, r, n, {
|
|
3044
2960
|
operator: "object",
|
|
3045
2961
|
message: "expected ':'"
|
|
3046
2962
|
});
|
|
3047
2963
|
let s;
|
|
3048
|
-
if ({i: r, ops: s} = await
|
|
2964
|
+
if ({i: r, ops: s} = await Y(e, r, n), a.push({
|
|
3049
2965
|
key: o,
|
|
3050
2966
|
value: s,
|
|
3051
2967
|
optional: !1
|
|
3052
|
-
}), i =
|
|
2968
|
+
}), i = U(e, r, n, { phrase: "}" }), i.is) {
|
|
3053
2969
|
({i: r} = i);
|
|
3054
2970
|
break;
|
|
3055
2971
|
}
|
|
3056
|
-
if (i =
|
|
2972
|
+
if (i = U(e, r, n, { phrase: "," }), {i: r} = i, !i.is) return q(e, r, n, {
|
|
3057
2973
|
operator: "object",
|
|
3058
2974
|
message: "expected ',' or '}'"
|
|
3059
2975
|
});
|
|
3060
2976
|
continue;
|
|
3061
2977
|
}
|
|
3062
|
-
let o =
|
|
2978
|
+
let o = G(e, r, n);
|
|
3063
2979
|
if (o.is) {
|
|
3064
2980
|
let t;
|
|
3065
2981
|
({i: r, value: t} = o);
|
|
3066
2982
|
let s;
|
|
3067
|
-
if (i =
|
|
2983
|
+
if (i = U(e, r, n, { phrase: ":" }), i.is) ({i: r} = i), {i: r, ops: s} = await Y(e, r, n);
|
|
3068
2984
|
else {
|
|
3069
2985
|
let i;
|
|
3070
|
-
({i: r, is: i} =
|
|
2986
|
+
({i: r, is: i} = U(e, r, n, { phrase: "?" })), s = i ? [{
|
|
3071
2987
|
op: "try",
|
|
3072
2988
|
params: {
|
|
3073
2989
|
try: [{
|
|
@@ -3091,17 +3007,15 @@ async function Bn(e, t, n) {
|
|
|
3091
3007
|
}],
|
|
3092
3008
|
value: s,
|
|
3093
3009
|
optional: !1
|
|
3094
|
-
}), i =
|
|
3010
|
+
}), i = U(e, r, n, { phrase: "}" }), i.is) {
|
|
3095
3011
|
({i: r} = i);
|
|
3096
3012
|
break;
|
|
3097
3013
|
}
|
|
3098
|
-
if (i =
|
|
3014
|
+
if (i = U(e, r, n, { phrase: "," }), {i: r} = i, !i.is) return q(e, r, n, {
|
|
3099
3015
|
operator: "object",
|
|
3100
3016
|
message: "expected ',' or '}'"
|
|
3101
3017
|
});
|
|
3102
|
-
|
|
3103
|
-
}
|
|
3104
|
-
return K(e, r, n, {
|
|
3018
|
+
} else return q(e, r, n, {
|
|
3105
3019
|
operator: "object",
|
|
3106
3020
|
message: "expected field declaration"
|
|
3107
3021
|
});
|
|
@@ -3115,14 +3029,14 @@ async function Bn(e, t, n) {
|
|
|
3115
3029
|
};
|
|
3116
3030
|
}
|
|
3117
3031
|
async function Vn(e, t, n) {
|
|
3118
|
-
let r = t, i =
|
|
3032
|
+
let r = t, i = U(e, r, n, { phrase: "[" });
|
|
3119
3033
|
if ({i: r} = i, !i.is) return Hn(e, r, n);
|
|
3120
3034
|
let a;
|
|
3121
|
-
if (i =
|
|
3035
|
+
if (i = U(e, r, n, { phrase: "]" }), i.is) ({i: r} = i), a = [{
|
|
3122
3036
|
op: "vod",
|
|
3123
3037
|
params: {}
|
|
3124
3038
|
}];
|
|
3125
|
-
else if ({i: r, ops: a} = await
|
|
3039
|
+
else if ({i: r, ops: a} = await J(e, r, n), i = U(e, r, n, { phrase: "]" }), {i: r} = i, !i.is) return q(e, r, n, {
|
|
3126
3040
|
operator: "array",
|
|
3127
3041
|
message: "expected ']'"
|
|
3128
3042
|
});
|
|
@@ -3135,26 +3049,25 @@ async function Vn(e, t, n) {
|
|
|
3135
3049
|
};
|
|
3136
3050
|
}
|
|
3137
3051
|
async function Hn(e, t, n) {
|
|
3138
|
-
let r = t, i = await
|
|
3052
|
+
let r = t, i = await Sn(e, r, n);
|
|
3139
3053
|
return i.is ? ({i: r} = i, {
|
|
3140
3054
|
i: r,
|
|
3141
3055
|
ops: i.ops
|
|
3142
3056
|
}) : Un(e, r, n);
|
|
3143
3057
|
}
|
|
3144
3058
|
async function Un(e, t, n) {
|
|
3145
|
-
let r = t, i =
|
|
3146
|
-
if ({i: r} = i, !i.is) return
|
|
3059
|
+
let r = t, i = U(e, r, n, { phrase: "(" });
|
|
3060
|
+
if ({i: r} = i, !i.is) return q(e, r, n);
|
|
3147
3061
|
let a;
|
|
3148
|
-
return {i: r, ops: a} = await
|
|
3062
|
+
return {i: r, ops: a} = await J(e, r, n), i = U(e, r, n, { phrase: ")" }), {i: r} = i, i.is ? {
|
|
3149
3063
|
i: r,
|
|
3150
3064
|
ops: a
|
|
3151
|
-
} :
|
|
3065
|
+
} : q(e, r, n, {
|
|
3152
3066
|
operator: "group",
|
|
3153
3067
|
message: "expected ')'"
|
|
3154
3068
|
});
|
|
3155
3069
|
}
|
|
3156
|
-
|
|
3157
|
-
//#region lib/interpreter/index.ts
|
|
3070
|
+
// lib/interpreter/index.ts
|
|
3158
3071
|
var Wn = {};
|
|
3159
3072
|
function Gn(e = {}, t = {}) {
|
|
3160
3073
|
return r(e, t);
|
|
@@ -3169,20 +3082,19 @@ var Kn = class {
|
|
|
3169
3082
|
get options() {
|
|
3170
3083
|
return this.#e;
|
|
3171
3084
|
}
|
|
3172
|
-
parse = async (e, t) => new
|
|
3173
|
-
version:
|
|
3085
|
+
parse = async (e, t) => new nn({
|
|
3086
|
+
version: "1.0",
|
|
3174
3087
|
instructions: await this.parseInstructions(e)
|
|
3175
3088
|
}, {
|
|
3176
|
-
program:
|
|
3177
|
-
runtime:
|
|
3089
|
+
program: en(t?.program, this.#t),
|
|
3090
|
+
runtime: I(t?.runtime, this.#n)
|
|
3178
3091
|
});
|
|
3179
3092
|
parseInstructions = async (e) => {
|
|
3180
|
-
let { ops: t } = await
|
|
3093
|
+
let { ops: t } = await gn(e, 0, { interpreter: this });
|
|
3181
3094
|
return t;
|
|
3182
3095
|
};
|
|
3183
|
-
}, qn = new Kn(), Jn = /* @__PURE__ */ t({ sortEntries: () => Yn }), Yn =
|
|
3184
|
-
|
|
3185
|
-
//#region lib/builtins/funcContains.ts
|
|
3096
|
+
}, qn = new Kn(), Jn = /* @__PURE__ */ t({ sortEntries: () => Yn }), Yn = ot(async (e, t) => [await e.alterValue(t, (t) => [...t].sort((t, n) => e.compareArrays(e.unwrapValue(t)[0], e.unwrapValue(n)[0])))]);
|
|
3097
|
+
// lib/builtins/funcContains.ts
|
|
3186
3098
|
function Xn(e, t, n, r, i) {
|
|
3187
3099
|
let a = e.unwrapValue(r), o = e.type(a), s = e.unwrapValue(i ?? null), c = e.type(s);
|
|
3188
3100
|
switch (o) {
|
|
@@ -3191,88 +3103,65 @@ function Xn(e, t, n, r, i) {
|
|
|
3191
3103
|
if (c === "string") return n(a.includes(s));
|
|
3192
3104
|
break;
|
|
3193
3105
|
case "object": return n(Object.values(a).some((t) => e.equals(t, s)));
|
|
3194
|
-
default:
|
|
3195
3106
|
}
|
|
3196
|
-
throw new
|
|
3107
|
+
throw new k("%s (%*<100v) cannot contain %s (%*<100v)", o, a, c, s);
|
|
3197
3108
|
}
|
|
3198
|
-
|
|
3199
|
-
//#region lib/builtins/funcEndsWith.ts
|
|
3109
|
+
// lib/builtins/funcEndsWith.ts
|
|
3200
3110
|
function Zn(e, t, n, r, i) {
|
|
3201
3111
|
let a = e.unwrapValue(r), o = e.type(a), s = e.unwrapValue(i ?? null), c = e.type(s);
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
if (c === "string") return n(a.endsWith(s));
|
|
3205
|
-
break;
|
|
3206
|
-
default:
|
|
3207
|
-
}
|
|
3208
|
-
throw new j("%s (%*<100v) cannot end with %s (%*<100v)", o, a, c, s);
|
|
3112
|
+
if (o === "string" && c === "string") return n(a.endsWith(s));
|
|
3113
|
+
throw new k("%s (%*<100v) cannot end with %s (%*<100v)", o, a, c, s);
|
|
3209
3114
|
}
|
|
3210
|
-
|
|
3211
|
-
//#region lib/builtins/funcError.ts
|
|
3115
|
+
// lib/builtins/funcError.ts
|
|
3212
3116
|
function Qn(e, t, n, r) {
|
|
3213
|
-
throw new
|
|
3117
|
+
throw new O(r);
|
|
3214
3118
|
}
|
|
3215
|
-
|
|
3216
|
-
//#region lib/builtins/funcFromJSON.ts
|
|
3119
|
+
// lib/builtins/funcFromJSON.ts
|
|
3217
3120
|
function $n(e, t, n, r) {
|
|
3218
3121
|
let i = e.unwrapValue(r), a = e.type(i);
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
throw new A(e.message);
|
|
3226
|
-
}
|
|
3227
|
-
return n(e);
|
|
3122
|
+
if (a === "string") {
|
|
3123
|
+
let e;
|
|
3124
|
+
try {
|
|
3125
|
+
e = JSON.parse(i);
|
|
3126
|
+
} catch (e) {
|
|
3127
|
+
throw new O(e.message);
|
|
3228
3128
|
}
|
|
3229
|
-
|
|
3129
|
+
return n(e);
|
|
3230
3130
|
}
|
|
3231
|
-
throw new
|
|
3131
|
+
throw new k("%s (%*<100v) cannot be parsed as JSON", a, i);
|
|
3232
3132
|
}
|
|
3233
|
-
|
|
3234
|
-
//#region lib/builtins/funcHas.ts
|
|
3133
|
+
// lib/builtins/funcHas.ts
|
|
3235
3134
|
function er(e, t, n, r, i) {
|
|
3236
3135
|
let a = e.unwrapValue(r), o = e.type(a), s = e.unwrapValue(i ?? null), c = e.type(s);
|
|
3237
3136
|
switch (o) {
|
|
3238
3137
|
case "array":
|
|
3239
3138
|
if (c === "number") return n(s >= 0 && s < a.length);
|
|
3240
3139
|
break;
|
|
3241
|
-
case "object":
|
|
3242
|
-
if (c === "string") return n(Object.hasOwn(a, s));
|
|
3243
|
-
break;
|
|
3244
|
-
default:
|
|
3140
|
+
case "object": if (c === "string") return n(Object.hasOwn(a, s));
|
|
3245
3141
|
}
|
|
3246
|
-
throw new
|
|
3142
|
+
throw new k("%s (%*<100v) cannot have %s (%*<100v) as key", o, a, c, s);
|
|
3247
3143
|
}
|
|
3248
|
-
|
|
3249
|
-
//#region lib/builtins/funcIn.ts
|
|
3144
|
+
// lib/builtins/funcIn.ts
|
|
3250
3145
|
function tr(e, t, n, r, i) {
|
|
3251
3146
|
let a = e.unwrapValue(r), o = e.type(a), s = e.unwrapValue(i ?? null), c = e.type(s);
|
|
3252
3147
|
switch (c) {
|
|
3253
3148
|
case "array":
|
|
3254
3149
|
if (o === "number") return n(a >= 0 && a < s.length);
|
|
3255
3150
|
break;
|
|
3256
|
-
case "object":
|
|
3257
|
-
if (o === "string") return n(Object.hasOwn(s, a));
|
|
3258
|
-
break;
|
|
3259
|
-
default:
|
|
3151
|
+
case "object": if (o === "string") return n(Object.hasOwn(s, a));
|
|
3260
3152
|
}
|
|
3261
|
-
throw new
|
|
3153
|
+
throw new k("%s (%*<100v) cannot have %s (%*<100v) as key", c, s, o, a);
|
|
3262
3154
|
}
|
|
3263
|
-
|
|
3264
|
-
//#region lib/builtins/funcKeys.ts
|
|
3155
|
+
// lib/builtins/funcKeys.ts
|
|
3265
3156
|
function nr(e, t, n, r) {
|
|
3266
3157
|
let i = e.unwrapValue(r), a = e.type(i);
|
|
3267
3158
|
switch (a) {
|
|
3268
3159
|
case "array": return n(i.map((e, t) => t));
|
|
3269
3160
|
case "object": return n(Object.keys(i));
|
|
3270
|
-
default:
|
|
3271
3161
|
}
|
|
3272
|
-
throw new
|
|
3162
|
+
throw new k("%s (%*<100v) has no keys", a, i);
|
|
3273
3163
|
}
|
|
3274
|
-
|
|
3275
|
-
//#region lib/builtins/funcLength.ts
|
|
3164
|
+
// lib/builtins/funcLength.ts
|
|
3276
3165
|
function rr(e, t, n, r) {
|
|
3277
3166
|
let i = e.unwrapValue(r), a = e.type(i);
|
|
3278
3167
|
switch (a) {
|
|
@@ -3280,123 +3169,88 @@ function rr(e, t, n, r) {
|
|
|
3280
3169
|
case "array": return n(i.length);
|
|
3281
3170
|
case "string": return n([...i].length);
|
|
3282
3171
|
case "object": return n(Object.keys(i).length);
|
|
3283
|
-
default:
|
|
3284
3172
|
}
|
|
3285
|
-
throw new
|
|
3173
|
+
throw new k("%s (%*<100v) has no length", a, i);
|
|
3286
3174
|
}
|
|
3287
|
-
|
|
3288
|
-
//#region lib/builtins/funcNow.ts
|
|
3175
|
+
// lib/builtins/funcNow.ts
|
|
3289
3176
|
function ir(e, t, n, r) {
|
|
3290
3177
|
return n(Date.now());
|
|
3291
3178
|
}
|
|
3292
|
-
|
|
3293
|
-
//#region lib/builtins/funcStartsWith.ts
|
|
3179
|
+
// lib/builtins/funcStartsWith.ts
|
|
3294
3180
|
function ar(e, t, n, r, i) {
|
|
3295
3181
|
let a = e.unwrapValue(r), o = e.type(a), s = e.unwrapValue(i ?? null), c = e.type(s);
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
if (c === "string") return n(a.startsWith(s));
|
|
3299
|
-
break;
|
|
3300
|
-
default:
|
|
3301
|
-
}
|
|
3302
|
-
throw new j("%s (%*<100v) cannot start with %s (%*<100v)", o, a, c, s);
|
|
3182
|
+
if (o === "string" && c === "string") return n(a.startsWith(s));
|
|
3183
|
+
throw new k("%s (%*<100v) cannot start with %s (%*<100v)", o, a, c, s);
|
|
3303
3184
|
}
|
|
3304
|
-
|
|
3305
|
-
//#region lib/builtins/funcToJSON.ts
|
|
3185
|
+
// lib/builtins/funcToJSON.ts
|
|
3306
3186
|
function or(e, t, n, r) {
|
|
3307
3187
|
return n(e.stringifyJSON(r, !1));
|
|
3308
3188
|
}
|
|
3309
|
-
|
|
3310
|
-
//#region lib/builtins/funcToLowerCase.ts
|
|
3189
|
+
// lib/builtins/funcToLowerCase.ts
|
|
3311
3190
|
async function sr(e, t, n, r) {
|
|
3312
3191
|
let i = e.type(r);
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
default:
|
|
3316
|
-
}
|
|
3317
|
-
throw new j("%s (%*<100v) cannot be converted to lower case", i, e.unwrapValue(r));
|
|
3192
|
+
if (i === "string") return n(await e.alterValue(r, (e) => e.toLowerCase()));
|
|
3193
|
+
throw new k("%s (%*<100v) cannot be converted to lower case", i, e.unwrapValue(r));
|
|
3318
3194
|
}
|
|
3319
|
-
|
|
3320
|
-
//#region lib/builtins/funcToNumber.ts
|
|
3195
|
+
// lib/builtins/funcToNumber.ts
|
|
3321
3196
|
function cr(e, t, n, r) {
|
|
3322
3197
|
let i = e.unwrapValue(r), a = e.type(i);
|
|
3323
3198
|
switch (a) {
|
|
3324
3199
|
case "number": return n(i);
|
|
3325
3200
|
case "string": {
|
|
3326
3201
|
let t = e.normalizeValue(+i);
|
|
3327
|
-
if (i === "" || e.type(t) !== "number") throw new
|
|
3202
|
+
if (i === "" || e.type(t) !== "number") throw new nt("%s (%*<100v) does not contain a valid number", a, i);
|
|
3328
3203
|
return n(t);
|
|
3329
3204
|
}
|
|
3330
|
-
default:
|
|
3331
3205
|
}
|
|
3332
|
-
throw new
|
|
3206
|
+
throw new k("%s (%*<100v) cannot be parsed as a number", a, i);
|
|
3333
3207
|
}
|
|
3334
|
-
|
|
3335
|
-
//#region lib/builtins/funcToString.ts
|
|
3208
|
+
// lib/builtins/funcToString.ts
|
|
3336
3209
|
function lr(e, t, n, r) {
|
|
3337
3210
|
return n(e.stringifyJSON(r, !0));
|
|
3338
3211
|
}
|
|
3339
|
-
|
|
3340
|
-
//#region lib/builtins/funcToUpperCase.ts
|
|
3212
|
+
// lib/builtins/funcToUpperCase.ts
|
|
3341
3213
|
async function ur(e, t, n, r) {
|
|
3342
3214
|
let i = e.type(r);
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
default:
|
|
3346
|
-
}
|
|
3347
|
-
throw new j("%s (%*<100v) cannot be converted to upper case", i, e.unwrapValue(r));
|
|
3215
|
+
if (i === "string") return n(await e.alterValue(r, (e) => e.toUpperCase()));
|
|
3216
|
+
throw new k("%s (%*<100v) cannot be converted to upper case", i, e.unwrapValue(r));
|
|
3348
3217
|
}
|
|
3349
|
-
|
|
3350
|
-
//#region lib/builtins/funcTrim.ts
|
|
3218
|
+
// lib/builtins/funcTrim.ts
|
|
3351
3219
|
async function dr(e, t, n, r) {
|
|
3352
3220
|
let i = e.type(r);
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
default:
|
|
3356
|
-
}
|
|
3357
|
-
throw new j("%s (%*<100v) cannot be trimmed", i, e.unwrapValue(r));
|
|
3221
|
+
if (i === "string") return n(await e.alterValue(r, (e) => e.trim()));
|
|
3222
|
+
throw new k("%s (%*<100v) cannot be trimmed", i, e.unwrapValue(r));
|
|
3358
3223
|
}
|
|
3359
|
-
|
|
3360
|
-
//#region lib/builtins/funcTrimEnd.ts
|
|
3224
|
+
// lib/builtins/funcTrimEnd.ts
|
|
3361
3225
|
async function fr(e, t, n, r) {
|
|
3362
3226
|
let i = e.type(r);
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
default:
|
|
3366
|
-
}
|
|
3367
|
-
throw new j("%s (%*<100v) cannot be trimmed", i, e.unwrapValue(r));
|
|
3227
|
+
if (i === "string") return n(await e.alterValue(r, (e) => e.trimEnd()));
|
|
3228
|
+
throw new k("%s (%*<100v) cannot be trimmed", i, e.unwrapValue(r));
|
|
3368
3229
|
}
|
|
3369
|
-
|
|
3370
|
-
//#region lib/builtins/funcTrimStart.ts
|
|
3230
|
+
// lib/builtins/funcTrimStart.ts
|
|
3371
3231
|
async function pr(e, t, n, r) {
|
|
3372
3232
|
let i = e.type(r);
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
default:
|
|
3376
|
-
}
|
|
3377
|
-
throw new j("%s (%*<100v) cannot be trimmed", i, e.unwrapValue(r));
|
|
3233
|
+
if (i === "string") return n(await e.alterValue(r, (e) => e.trimStart()));
|
|
3234
|
+
throw new k("%s (%*<100v) cannot be trimmed", i, e.unwrapValue(r));
|
|
3378
3235
|
}
|
|
3379
|
-
|
|
3380
|
-
//#region lib/builtins/funcType.ts
|
|
3236
|
+
// lib/builtins/funcType.ts
|
|
3381
3237
|
function mr(e, t, n, r) {
|
|
3382
3238
|
return n(e.type(r));
|
|
3383
3239
|
}
|
|
3384
|
-
|
|
3385
|
-
//#region lib/builtins/funcVoid.ts
|
|
3240
|
+
// lib/builtins/funcVoid.ts
|
|
3386
3241
|
function hr(e, t, n, r) {
|
|
3387
3242
|
return [];
|
|
3388
3243
|
}
|
|
3389
|
-
|
|
3390
|
-
//#region lib/builtins/math.ts
|
|
3244
|
+
// lib/builtins/math.ts
|
|
3391
3245
|
function gr(e, t) {
|
|
3392
3246
|
let n = e.type(t), r = e.unwrapValue(t);
|
|
3393
|
-
if (n !== "number") throw new
|
|
3247
|
+
if (n !== "number") throw new k("%s (%*<100v) cannot be used for mathematical operations", n, r);
|
|
3394
3248
|
return r;
|
|
3395
3249
|
}
|
|
3396
3250
|
function $(e) {
|
|
3397
3251
|
return async function(t, n, r, i, ...a) {
|
|
3398
3252
|
let o = t.type(i);
|
|
3399
|
-
if (o !== "number") throw new
|
|
3253
|
+
if (o !== "number") throw new k("%s (%*<100v) cannot be used for mathematical operations", o, t.unwrapValue(i));
|
|
3400
3254
|
return r(await t.alterValue(i, (n) => e(t, n, ...a)));
|
|
3401
3255
|
};
|
|
3402
3256
|
}
|
|
@@ -3451,13 +3305,11 @@ var _r = $((e, t, n) => t ** gr(e, n ?? null)), vr = $((e, t) => Math.sqrt(t)),
|
|
|
3451
3305
|
}
|
|
3452
3306
|
} })).run([null]), e;
|
|
3453
3307
|
});
|
|
3454
|
-
|
|
3455
|
-
//#region lib/interpreter/parseFunction.ts
|
|
3308
|
+
// lib/interpreter/parseFunction.ts
|
|
3456
3309
|
async function Ir(e, t, n) {
|
|
3457
|
-
return
|
|
3310
|
+
return at(e, await qn.parseInstructions(t), n);
|
|
3458
3311
|
}
|
|
3459
|
-
|
|
3460
|
-
//#region lib/main.ts
|
|
3312
|
+
// lib/main.ts
|
|
3461
3313
|
var Lr = n(async () => ({
|
|
3462
3314
|
interpreter: {},
|
|
3463
3315
|
program: {},
|
|
@@ -3466,9 +3318,8 @@ var Lr = n(async () => ({
|
|
|
3466
3318
|
let n = await Lr();
|
|
3467
3319
|
return new Kn({
|
|
3468
3320
|
interpreter: Gn(t?.interpreter, n.interpreter),
|
|
3469
|
-
program:
|
|
3470
|
-
runtime:
|
|
3321
|
+
program: en(t?.program, n.program),
|
|
3322
|
+
runtime: I(t?.runtime, n.runtime)
|
|
3471
3323
|
}).parse(e);
|
|
3472
3324
|
}, zr = async (e, t, n) => (await Rr(e, n)).run(t);
|
|
3473
|
-
|
|
3474
|
-
export { m as DEFINITION_VERSION, Ve as DEFINITION_VERSION_MAJOR, He as DEFINITION_VERSION_MINOR, h as JPLError, v as JPLErrorEnclosure, g as JPLExecutionError, y as JPLFatalError, $e as JPLReferenceError, A as JPLRuntimeError, it as JPLRuntimeScope, rt as JPLRuntimeSignal, nt as JPLSyntaxError, b as JPLType, tt as JPLTypeConversionError, j as JPLTypeError, et as JPLZeroDivisionError, ve as OPA_FIELD, ye as OPA_FUNCTION, be as OPA_ITER, xe as OPA_SLICE, Se as OPC_EQUAL, Ce as OPC_GREATER, we as OPC_GREATEREQUAL, Te as OPC_LESS, Ee as OPC_LESSEQUAL, De as OPC_UNEQUAL, Oe as OPM_ADDITION, ke as OPM_DIVISION, Ae as OPM_MULTIPLICATION, je as OPM_REMAINDER, Me as OPM_SUBTRACTION, Ne as OPU_ADDITION, Pe as OPU_DIVISION, Fe as OPU_MULTIPLICATION, Ie as OPU_NULL_COALESCENCE, Le as OPU_REMAINDER, Re as OPU_SET, ze as OPU_SUBTRACTION, Be as OPU_UPDATE, s as OP_ACCESS, c as OP_AND, l as OP_ARRAY_CONSTRUCTOR, u as OP_ASSIGNMENT, d as OP_CALCULATION, f as OP_COMPARISON, p as OP_CONSTANT, ee as OP_CONSTANT_FALSE, te as OP_CONSTANT_NULL, ne as OP_CONSTANT_TRUE, re as OP_FUNCTION_DEFINITION, ie as OP_IF, ae as OP_INTERPOLATED_STRING, oe as OP_NEGATION, se as OP_NOT, ce as OP_NULL_COALESCENCE, le as OP_NUMBER, ue as OP_OBJECT_CONSTRUCTOR, de as OP_OR, fe as OP_OUTPUT_CONCAT, pe as OP_STRING, me as OP_TRY, he as OP_VARIABLE, ge as OP_VARIABLE_DEFINITION, _e as OP_VOID, _ as adaptError, Ue as adaptErrors, We as adaptErrorsAsync, a as applyArray, o as applyCombinations, i as applyObject, qe as assertType, E as displayValue, Fr as getBuiltins, Lr as getOptions, Ze as jplJSONStripper, Xe as jplStripper, Ye as jplTypedStripper, Qe as jsonStripper, ft as mergeSegments, lt as mux, dt as muxAll, ut as muxAsync, M as muxOne, ct as nativeFunction, x as normalize, st as orphanFunction, Rr as parse, Ir as parseFunction, O as rawStripper, zr as run, ot as scopedFunction, Je as strictDisplayValue, w as stringify, D as strip, T as template, C as typeOf, Ke as typeOrder, S as unwrap };
|
|
3325
|
+
export { Ue as DEFINITION_VERSION, Ve as DEFINITION_VERSION_MAJOR, He as DEFINITION_VERSION_MINOR, m as JPLError, _ as JPLErrorEnclosure, h as JPLExecutionError, v as JPLFatalError, tt as JPLReferenceError, O as JPLRuntimeError, M as JPLRuntimeScope, rt as JPLRuntimeSignal, j as JPLSyntaxError, y as JPLType, nt as JPLTypeConversionError, k as JPLTypeError, A as JPLZeroDivisionError, ve as OPA_FIELD, ye as OPA_FUNCTION, be as OPA_ITER, xe as OPA_SLICE, Se as OPC_EQUAL, Ce as OPC_GREATER, we as OPC_GREATEREQUAL, Te as OPC_LESS, Ee as OPC_LESSEQUAL, De as OPC_UNEQUAL, Oe as OPM_ADDITION, ke as OPM_DIVISION, Ae as OPM_MULTIPLICATION, je as OPM_REMAINDER, Me as OPM_SUBTRACTION, Ne as OPU_ADDITION, Pe as OPU_DIVISION, Fe as OPU_MULTIPLICATION, Ie as OPU_NULL_COALESCENCE, Le as OPU_REMAINDER, Re as OPU_SET, ze as OPU_SUBTRACTION, Be as OPU_UPDATE, s as OP_ACCESS, c as OP_AND, l as OP_ARRAY_CONSTRUCTOR, u as OP_ASSIGNMENT, d as OP_CALCULATION, f as OP_COMPARISON, p as OP_CONSTANT, ee as OP_CONSTANT_FALSE, te as OP_CONSTANT_NULL, ne as OP_CONSTANT_TRUE, re as OP_FUNCTION_DEFINITION, ie as OP_IF, ae as OP_INTERPOLATED_STRING, oe as OP_NEGATION, se as OP_NOT, ce as OP_NULL_COALESCENCE, le as OP_NUMBER, ue as OP_OBJECT_CONSTRUCTOR, de as OP_OR, fe as OP_OUTPUT_CONCAT, pe as OP_STRING, me as OP_TRY, he as OP_VARIABLE, ge as OP_VARIABLE_DEFINITION, _e as OP_VOID, g as adaptError, We as adaptErrors, Ge as adaptErrorsAsync, a as applyArray, o as applyCombinations, i as applyObject, Ye as assertType, w as displayValue, Fr as getBuiltins, Lr as getOptions, $e as jplJSONStripper, Qe as jplStripper, Ze as jplTypedStripper, et as jsonStripper, lt as mergeSegments, st as mux, ct as muxAll, F as muxAsync, P as muxOne, ot as nativeFunction, b as normalize, at as orphanFunction, Rr as parse, Ir as parseFunction, E as rawStripper, zr as run, N as scopedFunction, Xe as strictDisplayValue, S as stringify, T as strip, C as template, Je as typeOf, qe as typeOrder, x as unwrap };
|