subscript 10.4.15 → 10.4.17
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/eval/op/optional.js +8 -22
- package/feature/accessor.js +9 -4
- package/feature/async.js +11 -3
- package/feature/loop.js +4 -10
- package/feature/number.js +9 -9
- package/feature/switch.js +1 -1
- package/jessie.min.js +8 -9
- package/justin.min.js +7 -8
- package/package.json +1 -1
- package/parse.js +1 -1
- package/subscript.min.js +2 -3
package/eval/op/optional.js
CHANGED
|
@@ -9,29 +9,15 @@ operator('?.()', (a, b) => {
|
|
|
9
9
|
b[0] === ',' ? (b = b.slice(1).map(compile), ctx => b.map(arg => arg(ctx))) :
|
|
10
10
|
(b = compile(b), ctx => [b(ctx)]);
|
|
11
11
|
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
return unsafe(
|
|
17
|
-
ctx => { const c = container(ctx); return c?.[prop]?.(...args(ctx)); };
|
|
12
|
+
// ?.() always null-short-circuits, so . and ?. produce identical code.
|
|
13
|
+
// The only real distinction is static key vs dynamic key.
|
|
14
|
+
if (a[0] === '.' || a[0] === '?.') {
|
|
15
|
+
const obj = compile(a[1]), key = a[2];
|
|
16
|
+
return unsafe(key) ? () => undefined : ctx => obj(ctx)?.[key]?.(...args(ctx));
|
|
18
17
|
}
|
|
19
|
-
if (a[0] === '?.[]') {
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
return ctx => { const c = container(ctx); const p = prop(ctx); return unsafe(p) ? undefined : c?.[p]?.(...args(ctx)); };
|
|
23
|
-
}
|
|
24
|
-
// Handle a?.() where a is a.method or a[method] - need to bind this
|
|
25
|
-
if (a[0] === '.') {
|
|
26
|
-
const obj = compile(a[1]);
|
|
27
|
-
const prop = a[2];
|
|
28
|
-
return unsafe(prop) ? () => undefined :
|
|
29
|
-
ctx => { const o = obj(ctx); return o?.[prop]?.(...args(ctx)); };
|
|
30
|
-
}
|
|
31
|
-
if (a[0] === '[]' && a.length === 3) {
|
|
32
|
-
const obj = compile(a[1]);
|
|
33
|
-
const prop = compile(a[2]);
|
|
34
|
-
return ctx => { const o = obj(ctx); const p = prop(ctx); return unsafe(p) ? undefined : o?.[p]?.(...args(ctx)); };
|
|
18
|
+
if ((a[0] === '[]' || a[0] === '?.[]') && a.length === 3) {
|
|
19
|
+
const obj = compile(a[1]), key = compile(a[2]);
|
|
20
|
+
return ctx => { const k = key(ctx); return unsafe(k) ? undefined : obj(ctx)?.[k]?.(...args(ctx)); };
|
|
35
21
|
}
|
|
36
22
|
const fn = compile(a);
|
|
37
23
|
return ctx => fn(ctx)?.(...args(ctx));
|
package/feature/accessor.js
CHANGED
|
@@ -47,14 +47,17 @@ const accessor = (kind) => a => {
|
|
|
47
47
|
token('get', ASSIGN - 1, accessor('get'));
|
|
48
48
|
token('set', ASSIGN - 1, accessor('set'));
|
|
49
49
|
|
|
50
|
-
// Method shorthand: { foo() {} } / {
|
|
50
|
+
// Method shorthand: { foo() {} } / { async foo() {} } / class { static foo() {} }
|
|
51
51
|
// → [':', key, ['=>', ['()', params], body]]
|
|
52
|
-
// Accepts identifier, string-literal node [, "..."],
|
|
52
|
+
// Accepts identifier, string-literal node [, "..."], ['async', key] from
|
|
53
|
+
// async.js, or ['static', key] from unary('static').
|
|
53
54
|
token('(', ASSIGN - 1, a => {
|
|
54
55
|
if (!a) return;
|
|
55
56
|
// ['static', key] from unary('static'): unwrap, re-wrap the resulting method node.
|
|
56
|
-
|
|
57
|
+
// ['async', key] from async.js: unwrap, wrap the method value in async.
|
|
58
|
+
let wrap, isAsync;
|
|
57
59
|
if (Array.isArray(a) && a[0] === 'static') wrap = 'static', a = a[1];
|
|
60
|
+
if (Array.isArray(a) && a[0] === 'async') isAsync = true, a = a[1];
|
|
58
61
|
// Accept identifier or string-literal node as key
|
|
59
62
|
if (!isMethodKey(a)) return;
|
|
60
63
|
const params = expr(0, CPAREN) || null;
|
|
@@ -62,6 +65,8 @@ token('(', ASSIGN - 1, a => {
|
|
|
62
65
|
// Not followed by { - not method shorthand, fall through
|
|
63
66
|
if (cur.charCodeAt(idx) !== OBRACE) return;
|
|
64
67
|
skip();
|
|
65
|
-
|
|
68
|
+
let value = ['=>', ['()', params], expr(0, CBRACE) || null];
|
|
69
|
+
if (isAsync) value = ['async', value];
|
|
70
|
+
const node = [':', a, value];
|
|
66
71
|
return wrap ? [wrap, node] : node;
|
|
67
72
|
});
|
package/feature/async.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Async/await/yield: async function, async arrow, await, yield expressions - parse half
|
|
2
|
-
import { parse, unary, expr, skip, keyword, cur, idx, word } from '../parse.js';
|
|
2
|
+
import { parse, unary, expr, skip, seek, keyword, cur, idx, word, next } from '../parse.js';
|
|
3
3
|
|
|
4
|
-
const PREFIX = 140, ASSIGN = 20;
|
|
4
|
+
const PREFIX = 140, ASSIGN = 20, OPAREN = 40;
|
|
5
5
|
|
|
6
6
|
// await expr → ['await', expr]
|
|
7
7
|
unary('await', PREFIX);
|
|
@@ -25,8 +25,16 @@ keyword('async', PREFIX, () => {
|
|
|
25
25
|
parse.space();
|
|
26
26
|
// async function - check for 'function' word
|
|
27
27
|
if (word('function')) return ['async', expr(PREFIX)];
|
|
28
|
+
// async name( → method shorthand (accessor.js handles params + body)
|
|
29
|
+
// async name => → arrow with single param
|
|
30
|
+
const from = idx;
|
|
31
|
+
const name = next(parse.id);
|
|
32
|
+
if (name) {
|
|
33
|
+
parse.space();
|
|
34
|
+
if (cur.charCodeAt(idx) === OPAREN) return ['async', name];
|
|
35
|
+
seek(from); // backtrack for general arrow parsing
|
|
36
|
+
}
|
|
28
37
|
// async arrow: async () => or async x =>
|
|
29
|
-
// Parse at assign precedence to catch => operator
|
|
30
38
|
const params = expr(ASSIGN - .5);
|
|
31
39
|
return params && ['async', params];
|
|
32
40
|
});
|
package/feature/loop.js
CHANGED
|
@@ -21,29 +21,23 @@ keyword('for', STATEMENT + 1, () => {
|
|
|
21
21
|
keyword('break', STATEMENT + 1, () => {
|
|
22
22
|
parse.asi && (parse.newline = false);
|
|
23
23
|
const from = idx;
|
|
24
|
-
parse.space();
|
|
25
|
-
const c = cur.charCodeAt(idx);
|
|
24
|
+
const c = parse.space();
|
|
26
25
|
if (!c || c === CBRACE || c === SEMI || parse.newline) return ['break'];
|
|
27
26
|
const label = next(parse.id);
|
|
28
27
|
if (!label) return ['break'];
|
|
29
|
-
|
|
30
|
-
parse.space();
|
|
31
|
-
const cc = cur.charCodeAt(idx);
|
|
28
|
+
const cc = parse.space();
|
|
32
29
|
if (!cc || cc === CBRACE || cc === SEMI || parse.newline) return ['break', label];
|
|
33
|
-
// Not a valid label - backtrack
|
|
34
30
|
seek(from);
|
|
35
31
|
return ['break'];
|
|
36
32
|
});
|
|
37
33
|
keyword('continue', STATEMENT + 1, () => {
|
|
38
34
|
parse.asi && (parse.newline = false);
|
|
39
35
|
const from = idx;
|
|
40
|
-
parse.space();
|
|
41
|
-
const c = cur.charCodeAt(idx);
|
|
36
|
+
const c = parse.space();
|
|
42
37
|
if (!c || c === CBRACE || c === SEMI || parse.newline) return ['continue'];
|
|
43
38
|
const label = next(parse.id);
|
|
44
39
|
if (!label) return ['continue'];
|
|
45
|
-
parse.space();
|
|
46
|
-
const cc = cur.charCodeAt(idx);
|
|
40
|
+
const cc = parse.space();
|
|
47
41
|
if (!cc || cc === CBRACE || cc === SEMI || parse.newline) return ['continue', label];
|
|
48
42
|
seek(from);
|
|
49
43
|
return ['continue'];
|
package/feature/number.js
CHANGED
|
@@ -15,8 +15,9 @@ const strip = s => s.indexOf('_') < 0 ? s : s.replaceAll('_', '');
|
|
|
15
15
|
// Supports numeric separators: 1_000_000 and BigInt suffix: 123n
|
|
16
16
|
const num = a => {
|
|
17
17
|
let str = strip(next(c =>
|
|
18
|
-
// . is decimal only if NOT
|
|
19
|
-
|
|
18
|
+
// . is decimal only if NOT range (..) and NOT member access (.name)
|
|
19
|
+
// Allows trailing decimal: 1. → 1, 0.95.toFixed → stops at second .
|
|
20
|
+
(c === PERIOD && (c = cur.charCodeAt(idx + 1)) !== PERIOD && !(parse.id(c) && c > _9 && c !== _e && c !== _E)) ||
|
|
20
21
|
(c >= _0 && c <= _9) ||
|
|
21
22
|
c === UNDERSCORE ||
|
|
22
23
|
((c === _E || c === _e) && ((c = cur.charCodeAt(idx + 1)) >= _0 && c <= _9 || c === PLUS || c === MINUS) ? 2 : 0)
|
|
@@ -27,17 +28,16 @@ const num = a => {
|
|
|
27
28
|
};
|
|
28
29
|
|
|
29
30
|
// Char test for prefix base (with underscore support)
|
|
30
|
-
const charTest =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
31
|
+
const charTest = base => c =>
|
|
32
|
+
c === UNDERSCORE ||
|
|
33
|
+
(c >= _0 && c <= _9 && c - _0 < base) ||
|
|
34
|
+
(base === 16 && (c >= _a && c <= _f || c >= _A && c <= _F));
|
|
35
35
|
|
|
36
36
|
// Default: no prefixes
|
|
37
37
|
parse.number = null;
|
|
38
38
|
|
|
39
39
|
// .1 (but not .. range)
|
|
40
|
-
lookup[PERIOD] = a => !a && cur.charCodeAt(idx + 1)
|
|
40
|
+
lookup[PERIOD] = a => !a && cur.charCodeAt(idx + 1) >= _0 && cur.charCodeAt(idx + 1) <= _9 && num();
|
|
41
41
|
|
|
42
42
|
// 0-9: check parse.number for prefix config
|
|
43
43
|
for (let i = _0; i <= _9; i++) lookup[i] = a => a ? void 0 : num();
|
|
@@ -48,7 +48,7 @@ lookup[_0] = a => {
|
|
|
48
48
|
for (const [pre, base] of Object.entries(cfg)) {
|
|
49
49
|
if (pre[0] === '0' && cur[idx + 1]?.toLowerCase() === pre[1]) {
|
|
50
50
|
skip(2);
|
|
51
|
-
const str = strip(next(charTest
|
|
51
|
+
const str = strip(next(charTest(base)));
|
|
52
52
|
if (cur.charCodeAt(idx) === _n) { skip(); return [, BigInt('0' + pre[1] + str)]; }
|
|
53
53
|
return [, parseInt(str, base)];
|
|
54
54
|
}
|
package/feature/switch.js
CHANGED
|
@@ -10,7 +10,7 @@ let inSwitch = 0;
|
|
|
10
10
|
// Reserve 'case' and 'default' as keywords that fail outside switch body
|
|
11
11
|
// Allows property names like {case:1} ONLY when not in switch context
|
|
12
12
|
const reserve = (w, l = w.length, c = w.charCodeAt(0), prev = lookup[c]) =>
|
|
13
|
-
lookup[c] = (a, prec, op) => (word(w) && !a && inSwitch) || prev?.(a, prec, op);
|
|
13
|
+
lookup[c] = (a, prec, op) => (word(w) && !a && inSwitch && (!parse.prop || parse.prop(idx + l))) || prev?.(a, prec, op);
|
|
14
14
|
reserve('case');
|
|
15
15
|
reserve('default');
|
|
16
16
|
|
package/jessie.min.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
`),o=t.pop(),n=c.slice(Math.max(0,e-40),e),p="\u032D",m=(c[e]||" ")+p,
|
|
3
|
-
${c[e-41]
|
|
4
|
-
`,""
|
|
5
|
-
`,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},re=()=>{let r=[],e="",t;for(;(t=c.charCodeAt(u))!==Ar;)t?t===ut?(h(),e+=mt[c[u]]||c[u],h()):t===ft&&c.charCodeAt(u+1)===lt?(r.push([,e]),e="",h(2),r.push(d(0,125))):(e+=c[u],h()):N("Unterminated template");return r.push([,e]),h(),r},ct=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],at=I[Ar];I[Ar]=(r,e)=>r&&e<pt?s.asi&&s.newline?void 0:(h(),["``",r,...re()]):r?at?.(r,e):(h(),ct(re()));s.string["'"]=!0;s.number={"0x":16,"0b":2,"0o":8};var dt=92,ht=117,At=123,yt=125,Ct=183,wt=s.id,ee=r=>r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102,gt=(r=u+2,e,t=0,o=0)=>{if(c.charCodeAt(u)!==dt||c.charCodeAt(u+1)!==ht)return 0;if(c.charCodeAt(r)===At){for(;ee(e=c.charCodeAt(++r));)t=t*16+(e<=57?e-48:(e&31)+9);return r>u+3&&t<=1114111&&c.charCodeAt(r)===yt?r-u+1:0}for(;o<4&&ee(c.charCodeAt(r+o));)o++;return o===4?6:0};s.id=r=>wt(r)||r===Ct||gt();var yr=5,Et=10,Cr=r=>{let e=u,t=d(Et-1);return t==null?r:r==="let"&&(t==="in"||t==="of")?(_(e),r):t[0]==="in"||t[0]==="of"?[t[0],[r,t[1]],t[2]]:t[0]===","?[r,...t.slice(1)]:[r,t]};C("let",yr+1,()=>Cr("let"));C("const",yr+1,()=>Cr("const"));C("var",yr+1,()=>Cr("var"));var rr=5,St=59,B=()=>(s.space()===123||N("Expected {"),h(),d(rr-.5,125)||null),U=()=>s.space()!==123?d(rr+.5):(h(),d(rr-.5,125)||null),kt=()=>{let r=u;return s.space()===St&&h(),s.space(),k("else")?(h(4),s.semi=!1,!0):(_(r),!1)};C("if",rr+1,()=>{s.space();let r=["if",L(),U()];return kt()&&r.push(U()),r});var Tt=200;C("function",Tt,()=>{s.space();let r=!1;c[u]==="*"&&(r=!0,h(),s.space());let e=T(s.id);return e&&s.space(),r?["function*",e,L()||null,B()]:["function",e,L()||null,B()]});var er=140,wr=20;O("await",er);C("yield",er,()=>(s.space(),c[u]==="*"?(h(),s.space(),["yield*",d(wr)]):["yield",d(wr)]));C("async",er,()=>{if(s.space(),k("function"))return["async",d(er)];let r=d(wr-.5);return r&&["async",r]});var te=200;var It=90,Nt=175,Rt=160,Ot=Rt-.5;O("static",Nt);A("instanceof",It);S("#",te,r=>{if(r)return;let e=T(s.id);return e?"#"+e:void 0});C("class",te,()=>{s.space();let r=T(s.id)||null;if(r==="extends")r=null,s.space();else{if(s.space(),!k("extends"))return["class",r,null,B()];h(7),s.space()}return["class",r,d(Ot),B()]});var gr=47,_t=92,Lt=91,Pt=93;S("/",140,r=>{let e=c.charCodeAt(u);if(r||e===gr||e===42||e===43||e===63)return;let t=!1,o=T(p=>p===_t?2:p===Lt?(t=!0,1):p===Pt?(t=!1,1):p&&(t||p!==gr));c.charCodeAt(u)===gr||N("Unterminated regex"),h();let n=T(p=>p===103||p===105||p===109||p===115||p===117||p===121);return n?["//",o,n]:["//",o]});var X=5,J=125,V=59;C("while",X+1,()=>(s.space(),["while",L(),U()]));C("do",X+1,()=>(r=>(s.space(),h(5),s.space(),["do",r,L()]))(U()));C("for",X+1,()=>(s.space(),k("await")?(h(5),s.space(),["for await",L(),U()]):["for",L(),U()]));C("break",X+1,()=>{s.asi&&(s.newline=!1);let r=u;s.space();let e=c.charCodeAt(u);if(!e||e===J||e===V||s.newline)return["break"];let t=T(s.id);if(!t)return["break"];s.space();let o=c.charCodeAt(u);return!o||o===J||o===V||s.newline?["break",t]:(_(r),["break"])});C("continue",X+1,()=>{s.asi&&(s.newline=!1);let r=u;s.space();let e=c.charCodeAt(u);if(!e||e===J||e===V||s.newline)return["continue"];let t=T(s.id);if(!t)return["continue"];s.space();let o=c.charCodeAt(u);return!o||o===J||o===V||s.newline?["continue",t]:(_(r),["continue"])});C("return",X+1,()=>{s.asi&&(s.newline=!1);let r=s.space();return!r||r===J||r===V||s.newline?["return"]:["return",d(X)]});var Er=5;C("try",Er+1,()=>{let r=["try",B()];return s.space(),k("catch")&&(h(5),s.space(),r.push(["catch",j()===40?L():null,B()])),s.space(),k("finally")&&(h(7),r.push(["finally",B()])),r});C("throw",Er+1,()=>{if(s.asi&&(s.newline=!1),s.space(),s.newline)throw SyntaxError("Unexpected newline after throw");return["throw",d(Er)]});var ie=5,Bt=20,oe=58,vt=59,se=125,Sr=0,pe=(r,e=r.length,t=r.charCodeAt(0),o=I[t])=>I[t]=(n,p,m)=>k(r)&&!n&&Sr||o?.(n,p,m);pe("case");pe("default");var ne=r=>{let e=[];for(;(r=s.space())!==se&&!k("case")&&!k("default");){if(r===vt){h();continue}s.semi=!1,e.push(d(ie+.5))||N()}return e.length>1?[";",...e]:e[0]||null},Mt=()=>{s.space()===123||N("Expected {"),h(),Sr++;let r=[];try{for(;s.space()!==se;)if(k("case")){_(u+4),s.space(),s.semi=!1;let e=d(Bt-.5);s.space()===oe&&h(),r.push(["case",e,ne()])}else k("default")?(_(u+7),s.space()===oe&&h(),r.push(["default",ne()])):N("Expected case or default")}finally{Sr--}return h(),r};C("switch",ie+1,()=>s.space()===40&&["switch",L(),...Mt()]);var kr=5,Ut=20;C("debugger",kr+1,()=>["debugger"]);C("with",kr+1,()=>(s.space(),["with",L(),U()]));var Kt=["if","for","while","do","switch","try"];S(":",Ut-1,r=>typeof r=="string"&&(s.space(),Kt.some(e=>k(e)))&&[":",r,d(kr)]);var Tr=5,$=10,fe=42,Dt=I[fe];I[fe]=(r,e)=>r?Dt?.(r,e):(h(),"*");S("from",$+1,r=>r?r[0]!=="="&&r[0]!==","&&(s.space(),["from",r,d($+1)]):!1);S("as",$+2,r=>r?(s.space(),["as",r,d($+2)]):!1);C("import",Tr,()=>k(".meta")?(h(5),["import.meta"]):["import",d($)]);C("export",Tr,()=>(s.space(),k("default")?(h(7),["export",["default",d($)]]):["export",d(Tr)]));var Ir=20,Gt=200,Ft=10,Ht=13,Xt=34,Qt=35,$t=39,jt=40,le=41,Wt=91,ue=123,me=125,zt=(r,e)=>{for(;r<e;){let t=c.charCodeAt(r++);if(t===Ft||t===Ht)return!0}return!1},Jt=r=>r===Xt||r===$t||r===Wt||r===Qt,Vt=()=>T(s.id)||(Jt(c.charCodeAt(u))?d(Gt-.5):null),Yt=r=>typeof r=="string"||Array.isArray(r)&&(r[0]===void 0||r[0]==="[]"),ce=r=>e=>{if(e)return;let t=u;if(s.space(),s.semi||zt(t,u))return!1;let o=Vt();if(!o||(s.space(),c.charCodeAt(u)!==jt))return!1;h();let n=d(0,le);return s.space(),c.charCodeAt(u)!==ue?!1:(h(),[r,o,n,d(0,me)])};S("get",Ir-1,ce("get"));S("set",Ir-1,ce("set"));S("(",Ir-1,r=>{if(!r)return;let e;if(Array.isArray(r)&&r[0]==="static"&&(e="static",r=r[1]),!Yt(r))return;let t=d(0,le)||null;if(s.space(),c.charCodeAt(u)!==ue)return;h();let o=[":",r,["=>",["()",t],d(0,me)||null]];return e?[e,o]:o});s.comment["#!"]=`
|
|
9
|
-
`;var Ae=32,_r=10,Zt=59,qt=125,ae=91,de=40,tr=G.asi??G[";"],xt=s._baseSpace??=s.space,bt=s._baseStep??=s.step,Nr=r=>Array.isArray(r)||typeof r=="string",ro=(G[";"]??5)+1,Or=r=>Array.isArray(r)&&(G[r[0]]<=ro||r[0]==="{}"&&Or(r[1])),eo=(r,e)=>{for(;(e=c.charCodeAt(r))<=Ae;){if(e===_r)return!0;r++}return!1},to=(r=u,e)=>{for(;r-- >0&&(e=c.charCodeAt(r))<=Ae;)if(e===_r)return!0;return!1};s.space=(r,e)=>{for(;;){for(e=u,r=xt();e<u;)if(c.charCodeAt(e++)===_r){s.newline=!0;break}if(r===Zt&&eo(u+1)){_(u+1),s.newline=s.semi=!0;continue}return r}};s.enter=()=>s.newline=s.semi=!1;s.exit=(r,e)=>{e===qt&&(s.newline=!0,s.semi=!1)};s.step=(r,e,t,o)=>{if(s.semi&&e>=tr)return!1;if(r&&!Nr(r))return null;if(Nr(r)){let p=(t===ae||t===de)&&to();if(s.semi||t===ae&&(p||Or(r))||t===de&&(Or(r)||p&&e>=tr))return he(r,e,o)??null}let n=s.newline;return bt(r,e,t,o)??(Nr(r)&&n?he(r,e,o)??null:null)};var Rr=0,oo=2e3,he=s.asi=(r,e,t,o,n)=>{if(e>=tr||Rr>=oo)return;s.semi=!1;let p=u;Rr++;try{o=t(tr-.5)}finally{Rr--}if(!(!o||u===p))return n=o?.[0]===";"?o.slice(1):[o],r?.[0]===";"?(r.push(...n),r):[";",r,...n]};var Ce=(r,e,t,o)=>typeof r=="string"?n=>e(n,r,n):r[0]==="."?(t=i(r[1]),o=r[2],n=>e(t(n),o,n)):r[0]==="[]"&&r.length===3?(t=i(r[1]),o=i(r[2]),n=>e(t(n),o(n),n)):r[0]==="()"&&r.length===2?Ce(r[1],e):(()=>{throw Error("Invalid assignment target")})(),ye={"=":(r,e,t)=>r[e]=t,"+=":(r,e,t)=>r[e]+=t,"-=":(r,e,t)=>r[e]-=t,"*=":(r,e,t)=>r[e]*=t,"/=":(r,e,t)=>r[e]/=t,"%=":(r,e,t)=>r[e]%=t,"|=":(r,e,t)=>r[e]|=t,"&=":(r,e,t)=>r[e]&=t,"^=":(r,e,t)=>r[e]^=t,">>=":(r,e,t)=>r[e]>>=t,"<<=":(r,e,t)=>r[e]<<=t};for(let r in ye)f(r,(e,t)=>(t=i(t),Ce(e,(o,n,p)=>ye[r](o,n,t(p)))));f("!",r=>(r=i(r),e=>!r(e)));f("||",(r,e)=>(r=i(r),e=i(e),t=>r(t)||e(t)));f("&&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&&e(t)));f("~",r=>(r=i(r),e=>~r(e)));f("|",(r,e)=>(r=i(r),e=i(e),t=>r(t)|e(t)));f("&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&e(t)));f("^",(r,e)=>(r=i(r),e=i(e),t=>r(t)^e(t)));f(">>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>e(t)));f("<<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<<e(t)));f(">",(r,e)=>(r=i(r),e=i(e),t=>r(t)>e(t)));f("<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<e(t)));f(">=",(r,e)=>(r=i(r),e=i(e),t=>r(t)>=e(t)));f("<=",(r,e)=>(r=i(r),e=i(e),t=>r(t)<=e(t)));f("==",(r,e)=>(r=i(r),e=i(e),t=>r(t)==e(t)));f("!=",(r,e)=>(r=i(r),e=i(e),t=>r(t)!=e(t)));f("+",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)+e(t)):(r=i(r),t=>+r(t)));f("-",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)-e(t)):(r=i(r),t=>-r(t)));f("*",(r,e)=>(r=i(r),e=i(e),t=>r(t)*e(t)));f("/",(r,e)=>(r=i(r),e=i(e),t=>r(t)/e(t)));f("%",(r,e)=>(r=i(r),e=i(e),t=>r(t)%e(t)));var Lr=(r,e,t,o)=>typeof r=="string"?n=>e(n,r):r[0]==="."?(t=i(r[1]),o=r[2],n=>e(t(n),o)):r[0]==="[]"&&r.length===3?(t=i(r[1]),o=i(r[2]),n=>e(t(n),o(n))):r[0]==="()"&&r.length===2?Lr(r[1],e):(()=>{throw Error("Invalid increment target")})();f("++",(r,e)=>Lr(r,e===null?(t,o)=>t[o]++:(t,o)=>++t[o]));f("--",(r,e)=>Lr(r,e===null?(t,o)=>t[o]--:(t,o)=>--t[o]));var we=(...r)=>(r=r.map(i),e=>{let t;for(let o of r)t=o(e);return t});f(",",we);f(";",we);var K=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",or=r=>{throw Error(r)};f("[]",(r,e)=>e===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(t=>t==null?(()=>{}):t[0]==="..."?(t=i(t[1]),o=>t(o)):(t=i(t),o=>[t(o)])),t=>r.flatMap(o=>o(t))):(e==null&&or("Missing index"),r=i(r),e=i(e),t=>{let o=e(t);return K(o)?void 0:r(t)[o]}));f(".",(r,e)=>(r=i(r),e=e[0]?e:e[1],K(e)?()=>{}:t=>r(t)[e]));f("()",(r,e)=>{if(e===void 0)return r==null?or("Empty ()"):i(r);let t=n=>n?.[0]===","&&n.slice(1).some(p=>p==null||t(p));t(e)&&or("Empty argument");let o=e?e[0]===","?(e=e.slice(1).map(i),n=>e.map(p=>p(n))):(e=i(e),n=>[e(n)]):()=>[];return Pr(r,(n,p,m)=>n[p](...o(m)))});var v=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&v(r[1])||r[0]==="{}"),Pr=(r,e,t,o)=>r==null?or("Empty ()"):r[0]==="()"&&r.length==2?Pr(r[1],e):typeof r=="string"?n=>e(n,r,n):r[0]==="."?(t=i(r[1]),o=r[2],n=>e(t(n),o,n)):r[0]==="?."?(t=i(r[1]),o=r[2],n=>{let p=t(n);return p==null?void 0:e(p,o,n)}):r[0]==="[]"&&r.length===3?(t=i(r[1]),o=i(r[2]),n=>e(t(n),o(n),n)):r[0]==="?.[]"?(t=i(r[1]),o=i(r[2]),n=>{let p=t(n);return p==null?void 0:e(p,o(n),n)}):(r=i(r),n=>e([r(n)],0,n)),D=Pr;f("===",(r,e)=>(r=i(r),e=i(e),t=>r(t)===e(t)));f("!==",(r,e)=>(r=i(r),e=i(e),t=>r(t)!==e(t)));f("??",(r,e)=>(r=i(r),e=i(e),t=>r(t)??e(t)));var no=r=>{throw Error(r)};f("**",(r,e)=>(r=i(r),e=i(e),t=>r(t)**e(t)));f("**=",(r,e)=>(v(r)||no("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]**=e(n))));f("in",(r,e)=>(r=i(r),e=i(e),t=>r(t)in e(t)));var io=r=>{throw Error(r)};f(">>>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>>e(t)));f(">>>=",(r,e)=>(v(r)||io("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]>>>=e(n))));var so=r=>r[0]?.[0]===","?r[0].slice(1):r,F=(r,e,t)=>{if(typeof r=="string"){t[r]=e;return}let[o,...n]=r,p=so(n);if(o==="{}"){let m=[];for(let l of p){if(Array.isArray(l)&&l[0]==="..."){let w={};for(let R in e)m.includes(R)||(w[R]=e[R]);t[l[1]]=w;break}let a,y,g;typeof l=="string"?a=y=l:l[0]==="="?(typeof l[1]=="string"?a=y=l[1]:[,a,y]=l[1],g=l[2]):[,a,y]=l,m.push(a);let E=e[a];E===void 0&&g&&(E=i(g)(t)),F(y,E,t)}}else if(o==="[]"){let m=0;for(let l of p){if(l===null){m++;continue}if(Array.isArray(l)&&l[0]==="..."){t[l[1]]=e.slice(m);break}let a=l,y;Array.isArray(l)&&l[0]==="="&&([,a,y]=l);let g=e[m++];g===void 0&&y&&(g=i(y)(t)),F(a,g,t)}}},Br=(...r)=>(r=r.map(e=>{if(typeof e=="string")return t=>{t[e]=void 0};if(e[0]==="="){let[,t,o]=e,n=i(o);return typeof t=="string"?p=>{p[t]=n(p)}:p=>F(t,n(p),p)}return i(e)}),e=>{for(let t of r)t(e)});f("let",Br);f("const",Br);f("var",Br);var nr=r=>{throw Error(r)};f("=",(r,e)=>{if(Array.isArray(r)&&(r[0]==="let"||r[0]==="const"||r[0]==="var")){let t=r[1];return e=i(e),typeof t=="string"?o=>{o[t]=e(o)}:o=>F(t,e(o),o)}return v(r)||nr("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]=e(n))});f("||=",(r,e)=>(v(r)||nr("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]||=e(n))));f("&&=",(r,e)=>(v(r)||nr("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]&&=e(n))));f("??=",(r,e)=>(v(r)||nr("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]??=e(n))));f("?",(r,e,t)=>(r=i(r),e=i(e),t=i(t),o=>r(o)?e(o):t(o)));var P=[];f("=>",(r,e)=>{r=r?.[0]==="()"?r[1]:r;let t=r?r[0]===","?r.slice(1):[r]:[],o=-1,n=null,p=t[t.length-1];Array.isArray(p)&&p[0]==="..."&&(o=t.length-1,n=p[1],t.length--);let m=e?.[0]==="{}";return e=i(m?["{",e[1]]:e),l=>(...a)=>{let y={};t.forEach((E,w)=>y[E]=a[w]),n&&(y[n]=a.slice(o));let g=new Proxy(y,{get:(E,w)=>w in E?E[w]:l?.[w],set:(E,w,R)=>((w in E?E:l)[w]=R,!0),has:(E,w)=>w in E||(l?w in l:!1)});try{let E=e(g);return m?void 0:E}catch(E){if(E===P)return E[0];throw E}}});f("...",r=>(r=i(r),e=>Object.entries(r(e))));f("?.",(r,e)=>(r=i(r),K(e)?()=>{}:t=>r(t)?.[e]));f("?.[]",(r,e)=>(r=i(r),e=i(e),t=>{let o=e(t);return K(o)?void 0:r(t)?.[o]}));f("?.()",(r,e)=>{let t=e?e[0]===","?(e=e.slice(1).map(i),n=>e.map(p=>p(n))):(e=i(e),n=>[e(n)]):()=>[];if(r[0]==="?."){let n=i(r[1]),p=r[2];return K(p)?()=>{}:m=>n(m)?.[p]?.(...t(m))}if(r[0]==="?.[]"){let n=i(r[1]),p=i(r[2]);return m=>{let l=n(m),a=p(m);return K(a)?void 0:l?.[a]?.(...t(m))}}if(r[0]==="."){let n=i(r[1]),p=r[2];return K(p)?()=>{}:m=>n(m)?.[p]?.(...t(m))}if(r[0]==="[]"&&r.length===3){let n=i(r[1]),p=i(r[2]);return m=>{let l=n(m),a=p(m);return K(a)?void 0:l?.[a]?.(...t(m))}}let o=i(r);return n=>o(n)?.(...t(n))});f("typeof",r=>(r=i(r),e=>typeof r(e)));f("void",r=>(r=i(r),e=>(r(e),void 0)));f("delete",r=>{if(r[0]==="."){let e=i(r[1]),t=r[2];return o=>delete e(o)[t]}if(r[0]==="[]"){let e=i(r[1]),t=i(r[2]);return o=>delete e(o)[t(o)]}return()=>!0});f("new",r=>{let e=i(r?.[0]==="()"?r[1]:r),t=r?.[0]==="()"?r[2]:null,o=t?t[0]===","?(n=>p=>n.map(m=>m(p)))(t.slice(1).map(i)):(n=>p=>[n(p)])(i(t)):()=>[];return n=>new(e(n))(...o(n))});var ir=Symbol("accessor");f("get",(r,e)=>(e=e?i(e):()=>{},t=>[[ir,r,{get:function(){let o=Object.create(t||{});return o.this=this,e(o)}}]]));f("set",(r,e,t)=>(t=t?i(t):()=>{},o=>[[ir,r,{set:function(n){let p=Object.create(o||{});p.this=this,p[e]=n,t(p)}}]]));var po=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);f("{}",(r,e)=>{if(e!==void 0)return;if(!po(r))return i(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let t=r.map(o=>i(typeof o=="string"?[":",o,o]:o));return o=>{let n={},p={};for(let m of t.flatMap(l=>l(o)))if(m[0]===ir){let[,l,a]=m;p[l]={...p[l],...a,configurable:!0,enumerable:!0}}else n[m[0]]=m[1];for(let m in p)Object.defineProperty(n,m,p[m]);return n}});f("{",r=>(r=r?i(r):()=>{},e=>r(Object.create(e))));f(":",(r,e)=>(e=i(e),Array.isArray(r)?(r=i(r),t=>[[r(t),e(t)]]):t=>[[r,e(t)]]));f("`",(...r)=>(r=r.map(i),e=>r.map(t=>t(e)).join("")));f("``",(r,...e)=>{r=i(r);let t=[],o=[];for(let p of e)Array.isArray(p)&&p[0]===void 0?t.push(p[1]):o.push(i(p));let n=Object.assign([...t],{raw:t});return p=>r(p)(n,...o.map(m=>m(p)))});f("function",(r,e,t)=>{t=t?i(t):()=>{};let o=e?e[0]===","?e.slice(1):[e]:[],n=null,p=-1,m=o[o.length-1];return Array.isArray(m)&&m[0]==="..."&&(p=o.length-1,n=m[1],o.length--),l=>{let a=(...y)=>{let g={};o.forEach((w,R)=>g[w]=y[R]),n&&(g[n]=y.slice(p));let E=new Proxy(g,{get:(w,R)=>R in w?w[R]:l[R],set:(w,R,Se)=>((R in w?w:l)[R]=Se,!0),has:(w,R)=>R in w||R in l});try{return t(E)}catch(w){if(w===P)return w[0];throw w}};return r&&(l[r]=a),a}});f("function*",(r,e,t)=>{throw Error("Generator functions are not supported in evaluation")});f("async",r=>{let e=i(r);return t=>{let o=e(t);return async function(...n){return o(...n)}}});f("await",r=>(r=i(r),async e=>await r(e)));f("yield",r=>(r=r?i(r):null,e=>{throw{__yield__:r?r(e):void 0}}));f("yield*",r=>(r=i(r),e=>{throw{__yield_all__:r(e)}}));var fo=Symbol("static"),lo=r=>{throw Error(r)};f("instanceof",(r,e)=>(r=i(r),e=i(e),t=>r(t)instanceof e(t)));f("class",(r,e,t)=>(e=e?i(e):null,t=t?i(t):null,o=>{let n=e?e(o):Object,p=function(...m){if(!(this instanceof p))return lo("Class constructor must be called with new");let l=e?Reflect.construct(n,m,p):this;return p.prototype.__constructor__&&p.prototype.__constructor__.apply(l,m),l};if(Object.setPrototypeOf(p.prototype,n.prototype),Object.setPrototypeOf(p,n),t){let m=Object.create(o);m.super=n;let l=t(m),a=Array.isArray(l)&&typeof l[0]?.[0]=="string"?l:[];for(let[y,g]of a)y==="constructor"?p.prototype.__constructor__=g:p.prototype[y]=g}return r&&(o[r]=p),p}));f("static",r=>(r=i(r),e=>[[fo,r(e)]]));f("//",(r,e)=>{let t=new RegExp(r,e||"");return()=>t});f("if",(r,e,t)=>(r=i(r),e=i(e),t=t!==void 0?i(t):null,o=>r(o)?e(o):t?.(o)));var M=Symbol("break"),H=Symbol("continue");f("while",(r,e)=>(r=i(r),e=i(e),t=>{let o;for(;r(t);)try{o=e(t)}catch(n){if(n===M)break;if(n===H)continue;if(n===P)return n[0];throw n}return o}));f("do",(r,e)=>(r=i(r),e=i(e),t=>{let o;do try{o=r(t)}catch(n){if(n===M)break;if(n===H)continue;if(n===P)return n[0];throw n}while(e(t));return o}));f("for",(r,e)=>{if(Array.isArray(r)&&r[0]===";"){let[,t,o,n]=r;return t=t?i(t):null,o=o?i(o):()=>!0,n=n?i(n):null,e=i(e),p=>{let m;for(t?.(p);o(p);n?.(p))try{m=e(p)}catch(l){if(l===M)break;if(l===H)continue;if(l===P)return l[0];throw l}return m}}if(Array.isArray(r)&&(r[0]==="in"||r[0]==="of")){let[t,o,n]=r;if(Array.isArray(o)&&(o[0]==="let"||o[0]==="const"||o[0]==="var")&&(o=o[1]),t==="in")return mo(o,n,e);if(t==="of")return uo(o,n,e)}});var uo=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,m=o?null:n[r];for(let l of e(n)){o?F(r,l,n):n[r]=l;try{p=t(n)}catch(a){if(a===M)break;if(a===H)continue;if(a===P)return a[0];throw a}}return o||(n[r]=m),p}},mo=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,m=o?null:n[r];for(let l in e(n)){o?F(r,l,n):n[r]=l;try{p=t(n)}catch(a){if(a===M)break;if(a===H)continue;if(a===P)return a[0];throw a}}return o||(n[r]=m),p}};f("break",()=>()=>{throw M});f("continue",()=>()=>{throw H});f("return",r=>(r=r!==void 0?i(r):null,e=>{throw P[0]=r?.(e),P}));f("try",(r,...e)=>{r=r?i(r):null;let t=e.find(l=>l?.[0]==="catch"),o=e.find(l=>l?.[0]==="finally"),n=t?.[1],p=t?.[2]?i(t[2]):null,m=o?.[1]?i(o[1]):null;return l=>{let a;try{a=r?.(l)}catch(y){if(y===M||y===H||y===P)throw y;if(n!=null&&p){let g=n in l,E=l[n];l[n]=y;try{a=p(l)}finally{g?l[n]=E:delete l[n]}}else if(!p)throw y}finally{m?.(l)}return a}});f("throw",r=>(r=i(r),e=>{throw r(e)}));f("switch",(r,...e)=>(r=i(r),e.length?(e=e.map(t=>[t[0]==="case"?i(t[1]):null,(t[0]==="case"?t[2]:t[1])?.[0]===";"?(t[0]==="case"?t[2]:t[1]).slice(1).map(i):(t[0]==="case"?t[2]:t[1])?[i(t[0]==="case"?t[2]:t[1])]:[]]),t=>{let o=r(t),n=!1,p;for(let[l,a]of e)if(n||l===null||l(t)===o)for(n=!0,m=0;m<a.length;m++)try{p=a[m](t)}catch(y){if(y===M)return p;throw y}var m;return p}):t=>r(t)));f("import",()=>()=>{});f("export",()=>()=>{});f("from",(r,e)=>()=>{});f("as",(r,e)=>()=>{});f("default",r=>i(r));var ge=new WeakMap,co=(r,...e)=>typeof r=="string"?i(s(r)):ge.get(r)||ge.set(r,ao(r,e)).get(r),Ee=57344,ao=(r,e)=>{let t=r.reduce((p,m,l)=>p+(l?String.fromCharCode(Ee+l-1):"")+m,""),o=s(t),n=p=>{if(typeof p=="string"&&p.length===1){let m=p.charCodeAt(0)-Ee,l;if(m>=0&&m<e.length)return l=e[m],ho(l)?l:[,l]}return Array.isArray(p)?p.map(n):p};return i(n(o))},ho=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Ao=co;export{fr as access,A as binary,i as compile,c as cur,Ao as default,N as err,d as expr,W as group,yo as id,u as idx,C as keyword,Q as literal,vr as loc,I as lookup,Mr as member,pr as nary,T as next,f as operator,sr as operators,L as parens,s as parse,j as peek,G as prec,lr as propName,_ as seek,h as skip,S as token,O as unary,k as word};
|
|
1
|
+
var l,c,s=r=>(l=0,c=r,s.enter?.(),r=a(),c[l]?R():r||""),R=(r="Unexpected token",e=l,t=c.slice(0,e).split(`
|
|
2
|
+
`),o=t.pop(),n=c.slice(Math.max(0,e-40),e),p="\u032D",m=(c[e]||" ")+p,u=c.slice(e+1,e+20))=>{throw SyntaxError(`${r} at ${t.length+1}:${o.length+1}
|
|
3
|
+
${n}${m}${u}`)},Br=(r,e=l)=>(Array.isArray(r)&&(r.loc=e),r),k=(r,e=l,t)=>{for(;t=r(c.charCodeAt(l));)l+=t;return c.slice(e,l)},h=(r=1)=>c[l+=r],I=r=>l=r,a=(r=0,e)=>{let t,o,n;for(e&&s.enter?.(r,e);(t=s.space())&&t!==e&&(n=s.step(o,r,t,a));)o=n;return e&&(t==e?(l++,s.exit?.(r,e)):R("Unclosed "+String.fromCharCode(e-(e>42?2:1)))),o},W=(r=l)=>{for(;c.charCodeAt(r)<=32;)r++;return c.charCodeAt(r)},Co=s.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,T=(r,e=r.length)=>c.substr(l,e)===r&&!s.id(c.charCodeAt(l+e)),L=()=>(h(),a(0,41)),N=[],D={},S=(r,e=32,t,o=r.charCodeAt(0),n=r.length,p=N[o],m=r.toUpperCase()!==r,u,d)=>(e=D[r]=!p&&D[r]||e,N[o]=(y,g,E,w=l)=>(u=E,(E?r==E:(n<2||r.charCodeAt(1)===c.charCodeAt(l+1)&&(n<3||c.substr(l,n)==r))&&(!m||!s.id(c.charCodeAt(l+n)))&&(u=E=r))&&g<e&&(l+=n,(d=t(y))?Br(d,w):(l=w,u=0,!m&&!p&&!y&&R()),d)||p?.(y,g,u))),A=(r,e,t=!1)=>S(r,e,o=>o&&(n=>n&&[r,o,n])(a(e-(t?.5:0)))),_=(r,e,t)=>S(r,e,o=>t?o&&[r,o]:!o&&(o=a(e-.5))&&[r,o]),$=(r,e)=>S(r,200,t=>!t&&[,e]),ir=(r,e,t,o)=>S(r,e,(n,p,m=n)=>(p=a(e-(t?.5:0)),n?.[0]!==r&&(n=[r,n||null]),p?.[0]===r?n.push(...p.slice(1)):p?n.push(p):o||W()===r.charCodeAt(0)?n.push(null):m&&n.length===2&&(n=n[1]),n)),z=(r,e)=>S(r[0],e,t=>!t&&[r,a(0,r.charCodeAt(1))||null]),sr=(r,e)=>S(r[0],e,t=>t&&[r,t,a(0,r.charCodeAt(1))||null]),pr=(r,e)=>(s.space(),e=c.charCodeAt(l),s.id(e)&&(e<48||e>57)?k(s.id):a(r)),vr=(r,e)=>S(r,e,t=>t&&(o=>o&&[r,t,o])(pr(e))),C=(r,e,t,o=r.charCodeAt(0),n=r.length,p=N[o],m)=>(D[r]??=e,N[o]=(u,d,y,g=l)=>!u&&(y?r==y:(n<2||c.substr(l,n)==r)&&(y=r))&&d<e&&!s.id(c.charCodeAt(l+n))&&(!s.prop||s.prop(l+n))&&(I(l+n),(m=t())?Br(m,g):I(g),m)||p?.(u,d,y));s.space=r=>{for(;(r=c.charCodeAt(l))<=32;)l++;return r};s.step=(r,e,t,o,n)=>(n=N[t])&&n(r,e)||(r?null:k(s.id)||null);var nr={},f=(r,e,t=nr[r])=>nr[r]=(...o)=>e(...o)||t?.(...o),i=r=>Array.isArray(r)?r[0]==null?(e=>()=>e)(r[1]):nr[r[0]]?.(...r.slice(1))??R(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:e=>e?.[r];var fr=46,H=48,j=57,Mr=69,Ur=101,Ne=43,Ie=45,Kr=95,Dr=110,Re=97,Oe=102,_e=65,Le=70,Gr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),lr=r=>{let e=Gr(k(t=>t===fr&&(t=c.charCodeAt(l+1))!==fr&&!(s.id(t)&&t>j&&t!==Ur&&t!==Mr)||t>=H&&t<=j||t===Kr||((t===Mr||t===Ur)&&((t=c.charCodeAt(l+1))>=H&&t<=j||t===Ne||t===Ie)?2:0)));return c.charCodeAt(l)===Dr?(h(),[,BigInt(e)]):(r=+e)!=r?R():[,r]},Pe=r=>e=>e===Kr||e>=H&&e<=j&&e-H<r||r===16&&(e>=Re&&e<=Oe||e>=_e&&e<=Le);s.number=null;N[fr]=r=>!r&&c.charCodeAt(l+1)>=H&&c.charCodeAt(l+1)<=j&&lr();for(let r=H;r<=j;r++)N[r]=e=>e?void 0:lr();N[H]=r=>{if(r)return;let e=s.number;if(e){for(let[t,o]of Object.entries(e))if(t[0]==="0"&&c[l+1]?.toLowerCase()===t[1]){h(2);let n=Gr(k(Pe(o)));return c.charCodeAt(l)===Dr?(h(),[,BigInt("0"+t[1]+n)]):[,parseInt(n,o)]}}return lr()};var Be=92,Fr=34,Hr=39,Xr=117,Qr=120,ve=123,Me=125,$r=10,Ue=13,Ke={n:`
|
|
4
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},jr=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,xr=r=>(e,t,o="",n=String.fromCharCode(r))=>{if(e||!s.string?.[n])return;h();let p=()=>{let m=c.charCodeAt(l+1);if(m===$r)return 2;if(m===Ue)return c.charCodeAt(l+2)===$r?3:2;if(m===Qr||m===Xr&&c.charCodeAt(l+2)!==ve){let u=m===Qr?2:4,d=0,y;for(let g=0;g<u;g++){if((y=jr(c.charCodeAt(l+2+g)))<0)return o+=c[l+1],2;d=d*16+y}return o+=String.fromCharCode(d),2+u}if(m===Xr){let u=0,d=l+3,y;for(;(y=jr(c.charCodeAt(d)))>=0;)u=u*16+y,d++;return d>l+3&&u<=1114111&&c.charCodeAt(d)===Me?(o+=String.fromCodePoint(u),d-l+1):(o+=c[l+1],2)}return o+=Ke[c[l+1]]||c[l+1],2};return k(m=>m-r&&(m!==Be?(o+=c[l],1):p())),c[l]===n?h():R("Bad string"),[,o]};N[Fr]=xr(Fr);N[Hr]=xr(Hr);s.string={'"':!0};var De=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>A(r,De,!0));var Ge=30,Fe=40,He=140;_("!",He);A("||",Ge);A("&&",Fe);var Xe=50,Qe=60,$e=70,Wr=100,je=140;A("|",Xe);A("&",$e);A("^",Qe);A(">>",Wr);A("<<",Wr);_("~",je);var Y=90;A("<",Y);A(">",Y);A("<=",Y);A(">=",Y);var zr=80;A("==",zr);A("!=",zr);var Jr=110,ur=120,Vr=140;A("+",Jr);A("-",Jr);A("*",ur);A("/",ur);A("%",ur);_("+",Vr);_("-",Vr);var Z=150;S("++",Z,r=>r?["++",r,null]:["++",a(Z-1)]);S("--",Z,r=>r?["--",r,null]:["--",a(Z-1)]);var xe=5,We=10;ir(",",We);ir(";",xe,!0,!0);var ze=170;z("()",ze);var Yr=170,Je=160;sr("[]",Yr);vr(".",Yr);sr("()",Je);var Ve=32,Ye=s.space;s.comment??={"//":`
|
|
5
|
+
`,"/*":"*/"};var mr;s.space=()=>{mr||(mr=Object.entries(s.comment).map(([n,p])=>[n,p,n.charCodeAt(0)]));for(var r;r=Ye();){for(var e=0,t;t=mr[e++];)if(r===t[2]&&c.substr(l,t[0].length)===t[0]){var o=l+t[0].length;if(t[1]===`
|
|
6
|
+
`)for(;c.charCodeAt(o)>=Ve;)o++;else{for(;c[o]&&c.substr(o,t[1].length)!==t[1];)o++;c[o]&&(o+=t[1].length)}I(o),r=0;break}if(r)return r}return r};var Zr=80;A("===",Zr);A("!==",Zr);var Ze=30;A("??",Ze);var qe=130,be=20;A("**",qe,!0);A("**=",be,!0);var qr=90;A("in",qr);A("of",qr);var rt=20,et=100;A(">>>",et);A(">>>=",rt,!0);var cr=20;A("||=",cr,!0);A("&&=",cr,!0);A("??=",cr,!0);$("true",!0);$("false",!1);$("null",null);C("undefined",200,()=>[]);$("NaN",NaN);$("Infinity",1/0);var ar=20;S("?",ar,(r,e,t)=>r&&(e=a(ar-1))&&k(o=>o===58)&&(t=a(ar-1),["?",r,e,t]));var tt=20;A("=>",tt,!0);var ot=20;_("...",ot);var br=170;S("?.",br,(r,e)=>{if(!r)return;let t=s.space();return t===40?(h(),["?.()",r,a(0,41)||null]):t===91?(h(),["?.[]",r,a(0,93)]):(e=pr(br),e?["?.",r,e]:void 0)});var dr=140,re=160,nt=re+1;_("typeof",dr);_("void",dr);_("delete",dr);var it=r=>s.space()===40?(h(),["()",r,a(0,41)||null]):r;C("new",nt,()=>T(".target")?(h(7),["new.target"]):["new",it(a(re))]);var st=20,ee=200;s.prop=r=>W(r)!==58;z("[]",ee);z("{}",ee);A(":",st-1,!0);var pt=170,hr=96,ft=36,lt=123,ut=92,mt={n:`
|
|
7
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},te=()=>{let r=[],e="",t;for(;(t=c.charCodeAt(l))!==hr;)t?t===ut?(h(),e+=mt[c[l]]||c[l],h()):t===ft&&c.charCodeAt(l+1)===lt?(r.push([,e]),e="",h(2),r.push(a(0,125))):(e+=c[l],h()):R("Unterminated template");return r.push([,e]),h(),r},ct=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],at=N[hr];N[hr]=(r,e)=>r&&e<pt?s.asi&&s.newline?void 0:(h(),["``",r,...te()]):r?at?.(r,e):(h(),ct(te()));s.string["'"]=!0;s.number={"0x":16,"0b":2,"0o":8};var dt=92,ht=117,At=123,yt=125,Ct=183,wt=s.id,oe=r=>r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102,gt=(r=l+2,e,t=0,o=0)=>{if(c.charCodeAt(l)!==dt||c.charCodeAt(l+1)!==ht)return 0;if(c.charCodeAt(r)===At){for(;oe(e=c.charCodeAt(++r));)t=t*16+(e<=57?e-48:(e&31)+9);return r>l+3&&t<=1114111&&c.charCodeAt(r)===yt?r-l+1:0}for(;o<4&&oe(c.charCodeAt(r+o));)o++;return o===4?6:0};s.id=r=>wt(r)||r===Ct||gt();var Ar=5,Et=10,yr=r=>{let e=l,t=a(Et-1);return t==null?r:r==="let"&&(t==="in"||t==="of")?(I(e),r):t[0]==="in"||t[0]==="of"?[t[0],[r,t[1]],t[2]]:t[0]===","?[r,...t.slice(1)]:[r,t]};C("let",Ar+1,()=>yr("let"));C("const",Ar+1,()=>yr("const"));C("var",Ar+1,()=>yr("var"));var q=5,St=59,B=()=>(s.space()===123||R("Expected {"),h(),a(q-.5,125)||null),U=()=>s.space()!==123?a(q+.5):(h(),a(q-.5,125)||null),kt=()=>{let r=l;return s.space()===St&&h(),s.space(),T("else")?(h(4),s.semi=!1,!0):(I(r),!1)};C("if",q+1,()=>{s.space();let r=["if",L(),U()];return kt()&&r.push(U()),r});var Tt=200;C("function",Tt,()=>{s.space();let r=!1;c[l]==="*"&&(r=!0,h(),s.space());let e=k(s.id);return e&&s.space(),r?["function*",e,L()||null,B()]:["function",e,L()||null,B()]});var b=140,Cr=20,Nt=40;_("await",b);C("yield",b,()=>(s.space(),c[l]==="*"?(h(),s.space(),["yield*",a(Cr)]):["yield",a(Cr)]));C("async",b,()=>{if(s.space(),T("function"))return["async",a(b)];let r=l,e=k(s.id);if(e){if(s.space(),c.charCodeAt(l)===Nt)return["async",e];I(r)}let t=a(Cr-.5);return t&&["async",t]});var ne=200;var It=90,Rt=175,Ot=160,_t=Ot-.5;_("static",Rt);A("instanceof",It);S("#",ne,r=>{if(r)return;let e=k(s.id);return e?"#"+e:void 0});C("class",ne,()=>{s.space();let r=k(s.id)||null;if(r==="extends")r=null,s.space();else{if(s.space(),!T("extends"))return["class",r,null,B()];h(7),s.space()}return["class",r,a(_t),B()]});var wr=47,Lt=92,Pt=91,Bt=93;S("/",140,r=>{let e=c.charCodeAt(l);if(r||e===wr||e===42||e===43||e===63)return;let t=!1,o=k(p=>p===Lt?2:p===Pt?(t=!0,1):p===Bt?(t=!1,1):p&&(t||p!==wr));c.charCodeAt(l)===wr||R("Unterminated regex"),h();let n=k(p=>p===103||p===105||p===109||p===115||p===117||p===121);return n?["//",o,n]:["//",o]});var X=5,J=125,V=59;C("while",X+1,()=>(s.space(),["while",L(),U()]));C("do",X+1,()=>(r=>(s.space(),h(5),s.space(),["do",r,L()]))(U()));C("for",X+1,()=>(s.space(),T("await")?(h(5),s.space(),["for await",L(),U()]):["for",L(),U()]));C("break",X+1,()=>{s.asi&&(s.newline=!1);let r=l,e=s.space();if(!e||e===J||e===V||s.newline)return["break"];let t=k(s.id);if(!t)return["break"];let o=s.space();return!o||o===J||o===V||s.newline?["break",t]:(I(r),["break"])});C("continue",X+1,()=>{s.asi&&(s.newline=!1);let r=l,e=s.space();if(!e||e===J||e===V||s.newline)return["continue"];let t=k(s.id);if(!t)return["continue"];let o=s.space();return!o||o===J||o===V||s.newline?["continue",t]:(I(r),["continue"])});C("return",X+1,()=>{s.asi&&(s.newline=!1);let r=s.space();return!r||r===J||r===V||s.newline?["return"]:["return",a(X)]});var gr=5;C("try",gr+1,()=>{let r=["try",B()];return s.space(),T("catch")&&(h(5),s.space(),r.push(["catch",W()===40?L():null,B()])),s.space(),T("finally")&&(h(7),r.push(["finally",B()])),r});C("throw",gr+1,()=>{if(s.asi&&(s.newline=!1),s.space(),s.newline)throw SyntaxError("Unexpected newline after throw");return["throw",a(gr)]});var pe=5,vt=20,ie=58,Mt=59,fe=125,Er=0,le=(r,e=r.length,t=r.charCodeAt(0),o=N[t])=>N[t]=(n,p,m)=>T(r)&&!n&&Er&&(!s.prop||s.prop(l+e))||o?.(n,p,m);le("case");le("default");var se=r=>{let e=[];for(;(r=s.space())!==fe&&!T("case")&&!T("default");){if(r===Mt){h();continue}s.semi=!1,e.push(a(pe+.5))||R()}return e.length>1?[";",...e]:e[0]||null},Ut=()=>{s.space()===123||R("Expected {"),h(),Er++;let r=[];try{for(;s.space()!==fe;)if(T("case")){I(l+4),s.space(),s.semi=!1;let e=a(vt-.5);s.space()===ie&&h(),r.push(["case",e,se()])}else T("default")?(I(l+7),s.space()===ie&&h(),r.push(["default",se()])):R("Expected case or default")}finally{Er--}return h(),r};C("switch",pe+1,()=>s.space()===40&&["switch",L(),...Ut()]);var Sr=5,Kt=20;C("debugger",Sr+1,()=>["debugger"]);C("with",Sr+1,()=>(s.space(),["with",L(),U()]));var Dt=["if","for","while","do","switch","try"];S(":",Kt-1,r=>typeof r=="string"&&(s.space(),Dt.some(e=>T(e)))&&[":",r,a(Sr)]);var kr=5,x=10,ue=42,Gt=N[ue];N[ue]=(r,e)=>r?Gt?.(r,e):(h(),"*");S("from",x+1,r=>r?r[0]!=="="&&r[0]!==","&&(s.space(),["from",r,a(x+1)]):!1);S("as",x+2,r=>r?(s.space(),["as",r,a(x+2)]):!1);C("import",kr,()=>T(".meta")?(h(5),["import.meta"]):["import",a(x)]);C("export",kr,()=>(s.space(),T("default")?(h(7),["export",["default",a(x)]]):["export",a(kr)]));var Tr=20,Ft=200,Ht=10,Xt=13,Qt=34,$t=35,jt=39,xt=40,me=41,Wt=91,ce=123,ae=125,zt=(r,e)=>{for(;r<e;){let t=c.charCodeAt(r++);if(t===Ht||t===Xt)return!0}return!1},Jt=r=>r===Qt||r===jt||r===Wt||r===$t,Vt=()=>k(s.id)||(Jt(c.charCodeAt(l))?a(Ft-.5):null),Yt=r=>typeof r=="string"||Array.isArray(r)&&(r[0]===void 0||r[0]==="[]"),de=r=>e=>{if(e)return;let t=l;if(s.space(),s.semi||zt(t,l))return!1;let o=Vt();if(!o||(s.space(),c.charCodeAt(l)!==xt))return!1;h();let n=a(0,me);return s.space(),c.charCodeAt(l)!==ce?!1:(h(),[r,o,n,a(0,ae)])};S("get",Tr-1,de("get"));S("set",Tr-1,de("set"));S("(",Tr-1,r=>{if(!r)return;let e,t;if(Array.isArray(r)&&r[0]==="static"&&(e="static",r=r[1]),Array.isArray(r)&&r[0]==="async"&&(t=!0,r=r[1]),!Yt(r))return;let o=a(0,me)||null;if(s.space(),c.charCodeAt(l)!==ce)return;h();let n=["=>",["()",o],a(0,ae)||null];t&&(n=["async",n]);let p=[":",r,n];return e?[e,p]:p});s.comment["#!"]=`
|
|
8
|
+
`;var Ce=32,Or=10,Zt=59,qt=125,he=91,Ae=40,rr=D.asi??D[";"],bt=s._baseSpace??=s.space,ro=s._baseStep??=s.step,Nr=r=>Array.isArray(r)||typeof r=="string",eo=(D[";"]??5)+1,Rr=r=>Array.isArray(r)&&(D[r[0]]<=eo||r[0]==="{}"&&Rr(r[1])),to=(r,e)=>{for(;(e=c.charCodeAt(r))<=Ce;){if(e===Or)return!0;r++}return!1},oo=(r=l,e)=>{for(;r-- >0&&(e=c.charCodeAt(r))<=Ce;)if(e===Or)return!0;return!1};s.space=(r,e)=>{for(;;){for(e=l,r=bt();e<l;)if(c.charCodeAt(e++)===Or){s.newline=!0;break}if(r===Zt&&to(l+1)){I(l+1),s.newline=s.semi=!0;continue}return r}};s.enter=()=>s.newline=s.semi=!1;s.exit=(r,e)=>{e===qt&&(s.newline=!0,s.semi=!1)};s.step=(r,e,t,o)=>{if(s.semi&&e>=rr)return!1;if(r&&!Nr(r))return null;if(Nr(r)){let p=(t===he||t===Ae)&&oo();if(s.semi||t===he&&(p||Rr(r))||t===Ae&&(Rr(r)||p&&e>=rr))return ye(r,e,o)??null}let n=s.newline;return ro(r,e,t,o)??(Nr(r)&&n?ye(r,e,o)??null:null)};var Ir=0,no=2e3,ye=s.asi=(r,e,t,o,n)=>{if(e>=rr||Ir>=no)return;s.semi=!1;let p=l;Ir++;try{o=t(rr-.5)}finally{Ir--}if(!(!o||l===p))return n=o?.[0]===";"?o.slice(1):[o],r?.[0]===";"?(r.push(...n),r):[";",r,...n]};var ge=(r,e,t,o)=>typeof r=="string"?n=>e(n,r,n):r[0]==="."?(t=i(r[1]),o=r[2],n=>e(t(n),o,n)):r[0]==="[]"&&r.length===3?(t=i(r[1]),o=i(r[2]),n=>e(t(n),o(n),n)):r[0]==="()"&&r.length===2?ge(r[1],e):(()=>{throw Error("Invalid assignment target")})(),we={"=":(r,e,t)=>r[e]=t,"+=":(r,e,t)=>r[e]+=t,"-=":(r,e,t)=>r[e]-=t,"*=":(r,e,t)=>r[e]*=t,"/=":(r,e,t)=>r[e]/=t,"%=":(r,e,t)=>r[e]%=t,"|=":(r,e,t)=>r[e]|=t,"&=":(r,e,t)=>r[e]&=t,"^=":(r,e,t)=>r[e]^=t,">>=":(r,e,t)=>r[e]>>=t,"<<=":(r,e,t)=>r[e]<<=t};for(let r in we)f(r,(e,t)=>(t=i(t),ge(e,(o,n,p)=>we[r](o,n,t(p)))));f("!",r=>(r=i(r),e=>!r(e)));f("||",(r,e)=>(r=i(r),e=i(e),t=>r(t)||e(t)));f("&&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&&e(t)));f("~",r=>(r=i(r),e=>~r(e)));f("|",(r,e)=>(r=i(r),e=i(e),t=>r(t)|e(t)));f("&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&e(t)));f("^",(r,e)=>(r=i(r),e=i(e),t=>r(t)^e(t)));f(">>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>e(t)));f("<<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<<e(t)));f(">",(r,e)=>(r=i(r),e=i(e),t=>r(t)>e(t)));f("<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<e(t)));f(">=",(r,e)=>(r=i(r),e=i(e),t=>r(t)>=e(t)));f("<=",(r,e)=>(r=i(r),e=i(e),t=>r(t)<=e(t)));f("==",(r,e)=>(r=i(r),e=i(e),t=>r(t)==e(t)));f("!=",(r,e)=>(r=i(r),e=i(e),t=>r(t)!=e(t)));f("+",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)+e(t)):(r=i(r),t=>+r(t)));f("-",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)-e(t)):(r=i(r),t=>-r(t)));f("*",(r,e)=>(r=i(r),e=i(e),t=>r(t)*e(t)));f("/",(r,e)=>(r=i(r),e=i(e),t=>r(t)/e(t)));f("%",(r,e)=>(r=i(r),e=i(e),t=>r(t)%e(t)));var _r=(r,e,t,o)=>typeof r=="string"?n=>e(n,r):r[0]==="."?(t=i(r[1]),o=r[2],n=>e(t(n),o)):r[0]==="[]"&&r.length===3?(t=i(r[1]),o=i(r[2]),n=>e(t(n),o(n))):r[0]==="()"&&r.length===2?_r(r[1],e):(()=>{throw Error("Invalid increment target")})();f("++",(r,e)=>_r(r,e===null?(t,o)=>t[o]++:(t,o)=>++t[o]));f("--",(r,e)=>_r(r,e===null?(t,o)=>t[o]--:(t,o)=>--t[o]));var Ee=(...r)=>(r=r.map(i),e=>{let t;for(let o of r)t=o(e);return t});f(",",Ee);f(";",Ee);var Q=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",er=r=>{throw Error(r)};f("[]",(r,e)=>e===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(t=>t==null?(()=>{}):t[0]==="..."?(t=i(t[1]),o=>t(o)):(t=i(t),o=>[t(o)])),t=>r.flatMap(o=>o(t))):(e==null&&er("Missing index"),r=i(r),e=i(e),t=>{let o=e(t);return Q(o)?void 0:r(t)[o]}));f(".",(r,e)=>(r=i(r),e=e[0]?e:e[1],Q(e)?()=>{}:t=>r(t)[e]));f("()",(r,e)=>{if(e===void 0)return r==null?er("Empty ()"):i(r);let t=n=>n?.[0]===","&&n.slice(1).some(p=>p==null||t(p));t(e)&&er("Empty argument");let o=e?e[0]===","?(e=e.slice(1).map(i),n=>e.map(p=>p(n))):(e=i(e),n=>[e(n)]):()=>[];return Lr(r,(n,p,m)=>n[p](...o(m)))});var v=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&v(r[1])||r[0]==="{}"),Lr=(r,e,t,o)=>r==null?er("Empty ()"):r[0]==="()"&&r.length==2?Lr(r[1],e):typeof r=="string"?n=>e(n,r,n):r[0]==="."?(t=i(r[1]),o=r[2],n=>e(t(n),o,n)):r[0]==="?."?(t=i(r[1]),o=r[2],n=>{let p=t(n);return p==null?void 0:e(p,o,n)}):r[0]==="[]"&&r.length===3?(t=i(r[1]),o=i(r[2]),n=>e(t(n),o(n),n)):r[0]==="?.[]"?(t=i(r[1]),o=i(r[2]),n=>{let p=t(n);return p==null?void 0:e(p,o(n),n)}):(r=i(r),n=>e([r(n)],0,n)),K=Lr;f("===",(r,e)=>(r=i(r),e=i(e),t=>r(t)===e(t)));f("!==",(r,e)=>(r=i(r),e=i(e),t=>r(t)!==e(t)));f("??",(r,e)=>(r=i(r),e=i(e),t=>r(t)??e(t)));var io=r=>{throw Error(r)};f("**",(r,e)=>(r=i(r),e=i(e),t=>r(t)**e(t)));f("**=",(r,e)=>(v(r)||io("Invalid assignment target"),e=i(e),K(r,(t,o,n)=>t[o]**=e(n))));f("in",(r,e)=>(r=i(r),e=i(e),t=>r(t)in e(t)));var so=r=>{throw Error(r)};f(">>>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>>e(t)));f(">>>=",(r,e)=>(v(r)||so("Invalid assignment target"),e=i(e),K(r,(t,o,n)=>t[o]>>>=e(n))));var po=r=>r[0]?.[0]===","?r[0].slice(1):r,G=(r,e,t)=>{if(typeof r=="string"){t[r]=e;return}let[o,...n]=r,p=po(n);if(o==="{}"){let m=[];for(let u of p){if(Array.isArray(u)&&u[0]==="..."){let w={};for(let O in e)m.includes(O)||(w[O]=e[O]);t[u[1]]=w;break}let d,y,g;typeof u=="string"?d=y=u:u[0]==="="?(typeof u[1]=="string"?d=y=u[1]:[,d,y]=u[1],g=u[2]):[,d,y]=u,m.push(d);let E=e[d];E===void 0&&g&&(E=i(g)(t)),G(y,E,t)}}else if(o==="[]"){let m=0;for(let u of p){if(u===null){m++;continue}if(Array.isArray(u)&&u[0]==="..."){t[u[1]]=e.slice(m);break}let d=u,y;Array.isArray(u)&&u[0]==="="&&([,d,y]=u);let g=e[m++];g===void 0&&y&&(g=i(y)(t)),G(d,g,t)}}},Pr=(...r)=>(r=r.map(e=>{if(typeof e=="string")return t=>{t[e]=void 0};if(e[0]==="="){let[,t,o]=e,n=i(o);return typeof t=="string"?p=>{p[t]=n(p)}:p=>G(t,n(p),p)}return i(e)}),e=>{for(let t of r)t(e)});f("let",Pr);f("const",Pr);f("var",Pr);var tr=r=>{throw Error(r)};f("=",(r,e)=>{if(Array.isArray(r)&&(r[0]==="let"||r[0]==="const"||r[0]==="var")){let t=r[1];return e=i(e),typeof t=="string"?o=>{o[t]=e(o)}:o=>G(t,e(o),o)}return v(r)||tr("Invalid assignment target"),e=i(e),K(r,(t,o,n)=>t[o]=e(n))});f("||=",(r,e)=>(v(r)||tr("Invalid assignment target"),e=i(e),K(r,(t,o,n)=>t[o]||=e(n))));f("&&=",(r,e)=>(v(r)||tr("Invalid assignment target"),e=i(e),K(r,(t,o,n)=>t[o]&&=e(n))));f("??=",(r,e)=>(v(r)||tr("Invalid assignment target"),e=i(e),K(r,(t,o,n)=>t[o]??=e(n))));f("?",(r,e,t)=>(r=i(r),e=i(e),t=i(t),o=>r(o)?e(o):t(o)));var P=[];f("=>",(r,e)=>{r=r?.[0]==="()"?r[1]:r;let t=r?r[0]===","?r.slice(1):[r]:[],o=-1,n=null,p=t[t.length-1];Array.isArray(p)&&p[0]==="..."&&(o=t.length-1,n=p[1],t.length--);let m=e?.[0]==="{}";return e=i(m?["{",e[1]]:e),u=>(...d)=>{let y={};t.forEach((E,w)=>y[E]=d[w]),n&&(y[n]=d.slice(o));let g=new Proxy(y,{get:(E,w)=>w in E?E[w]:u?.[w],set:(E,w,O)=>((w in E?E:u)[w]=O,!0),has:(E,w)=>w in E||(u?w in u:!1)});try{let E=e(g);return m?void 0:E}catch(E){if(E===P)return E[0];throw E}}});f("...",r=>(r=i(r),e=>Object.entries(r(e))));f("?.",(r,e)=>(r=i(r),Q(e)?()=>{}:t=>r(t)?.[e]));f("?.[]",(r,e)=>(r=i(r),e=i(e),t=>{let o=e(t);return Q(o)?void 0:r(t)?.[o]}));f("?.()",(r,e)=>{let t=e?e[0]===","?(e=e.slice(1).map(i),n=>e.map(p=>p(n))):(e=i(e),n=>[e(n)]):()=>[];if(r[0]==="."||r[0]==="?."){let n=i(r[1]),p=r[2];return Q(p)?()=>{}:m=>n(m)?.[p]?.(...t(m))}if((r[0]==="[]"||r[0]==="?.[]")&&r.length===3){let n=i(r[1]),p=i(r[2]);return m=>{let u=p(m);return Q(u)?void 0:n(m)?.[u]?.(...t(m))}}let o=i(r);return n=>o(n)?.(...t(n))});f("typeof",r=>(r=i(r),e=>typeof r(e)));f("void",r=>(r=i(r),e=>(r(e),void 0)));f("delete",r=>{if(r[0]==="."){let e=i(r[1]),t=r[2];return o=>delete e(o)[t]}if(r[0]==="[]"){let e=i(r[1]),t=i(r[2]);return o=>delete e(o)[t(o)]}return()=>!0});f("new",r=>{let e=i(r?.[0]==="()"?r[1]:r),t=r?.[0]==="()"?r[2]:null,o=t?t[0]===","?(n=>p=>n.map(m=>m(p)))(t.slice(1).map(i)):(n=>p=>[n(p)])(i(t)):()=>[];return n=>new(e(n))(...o(n))});var or=Symbol("accessor");f("get",(r,e)=>(e=e?i(e):()=>{},t=>[[or,r,{get:function(){let o=Object.create(t||{});return o.this=this,e(o)}}]]));f("set",(r,e,t)=>(t=t?i(t):()=>{},o=>[[or,r,{set:function(n){let p=Object.create(o||{});p.this=this,p[e]=n,t(p)}}]]));var fo=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);f("{}",(r,e)=>{if(e!==void 0)return;if(!fo(r))return i(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let t=r.map(o=>i(typeof o=="string"?[":",o,o]:o));return o=>{let n={},p={};for(let m of t.flatMap(u=>u(o)))if(m[0]===or){let[,u,d]=m;p[u]={...p[u],...d,configurable:!0,enumerable:!0}}else n[m[0]]=m[1];for(let m in p)Object.defineProperty(n,m,p[m]);return n}});f("{",r=>(r=r?i(r):()=>{},e=>r(Object.create(e))));f(":",(r,e)=>(e=i(e),Array.isArray(r)?(r=i(r),t=>[[r(t),e(t)]]):t=>[[r,e(t)]]));f("`",(...r)=>(r=r.map(i),e=>r.map(t=>t(e)).join("")));f("``",(r,...e)=>{r=i(r);let t=[],o=[];for(let p of e)Array.isArray(p)&&p[0]===void 0?t.push(p[1]):o.push(i(p));let n=Object.assign([...t],{raw:t});return p=>r(p)(n,...o.map(m=>m(p)))});f("function",(r,e,t)=>{t=t?i(t):()=>{};let o=e?e[0]===","?e.slice(1):[e]:[],n=null,p=-1,m=o[o.length-1];return Array.isArray(m)&&m[0]==="..."&&(p=o.length-1,n=m[1],o.length--),u=>{let d=(...y)=>{let g={};o.forEach((w,O)=>g[w]=y[O]),n&&(g[n]=y.slice(p));let E=new Proxy(g,{get:(w,O)=>O in w?w[O]:u[O],set:(w,O,Te)=>((O in w?w:u)[O]=Te,!0),has:(w,O)=>O in w||O in u});try{return t(E)}catch(w){if(w===P)return w[0];throw w}};return r&&(u[r]=d),d}});f("function*",(r,e,t)=>{throw Error("Generator functions are not supported in evaluation")});f("async",r=>{let e=i(r);return t=>{let o=e(t);return async function(...n){return o(...n)}}});f("await",r=>(r=i(r),async e=>await r(e)));f("yield",r=>(r=r?i(r):null,e=>{throw{__yield__:r?r(e):void 0}}));f("yield*",r=>(r=i(r),e=>{throw{__yield_all__:r(e)}}));var lo=Symbol("static"),uo=r=>{throw Error(r)};f("instanceof",(r,e)=>(r=i(r),e=i(e),t=>r(t)instanceof e(t)));f("class",(r,e,t)=>(e=e?i(e):null,t=t?i(t):null,o=>{let n=e?e(o):Object,p=function(...m){if(!(this instanceof p))return uo("Class constructor must be called with new");let u=e?Reflect.construct(n,m,p):this;return p.prototype.__constructor__&&p.prototype.__constructor__.apply(u,m),u};if(Object.setPrototypeOf(p.prototype,n.prototype),Object.setPrototypeOf(p,n),t){let m=Object.create(o);m.super=n;let u=t(m),d=Array.isArray(u)&&typeof u[0]?.[0]=="string"?u:[];for(let[y,g]of d)y==="constructor"?p.prototype.__constructor__=g:p.prototype[y]=g}return r&&(o[r]=p),p}));f("static",r=>(r=i(r),e=>[[lo,r(e)]]));f("//",(r,e)=>{let t=new RegExp(r,e||"");return()=>t});f("if",(r,e,t)=>(r=i(r),e=i(e),t=t!==void 0?i(t):null,o=>r(o)?e(o):t?.(o)));var M=Symbol("break"),F=Symbol("continue");f("while",(r,e)=>(r=i(r),e=i(e),t=>{let o;for(;r(t);)try{o=e(t)}catch(n){if(n===M)break;if(n===F)continue;if(n===P)return n[0];throw n}return o}));f("do",(r,e)=>(r=i(r),e=i(e),t=>{let o;do try{o=r(t)}catch(n){if(n===M)break;if(n===F)continue;if(n===P)return n[0];throw n}while(e(t));return o}));f("for",(r,e)=>{if(Array.isArray(r)&&r[0]===";"){let[,t,o,n]=r;return t=t?i(t):null,o=o?i(o):()=>!0,n=n?i(n):null,e=i(e),p=>{let m;for(t?.(p);o(p);n?.(p))try{m=e(p)}catch(u){if(u===M)break;if(u===F)continue;if(u===P)return u[0];throw u}return m}}if(Array.isArray(r)&&(r[0]==="in"||r[0]==="of")){let[t,o,n]=r;if(Array.isArray(o)&&(o[0]==="let"||o[0]==="const"||o[0]==="var")&&(o=o[1]),t==="in")return co(o,n,e);if(t==="of")return mo(o,n,e)}});var mo=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,m=o?null:n[r];for(let u of e(n)){o?G(r,u,n):n[r]=u;try{p=t(n)}catch(d){if(d===M)break;if(d===F)continue;if(d===P)return d[0];throw d}}return o||(n[r]=m),p}},co=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,m=o?null:n[r];for(let u in e(n)){o?G(r,u,n):n[r]=u;try{p=t(n)}catch(d){if(d===M)break;if(d===F)continue;if(d===P)return d[0];throw d}}return o||(n[r]=m),p}};f("break",()=>()=>{throw M});f("continue",()=>()=>{throw F});f("return",r=>(r=r!==void 0?i(r):null,e=>{throw P[0]=r?.(e),P}));f("try",(r,...e)=>{r=r?i(r):null;let t=e.find(u=>u?.[0]==="catch"),o=e.find(u=>u?.[0]==="finally"),n=t?.[1],p=t?.[2]?i(t[2]):null,m=o?.[1]?i(o[1]):null;return u=>{let d;try{d=r?.(u)}catch(y){if(y===M||y===F||y===P)throw y;if(n!=null&&p){let g=n in u,E=u[n];u[n]=y;try{d=p(u)}finally{g?u[n]=E:delete u[n]}}else if(!p)throw y}finally{m?.(u)}return d}});f("throw",r=>(r=i(r),e=>{throw r(e)}));f("switch",(r,...e)=>(r=i(r),e.length?(e=e.map(t=>[t[0]==="case"?i(t[1]):null,(t[0]==="case"?t[2]:t[1])?.[0]===";"?(t[0]==="case"?t[2]:t[1]).slice(1).map(i):(t[0]==="case"?t[2]:t[1])?[i(t[0]==="case"?t[2]:t[1])]:[]]),t=>{let o=r(t),n=!1,p;for(let[u,d]of e)if(n||u===null||u(t)===o)for(n=!0,m=0;m<d.length;m++)try{p=d[m](t)}catch(y){if(y===M)return p;throw y}var m;return p}):t=>r(t)));f("import",()=>()=>{});f("export",()=>()=>{});f("from",(r,e)=>()=>{});f("as",(r,e)=>()=>{});f("default",r=>i(r));var Se=new WeakMap,ao=(r,...e)=>typeof r=="string"?i(s(r)):Se.get(r)||Se.set(r,ho(r,e)).get(r),ke=57344,ho=(r,e)=>{let t=r.reduce((p,m,u)=>p+(u?String.fromCharCode(ke+u-1):"")+m,""),o=s(t),n=p=>{if(typeof p=="string"&&p.length===1){let m=p.charCodeAt(0)-ke,u;if(m>=0&&m<e.length)return u=e[m],Ao(u)?u:[,u]}return Array.isArray(p)?p.map(n):p};return i(n(o))},Ao=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),yo=ao;export{sr as access,A as binary,i as compile,c as cur,yo as default,R as err,a as expr,z as group,Co as id,l as idx,C as keyword,$ as literal,Br as loc,N as lookup,vr as member,ir as nary,k as next,f as operator,nr as operators,L as parens,s as parse,W as peek,D as prec,pr as propName,I as seek,h as skip,S as token,_ as unary,T as word};
|
package/justin.min.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
var u,
|
|
2
|
-
`),o=e.pop(),i=
|
|
3
|
-
${l[t-41]
|
|
4
|
-
`,""
|
|
5
|
-
`,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Rr=()=>{let r=[],t="",e;for(;(e=l.charCodeAt(u))!==er;)e?e===wt?(y(),t+=It[l[u]]||l[u],y()):e===St&&l.charCodeAt(u+1)===Et?(r.push([,t]),t="",y(2),r.push(C(0,125))):(t+=l[u],y()):N("Unterminated template");return r.push([,t]),y(),r},kt=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],Nt=w[er];w[er]=(r,t)=>r&&t<yt?d.asi&&d.newline?void 0:(y(),["``",r,...Rr()]):r?Nt?.(r,t):(y(),kt(Rr()));d.string["'"]=!0;d.number={"0x":16,"0b":2,"0o":8};var Tr=(r,t,e,o)=>typeof r=="string"?i=>t(i,r,i):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o,i)):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i),i)):r[0]==="()"&&r.length===2?Tr(r[1],t):(()=>{throw Error("Invalid assignment target")})(),Pr={"=":(r,t,e)=>r[t]=e,"+=":(r,t,e)=>r[t]+=e,"-=":(r,t,e)=>r[t]-=e,"*=":(r,t,e)=>r[t]*=e,"/=":(r,t,e)=>r[t]/=e,"%=":(r,t,e)=>r[t]%=e,"|=":(r,t,e)=>r[t]|=e,"&=":(r,t,e)=>r[t]&=e,"^=":(r,t,e)=>r[t]^=e,">>=":(r,t,e)=>r[t]>>=e,"<<=":(r,t,e)=>r[t]<<=e};for(let r in Pr)p(r,(t,e)=>(e=n(e),Tr(t,(o,i,s)=>Pr[r](o,i,e(s)))));p("!",r=>(r=n(r),t=>!r(t)));p("||",(r,t)=>(r=n(r),t=n(t),e=>r(e)||t(e)));p("&&",(r,t)=>(r=n(r),t=n(t),e=>r(e)&&t(e)));p("~",r=>(r=n(r),t=>~r(t)));p("|",(r,t)=>(r=n(r),t=n(t),e=>r(e)|t(e)));p("&",(r,t)=>(r=n(r),t=n(t),e=>r(e)&t(e)));p("^",(r,t)=>(r=n(r),t=n(t),e=>r(e)^t(e)));p(">>",(r,t)=>(r=n(r),t=n(t),e=>r(e)>>t(e)));p("<<",(r,t)=>(r=n(r),t=n(t),e=>r(e)<<t(e)));p(">",(r,t)=>(r=n(r),t=n(t),e=>r(e)>t(e)));p("<",(r,t)=>(r=n(r),t=n(t),e=>r(e)<t(e)));p(">=",(r,t)=>(r=n(r),t=n(t),e=>r(e)>=t(e)));p("<=",(r,t)=>(r=n(r),t=n(t),e=>r(e)<=t(e)));p("==",(r,t)=>(r=n(r),t=n(t),e=>r(e)==t(e)));p("!=",(r,t)=>(r=n(r),t=n(t),e=>r(e)!=t(e)));p("+",(r,t)=>t!==void 0?(r=n(r),t=n(t),e=>r(e)+t(e)):(r=n(r),e=>+r(e)));p("-",(r,t)=>t!==void 0?(r=n(r),t=n(t),e=>r(e)-t(e)):(r=n(r),e=>-r(e)));p("*",(r,t)=>(r=n(r),t=n(t),e=>r(e)*t(e)));p("/",(r,t)=>(r=n(r),t=n(t),e=>r(e)/t(e)));p("%",(r,t)=>(r=n(r),t=n(t),e=>r(e)%t(e)));var or=(r,t,e,o)=>typeof r=="string"?i=>t(i,r):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o)):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i))):r[0]==="()"&&r.length===2?or(r[1],t):(()=>{throw Error("Invalid increment target")})();p("++",(r,t)=>or(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));p("--",(r,t)=>or(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var Ur=(...r)=>(r=r.map(n),t=>{let e;for(let o of r)e=o(t);return e});p(",",Ur);p(";",Ur);var O=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",Q=r=>{throw Error(r)};p("[]",(r,t)=>t===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(e=>e==null?(()=>{}):e[0]==="..."?(e=n(e[1]),o=>e(o)):(e=n(e),o=>[e(o)])),e=>r.flatMap(o=>o(e))):(t==null&&Q("Missing index"),r=n(r),t=n(t),e=>{let o=t(e);return O(o)?void 0:r(e)[o]}));p(".",(r,t)=>(r=n(r),t=t[0]?t:t[1],O(t)?()=>{}:e=>r(e)[t]));p("()",(r,t)=>{if(t===void 0)return r==null?Q("Empty ()"):n(r);let e=i=>i?.[0]===","&&i.slice(1).some(s=>s==null||e(s));e(t)&&Q("Empty argument");let o=t?t[0]===","?(t=t.slice(1).map(n),i=>t.map(s=>s(i))):(t=n(t),i=>[t(i)]):()=>[];return nr(r,(i,s,m)=>i[s](...o(m)))});var v=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&v(r[1])||r[0]==="{}"),nr=(r,t,e,o)=>r==null?Q("Empty ()"):r[0]==="()"&&r.length==2?nr(r[1],t):typeof r=="string"?i=>t(i,r,i):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o,i)):r[0]==="?."?(e=n(r[1]),o=r[2],i=>{let s=e(i);return s==null?void 0:t(s,o,i)}):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i),i)):r[0]==="?.[]"?(e=n(r[1]),o=n(r[2]),i=>{let s=e(i);return s==null?void 0:t(s,o(i),i)}):(r=n(r),i=>t([r(i)],0,i)),R=nr;p("===",(r,t)=>(r=n(r),t=n(t),e=>r(e)===t(e)));p("!==",(r,t)=>(r=n(r),t=n(t),e=>r(e)!==t(e)));p("??",(r,t)=>(r=n(r),t=n(t),e=>r(e)??t(e)));var vt=r=>{throw Error(r)};p("**",(r,t)=>(r=n(r),t=n(t),e=>r(e)**t(e)));p("**=",(r,t)=>(v(r)||vt("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]**=t(i))));p("in",(r,t)=>(r=n(r),t=n(t),e=>r(e)in t(e)));var Lt=r=>{throw Error(r)};p(">>>",(r,t)=>(r=n(r),t=n(t),e=>r(e)>>>t(e)));p(">>>=",(r,t)=>(v(r)||Lt("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]>>>=t(i))));var Ot=r=>r[0]?.[0]===","?r[0].slice(1):r,B=(r,t,e)=>{if(typeof r=="string"){e[r]=t;return}let[o,...i]=r,s=Ot(i);if(o==="{}"){let m=[];for(let f of s){if(Array.isArray(f)&&f[0]==="..."){let E={};for(let T in t)m.includes(T)||(E[T]=t[T]);e[f[1]]=E;break}let A,h,S;typeof f=="string"?A=h=f:f[0]==="="?(typeof f[1]=="string"?A=h=f[1]:[,A,h]=f[1],S=f[2]):[,A,h]=f,m.push(A);let g=t[A];g===void 0&&S&&(g=n(S)(e)),B(h,g,e)}}else if(o==="[]"){let m=0;for(let f of s){if(f===null){m++;continue}if(Array.isArray(f)&&f[0]==="..."){e[f[1]]=t.slice(m);break}let A=f,h;Array.isArray(f)&&f[0]==="="&&([,A,h]=f);let S=t[m++];S===void 0&&h&&(S=n(h)(e)),B(A,S,e)}}},ir=(...r)=>(r=r.map(t=>{if(typeof t=="string")return e=>{e[t]=void 0};if(t[0]==="="){let[,e,o]=t,i=n(o);return typeof e=="string"?s=>{s[e]=i(s)}:s=>B(e,i(s),s)}return n(t)}),t=>{for(let e of r)e(t)});p("let",ir);p("const",ir);p("var",ir);var H=r=>{throw Error(r)};p("=",(r,t)=>{if(Array.isArray(r)&&(r[0]==="let"||r[0]==="const"||r[0]==="var")){let e=r[1];return t=n(t),typeof e=="string"?o=>{o[e]=t(o)}:o=>B(e,t(o),o)}return v(r)||H("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]=t(i))});p("||=",(r,t)=>(v(r)||H("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]||=t(i))));p("&&=",(r,t)=>(v(r)||H("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]&&=t(i))));p("??=",(r,t)=>(v(r)||H("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]??=t(i))));p("?",(r,t,e)=>(r=n(r),t=n(t),e=n(e),o=>r(o)?t(o):e(o)));var Rt=[];p("=>",(r,t)=>{r=r?.[0]==="()"?r[1]:r;let e=r?r[0]===","?r.slice(1):[r]:[],o=-1,i=null,s=e[e.length-1];Array.isArray(s)&&s[0]==="..."&&(o=e.length-1,i=s[1],e.length--);let m=t?.[0]==="{}";return t=n(m?["{",t[1]]:t),f=>(...A)=>{let h={};e.forEach((g,E)=>h[g]=A[E]),i&&(h[i]=A.slice(o));let S=new Proxy(h,{get:(g,E)=>E in g?g[E]:f?.[E],set:(g,E,T)=>((E in g?g:f)[E]=T,!0),has:(g,E)=>E in g||(f?E in f:!1)});try{let g=t(S);return m?void 0:g}catch(g){if(g===Rt)return g[0];throw g}}});p("...",r=>(r=n(r),t=>Object.entries(r(t))));p("?.",(r,t)=>(r=n(r),O(t)?()=>{}:e=>r(e)?.[t]));p("?.[]",(r,t)=>(r=n(r),t=n(t),e=>{let o=t(e);return O(o)?void 0:r(e)?.[o]}));p("?.()",(r,t)=>{let e=t?t[0]===","?(t=t.slice(1).map(n),i=>t.map(s=>s(i))):(t=n(t),i=>[t(i)]):()=>[];if(r[0]==="?."){let i=n(r[1]),s=r[2];return O(s)?()=>{}:m=>i(m)?.[s]?.(...e(m))}if(r[0]==="?.[]"){let i=n(r[1]),s=n(r[2]);return m=>{let f=i(m),A=s(m);return O(A)?void 0:f?.[A]?.(...e(m))}}if(r[0]==="."){let i=n(r[1]),s=r[2];return O(s)?()=>{}:m=>i(m)?.[s]?.(...e(m))}if(r[0]==="[]"&&r.length===3){let i=n(r[1]),s=n(r[2]);return m=>{let f=i(m),A=s(m);return O(A)?void 0:f?.[A]?.(...e(m))}}let o=n(r);return i=>o(i)?.(...e(i))});p("typeof",r=>(r=n(r),t=>typeof r(t)));p("void",r=>(r=n(r),t=>(r(t),void 0)));p("delete",r=>{if(r[0]==="."){let t=n(r[1]),e=r[2];return o=>delete t(o)[e]}if(r[0]==="[]"){let t=n(r[1]),e=n(r[2]);return o=>delete t(o)[e(o)]}return()=>!0});p("new",r=>{let t=n(r?.[0]==="()"?r[1]:r),e=r?.[0]==="()"?r[2]:null,o=e?e[0]===","?(i=>s=>i.map(m=>m(s)))(e.slice(1).map(n)):(i=>s=>[i(s)])(n(e)):()=>[];return i=>new(t(i))(...o(i))});var j=Symbol("accessor");p("get",(r,t)=>(t=t?n(t):()=>{},e=>[[j,r,{get:function(){let o=Object.create(e||{});return o.this=this,t(o)}}]]));p("set",(r,t,e)=>(e=e?n(e):()=>{},o=>[[j,r,{set:function(i){let s=Object.create(o||{});s.this=this,s[t]=i,e(s)}}]]));var Pt=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);p("{}",(r,t)=>{if(t!==void 0)return;if(!Pt(r))return n(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let e=r.map(o=>n(typeof o=="string"?[":",o,o]:o));return o=>{let i={},s={};for(let m of e.flatMap(f=>f(o)))if(m[0]===j){let[,f,A]=m;s[f]={...s[f],...A,configurable:!0,enumerable:!0}}else i[m[0]]=m[1];for(let m in s)Object.defineProperty(i,m,s[m]);return i}});p("{",r=>(r=r?n(r):()=>{},t=>r(Object.create(t))));p(":",(r,t)=>(t=n(t),Array.isArray(r)?(r=n(r),e=>[[r(e),t(e)]]):e=>[[r,t(e)]]));p("`",(...r)=>(r=r.map(n),t=>r.map(e=>e(t)).join("")));p("``",(r,...t)=>{r=n(r);let e=[],o=[];for(let s of t)Array.isArray(s)&&s[0]===void 0?e.push(s[1]):o.push(n(s));let i=Object.assign([...e],{raw:e});return s=>r(s)(i,...o.map(m=>m(s)))});var _r=new WeakMap,Tt=(r,...t)=>typeof r=="string"?n(d(r)):_r.get(r)||_r.set(r,Ut(r,t)).get(r),Br=57344,Ut=(r,t)=>{let e=r.reduce((s,m,f)=>s+(f?String.fromCharCode(Br+f-1):"")+m,""),o=d(e),i=s=>{if(typeof s=="string"&&s.length===1){let m=s.charCodeAt(0)-Br,f;if(m>=0&&m<t.length)return f=t[m],_t(f)?f:[,f]}return Array.isArray(s)?s.map(i):s};return n(i(o))},_t=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Bt=Tt;export{V as access,c as binary,n as compile,l as cur,Bt as default,N as err,C as expr,U as group,at as id,u as idx,M as keyword,P as literal,sr as loc,w as lookup,mr as member,J as nary,L as next,p as operator,W as operators,Mt as parens,d as parse,z as peek,K as prec,Y as propName,a as seek,y as skip,I as token,k as unary,pr as word};
|
|
1
|
+
var f,u,d=r=>(f=0,u=r,d.enter?.(),r=y(),u[f]?N():r||""),N=(r="Unexpected token",t=f,e=u.slice(0,t).split(`
|
|
2
|
+
`),o=e.pop(),i=u.slice(Math.max(0,t-40),t),p="\u032D",l=(u[t]||" ")+p,m=u.slice(t+1,t+20))=>{throw SyntaxError(`${r} at ${e.length+1}:${o.length+1}
|
|
3
|
+
${i}${l}${m}`)},ir=(r,t=f)=>(Array.isArray(r)&&(r.loc=t),r),L=(r,t=f,e)=>{for(;e=r(u.charCodeAt(f));)f+=e;return u.slice(t,f)},C=(r=1)=>u[f+=r],M=r=>f=r,y=(r=0,t)=>{let e,o,i;for(t&&d.enter?.(r,t);(e=d.space())&&e!==t&&(i=d.step(o,r,e,y));)o=i;return t&&(e==t?(f++,d.exit?.(r,t)):N("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),o},K=(r=f)=>{for(;u.charCodeAt(r)<=32;)r++;return u.charCodeAt(r)},Bt=d.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,sr=(r,t=r.length)=>u.substr(f,t)===r&&!d.id(u.charCodeAt(f+t)),Mt=()=>(C(),y(0,41)),w=[],H={},I=(r,t=32,e,o=r.charCodeAt(0),i=r.length,p=w[o],l=r.toUpperCase()!==r,m,A)=>(t=H[r]=!p&&H[r]||t,w[o]=(h,S,g,E=f)=>(m=g,(g?r==g:(i<2||r.charCodeAt(1)===u.charCodeAt(f+1)&&(i<3||u.substr(f,i)==r))&&(!l||!d.id(u.charCodeAt(f+i)))&&(m=g=r))&&S<t&&(f+=i,(A=e(h))?ir(A,E):(f=E,m=0,!l&&!p&&!h&&N()),A)||p?.(h,S,m))),c=(r,t,e=!1)=>I(r,t,o=>o&&(i=>i&&[r,o,i])(y(t-(e?.5:0)))),k=(r,t,e)=>I(r,t,o=>e?o&&[r,o]:!o&&(o=y(t-.5))&&[r,o]),T=(r,t)=>I(r,200,e=>!e&&[,t]),W=(r,t,e,o)=>I(r,t,(i,p,l=i)=>(p=y(t-(e?.5:0)),i?.[0]!==r&&(i=[r,i||null]),p?.[0]===r?i.push(...p.slice(1)):p?i.push(p):o||K()===r.charCodeAt(0)?i.push(null):l&&i.length===2&&(i=i[1]),i)),a=(r,t)=>I(r[0],t,e=>!e&&[r,y(0,r.charCodeAt(1))||null]),z=(r,t)=>I(r[0],t,e=>e&&[r,e,y(0,r.charCodeAt(1))||null]),J=(r,t)=>(d.space(),t=u.charCodeAt(f),d.id(t)&&(t<48||t>57)?L(d.id):y(r)),pr=(r,t)=>I(r,t,e=>e&&(o=>o&&[r,e,o])(J(t))),D=(r,t,e,o=r.charCodeAt(0),i=r.length,p=w[o],l)=>(H[r]??=t,w[o]=(m,A,h,S=f)=>!m&&(h?r==h:(i<2||u.substr(f,i)==r)&&(h=r))&&A<t&&!d.id(u.charCodeAt(f+i))&&(!d.prop||d.prop(f+i))&&(M(f+i),(l=e())?ir(l,S):M(S),l)||p?.(m,A,h));d.space=r=>{for(;(r=u.charCodeAt(f))<=32;)f++;return r};d.step=(r,t,e,o,i)=>(i=w[e])&&i(r,t)||(r?null:L(d.id)||null);var j={},s=(r,t,e=j[r])=>j[r]=(...o)=>t(...o)||e?.(...o),n=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):j[r[0]]?.(...r.slice(1))??N(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:t=>t?.[r];var V=46,R=48,U=57,mr=69,fr=101,Dr=43,Fr=45,lr=95,ur=110,Gr=97,Xr=102,$r=65,Qr=70,cr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),Y=r=>{let t=cr(L(e=>e===V&&(e=u.charCodeAt(f+1))!==V&&!(d.id(e)&&e>U&&e!==fr&&e!==mr)||e>=R&&e<=U||e===lr||((e===mr||e===fr)&&((e=u.charCodeAt(f+1))>=R&&e<=U||e===Dr||e===Fr)?2:0)));return u.charCodeAt(f)===ur?(C(),[,BigInt(t)]):(r=+t)!=r?N():[,r]},Hr=r=>t=>t===lr||t>=R&&t<=U&&t-R<r||r===16&&(t>=Gr&&t<=Xr||t>=$r&&t<=Qr);d.number=null;w[V]=r=>!r&&u.charCodeAt(f+1)>=R&&u.charCodeAt(f+1)<=U&&Y();for(let r=R;r<=U;r++)w[r]=t=>t?void 0:Y();w[R]=r=>{if(r)return;let t=d.number;if(t){for(let[e,o]of Object.entries(t))if(e[0]==="0"&&u[f+1]?.toLowerCase()===e[1]){C(2);let i=cr(L(Hr(o)));return u.charCodeAt(f)===ur?(C(),[,BigInt("0"+e[1]+i)]):[,parseInt(i,o)]}}return Y()};var jr=92,dr=34,Ar=39,hr=117,gr=120,Kr=123,Wr=125,yr=10,zr=13,Jr={n:`
|
|
4
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},Cr=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,Sr=r=>(t,e,o="",i=String.fromCharCode(r))=>{if(t||!d.string?.[i])return;C();let p=()=>{let l=u.charCodeAt(f+1);if(l===yr)return 2;if(l===zr)return u.charCodeAt(f+2)===yr?3:2;if(l===gr||l===hr&&u.charCodeAt(f+2)!==Kr){let m=l===gr?2:4,A=0,h;for(let S=0;S<m;S++){if((h=Cr(u.charCodeAt(f+2+S)))<0)return o+=u[f+1],2;A=A*16+h}return o+=String.fromCharCode(A),2+m}if(l===hr){let m=0,A=f+3,h;for(;(h=Cr(u.charCodeAt(A)))>=0;)m=m*16+h,A++;return A>f+3&&m<=1114111&&u.charCodeAt(A)===Wr?(o+=String.fromCodePoint(m),A-f+1):(o+=u[f+1],2)}return o+=Jr[u[f+1]]||u[f+1],2};return L(l=>l-r&&(l!==jr?(o+=u[f],1):p())),u[f]===i?C():N("Bad string"),[,o]};w[dr]=Sr(dr);w[Ar]=Sr(Ar);d.string={'"':!0};var Vr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>c(r,Vr,!0));var Yr=30,Zr=40,qr=140;k("!",qr);c("||",Yr);c("&&",Zr);var xr=50,br=60,rt=70,Er=100,tt=140;c("|",xr);c("&",rt);c("^",br);c(">>",Er);c("<<",Er);k("~",tt);var F=90;c("<",F);c(">",F);c("<=",F);c(">=",F);var wr=80;c("==",wr);c("!=",wr);var Ir=110,Z=120,kr=140;c("+",Ir);c("-",Ir);c("*",Z);c("/",Z);c("%",Z);k("+",kr);k("-",kr);var G=150;I("++",G,r=>r?["++",r,null]:["++",y(G-1)]);I("--",G,r=>r?["--",r,null]:["--",y(G-1)]);var et=5,ot=10;W(",",ot);W(";",et,!0,!0);var nt=170;a("()",nt);var Nr=170,it=160;z("[]",Nr);pr(".",Nr);z("()",it);var st=32,pt=d.space;d.comment??={"//":`
|
|
5
|
+
`,"/*":"*/"};var q;d.space=()=>{q||(q=Object.entries(d.comment).map(([i,p])=>[i,p,i.charCodeAt(0)]));for(var r;r=pt();){for(var t=0,e;e=q[t++];)if(r===e[2]&&u.substr(f,e[0].length)===e[0]){var o=f+e[0].length;if(e[1]===`
|
|
6
|
+
`)for(;u.charCodeAt(o)>=st;)o++;else{for(;u[o]&&u.substr(o,e[1].length)!==e[1];)o++;u[o]&&(o+=e[1].length)}M(o),r=0;break}if(r)return r}return r};var vr=80;c("===",vr);c("!==",vr);var mt=30;c("??",mt);var ft=130,lt=20;c("**",ft,!0);c("**=",lt,!0);var Lr=90;c("in",Lr);c("of",Lr);var ut=20,ct=100;c(">>>",ct);c(">>>=",ut,!0);var x=20;c("||=",x,!0);c("&&=",x,!0);c("??=",x,!0);T("true",!0);T("false",!1);T("null",null);D("undefined",200,()=>[]);T("NaN",NaN);T("Infinity",1/0);var b=20;I("?",b,(r,t,e)=>r&&(t=y(b-1))&&L(o=>o===58)&&(e=y(b-1),["?",r,t,e]));var dt=20;c("=>",dt,!0);var At=20;k("...",At);var Or=170;I("?.",Or,(r,t)=>{if(!r)return;let e=d.space();return e===40?(C(),["?.()",r,y(0,41)||null]):e===91?(C(),["?.[]",r,y(0,93)]):(t=J(Or),t?["?.",r,t]:void 0)});var rr=140,Rr=160,ht=Rr+1;k("typeof",rr);k("void",rr);k("delete",rr);var gt=r=>d.space()===40?(C(),["()",r,y(0,41)||null]):r;D("new",ht,()=>sr(".target")?(C(7),["new.target"]):["new",gt(y(Rr))]);var yt=20,Pr=200;d.prop=r=>K(r)!==58;a("[]",Pr);a("{}",Pr);c(":",yt-1,!0);var Ct=170,tr=96,St=36,Et=123,wt=92,It={n:`
|
|
7
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Tr=()=>{let r=[],t="",e;for(;(e=u.charCodeAt(f))!==tr;)e?e===wt?(C(),t+=It[u[f]]||u[f],C()):e===St&&u.charCodeAt(f+1)===Et?(r.push([,t]),t="",C(2),r.push(y(0,125))):(t+=u[f],C()):N("Unterminated template");return r.push([,t]),C(),r},kt=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],Nt=w[tr];w[tr]=(r,t)=>r&&t<Ct?d.asi&&d.newline?void 0:(C(),["``",r,...Tr()]):r?Nt?.(r,t):(C(),kt(Tr()));d.string["'"]=!0;d.number={"0x":16,"0b":2,"0o":8};var _r=(r,t,e,o)=>typeof r=="string"?i=>t(i,r,i):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o,i)):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i),i)):r[0]==="()"&&r.length===2?_r(r[1],t):(()=>{throw Error("Invalid assignment target")})(),Ur={"=":(r,t,e)=>r[t]=e,"+=":(r,t,e)=>r[t]+=e,"-=":(r,t,e)=>r[t]-=e,"*=":(r,t,e)=>r[t]*=e,"/=":(r,t,e)=>r[t]/=e,"%=":(r,t,e)=>r[t]%=e,"|=":(r,t,e)=>r[t]|=e,"&=":(r,t,e)=>r[t]&=e,"^=":(r,t,e)=>r[t]^=e,">>=":(r,t,e)=>r[t]>>=e,"<<=":(r,t,e)=>r[t]<<=e};for(let r in Ur)s(r,(t,e)=>(e=n(e),_r(t,(o,i,p)=>Ur[r](o,i,e(p)))));s("!",r=>(r=n(r),t=>!r(t)));s("||",(r,t)=>(r=n(r),t=n(t),e=>r(e)||t(e)));s("&&",(r,t)=>(r=n(r),t=n(t),e=>r(e)&&t(e)));s("~",r=>(r=n(r),t=>~r(t)));s("|",(r,t)=>(r=n(r),t=n(t),e=>r(e)|t(e)));s("&",(r,t)=>(r=n(r),t=n(t),e=>r(e)&t(e)));s("^",(r,t)=>(r=n(r),t=n(t),e=>r(e)^t(e)));s(">>",(r,t)=>(r=n(r),t=n(t),e=>r(e)>>t(e)));s("<<",(r,t)=>(r=n(r),t=n(t),e=>r(e)<<t(e)));s(">",(r,t)=>(r=n(r),t=n(t),e=>r(e)>t(e)));s("<",(r,t)=>(r=n(r),t=n(t),e=>r(e)<t(e)));s(">=",(r,t)=>(r=n(r),t=n(t),e=>r(e)>=t(e)));s("<=",(r,t)=>(r=n(r),t=n(t),e=>r(e)<=t(e)));s("==",(r,t)=>(r=n(r),t=n(t),e=>r(e)==t(e)));s("!=",(r,t)=>(r=n(r),t=n(t),e=>r(e)!=t(e)));s("+",(r,t)=>t!==void 0?(r=n(r),t=n(t),e=>r(e)+t(e)):(r=n(r),e=>+r(e)));s("-",(r,t)=>t!==void 0?(r=n(r),t=n(t),e=>r(e)-t(e)):(r=n(r),e=>-r(e)));s("*",(r,t)=>(r=n(r),t=n(t),e=>r(e)*t(e)));s("/",(r,t)=>(r=n(r),t=n(t),e=>r(e)/t(e)));s("%",(r,t)=>(r=n(r),t=n(t),e=>r(e)%t(e)));var er=(r,t,e,o)=>typeof r=="string"?i=>t(i,r):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o)):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i))):r[0]==="()"&&r.length===2?er(r[1],t):(()=>{throw Error("Invalid increment target")})();s("++",(r,t)=>er(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));s("--",(r,t)=>er(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var ar=(...r)=>(r=r.map(n),t=>{let e;for(let o of r)e=o(t);return e});s(",",ar);s(";",ar);var P=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",X=r=>{throw Error(r)};s("[]",(r,t)=>t===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(e=>e==null?(()=>{}):e[0]==="..."?(e=n(e[1]),o=>e(o)):(e=n(e),o=>[e(o)])),e=>r.flatMap(o=>o(e))):(t==null&&X("Missing index"),r=n(r),t=n(t),e=>{let o=t(e);return P(o)?void 0:r(e)[o]}));s(".",(r,t)=>(r=n(r),t=t[0]?t:t[1],P(t)?()=>{}:e=>r(e)[t]));s("()",(r,t)=>{if(t===void 0)return r==null?X("Empty ()"):n(r);let e=i=>i?.[0]===","&&i.slice(1).some(p=>p==null||e(p));e(t)&&X("Empty argument");let o=t?t[0]===","?(t=t.slice(1).map(n),i=>t.map(p=>p(i))):(t=n(t),i=>[t(i)]):()=>[];return or(r,(i,p,l)=>i[p](...o(l)))});var v=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&v(r[1])||r[0]==="{}"),or=(r,t,e,o)=>r==null?X("Empty ()"):r[0]==="()"&&r.length==2?or(r[1],t):typeof r=="string"?i=>t(i,r,i):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o,i)):r[0]==="?."?(e=n(r[1]),o=r[2],i=>{let p=e(i);return p==null?void 0:t(p,o,i)}):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i),i)):r[0]==="?.[]"?(e=n(r[1]),o=n(r[2]),i=>{let p=e(i);return p==null?void 0:t(p,o(i),i)}):(r=n(r),i=>t([r(i)],0,i)),O=or;s("===",(r,t)=>(r=n(r),t=n(t),e=>r(e)===t(e)));s("!==",(r,t)=>(r=n(r),t=n(t),e=>r(e)!==t(e)));s("??",(r,t)=>(r=n(r),t=n(t),e=>r(e)??t(e)));var vt=r=>{throw Error(r)};s("**",(r,t)=>(r=n(r),t=n(t),e=>r(e)**t(e)));s("**=",(r,t)=>(v(r)||vt("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]**=t(i))));s("in",(r,t)=>(r=n(r),t=n(t),e=>r(e)in t(e)));var Lt=r=>{throw Error(r)};s(">>>",(r,t)=>(r=n(r),t=n(t),e=>r(e)>>>t(e)));s(">>>=",(r,t)=>(v(r)||Lt("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]>>>=t(i))));var Ot=r=>r[0]?.[0]===","?r[0].slice(1):r,B=(r,t,e)=>{if(typeof r=="string"){e[r]=t;return}let[o,...i]=r,p=Ot(i);if(o==="{}"){let l=[];for(let m of p){if(Array.isArray(m)&&m[0]==="..."){let E={};for(let _ in t)l.includes(_)||(E[_]=t[_]);e[m[1]]=E;break}let A,h,S;typeof m=="string"?A=h=m:m[0]==="="?(typeof m[1]=="string"?A=h=m[1]:[,A,h]=m[1],S=m[2]):[,A,h]=m,l.push(A);let g=t[A];g===void 0&&S&&(g=n(S)(e)),B(h,g,e)}}else if(o==="[]"){let l=0;for(let m of p){if(m===null){l++;continue}if(Array.isArray(m)&&m[0]==="..."){e[m[1]]=t.slice(l);break}let A=m,h;Array.isArray(m)&&m[0]==="="&&([,A,h]=m);let S=t[l++];S===void 0&&h&&(S=n(h)(e)),B(A,S,e)}}},nr=(...r)=>(r=r.map(t=>{if(typeof t=="string")return e=>{e[t]=void 0};if(t[0]==="="){let[,e,o]=t,i=n(o);return typeof e=="string"?p=>{p[e]=i(p)}:p=>B(e,i(p),p)}return n(t)}),t=>{for(let e of r)e(t)});s("let",nr);s("const",nr);s("var",nr);var $=r=>{throw Error(r)};s("=",(r,t)=>{if(Array.isArray(r)&&(r[0]==="let"||r[0]==="const"||r[0]==="var")){let e=r[1];return t=n(t),typeof e=="string"?o=>{o[e]=t(o)}:o=>B(e,t(o),o)}return v(r)||$("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]=t(i))});s("||=",(r,t)=>(v(r)||$("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]||=t(i))));s("&&=",(r,t)=>(v(r)||$("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]&&=t(i))));s("??=",(r,t)=>(v(r)||$("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]??=t(i))));s("?",(r,t,e)=>(r=n(r),t=n(t),e=n(e),o=>r(o)?t(o):e(o)));var Rt=[];s("=>",(r,t)=>{r=r?.[0]==="()"?r[1]:r;let e=r?r[0]===","?r.slice(1):[r]:[],o=-1,i=null,p=e[e.length-1];Array.isArray(p)&&p[0]==="..."&&(o=e.length-1,i=p[1],e.length--);let l=t?.[0]==="{}";return t=n(l?["{",t[1]]:t),m=>(...A)=>{let h={};e.forEach((g,E)=>h[g]=A[E]),i&&(h[i]=A.slice(o));let S=new Proxy(h,{get:(g,E)=>E in g?g[E]:m?.[E],set:(g,E,_)=>((E in g?g:m)[E]=_,!0),has:(g,E)=>E in g||(m?E in m:!1)});try{let g=t(S);return l?void 0:g}catch(g){if(g===Rt)return g[0];throw g}}});s("...",r=>(r=n(r),t=>Object.entries(r(t))));s("?.",(r,t)=>(r=n(r),P(t)?()=>{}:e=>r(e)?.[t]));s("?.[]",(r,t)=>(r=n(r),t=n(t),e=>{let o=t(e);return P(o)?void 0:r(e)?.[o]}));s("?.()",(r,t)=>{let e=t?t[0]===","?(t=t.slice(1).map(n),i=>t.map(p=>p(i))):(t=n(t),i=>[t(i)]):()=>[];if(r[0]==="."||r[0]==="?."){let i=n(r[1]),p=r[2];return P(p)?()=>{}:l=>i(l)?.[p]?.(...e(l))}if((r[0]==="[]"||r[0]==="?.[]")&&r.length===3){let i=n(r[1]),p=n(r[2]);return l=>{let m=p(l);return P(m)?void 0:i(l)?.[m]?.(...e(l))}}let o=n(r);return i=>o(i)?.(...e(i))});s("typeof",r=>(r=n(r),t=>typeof r(t)));s("void",r=>(r=n(r),t=>(r(t),void 0)));s("delete",r=>{if(r[0]==="."){let t=n(r[1]),e=r[2];return o=>delete t(o)[e]}if(r[0]==="[]"){let t=n(r[1]),e=n(r[2]);return o=>delete t(o)[e(o)]}return()=>!0});s("new",r=>{let t=n(r?.[0]==="()"?r[1]:r),e=r?.[0]==="()"?r[2]:null,o=e?e[0]===","?(i=>p=>i.map(l=>l(p)))(e.slice(1).map(n)):(i=>p=>[i(p)])(n(e)):()=>[];return i=>new(t(i))(...o(i))});var Q=Symbol("accessor");s("get",(r,t)=>(t=t?n(t):()=>{},e=>[[Q,r,{get:function(){let o=Object.create(e||{});return o.this=this,t(o)}}]]));s("set",(r,t,e)=>(e=e?n(e):()=>{},o=>[[Q,r,{set:function(i){let p=Object.create(o||{});p.this=this,p[t]=i,e(p)}}]]));var Pt=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);s("{}",(r,t)=>{if(t!==void 0)return;if(!Pt(r))return n(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let e=r.map(o=>n(typeof o=="string"?[":",o,o]:o));return o=>{let i={},p={};for(let l of e.flatMap(m=>m(o)))if(l[0]===Q){let[,m,A]=l;p[m]={...p[m],...A,configurable:!0,enumerable:!0}}else i[l[0]]=l[1];for(let l in p)Object.defineProperty(i,l,p[l]);return i}});s("{",r=>(r=r?n(r):()=>{},t=>r(Object.create(t))));s(":",(r,t)=>(t=n(t),Array.isArray(r)?(r=n(r),e=>[[r(e),t(e)]]):e=>[[r,t(e)]]));s("`",(...r)=>(r=r.map(n),t=>r.map(e=>e(t)).join("")));s("``",(r,...t)=>{r=n(r);let e=[],o=[];for(let p of t)Array.isArray(p)&&p[0]===void 0?e.push(p[1]):o.push(n(p));let i=Object.assign([...e],{raw:e});return p=>r(p)(i,...o.map(l=>l(p)))});var Br=new WeakMap,Tt=(r,...t)=>typeof r=="string"?n(d(r)):Br.get(r)||Br.set(r,Ut(r,t)).get(r),Mr=57344,Ut=(r,t)=>{let e=r.reduce((p,l,m)=>p+(m?String.fromCharCode(Mr+m-1):"")+l,""),o=d(e),i=p=>{if(typeof p=="string"&&p.length===1){let l=p.charCodeAt(0)-Mr,m;if(l>=0&&l<t.length)return m=t[l],_t(m)?m:[,m]}return Array.isArray(p)?p.map(i):p};return n(i(o))},_t=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),at=Tt;export{z as access,c as binary,n as compile,u as cur,at as default,N as err,y as expr,a as group,Bt as id,f as idx,D as keyword,T as literal,ir as loc,w as lookup,pr as member,W as nary,L as next,s as operator,j as operators,Mt as parens,d as parse,K as peek,H as prec,J as propName,M as seek,C as skip,I as token,k as unary,sr as word};
|
package/package.json
CHANGED
package/parse.js
CHANGED
|
@@ -25,7 +25,7 @@ export let idx, cur,
|
|
|
25
25
|
chr = (cur[at] || ' ') + ptr,
|
|
26
26
|
after = cur.slice(at + 1, at + 20)
|
|
27
27
|
) => {
|
|
28
|
-
throw SyntaxError(`${msg} at ${lines.length + 1}:${last.length + 1}\n${
|
|
28
|
+
throw SyntaxError(`${msg} at ${lines.length + 1}:${last.length + 1}\n${before}${chr}${after}`)
|
|
29
29
|
},
|
|
30
30
|
|
|
31
31
|
// attach location to node (returns node for chaining)
|
package/subscript.min.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var s,p,f=r=>(s=0,p=r,f.enter?.(),r=g(),p[s]?S():r||""),S=(r="Unexpected token",t=s,e=p.slice(0,t).split(`
|
|
2
2
|
`),n=e.pop(),o=p.slice(Math.max(0,t-40),t),m="\u032D",u=(p[t]||" ")+m,d=p.slice(t+1,t+20))=>{throw SyntaxError(`${r} at ${e.length+1}:${n.length+1}
|
|
3
|
-
${p[t-41]
|
|
4
|
-
`,""
|
|
5
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},j=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,a=r=>(t,e,n="",o=String.fromCharCode(r))=>{if(t||!f.string?.[o])return;w();let m=()=>{let u=p.charCodeAt(s+1);if(u===x)return 2;if(u===Ur)return p.charCodeAt(s+2)===x?3:2;if(u===q||u===Z&&p.charCodeAt(s+2)!==Ir){let d=u===q?2:4,A=0,C;for(let E=0;E<d;E++){if((C=j(p.charCodeAt(s+2+E)))<0)return n+=p[s+1],2;A=A*16+C}return n+=String.fromCharCode(A),2+d}if(u===Z){let d=0,A=s+3,C;for(;(C=j(p.charCodeAt(A)))>=0;)d=d*16+C,A++;return A>s+3&&d<=1114111&&p.charCodeAt(A)===Rr?(n+=String.fromCodePoint(d),A-s+1):(n+=p[s+1],2)}return n+=Lr[p[s+1]]||p[s+1],2};return _(u=>u-r&&(u!==_r?(n+=p[s],1):m())),p[s]===o?w():S("Bad string"),[,n]};c[V]=a(V);c[Y]=a(Y);f.string={'"':!0};var Pr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>h(r,Pr,!0));var Tr=30,kr=40,Dr=140;I("!",Dr);h("||",Tr);h("&&",kr);var Mr=50,Nr=60,Fr=70,b=100,$r=140;h("|",Mr);h("&",Fr);h("^",Nr);h(">>",b);h("<<",b);I("~",$r);var k=90;h("<",k);h(">",k);h("<=",k);h(">=",k);var rr=80;h("==",rr);h("!=",rr);var tr=110,O=120,er=140;h("+",tr);h("-",tr);h("*",O);h("/",O);h("%",O);I("+",er);I("-",er);var D=150;y("++",D,r=>r?["++",r,null]:["++",g(D-1)]);y("--",D,r=>r?["--",r,null]:["--",g(D-1)]);var Br=5,Xr=10;$(",",Xr);$(";",Br,!0,!0);var Or=170;W("()",Or);var or=170,Qr=160;B("[]",or);z(".",or);B("()",Qr);var ir=(r,t,e,n)=>typeof r=="string"?o=>t(o,r,o):r[0]==="."?(e=i(r[1]),n=r[2],o=>t(e(o),n,o)):r[0]==="[]"&&r.length===3?(e=i(r[1]),n=i(r[2]),o=>t(e(o),n(o),o)):r[0]==="()"&&r.length===2?ir(r[1],t):(()=>{throw Error("Invalid assignment target")})(),nr={"=":(r,t,e)=>r[t]=e,"+=":(r,t,e)=>r[t]+=e,"-=":(r,t,e)=>r[t]-=e,"*=":(r,t,e)=>r[t]*=e,"/=":(r,t,e)=>r[t]/=e,"%=":(r,t,e)=>r[t]%=e,"|=":(r,t,e)=>r[t]|=e,"&=":(r,t,e)=>r[t]&=e,"^=":(r,t,e)=>r[t]^=e,">>=":(r,t,e)=>r[t]>>=e,"<<=":(r,t,e)=>r[t]<<=e};for(let r in nr)l(r,(t,e)=>(e=i(e),ir(t,(n,o,m)=>nr[r](n,o,e(m)))));l("!",r=>(r=i(r),t=>!r(t)));l("||",(r,t)=>(r=i(r),t=i(t),e=>r(e)||t(e)));l("&&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&&t(e)));l("~",r=>(r=i(r),t=>~r(t)));l("|",(r,t)=>(r=i(r),t=i(t),e=>r(e)|t(e)));l("&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&t(e)));l("^",(r,t)=>(r=i(r),t=i(t),e=>r(e)^t(e)));l(">>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>t(e)));l("<<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<<t(e)));l(">",(r,t)=>(r=i(r),t=i(t),e=>r(e)>t(e)));l("<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<t(e)));l(">=",(r,t)=>(r=i(r),t=i(t),e=>r(e)>=t(e)));l("<=",(r,t)=>(r=i(r),t=i(t),e=>r(e)<=t(e)));l("==",(r,t)=>(r=i(r),t=i(t),e=>r(e)==t(e)));l("!=",(r,t)=>(r=i(r),t=i(t),e=>r(e)!=t(e)));l("+",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)+t(e)):(r=i(r),e=>+r(e)));l("-",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)-t(e)):(r=i(r),e=>-r(e)));l("*",(r,t)=>(r=i(r),t=i(t),e=>r(e)*t(e)));l("/",(r,t)=>(r=i(r),t=i(t),e=>r(e)/t(e)));l("%",(r,t)=>(r=i(r),t=i(t),e=>r(e)%t(e)));var Q=(r,t,e,n)=>typeof r=="string"?o=>t(o,r):r[0]==="."?(e=i(r[1]),n=r[2],o=>t(e(o),n)):r[0]==="[]"&&r.length===3?(e=i(r[1]),n=i(r[2]),o=>t(e(o),n(o))):r[0]==="()"&&r.length===2?Q(r[1],t):(()=>{throw Error("Invalid increment target")})();l("++",(r,t)=>Q(r,t===null?(e,n)=>e[n]++:(e,n)=>++e[n]));l("--",(r,t)=>Q(r,t===null?(e,n)=>e[n]--:(e,n)=>--e[n]));var sr=(...r)=>(r=r.map(i),t=>{let e;for(let n of r)e=n(t);return e});l(",",sr);l(";",sr);var pr=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",M=r=>{throw Error(r)};l("[]",(r,t)=>t===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(e=>e==null?(()=>{}):e[0]==="..."?(e=i(e[1]),n=>e(n)):(e=i(e),n=>[e(n)])),e=>r.flatMap(n=>n(e))):(t==null&&M("Missing index"),r=i(r),t=i(t),e=>{let n=t(e);return pr(n)?void 0:r(e)[n]}));l(".",(r,t)=>(r=i(r),t=t[0]?t:t[1],pr(t)?()=>{}:e=>r(e)[t]));l("()",(r,t)=>{if(t===void 0)return r==null?M("Empty ()"):i(r);let e=o=>o?.[0]===","&&o.slice(1).some(m=>m==null||e(m));e(t)&&M("Empty argument");let n=t?t[0]===","?(t=t.slice(1).map(i),o=>t.map(m=>m(o))):(t=i(t),o=>[t(o)]):()=>[];return mr(r,(o,m,u)=>o[m](...n(u)))});var mr=(r,t,e,n)=>r==null?M("Empty ()"):r[0]==="()"&&r.length==2?mr(r[1],t):typeof r=="string"?o=>t(o,r,o):r[0]==="."?(e=i(r[1]),n=r[2],o=>t(e(o),n,o)):r[0]==="?."?(e=i(r[1]),n=r[2],o=>{let m=e(o);return m==null?void 0:t(m,n,o)}):r[0]==="[]"&&r.length===3?(e=i(r[1]),n=i(r[2]),o=>t(e(o),n(o),o)):r[0]==="?.[]"?(e=i(r[1]),n=i(r[2]),o=>{let m=e(o);return m==null?void 0:t(m,n(o),o)}):(r=i(r),o=>t([r(o)],0,o));var lr=new WeakMap,Hr=(r,...t)=>typeof r=="string"?i(f(r)):lr.get(r)||lr.set(r,vr(r,t)).get(r),ur=57344,vr=(r,t)=>{let e=r.reduce((m,u,d)=>m+(d?String.fromCharCode(ur+d-1):"")+u,""),n=f(e),o=m=>{if(typeof m=="string"&&m.length===1){let u=m.charCodeAt(0)-ur,d;if(u>=0&&u<t.length)return d=t[u],Gr(d)?d:[,d]}return Array.isArray(m)?m.map(o):m};return i(o(n))},Gr=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),zt=Hr;export{B as access,h as binary,i as compile,p as cur,zt as default,S as err,g as expr,W as group,Wr as id,s as idx,Vr as keyword,Kr as literal,G as loc,c as lookup,z as member,$ as nary,_ as next,l as operator,F as operators,Jr as parens,f as parse,fr as peek,N as prec,dr as propName,v as seek,w as skip,y as token,I as unary,zr as word};
|
|
3
|
+
${o}${u}${d}`)},v=(r,t=s)=>(Array.isArray(r)&&(r.loc=t),r),_=(r,t=s,e)=>{for(;e=r(p.charCodeAt(s));)s+=e;return p.slice(t,s)},w=(r=1)=>p[s+=r],H=r=>s=r,g=(r=0,t)=>{let e,n,o;for(t&&f.enter?.(r,t);(e=f.space())&&e!==t&&(o=f.step(n,r,e,g));)n=o;return t&&(e==t?(s++,f.exit?.(r,t)):S("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),n},hr=(r=s)=>{for(;p.charCodeAt(r)<=32;)r++;return p.charCodeAt(r)},Wr=f.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,zr=(r,t=r.length)=>p.substr(s,t)===r&&!f.id(p.charCodeAt(s+t)),Jr=()=>(w(),g(0,41)),c=[],D={},y=(r,t=32,e,n=r.charCodeAt(0),o=r.length,m=c[n],u=r.toUpperCase()!==r,d,A)=>(t=D[r]=!m&&D[r]||t,c[n]=(C,E,L,Q=s)=>(d=L,(L?r==L:(o<2||r.charCodeAt(1)===p.charCodeAt(s+1)&&(o<3||p.substr(s,o)==r))&&(!u||!f.id(p.charCodeAt(s+o)))&&(d=L=r))&&E<t&&(s+=o,(A=e(C))?v(A,Q):(s=Q,d=0,!u&&!m&&!C&&S()),A)||m?.(C,E,d))),h=(r,t,e=!1)=>y(r,t,n=>n&&(o=>o&&[r,n,o])(g(t-(e?.5:0)))),I=(r,t,e)=>y(r,t,n=>e?n&&[r,n]:!n&&(n=g(t-.5))&&[r,n]),Kr=(r,t)=>y(r,200,e=>!e&&[,t]),N=(r,t,e,n)=>y(r,t,(o,m,u=o)=>(m=g(t-(e?.5:0)),o?.[0]!==r&&(o=[r,o||null]),m?.[0]===r?o.push(...m.slice(1)):m?o.push(m):n||hr()===r.charCodeAt(0)?o.push(null):u&&o.length===2&&(o=o[1]),o)),G=(r,t)=>y(r[0],t,e=>!e&&[r,g(0,r.charCodeAt(1))||null]),F=(r,t)=>y(r[0],t,e=>e&&[r,e,g(0,r.charCodeAt(1))||null]),Ar=(r,t)=>(f.space(),t=p.charCodeAt(s),f.id(t)&&(t<48||t>57)?_(f.id):g(r)),W=(r,t)=>y(r,t,e=>e&&(n=>n&&[r,e,n])(Ar(t))),Vr=(r,t,e,n=r.charCodeAt(0),o=r.length,m=c[n],u)=>(D[r]??=t,c[n]=(d,A,C,E=s)=>!d&&(C?r==C:(o<2||p.substr(s,o)==r)&&(C=r))&&A<t&&!f.id(p.charCodeAt(s+o))&&(!f.prop||f.prop(s+o))&&(H(s+o),(u=e())?v(u,E):H(E),u)||m?.(d,A,C));f.space=r=>{for(;(r=p.charCodeAt(s))<=32;)s++;return r};f.step=(r,t,e,n,o)=>(o=c[e])&&o(r,t)||(r?null:_(f.id)||null);var M={},l=(r,t,e=M[r])=>M[r]=(...n)=>t(...n)||e?.(...n),i=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):M[r[0]]?.(...r.slice(1))??S(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:t=>t?.[r];var $=46,R=48,U=57,z=69,J=101,Cr=43,cr=45,K=95,V=110,gr=97,yr=102,Er=65,Sr=70,Y=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),B=r=>{let t=Y(_(e=>e===$&&(e=p.charCodeAt(s+1))!==$&&!(f.id(e)&&e>U&&e!==J&&e!==z)||e>=R&&e<=U||e===K||((e===z||e===J)&&((e=p.charCodeAt(s+1))>=R&&e<=U||e===Cr||e===cr)?2:0)));return p.charCodeAt(s)===V?(w(),[,BigInt(t)]):(r=+t)!=r?S():[,r]},wr=r=>t=>t===K||t>=R&&t<=U&&t-R<r||r===16&&(t>=gr&&t<=yr||t>=Er&&t<=Sr);f.number=null;c[$]=r=>!r&&p.charCodeAt(s+1)>=R&&p.charCodeAt(s+1)<=U&&B();for(let r=R;r<=U;r++)c[r]=t=>t?void 0:B();c[R]=r=>{if(r)return;let t=f.number;if(t){for(let[e,n]of Object.entries(t))if(e[0]==="0"&&p[s+1]?.toLowerCase()===e[1]){w(2);let o=Y(_(wr(n)));return p.charCodeAt(s)===V?(w(),[,BigInt("0"+e[1]+o)]):[,parseInt(o,n)]}}return B()};var _r=92,Z=34,q=39,x=117,j=120,Ir=123,Rr=125,a=10,Ur=13,Lr={n:`
|
|
4
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},b=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,rr=r=>(t,e,n="",o=String.fromCharCode(r))=>{if(t||!f.string?.[o])return;w();let m=()=>{let u=p.charCodeAt(s+1);if(u===a)return 2;if(u===Ur)return p.charCodeAt(s+2)===a?3:2;if(u===j||u===x&&p.charCodeAt(s+2)!==Ir){let d=u===j?2:4,A=0,C;for(let E=0;E<d;E++){if((C=b(p.charCodeAt(s+2+E)))<0)return n+=p[s+1],2;A=A*16+C}return n+=String.fromCharCode(A),2+d}if(u===x){let d=0,A=s+3,C;for(;(C=b(p.charCodeAt(A)))>=0;)d=d*16+C,A++;return A>s+3&&d<=1114111&&p.charCodeAt(A)===Rr?(n+=String.fromCodePoint(d),A-s+1):(n+=p[s+1],2)}return n+=Lr[p[s+1]]||p[s+1],2};return _(u=>u-r&&(u!==_r?(n+=p[s],1):m())),p[s]===o?w():S("Bad string"),[,n]};c[Z]=rr(Z);c[q]=rr(q);f.string={'"':!0};var Pr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>h(r,Pr,!0));var Tr=30,kr=40,Dr=140;I("!",Dr);h("||",Tr);h("&&",kr);var Mr=50,Nr=60,Fr=70,tr=100,$r=140;h("|",Mr);h("&",Fr);h("^",Nr);h(">>",tr);h("<<",tr);I("~",$r);var P=90;h("<",P);h(">",P);h("<=",P);h(">=",P);var er=80;h("==",er);h("!=",er);var or=110,X=120,nr=140;h("+",or);h("-",or);h("*",X);h("/",X);h("%",X);I("+",nr);I("-",nr);var T=150;y("++",T,r=>r?["++",r,null]:["++",g(T-1)]);y("--",T,r=>r?["--",r,null]:["--",g(T-1)]);var Br=5,Xr=10;N(",",Xr);N(";",Br,!0,!0);var Or=170;G("()",Or);var ir=170,Qr=160;F("[]",ir);W(".",ir);F("()",Qr);var pr=(r,t,e,n)=>typeof r=="string"?o=>t(o,r,o):r[0]==="."?(e=i(r[1]),n=r[2],o=>t(e(o),n,o)):r[0]==="[]"&&r.length===3?(e=i(r[1]),n=i(r[2]),o=>t(e(o),n(o),o)):r[0]==="()"&&r.length===2?pr(r[1],t):(()=>{throw Error("Invalid assignment target")})(),sr={"=":(r,t,e)=>r[t]=e,"+=":(r,t,e)=>r[t]+=e,"-=":(r,t,e)=>r[t]-=e,"*=":(r,t,e)=>r[t]*=e,"/=":(r,t,e)=>r[t]/=e,"%=":(r,t,e)=>r[t]%=e,"|=":(r,t,e)=>r[t]|=e,"&=":(r,t,e)=>r[t]&=e,"^=":(r,t,e)=>r[t]^=e,">>=":(r,t,e)=>r[t]>>=e,"<<=":(r,t,e)=>r[t]<<=e};for(let r in sr)l(r,(t,e)=>(e=i(e),pr(t,(n,o,m)=>sr[r](n,o,e(m)))));l("!",r=>(r=i(r),t=>!r(t)));l("||",(r,t)=>(r=i(r),t=i(t),e=>r(e)||t(e)));l("&&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&&t(e)));l("~",r=>(r=i(r),t=>~r(t)));l("|",(r,t)=>(r=i(r),t=i(t),e=>r(e)|t(e)));l("&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&t(e)));l("^",(r,t)=>(r=i(r),t=i(t),e=>r(e)^t(e)));l(">>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>t(e)));l("<<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<<t(e)));l(">",(r,t)=>(r=i(r),t=i(t),e=>r(e)>t(e)));l("<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<t(e)));l(">=",(r,t)=>(r=i(r),t=i(t),e=>r(e)>=t(e)));l("<=",(r,t)=>(r=i(r),t=i(t),e=>r(e)<=t(e)));l("==",(r,t)=>(r=i(r),t=i(t),e=>r(e)==t(e)));l("!=",(r,t)=>(r=i(r),t=i(t),e=>r(e)!=t(e)));l("+",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)+t(e)):(r=i(r),e=>+r(e)));l("-",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)-t(e)):(r=i(r),e=>-r(e)));l("*",(r,t)=>(r=i(r),t=i(t),e=>r(e)*t(e)));l("/",(r,t)=>(r=i(r),t=i(t),e=>r(e)/t(e)));l("%",(r,t)=>(r=i(r),t=i(t),e=>r(e)%t(e)));var O=(r,t,e,n)=>typeof r=="string"?o=>t(o,r):r[0]==="."?(e=i(r[1]),n=r[2],o=>t(e(o),n)):r[0]==="[]"&&r.length===3?(e=i(r[1]),n=i(r[2]),o=>t(e(o),n(o))):r[0]==="()"&&r.length===2?O(r[1],t):(()=>{throw Error("Invalid increment target")})();l("++",(r,t)=>O(r,t===null?(e,n)=>e[n]++:(e,n)=>++e[n]));l("--",(r,t)=>O(r,t===null?(e,n)=>e[n]--:(e,n)=>--e[n]));var mr=(...r)=>(r=r.map(i),t=>{let e;for(let n of r)e=n(t);return e});l(",",mr);l(";",mr);var lr=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",k=r=>{throw Error(r)};l("[]",(r,t)=>t===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(e=>e==null?(()=>{}):e[0]==="..."?(e=i(e[1]),n=>e(n)):(e=i(e),n=>[e(n)])),e=>r.flatMap(n=>n(e))):(t==null&&k("Missing index"),r=i(r),t=i(t),e=>{let n=t(e);return lr(n)?void 0:r(e)[n]}));l(".",(r,t)=>(r=i(r),t=t[0]?t:t[1],lr(t)?()=>{}:e=>r(e)[t]));l("()",(r,t)=>{if(t===void 0)return r==null?k("Empty ()"):i(r);let e=o=>o?.[0]===","&&o.slice(1).some(m=>m==null||e(m));e(t)&&k("Empty argument");let n=t?t[0]===","?(t=t.slice(1).map(i),o=>t.map(m=>m(o))):(t=i(t),o=>[t(o)]):()=>[];return ur(r,(o,m,u)=>o[m](...n(u)))});var ur=(r,t,e,n)=>r==null?k("Empty ()"):r[0]==="()"&&r.length==2?ur(r[1],t):typeof r=="string"?o=>t(o,r,o):r[0]==="."?(e=i(r[1]),n=r[2],o=>t(e(o),n,o)):r[0]==="?."?(e=i(r[1]),n=r[2],o=>{let m=e(o);return m==null?void 0:t(m,n,o)}):r[0]==="[]"&&r.length===3?(e=i(r[1]),n=i(r[2]),o=>t(e(o),n(o),o)):r[0]==="?.[]"?(e=i(r[1]),n=i(r[2]),o=>{let m=e(o);return m==null?void 0:t(m,n(o),o)}):(r=i(r),o=>t([r(o)],0,o));var fr=new WeakMap,Hr=(r,...t)=>typeof r=="string"?i(f(r)):fr.get(r)||fr.set(r,vr(r,t)).get(r),dr=57344,vr=(r,t)=>{let e=r.reduce((m,u,d)=>m+(d?String.fromCharCode(dr+d-1):"")+u,""),n=f(e),o=m=>{if(typeof m=="string"&&m.length===1){let u=m.charCodeAt(0)-dr,d;if(u>=0&&u<t.length)return d=t[u],Gr(d)?d:[,d]}return Array.isArray(m)?m.map(o):m};return i(o(n))},Gr=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),zt=Hr;export{F as access,h as binary,i as compile,p as cur,zt as default,S as err,g as expr,G as group,Wr as id,s as idx,Vr as keyword,Kr as literal,v as loc,c as lookup,W as member,N as nary,_ as next,l as operator,M as operators,Jr as parens,f as parse,hr as peek,D as prec,Ar as propName,H as seek,w as skip,y as token,I as unary,zr as word};
|