subscript 10.4.17 → 10.5.1
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/README.md +18 -18
- package/feature/comment.js +10 -12
- package/feature/loop.js +22 -4
- package/feature/number.js +18 -20
- package/feature/var.js +2 -2
- package/jessie.min.js +7 -7
- package/justin.min.js +7 -7
- package/package.json +1 -1
- package/parse.js +38 -33
- package/subscript.min.js +4 -4
package/README.md
CHANGED
|
@@ -122,29 +122,29 @@ subscript('constructor.constructor("alert(1)")()')({})
|
|
|
122
122
|
|
|
123
123
|
## Performance
|
|
124
124
|
|
|
125
|
-
Parsing `a + b * c - d / e + f.g[0](h) + i.j`, 30k iterations:
|
|
125
|
+
Parsing `a + b * c - d / e + f.g[0](h) + i.j`, 30k iterations — each iteration parses an unseen source, so source-keyed compile caches (`new Function`, angular-expressions) don't help:
|
|
126
126
|
|
|
127
127
|
```
|
|
128
128
|
Parse:
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
cel-js
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
129
|
+
subscript 26ms
|
|
130
|
+
justin 35ms
|
|
131
|
+
cel-js 45ms
|
|
132
|
+
jsep 46ms
|
|
133
|
+
jessie 51ms ← JS subset (statements + functions)
|
|
134
|
+
expr-eval 74ms
|
|
135
|
+
oxc 86ms ← full JS parser (native Rust)
|
|
136
|
+
mathjs 156ms
|
|
137
|
+
new Function 166ms
|
|
138
|
+
jexl 304ms
|
|
139
|
+
angular-expr 48s
|
|
140
140
|
|
|
141
141
|
Eval:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
cel-js
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
angular-expr
|
|
142
|
+
new Function 0.2ms
|
|
143
|
+
subscript 1.7ms
|
|
144
|
+
cel-js 10ms
|
|
145
|
+
mathjs 10ms
|
|
146
|
+
expression-eval 24ms
|
|
147
|
+
angular-expr 44ms
|
|
148
148
|
```
|
|
149
149
|
|
|
150
150
|
Run via `node --import ./test/https-loader.js test/benchmark.js`.
|
package/feature/comment.js
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
/** Configurable comments via parse.comment = { start: end } */
|
|
2
2
|
import { parse, cur, idx, seek } from '../parse.js';
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const space = parse.space;
|
|
5
5
|
|
|
6
6
|
// Default C-style comments
|
|
7
7
|
parse.comment ??= { '//': '\n', '/*': '*/' };
|
|
8
8
|
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
// Reads parse.comment live — no derived cache to go stale when the config is
|
|
10
|
+
// extended after load (shebang.js) or reconfigured between parses.
|
|
12
11
|
parse.space = () => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
seek(i); cc = 0; break;
|
|
12
|
+
for (var cc, cm, s, e, i; (cc = space()); ) {
|
|
13
|
+
for (s in cm = parse.comment) {
|
|
14
|
+
if (cc === s.charCodeAt(0) && (s.length < 2 || cur.charCodeAt(idx + 1) === s.charCodeAt(1)) && (s.length < 3 || cur.substr(idx, s.length) === s)) {
|
|
15
|
+
e = cm[s], i = cur.indexOf(e, idx + s.length);
|
|
16
|
+
// line comments stop before their `\n` (ASI reads it); others consume the end mark
|
|
17
|
+
seek(i < 0 ? cur.length : e === '\n' ? i : i + e.length);
|
|
18
|
+
cc = 0; break;
|
|
21
19
|
}
|
|
22
20
|
}
|
|
23
21
|
if (cc) return cc;
|
package/feature/loop.js
CHANGED
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
// Loops: while, do-while, for, for await, break, continue, return - parse half
|
|
2
|
-
import { expr, skip, parse, word, keyword, parens,
|
|
2
|
+
import { expr, skip, parse, word, keyword, parens, idx, next, seek, prec } from '../parse.js';
|
|
3
3
|
import { body } from './if.js';
|
|
4
4
|
|
|
5
5
|
const STATEMENT = 5, CBRACE = 125, SEMI = 59;
|
|
6
6
|
|
|
7
7
|
keyword('while', STATEMENT + 1, () => (parse.space(), ['while', parens(), body()]));
|
|
8
|
-
keyword('do', STATEMENT + 1,
|
|
8
|
+
keyword('do', STATEMENT + 1, b => (b = body(), parse.space(), skip(5), parse.space(), ['do', b, parens()]));
|
|
9
|
+
|
|
10
|
+
// A for-in/of head is not a plain expression: the grammar makes everything right of
|
|
11
|
+
// the keyword the iteration source, while expression precedence binds relational
|
|
12
|
+
// `in`/`of` tighter than assignment/sequence/ternary/logical — `for (k in o = x)`
|
|
13
|
+
// would parse as `(k in o) = x`, stranding the wrappers around the whole head.
|
|
14
|
+
// Splice them back: descend the leftmost spine through looser-than-`in` ops to the
|
|
15
|
+
// in/of node and swap it for its own right operand.
|
|
16
|
+
const head = (h, spine = h, parent) => {
|
|
17
|
+
// decl: `for (let k in o)` / `for (let k in o = x)` land as [let [in k o]] /
|
|
18
|
+
// [let [= [in k o] x]] — re-associate the declarator, keep the declaration
|
|
19
|
+
// on the iteration variable.
|
|
20
|
+
if ((h?.[0] === 'let' || h?.[0] === 'const' || h?.[0] === 'var') && h.length === 2)
|
|
21
|
+
return (spine = head(h[1]))?.[0] === 'in' || spine?.[0] === 'of'
|
|
22
|
+
? [spine[0], [h[0], spine[1]], spine[2]] : h;
|
|
23
|
+
while (Array.isArray(spine) && prec[spine[0]] < prec.in) parent = spine, spine = spine[1];
|
|
24
|
+
return parent && Array.isArray(spine) && (spine[0] === 'in' || spine[0] === 'of')
|
|
25
|
+
? (parent[1] = spine[2], [spine[0], spine[1], h]) : h;
|
|
26
|
+
};
|
|
9
27
|
|
|
10
28
|
// for / for await
|
|
11
29
|
keyword('for', STATEMENT + 1, () => {
|
|
@@ -13,9 +31,9 @@ keyword('for', STATEMENT + 1, () => {
|
|
|
13
31
|
// for await (x of y)
|
|
14
32
|
if (word('await')) {
|
|
15
33
|
skip(5);
|
|
16
|
-
return (parse.space(), ['for await', parens(), body()]);
|
|
34
|
+
return (parse.space(), ['for await', head(parens()), body()]);
|
|
17
35
|
}
|
|
18
|
-
return ['for', parens(), body()];
|
|
36
|
+
return ['for', head(parens()), body()];
|
|
19
37
|
});
|
|
20
38
|
|
|
21
39
|
keyword('break', STATEMENT + 1, () => {
|
package/feature/number.js
CHANGED
|
@@ -11,17 +11,18 @@ const _a = 97, _f = 102, _A = 65, _F = 70;
|
|
|
11
11
|
// Strip underscores only if present (avoid allocation for common case)
|
|
12
12
|
const strip = s => s.indexOf('_') < 0 ? s : s.replaceAll('_', '');
|
|
13
13
|
|
|
14
|
-
// Decimal
|
|
15
|
-
//
|
|
14
|
+
// Decimal digit test - . is decimal only if NOT range (..) and NOT member
|
|
15
|
+
// access (.name); allows trailing decimal: 1. → 1, 0.95.toFixed → stops at
|
|
16
|
+
// second . Supports numeric separators (1_000_000) and exponent (1e-3).
|
|
17
|
+
const dec = c =>
|
|
18
|
+
(c === PERIOD && (c = cur.charCodeAt(idx + 1)) !== PERIOD && !(parse.id(c) && c > _9 && c !== _e && c !== _E)) ||
|
|
19
|
+
(c >= _0 && c <= _9) ||
|
|
20
|
+
c === UNDERSCORE ||
|
|
21
|
+
((c === _E || c === _e) && ((c = cur.charCodeAt(idx + 1)) >= _0 && c <= _9 || c === PLUS || c === MINUS) ? 2 : 0);
|
|
22
|
+
|
|
23
|
+
// Decimal number with BigInt suffix: 123n
|
|
16
24
|
const num = a => {
|
|
17
|
-
let str = strip(next(
|
|
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)) ||
|
|
21
|
-
(c >= _0 && c <= _9) ||
|
|
22
|
-
c === UNDERSCORE ||
|
|
23
|
-
((c === _E || c === _e) && ((c = cur.charCodeAt(idx + 1)) >= _0 && c <= _9 || c === PLUS || c === MINUS) ? 2 : 0)
|
|
24
|
-
));
|
|
25
|
+
let str = strip(next(dec));
|
|
25
26
|
// BigInt suffix
|
|
26
27
|
if (cur.charCodeAt(idx) === _n) { skip(); return [, BigInt(str)]; }
|
|
27
28
|
return (a = +str) != a ? err() : [, a];
|
|
@@ -41,17 +42,14 @@ lookup[PERIOD] = a => !a && cur.charCodeAt(idx + 1) >= _0 && cur.charCodeAt(idx
|
|
|
41
42
|
|
|
42
43
|
// 0-9: check parse.number for prefix config
|
|
43
44
|
for (let i = _0; i <= _9; i++) lookup[i] = a => a ? void 0 : num();
|
|
44
|
-
lookup[_0] = a => {
|
|
45
|
+
lookup[_0] = (a, base) => {
|
|
45
46
|
if (a) return;
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (cur.charCodeAt(idx) === _n) { skip(); return [, BigInt('0' + pre[1] + str)]; }
|
|
53
|
-
return [, parseInt(str, base)];
|
|
54
|
-
}
|
|
47
|
+
for (const pre in parse.number) {
|
|
48
|
+
if (pre[0] === '0' && (cur.charCodeAt(idx + 1) | 32) === pre.charCodeAt(1)) {
|
|
49
|
+
skip(2);
|
|
50
|
+
const str = strip(next(charTest(base = parse.number[pre])));
|
|
51
|
+
if (cur.charCodeAt(idx) === _n) { skip(); return [, BigInt('0' + pre[1] + str)]; }
|
|
52
|
+
return [, parseInt(str, base)];
|
|
55
53
|
}
|
|
56
54
|
}
|
|
57
55
|
return num();
|
package/feature/var.js
CHANGED
|
@@ -18,13 +18,13 @@ const STATEMENT = 5, SEQ = 10;
|
|
|
18
18
|
// list. If nothing parses, the keyword falls back to identifier
|
|
19
19
|
// (`{let}`, `(let)`, bare `let`, etc.). For `for (let in/of obj)`, expr reads
|
|
20
20
|
// `in`/`of` as a bare identifier — backtrack so the binary op picks `let` up.
|
|
21
|
+
// A for-in/of head keeps its in/of inside the declarator ([let [in x o]]);
|
|
22
|
+
// loop.js re-associates it to the documented shape.
|
|
21
23
|
const decl = kw => {
|
|
22
24
|
const from = idx;
|
|
23
25
|
const node = expr(SEQ - 1);
|
|
24
26
|
if (node == null) return kw;
|
|
25
27
|
if (kw === 'let' && (node === 'in' || node === 'of')) return seek(from), kw;
|
|
26
|
-
if (node[0] === 'in' || node[0] === 'of')
|
|
27
|
-
return [node[0], [kw, node[1]], node[2]];
|
|
28
28
|
if (node[0] === ',') return [kw, ...node.slice(1)];
|
|
29
29
|
return [kw, node];
|
|
30
30
|
};
|
package/jessie.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var l,c,s=r=>(l=0,c=r,s.enter?.(),r=
|
|
1
|
+
var l,c,s=r=>(l=0,c=r,s.enter?.(),r=d(),c[l]?I():r||""),I=(r="Unexpected token",e=l,t=c.slice(0,e).split(`
|
|
2
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}`)},
|
|
4
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},
|
|
5
|
-
`,"/*":"*/"};
|
|
6
|
-
|
|
7
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},
|
|
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};
|
|
3
|
+
${n}${m}${u}`)},Ie=(r,e=l)=>(Array.isArray(r)&&(r.loc=e),r),E=(r,e=l,t)=>{for(;t=r(c.charCodeAt(l));)l+=t;return c.slice(e,l)},h=(r=1)=>c[l+=r],_=r=>l=r,d=(r=0,e)=>{let t,o,n;for(e&&s.enter?.(r,e);(t=s.space())&&t!==e&&(n=s.step(o,r,t,d));)o=n;return e&&(t==e?(l++,s.exit?.(r,e)):I("Unclosed "+String.fromCharCode(e-(e>42?2:1)))),o},W=(r=l)=>{for(;c.charCodeAt(r)<=32;)r++;return c.charCodeAt(r)},go=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,S=(r,e=r.length)=>c.substr(l,e)===r&&!s.id(c.charCodeAt(l+e)),L=()=>(h(),d(0,41)),N=[],B={},g=(r,e=32,t,o=r.charCodeAt(0))=>Mr({op:r,l:r.length,p:B[r]=!N[o]&&B[r]||e,map:t,word:r.toUpperCase()!==r,kw:!1}),A=(r,e,t=!1)=>g(r,e,(o,n)=>o&&(n=d(e-(t?.5:0)))&&[r,o,n]),O=(r,e,t)=>g(r,e,o=>t?o&&[r,o]:!o&&(o=d(e-.5))&&[r,o]),$=(r,e)=>g(r,200,t=>!t&&[,e]),ir=(r,e,t,o)=>g(r,e,(n,p,m=n)=>(p=d(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)=>g(r[0],e,t=>!t&&[r,d(0,r.charCodeAt(1))||null]),sr=(r,e)=>g(r[0],e,t=>t&&[r,t,d(0,r.charCodeAt(1))||null]),pr=(r,e)=>(s.space(),e=c.charCodeAt(l),s.id(e)&&(e<48||e>57)?E(s.id):d(r)),vr=(r,e)=>g(r,e,(t,o)=>t&&(o=pr(e))&&[r,t,o]),w=(r,e,t)=>(B[r]??=e,Mr({op:r,l:r.length,p:e,map:t,word:!0,kw:!0})),Br=(r,e,t=(o,n,p,m=l,u,a,y)=>{for(y=0;a=r[y++];)if(!(a.kw&&o)&&!(p?a.op!==p:!((a.l<2||a.op.charCodeAt(1)===c.charCodeAt(l+1)&&(a.l<3||c.substr(l,a.l)===a.op))&&(!a.word||!s.id(c.charCodeAt(l+a.l)))&&(p=a.op)))&&!(n>=a.p)&&!(a.kw&&s.prop&&!s.prop(l+a.l))){if(l+=a.l,u=a.map(o))return Ie(u,m);l=m,p=0,a.word||o||e||r[y]||I()}return e?.(o,n,p)})=>(t.ops=r,t.tail=e,t),Mr=(r,e=r.op.charCodeAt(0),t=N[e])=>N[e]=t?.ops?Br([r,...t.ops],t.tail):Br([r],t);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:E(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))??I(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:e=>e?.[r];var fr=46,H=48,j=57,Ur=69,Kr=101,Re=43,Oe=45,Dr=95,Gr=110,_e=97,Le=102,Pe=65,Be=70,Fr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),ve=r=>r===fr&&(r=c.charCodeAt(l+1))!==fr&&!(s.id(r)&&r>j&&r!==Kr&&r!==Ur)||r>=H&&r<=j||r===Dr||((r===Ur||r===Kr)&&((r=c.charCodeAt(l+1))>=H&&r<=j||r===Re||r===Oe)?2:0),lr=r=>{let e=Fr(E(ve));return c.charCodeAt(l)===Gr?(h(),[,BigInt(e)]):(r=+e)!=r?I():[,r]},Me=r=>e=>e===Dr||e>=H&&e<=j&&e-H<r||r===16&&(e>=_e&&e<=Le||e>=Pe&&e<=Be);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,e)=>{if(!r){for(let t in s.number)if(t[0]==="0"&&(c.charCodeAt(l+1)|32)===t.charCodeAt(1)){h(2);let o=Fr(E(Me(e=s.number[t])));return c.charCodeAt(l)===Gr?(h(),[,BigInt("0"+t[1]+o)]):[,parseInt(o,e)]}return lr()}};var Ue=92,Hr=34,Xr=39,Qr=117,$r=120,Ke=123,De=125,jr=10,Ge=13,Fe={n:`
|
|
4
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},xr=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,Wr=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===jr)return 2;if(m===Ge)return c.charCodeAt(l+2)===jr?3:2;if(m===$r||m===Qr&&c.charCodeAt(l+2)!==Ke){let u=m===$r?2:4,a=0,y;for(let T=0;T<u;T++){if((y=xr(c.charCodeAt(l+2+T)))<0)return o+=c[l+1],2;a=a*16+y}return o+=String.fromCharCode(a),2+u}if(m===Qr){let u=0,a=l+3,y;for(;(y=xr(c.charCodeAt(a)))>=0;)u=u*16+y,a++;return a>l+3&&u<=1114111&&c.charCodeAt(a)===De?(o+=String.fromCodePoint(u),a-l+1):(o+=c[l+1],2)}return o+=Fe[c[l+1]]||c[l+1],2};return E(m=>m-r&&(m!==Ue?(o+=c[l],1):p())),c[l]===n?h():I("Bad string"),[,o]};N[Hr]=Wr(Hr);N[Xr]=Wr(Xr);s.string={'"':!0};var He=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>A(r,He,!0));var Xe=30,Qe=40,$e=140;O("!",$e);A("||",Xe);A("&&",Qe);var je=50,xe=60,We=70,zr=100,ze=140;A("|",je);A("&",We);A("^",xe);A(">>",zr);A("<<",zr);O("~",ze);var Y=90;A("<",Y);A(">",Y);A("<=",Y);A(">=",Y);var Jr=80;A("==",Jr);A("!=",Jr);var Vr=110,ur=120,Yr=140;A("+",Vr);A("-",Vr);A("*",ur);A("/",ur);A("%",ur);O("+",Yr);O("-",Yr);var Z=150;g("++",Z,r=>r?["++",r,null]:["++",d(Z-1)]);g("--",Z,r=>r?["--",r,null]:["--",d(Z-1)]);var Je=5,Ve=10;ir(",",Ve);ir(";",Je,!0,!0);var Ye=170;z("()",Ye);var Zr=170,Ze=160;sr("[]",Zr);vr(".",Zr);sr("()",Ze);var qe=s.space;s.comment??={"//":`
|
|
5
|
+
`,"/*":"*/"};s.space=()=>{for(var r,e,t,o,n;r=qe();){for(t in e=s.comment)if(r===t.charCodeAt(0)&&(t.length<2||c.charCodeAt(l+1)===t.charCodeAt(1))&&(t.length<3||c.substr(l,t.length)===t)){o=e[t],n=c.indexOf(o,l+t.length),_(n<0?c.length:o===`
|
|
6
|
+
`?n:n+o.length),r=0;break}if(r)return r}return r};var qr=80;A("===",qr);A("!==",qr);var be=30;A("??",be);var rt=130,et=20;A("**",rt,!0);A("**=",et,!0);var br=90;A("in",br);A("of",br);var tt=20,ot=100;A(">>>",ot);A(">>>=",tt,!0);var mr=20;A("||=",mr,!0);A("&&=",mr,!0);A("??=",mr,!0);$("true",!0);$("false",!1);$("null",null);w("undefined",200,()=>[]);$("NaN",NaN);$("Infinity",1/0);var cr=20;g("?",cr,(r,e,t)=>r&&(e=d(cr-1))&&E(o=>o===58)&&(t=d(cr-1),["?",r,e,t]));var nt=20;A("=>",nt,!0);var it=20;O("...",it);var re=170;g("?.",re,(r,e)=>{if(!r)return;let t=s.space();return t===40?(h(),["?.()",r,d(0,41)||null]):t===91?(h(),["?.[]",r,d(0,93)]):(e=pr(re),e?["?.",r,e]:void 0)});var ar=140,ee=160,st=ee+1;O("typeof",ar);O("void",ar);O("delete",ar);var pt=r=>s.space()===40?(h(),["()",r,d(0,41)||null]):r;w("new",st,()=>S(".target")?(h(7),["new.target"]):["new",pt(d(ee))]);var ft=20,te=200;s.prop=r=>W(r)!==58;z("[]",te);z("{}",te);A(":",ft-1,!0);var lt=170,dr=96,ut=36,mt=123,ct=92,at={n:`
|
|
7
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},oe=()=>{let r=[],e="",t;for(;(t=c.charCodeAt(l))!==dr;)t?t===ct?(h(),e+=at[c[l]]||c[l],h()):t===ut&&c.charCodeAt(l+1)===mt?(r.push([,e]),e="",h(2),r.push(d(0,125))):(e+=c[l],h()):I("Unterminated template");return r.push([,e]),h(),r},dt=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],ht=N[dr];N[dr]=(r,e)=>r&&e<lt?s.asi&&s.newline?void 0:(h(),["``",r,...oe()]):r?ht?.(r,e):(h(),dt(oe()));s.string["'"]=!0;s.number={"0x":16,"0b":2,"0o":8};var At=92,yt=117,wt=123,Ct=125,gt=183,Et=s.id,ne=r=>r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102,St=(r=l+2,e,t=0,o=0)=>{if(c.charCodeAt(l)!==At||c.charCodeAt(l+1)!==yt)return 0;if(c.charCodeAt(r)===wt){for(;ne(e=c.charCodeAt(++r));)t=t*16+(e<=57?e-48:(e&31)+9);return r>l+3&&t<=1114111&&c.charCodeAt(r)===Ct?r-l+1:0}for(;o<4&&ne(c.charCodeAt(r+o));)o++;return o===4?6:0};s.id=r=>Et(r)||r===gt||St();var hr=5,kt=10,Ar=r=>{let e=l,t=d(kt-1);return t==null?r:r==="let"&&(t==="in"||t==="of")?(_(e),r):t[0]===","?[r,...t.slice(1)]:[r,t]};w("let",hr+1,()=>Ar("let"));w("const",hr+1,()=>Ar("const"));w("var",hr+1,()=>Ar("var"));var q=5,Tt=59,v=()=>(s.space()===123||I("Expected {"),h(),d(q-.5,125)||null),K=()=>s.space()!==123?d(q+.5):(h(),d(q-.5,125)||null),Nt=()=>{let r=l;return s.space()===Tt&&h(),s.space(),S("else")?(h(4),s.semi=!1,!0):(_(r),!1)};w("if",q+1,()=>{s.space();let r=["if",L(),K()];return Nt()&&r.push(K()),r});var It=200;w("function",It,()=>{s.space();let r=!1;c[l]==="*"&&(r=!0,h(),s.space());let e=E(s.id);return e&&s.space(),r?["function*",e,L()||null,v()]:["function",e,L()||null,v()]});var b=140,yr=20,Rt=40;O("await",b);w("yield",b,()=>(s.space(),c[l]==="*"?(h(),s.space(),["yield*",d(yr)]):["yield",d(yr)]));w("async",b,()=>{if(s.space(),S("function"))return["async",d(b)];let r=l,e=E(s.id);if(e){if(s.space(),c.charCodeAt(l)===Rt)return["async",e];_(r)}let t=d(yr-.5);return t&&["async",t]});var ie=200;var Ot=90,_t=175,Lt=160,Pt=Lt-.5;O("static",_t);A("instanceof",Ot);g("#",ie,r=>{if(r)return;let e=E(s.id);return e?"#"+e:void 0});w("class",ie,()=>{s.space();let r=E(s.id)||null;if(r==="extends")r=null,s.space();else{if(s.space(),!S("extends"))return["class",r,null,v()];h(7),s.space()}return["class",r,d(Pt),v()]});var wr=47,Bt=92,vt=91,Mt=93;g("/",140,r=>{let e=c.charCodeAt(l);if(r||e===wr||e===42||e===43||e===63)return;let t=!1,o=E(p=>p===Bt?2:p===vt?(t=!0,1):p===Mt?(t=!1,1):p&&(t||p!==wr));c.charCodeAt(l)===wr||I("Unterminated regex"),h();let n=E(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;w("while",X+1,()=>(s.space(),["while",L(),K()]));w("do",X+1,r=>(r=K(),s.space(),h(5),s.space(),["do",r,L()]));var Cr=(r,e=r,t)=>{if((r?.[0]==="let"||r?.[0]==="const"||r?.[0]==="var")&&r.length===2)return(e=Cr(r[1]))?.[0]==="in"||e?.[0]==="of"?[e[0],[r[0],e[1]],e[2]]:r;for(;Array.isArray(e)&&B[e[0]]<B.in;)t=e,e=e[1];return t&&Array.isArray(e)&&(e[0]==="in"||e[0]==="of")?(t[1]=e[2],[e[0],e[1],r]):r};w("for",X+1,()=>(s.space(),S("await")?(h(5),s.space(),["for await",Cr(L()),K()]):["for",Cr(L()),K()]));w("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=E(s.id);if(!t)return["break"];let o=s.space();return!o||o===J||o===V||s.newline?["break",t]:(_(r),["break"])});w("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=E(s.id);if(!t)return["continue"];let o=s.space();return!o||o===J||o===V||s.newline?["continue",t]:(_(r),["continue"])});w("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 gr=5;w("try",gr+1,()=>{let r=["try",v()];return s.space(),S("catch")&&(h(5),s.space(),r.push(["catch",W()===40?L():null,v()])),s.space(),S("finally")&&(h(7),r.push(["finally",v()])),r});w("throw",gr+1,()=>{if(s.asi&&(s.newline=!1),s.space(),s.newline)throw SyntaxError("Unexpected newline after throw");return["throw",d(gr)]});var fe=5,Ut=20,se=58,Kt=59,le=125,Er=0,ue=(r,e=r.length,t=r.charCodeAt(0),o=N[t])=>N[t]=(n,p,m)=>S(r)&&!n&&Er&&(!s.prop||s.prop(l+e))||o?.(n,p,m);ue("case");ue("default");var pe=r=>{let e=[];for(;(r=s.space())!==le&&!S("case")&&!S("default");){if(r===Kt){h();continue}s.semi=!1,e.push(d(fe+.5))||I()}return e.length>1?[";",...e]:e[0]||null},Dt=()=>{s.space()===123||I("Expected {"),h(),Er++;let r=[];try{for(;s.space()!==le;)if(S("case")){_(l+4),s.space(),s.semi=!1;let e=d(Ut-.5);s.space()===se&&h(),r.push(["case",e,pe()])}else S("default")?(_(l+7),s.space()===se&&h(),r.push(["default",pe()])):I("Expected case or default")}finally{Er--}return h(),r};w("switch",fe+1,()=>s.space()===40&&["switch",L(),...Dt()]);var Sr=5,Gt=20;w("debugger",Sr+1,()=>["debugger"]);w("with",Sr+1,()=>(s.space(),["with",L(),K()]));var Ft=["if","for","while","do","switch","try"];g(":",Gt-1,r=>typeof r=="string"&&(s.space(),Ft.some(e=>S(e)))&&[":",r,d(Sr)]);var kr=5,x=10,me=42,Ht=N[me];N[me]=(r,e)=>r?Ht?.(r,e):(h(),"*");g("from",x+1,r=>r?r[0]!=="="&&r[0]!==","&&(s.space(),["from",r,d(x+1)]):!1);g("as",x+2,r=>r?(s.space(),["as",r,d(x+2)]):!1);w("import",kr,()=>S(".meta")?(h(5),["import.meta"]):["import",d(x)]);w("export",kr,()=>(s.space(),S("default")?(h(7),["export",["default",d(x)]]):["export",d(kr)]));var Tr=20,Xt=200,Qt=10,$t=13,jt=34,xt=35,Wt=39,zt=40,ce=41,Jt=91,ae=123,de=125,Vt=(r,e)=>{for(;r<e;){let t=c.charCodeAt(r++);if(t===Qt||t===$t)return!0}return!1},Yt=r=>r===jt||r===Wt||r===Jt||r===xt,Zt=()=>E(s.id)||(Yt(c.charCodeAt(l))?d(Xt-.5):null),qt=r=>typeof r=="string"||Array.isArray(r)&&(r[0]===void 0||r[0]==="[]"),he=r=>e=>{if(e)return;let t=l;if(s.space(),s.semi||Vt(t,l))return!1;let o=Zt();if(!o||(s.space(),c.charCodeAt(l)!==zt))return!1;h();let n=d(0,ce);return s.space(),c.charCodeAt(l)!==ae?!1:(h(),[r,o,n,d(0,de)])};g("get",Tr-1,he("get"));g("set",Tr-1,he("set"));g("(",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]),!qt(r))return;let o=d(0,ce)||null;if(s.space(),c.charCodeAt(l)!==ae)return;h();let n=["=>",["()",o],d(0,de)||null];t&&(n=["async",n]);let p=[":",r,n];return e?[e,p]:p});s.comment["#!"]=`
|
|
8
|
+
`;var Ce=32,Or=10,bt=59,ro=125,Ae=91,ye=40,rr=B.asi??B[";"],eo=s._baseSpace??=s.space,to=s._baseStep??=s.step,Nr=r=>Array.isArray(r)||typeof r=="string",oo=(B[";"]??5)+1,Rr=r=>Array.isArray(r)&&(B[r[0]]<=oo||r[0]==="{}"&&Rr(r[1])),no=(r,e)=>{for(;(e=c.charCodeAt(r))<=Ce;){if(e===Or)return!0;r++}return!1},io=(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=eo();e<l;)if(c.charCodeAt(e++)===Or){s.newline=!0;break}if(r===bt&&no(l+1)){_(l+1),s.newline=s.semi=!0;continue}return r}};s.enter=()=>s.newline=s.semi=!1;s.exit=(r,e)=>{e===ro&&(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===Ae||t===ye)&&io();if(s.semi||t===Ae&&(p||Rr(r))||t===ye&&(Rr(r)||p&&e>=rr))return we(r,e,o)??null}let n=s.newline;return to(r,e,t,o)??(Nr(r)&&n?we(r,e,o)??null:null)};var Ir=0,so=2e3,we=s.asi=(r,e,t,o,n)=>{if(e>=rr||Ir>=so)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 Ee=(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?Ee(r[1],e):(()=>{throw Error("Invalid assignment target")})(),ge={"=":(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 ge)f(r,(e,t)=>(t=i(t),Ee(e,(o,n,p)=>ge[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 Se=(...r)=>(r=r.map(i),e=>{let t;for(let o of r)t=o(e);return t});f(",",Se);f(";",Se);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 M=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&M(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)),D=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 po=r=>{throw Error(r)};f("**",(r,e)=>(r=i(r),e=i(e),t=>r(t)**e(t)));f("**=",(r,e)=>(M(r)||po("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 fo=r=>{throw Error(r)};f(">>>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>>e(t)));f(">>>=",(r,e)=>(M(r)||fo("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]>>>=e(n))));var lo=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=lo(n);if(o==="{}"){let m=[];for(let u of p){if(Array.isArray(u)&&u[0]==="..."){let C={};for(let R in e)m.includes(R)||(C[R]=e[R]);t[u[1]]=C;break}let a,y,T;typeof u=="string"?a=y=u:u[0]==="="?(typeof u[1]=="string"?a=y=u[1]:[,a,y]=u[1],T=u[2]):[,a,y]=u,m.push(a);let k=e[a];k===void 0&&T&&(k=i(T)(t)),G(y,k,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 a=u,y;Array.isArray(u)&&u[0]==="="&&([,a,y]=u);let T=e[m++];T===void 0&&y&&(T=i(y)(t)),G(a,T,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 M(r)||tr("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]=e(n))});f("||=",(r,e)=>(M(r)||tr("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]||=e(n))));f("&&=",(r,e)=>(M(r)||tr("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]&&=e(n))));f("??=",(r,e)=>(M(r)||tr("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),u=>(...a)=>{let y={};t.forEach((k,C)=>y[k]=a[C]),n&&(y[n]=a.slice(o));let T=new Proxy(y,{get:(k,C)=>C in k?k[C]:u?.[C],set:(k,C,R)=>((C in k?k:u)[C]=R,!0),has:(k,C)=>C in k||(u?C in u:!1)});try{let k=e(T);return m?void 0:k}catch(k){if(k===P)return k[0];throw k}}});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 uo=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);f("{}",(r,e)=>{if(e!==void 0)return;if(!uo(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,a]=m;p[u]={...p[u],...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--),u=>{let a=(...y)=>{let T={};o.forEach((C,R)=>T[C]=y[R]),n&&(T[n]=y.slice(p));let k=new Proxy(T,{get:(C,R)=>R in C?C[R]:u[R],set:(C,R,Ne)=>((R in C?C:u)[R]=Ne,!0),has:(C,R)=>R in C||R in u});try{return t(k)}catch(C){if(C===P)return C[0];throw C}};return r&&(u[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 mo=Symbol("static"),co=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 co("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),a=Array.isArray(u)&&typeof u[0]?.[0]=="string"?u:[];for(let[y,T]of a)y==="constructor"?p.prototype.__constructor__=T:p.prototype[y]=T}return r&&(o[r]=p),p}));f("static",r=>(r=i(r),e=>[[mo,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 U=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===U)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===U)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===U)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 ho(o,n,e);if(t==="of")return ao(o,n,e)}});var ao=(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(a){if(a===U)break;if(a===F)continue;if(a===P)return a[0];throw a}}return o||(n[r]=m),p}},ho=(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(a){if(a===U)break;if(a===F)continue;if(a===P)return a[0];throw a}}return o||(n[r]=m),p}};f("break",()=>()=>{throw U});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 a;try{a=r?.(u)}catch(y){if(y===U||y===F||y===P)throw y;if(n!=null&&p){let T=n in u,k=u[n];u[n]=y;try{a=p(u)}finally{T?u[n]=k:delete u[n]}}else if(!p)throw y}finally{m?.(u)}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[u,a]of e)if(n||u===null||u(t)===o)for(n=!0,m=0;m<a.length;m++)try{p=a[m](t)}catch(y){if(y===U)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 ke=new WeakMap,Ao=(r,...e)=>typeof r=="string"?i(s(r)):ke.get(r)||ke.set(r,yo(r,e)).get(r),Te=57344,yo=(r,e)=>{let t=r.reduce((p,m,u)=>p+(u?String.fromCharCode(Te+u-1):"")+m,""),o=s(t),n=p=>{if(typeof p=="string"&&p.length===1){let m=p.charCodeAt(0)-Te,u;if(m>=0&&m<e.length)return u=e[m],wo(u)?u:[,u]}return Array.isArray(p)?p.map(n):p};return i(n(o))},wo=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Co=Ao;export{sr as access,A as binary,i as compile,c as cur,Co as default,I as err,d as expr,z as group,go as id,l as idx,w as keyword,$ as literal,Ie as loc,N as lookup,vr as member,ir as nary,E as next,f as operator,nr as operators,L as parens,s as parse,W as peek,B as prec,pr as propName,_ as seek,h as skip,g as token,O as unary,S as word};
|
package/justin.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
`),o=e.pop(),i=u.slice(Math.max(0,t-40),t),
|
|
3
|
-
${i}${l}${
|
|
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;
|
|
5
|
-
`,"/*":"*/"};
|
|
6
|
-
|
|
7
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},
|
|
1
|
+
var m,u,d=r=>(m=0,u=r,d.enter?.(),r=g(),u[m]?N():r||""),N=(r="Unexpected token",t=m,e=u.slice(0,t).split(`
|
|
2
|
+
`),o=e.pop(),i=u.slice(Math.max(0,t-40),t),s="\u032D",l=(u[t]||" ")+s,f=u.slice(t+1,t+20))=>{throw SyntaxError(`${r} at ${e.length+1}:${o.length+1}
|
|
3
|
+
${i}${l}${f}`)},Dr=(r,t=m)=>(Array.isArray(r)&&(r.loc=t),r),L=(r,t=m,e)=>{for(;e=r(u.charCodeAt(m));)m+=e;return u.slice(t,m)},y=(r=1)=>u[m+=r],nr=r=>m=r,g=(r=0,t)=>{let e,o,i;for(t&&d.enter?.(r,t);(e=d.space())&&e!==t&&(i=d.step(o,r,e,g));)o=i;return t&&(e==t?(m++,d.exit?.(r,t)):N("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),o},K=(r=m)=>{for(;u.charCodeAt(r)<=32;)r++;return u.charCodeAt(r)},Mt=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,ir=(r,t=r.length)=>u.substr(m,t)===r&&!d.id(u.charCodeAt(m+t)),Dt=()=>(y(),g(0,41)),E=[],Q={},w=(r,t=32,e,o=r.charCodeAt(0))=>sr({op:r,l:r.length,p:Q[r]=!E[o]&&Q[r]||t,map:e,word:r.toUpperCase()!==r,kw:!1}),c=(r,t,e=!1)=>w(r,t,(o,i)=>o&&(i=g(t-(e?.5:0)))&&[r,o,i]),k=(r,t,e)=>w(r,t,o=>e?o&&[r,o]:!o&&(o=g(t-.5))&&[r,o]),a=(r,t)=>w(r,200,e=>!e&&[,t]),W=(r,t,e,o)=>w(r,t,(i,s,l=i)=>(s=g(t-(e?.5:0)),i?.[0]!==r&&(i=[r,i||null]),s?.[0]===r?i.push(...s.slice(1)):s?i.push(s):o||K()===r.charCodeAt(0)?i.push(null):l&&i.length===2&&(i=i[1]),i)),_=(r,t)=>w(r[0],t,e=>!e&&[r,g(0,r.charCodeAt(1))||null]),j=(r,t)=>w(r[0],t,e=>e&&[r,e,g(0,r.charCodeAt(1))||null]),z=(r,t)=>(d.space(),t=u.charCodeAt(m),d.id(t)&&(t<48||t>57)?L(d.id):g(r)),pr=(r,t)=>w(r,t,(e,o)=>e&&(o=z(t))&&[r,e,o]),M=(r,t,e)=>(Q[r]??=t,sr({op:r,l:r.length,p:t,map:e,word:!0,kw:!0})),or=(r,t,e=(o,i,s,l=m,f,h,A)=>{for(A=0;h=r[A++];)if(!(h.kw&&o)&&!(s?h.op!==s:!((h.l<2||h.op.charCodeAt(1)===u.charCodeAt(m+1)&&(h.l<3||u.substr(m,h.l)===h.op))&&(!h.word||!d.id(u.charCodeAt(m+h.l)))&&(s=h.op)))&&!(i>=h.p)&&!(h.kw&&d.prop&&!d.prop(m+h.l))){if(m+=h.l,f=h.map(o))return Dr(f,l);m=l,s=0,h.word||o||t||r[A]||N()}return t?.(o,i,s)})=>(e.ops=r,e.tail=t,e),sr=(r,t=r.op.charCodeAt(0),e=E[t])=>E[t]=e?.ops?or([r,...e.ops],e.tail):or([r],e);d.space=r=>{for(;(r=u.charCodeAt(m))<=32;)m++;return r};d.step=(r,t,e,o,i)=>(i=E[e])&&i(r,t)||(r?null:L(d.id)||null);var H={},p=(r,t,e=H[r])=>H[r]=(...o)=>t(...o)||e?.(...o),n=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):H[r[0]]?.(...r.slice(1))??N(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:t=>t?.[r];var J=46,R=48,T=57,mr=69,fr=101,Fr=43,Gr=45,lr=95,ur=110,Xr=97,$r=102,Qr=65,Hr=70,cr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),Kr=r=>r===J&&(r=u.charCodeAt(m+1))!==J&&!(d.id(r)&&r>T&&r!==fr&&r!==mr)||r>=R&&r<=T||r===lr||((r===mr||r===fr)&&((r=u.charCodeAt(m+1))>=R&&r<=T||r===Fr||r===Gr)?2:0),V=r=>{let t=cr(L(Kr));return u.charCodeAt(m)===ur?(y(),[,BigInt(t)]):(r=+t)!=r?N():[,r]},Wr=r=>t=>t===lr||t>=R&&t<=T&&t-R<r||r===16&&(t>=Xr&&t<=$r||t>=Qr&&t<=Hr);d.number=null;E[J]=r=>!r&&u.charCodeAt(m+1)>=R&&u.charCodeAt(m+1)<=T&&V();for(let r=R;r<=T;r++)E[r]=t=>t?void 0:V();E[R]=(r,t)=>{if(!r){for(let e in d.number)if(e[0]==="0"&&(u.charCodeAt(m+1)|32)===e.charCodeAt(1)){y(2);let o=cr(L(Wr(t=d.number[e])));return u.charCodeAt(m)===ur?(y(),[,BigInt("0"+e[1]+o)]):[,parseInt(o,t)]}return V()}};var jr=92,dr=34,hr=39,Ar=117,gr=120,zr=123,Jr=125,yr=10,Vr=13,Yr={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;y();let s=()=>{let l=u.charCodeAt(m+1);if(l===yr)return 2;if(l===Vr)return u.charCodeAt(m+2)===yr?3:2;if(l===gr||l===Ar&&u.charCodeAt(m+2)!==zr){let f=l===gr?2:4,h=0,A;for(let I=0;I<f;I++){if((A=Cr(u.charCodeAt(m+2+I)))<0)return o+=u[m+1],2;h=h*16+A}return o+=String.fromCharCode(h),2+f}if(l===Ar){let f=0,h=m+3,A;for(;(A=Cr(u.charCodeAt(h)))>=0;)f=f*16+A,h++;return h>m+3&&f<=1114111&&u.charCodeAt(h)===Jr?(o+=String.fromCodePoint(f),h-m+1):(o+=u[m+1],2)}return o+=Yr[u[m+1]]||u[m+1],2};return L(l=>l-r&&(l!==jr?(o+=u[m],1):s())),u[m]===i?y():N("Bad string"),[,o]};E[dr]=Sr(dr);E[hr]=Sr(hr);d.string={'"':!0};var Zr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>c(r,Zr,!0));var qr=30,xr=40,br=140;k("!",br);c("||",qr);c("&&",xr);var rt=50,tt=60,et=70,Er=100,ot=140;c("|",rt);c("&",et);c("^",tt);c(">>",Er);c("<<",Er);k("~",ot);var D=90;c("<",D);c(">",D);c("<=",D);c(">=",D);var wr=80;c("==",wr);c("!=",wr);var Ir=110,Y=120,kr=140;c("+",Ir);c("-",Ir);c("*",Y);c("/",Y);c("%",Y);k("+",kr);k("-",kr);var F=150;w("++",F,r=>r?["++",r,null]:["++",g(F-1)]);w("--",F,r=>r?["--",r,null]:["--",g(F-1)]);var nt=5,it=10;W(",",it);W(";",nt,!0,!0);var pt=170;_("()",pt);var Nr=170,st=160;j("[]",Nr);pr(".",Nr);j("()",st);var mt=d.space;d.comment??={"//":`
|
|
5
|
+
`,"/*":"*/"};d.space=()=>{for(var r,t,e,o,i;r=mt();){for(e in t=d.comment)if(r===e.charCodeAt(0)&&(e.length<2||u.charCodeAt(m+1)===e.charCodeAt(1))&&(e.length<3||u.substr(m,e.length)===e)){o=t[e],i=u.indexOf(o,m+e.length),nr(i<0?u.length:o===`
|
|
6
|
+
`?i:i+o.length),r=0;break}if(r)return r}return r};var vr=80;c("===",vr);c("!==",vr);var ft=30;c("??",ft);var lt=130,ut=20;c("**",lt,!0);c("**=",ut,!0);var Lr=90;c("in",Lr);c("of",Lr);var ct=20,dt=100;c(">>>",dt);c(">>>=",ct,!0);var Z=20;c("||=",Z,!0);c("&&=",Z,!0);c("??=",Z,!0);a("true",!0);a("false",!1);a("null",null);M("undefined",200,()=>[]);a("NaN",NaN);a("Infinity",1/0);var q=20;w("?",q,(r,t,e)=>r&&(t=g(q-1))&&L(o=>o===58)&&(e=g(q-1),["?",r,t,e]));var ht=20;c("=>",ht,!0);var At=20;k("...",At);var Or=170;w("?.",Or,(r,t)=>{if(!r)return;let e=d.space();return e===40?(y(),["?.()",r,g(0,41)||null]):e===91?(y(),["?.[]",r,g(0,93)]):(t=z(Or),t?["?.",r,t]:void 0)});var x=140,Rr=160,gt=Rr+1;k("typeof",x);k("void",x);k("delete",x);var yt=r=>d.space()===40?(y(),["()",r,g(0,41)||null]):r;M("new",gt,()=>ir(".target")?(y(7),["new.target"]):["new",yt(g(Rr))]);var Ct=20,Pr=200;d.prop=r=>K(r)!==58;_("[]",Pr);_("{}",Pr);c(":",Ct-1,!0);var St=170,b=96,Et=36,wt=123,It=92,kt={n:`
|
|
7
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},ar=()=>{let r=[],t="",e;for(;(e=u.charCodeAt(m))!==b;)e?e===It?(y(),t+=kt[u[m]]||u[m],y()):e===Et&&u.charCodeAt(m+1)===wt?(r.push([,t]),t="",y(2),r.push(g(0,125))):(t+=u[m],y()):N("Unterminated template");return r.push([,t]),y(),r},Nt=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],vt=E[b];E[b]=(r,t)=>r&&t<St?d.asi&&d.newline?void 0:(y(),["``",r,...ar()]):r?vt?.(r,t):(y(),Nt(ar()));d.string["'"]=!0;d.number={"0x":16,"0b":2,"0o":8};var Ur=(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?Ur(r[1],t):(()=>{throw Error("Invalid assignment target")})(),Tr={"=":(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 Tr)p(r,(t,e)=>(e=n(e),Ur(t,(o,i,s)=>Tr[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 rr=(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?rr(r[1],t):(()=>{throw Error("Invalid increment target")})();p("++",(r,t)=>rr(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));p("--",(r,t)=>rr(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var _r=(...r)=>(r=r.map(n),t=>{let e;for(let o of r)e=o(t);return e});p(",",_r);p(";",_r);var P=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",G=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&&G("Missing index"),r=n(r),t=n(t),e=>{let o=t(e);return P(o)?void 0:r(e)[o]}));p(".",(r,t)=>(r=n(r),t=t[0]?t:t[1],P(t)?()=>{}:e=>r(e)[t]));p("()",(r,t)=>{if(t===void 0)return r==null?G("Empty ()"):n(r);let e=i=>i?.[0]===","&&i.slice(1).some(s=>s==null||e(s));e(t)&&G("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 tr(r,(i,s,l)=>i[s](...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]==="{}"),tr=(r,t,e,o)=>r==null?G("Empty ()"):r[0]==="()"&&r.length==2?tr(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)),O=tr;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 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),O(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 Ot=r=>{throw Error(r)};p(">>>",(r,t)=>(r=n(r),t=n(t),e=>r(e)>>>t(e)));p(">>>=",(r,t)=>(v(r)||Ot("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]>>>=t(i))));var Rt=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=Rt(i);if(o==="{}"){let l=[];for(let f of s){if(Array.isArray(f)&&f[0]==="..."){let S={};for(let U in t)l.includes(U)||(S[U]=t[U]);e[f[1]]=S;break}let h,A,I;typeof f=="string"?h=A=f:f[0]==="="?(typeof f[1]=="string"?h=A=f[1]:[,h,A]=f[1],I=f[2]):[,h,A]=f,l.push(h);let C=t[h];C===void 0&&I&&(C=n(I)(e)),B(A,C,e)}}else if(o==="[]"){let l=0;for(let f of s){if(f===null){l++;continue}if(Array.isArray(f)&&f[0]==="..."){e[f[1]]=t.slice(l);break}let h=f,A;Array.isArray(f)&&f[0]==="="&&([,h,A]=f);let I=t[l++];I===void 0&&A&&(I=n(A)(e)),B(h,I,e)}}},er=(...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",er);p("const",er);p("var",er);var X=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)||X("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]=t(i))});p("||=",(r,t)=>(v(r)||X("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]||=t(i))));p("&&=",(r,t)=>(v(r)||X("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]&&=t(i))));p("??=",(r,t)=>(v(r)||X("Invalid assignment target"),t=n(t),O(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 Pt=[];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 l=t?.[0]==="{}";return t=n(l?["{",t[1]]:t),f=>(...h)=>{let A={};e.forEach((C,S)=>A[C]=h[S]),i&&(A[i]=h.slice(o));let I=new Proxy(A,{get:(C,S)=>S in C?C[S]:f?.[S],set:(C,S,U)=>((S in C?C:f)[S]=U,!0),has:(C,S)=>S in C||(f?S in f:!1)});try{let C=t(I);return l?void 0:C}catch(C){if(C===Pt)return C[0];throw C}}});p("...",r=>(r=n(r),t=>Object.entries(r(t))));p("?.",(r,t)=>(r=n(r),P(t)?()=>{}:e=>r(e)?.[t]));p("?.[]",(r,t)=>(r=n(r),t=n(t),e=>{let o=t(e);return P(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]==="."||r[0]==="?."){let i=n(r[1]),s=r[2];return P(s)?()=>{}:l=>i(l)?.[s]?.(...e(l))}if((r[0]==="[]"||r[0]==="?.[]")&&r.length===3){let i=n(r[1]),s=n(r[2]);return l=>{let f=s(l);return P(f)?void 0:i(l)?.[f]?.(...e(l))}}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(l=>l(s)))(e.slice(1).map(n)):(i=>s=>[i(s)])(n(e)):()=>[];return i=>new(t(i))(...o(i))});var $=Symbol("accessor");p("get",(r,t)=>(t=t?n(t):()=>{},e=>[[$,r,{get:function(){let o=Object.create(e||{});return o.this=this,t(o)}}]]));p("set",(r,t,e)=>(e=e?n(e):()=>{},o=>[[$,r,{set:function(i){let s=Object.create(o||{});s.this=this,s[t]=i,e(s)}}]]));var at=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);p("{}",(r,t)=>{if(t!==void 0)return;if(!at(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 l of e.flatMap(f=>f(o)))if(l[0]===$){let[,f,h]=l;s[f]={...s[f],...h,configurable:!0,enumerable:!0}}else i[l[0]]=l[1];for(let l in s)Object.defineProperty(i,l,s[l]);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(l=>l(s)))});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((s,l,f)=>s+(f?String.fromCharCode(Mr+f-1):"")+l,""),o=d(e),i=s=>{if(typeof s=="string"&&s.length===1){let l=s.charCodeAt(0)-Mr,f;if(l>=0&&l<t.length)return f=t[l],_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{j as access,c as binary,n as compile,u as cur,Bt as default,N as err,g as expr,_ as group,Mt as id,m as idx,M as keyword,a as literal,Dr as loc,E as lookup,pr as member,W as nary,L as next,p as operator,H as operators,Dt as parens,d as parse,K as peek,Q as prec,z as propName,nr as seek,y as skip,w as token,k as unary,ir as word};
|
package/package.json
CHANGED
package/parse.js
CHANGED
|
@@ -82,27 +82,12 @@ export let idx, cur,
|
|
|
82
82
|
prec = {},
|
|
83
83
|
|
|
84
84
|
// create operator checker/mapper - for symbols and special cases
|
|
85
|
-
token = (
|
|
86
|
-
op,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
prev = lookup[c],
|
|
92
|
-
word = op.toUpperCase() !== op,
|
|
93
|
-
matched, r
|
|
94
|
-
) => (p = prec[op] = !prev && prec[op] || p, lookup[c] = (a, curPrec, curOp, from = idx) =>
|
|
95
|
-
(matched = curOp,
|
|
96
|
-
(curOp ?
|
|
97
|
-
op == curOp :
|
|
98
|
-
(l < 2 || (op.charCodeAt(1) === cur.charCodeAt(idx + 1) && (l < 3 || cur.substr(idx, l) == op))) && (!word || !parse.id(cur.charCodeAt(idx + l))) && (matched = curOp = op)
|
|
99
|
-
) &&
|
|
100
|
-
curPrec < p &&
|
|
101
|
-
(idx += l, (r = map(a)) ? loc(r, from) : (idx = from, matched = 0, !word && !prev && !a && err()), r)
|
|
102
|
-
) ||
|
|
103
|
-
prev?.(a, curPrec, matched)),
|
|
104
|
-
|
|
105
|
-
binary = (op, p, right = false) => token(op, p, a => a && (b => b && [op, a, b])(expr(p - (right ? .5 : 0)))),
|
|
85
|
+
token = (op, p = SPACE, map, c = op.charCodeAt(0)) => register({
|
|
86
|
+
op, l: op.length, p: prec[op] = !lookup[c] && prec[op] || p, map,
|
|
87
|
+
word: op.toUpperCase() !== op, kw: false
|
|
88
|
+
}),
|
|
89
|
+
|
|
90
|
+
binary = (op, p, right = false) => token(op, p, (a, b) => a && (b = expr(p - (right ? .5 : 0))) && [op, a, b]),
|
|
106
91
|
|
|
107
92
|
unary = (op, p, post) => token(op, p, a => post ? (a && [op, a]) : (!a && (a = expr(p - .5)) && [op, a])),
|
|
108
93
|
|
|
@@ -141,23 +126,43 @@ export let idx, cur,
|
|
|
141
126
|
|
|
142
127
|
// member(op, p) - binary operator whose right side is a name, not an expression
|
|
143
128
|
// (a.b, a::b, a->b). Same [op, a, b] shape as binary().
|
|
144
|
-
member = (op, p) => token(op, p, a => a && (b
|
|
129
|
+
member = (op, p) => token(op, p, (a, b) => a && (b = propName(p)) && [op, a, b]),
|
|
145
130
|
|
|
146
131
|
// keyword(op, p, fn) - prefix word token with property name support.
|
|
147
132
|
// Records p in the prec registry (like token does) so dialects can
|
|
148
133
|
// introspect keyword precedence. parse.prop set by collection.js to
|
|
149
134
|
// prevent matching {keyword: value}.
|
|
150
|
-
keyword = (op, p, map
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
);
|
|
135
|
+
keyword = (op, p, map) => (prec[op] ??= p, register({
|
|
136
|
+
op, l: op.length, p, map, word: true, kw: true
|
|
137
|
+
}));
|
|
138
|
+
|
|
139
|
+
// One dispatcher per first char: tries registered op descriptors newest-first,
|
|
140
|
+
// then falls back to whatever handler the char had before token()/keyword()
|
|
141
|
+
// (number, string, custom lookup[c] assignments). curOp carries a committed
|
|
142
|
+
// text-match down the list: once an op's text matches, only same-name
|
|
143
|
+
// descriptors (overrides) may retry, until a failed map resets the commitment.
|
|
144
|
+
const dispatch = (ops, tail, fn = (a, curPrec, curOp, from = idx, r, d, i) => {
|
|
145
|
+
for (i = 0; (d = ops[i++]);) {
|
|
146
|
+
if (d.kw && a) continue;
|
|
147
|
+
if (curOp ? d.op !== curOp :
|
|
148
|
+
!((d.l < 2 || (d.op.charCodeAt(1) === cur.charCodeAt(idx + 1) && (d.l < 3 || cur.substr(idx, d.l) === d.op))) &&
|
|
149
|
+
(!d.word || !parse.id(cur.charCodeAt(idx + d.l))) &&
|
|
150
|
+
(curOp = d.op))) continue;
|
|
151
|
+
if (curPrec >= d.p) continue;
|
|
152
|
+
if (d.kw && parse.prop && !parse.prop(idx + d.l)) continue;
|
|
153
|
+
idx += d.l;
|
|
154
|
+
if (r = d.map(a)) return loc(r, from);
|
|
155
|
+
idx = from, curOp = 0;
|
|
156
|
+
d.word || a || tail || ops[i] || err();
|
|
157
|
+
}
|
|
158
|
+
return tail?.(a, curPrec, curOp);
|
|
159
|
+
}) => (fn.ops = ops, fn.tail = tail, fn);
|
|
160
|
+
|
|
161
|
+
// prepend op descriptor for its first char; pre-token handler stays as tail.
|
|
162
|
+
// Copy-on-write: each registration makes a fresh dispatcher, so a saved
|
|
163
|
+
// lookup[c] restored later (tests, embedders) still excludes it.
|
|
164
|
+
const register = (d, c = d.op.charCodeAt(0), fn = lookup[c]) =>
|
|
165
|
+
lookup[c] = fn?.ops ? dispatch([d, ...fn.ops], fn.tail) : dispatch([d], fn);
|
|
161
166
|
|
|
162
167
|
// Skip space chars, return first non-space character.
|
|
163
168
|
// Wrappers (comment, asi) compose by reading the previous parse.space first.
|
package/subscript.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var s,
|
|
2
|
-
`),
|
|
3
|
-
${
|
|
4
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},
|
|
1
|
+
var p,s,f=r=>(p=0,s=r,f.enter?.(),r=C(),s[p]?E():r||""),E=(r="Unexpected token",t=p,e=s.slice(0,t).split(`
|
|
2
|
+
`),o=e.pop(),n=s.slice(Math.max(0,t-40),t),l="\u032D",c=(s[t]||" ")+l,A=s.slice(t+1,t+20))=>{throw SyntaxError(`${r} at ${e.length+1}:${o.length+1}
|
|
3
|
+
${n}${c}${A}`)},fr=(r,t=p)=>(Array.isArray(r)&&(r.loc=t),r),w=(r,t=p,e)=>{for(;e=r(s.charCodeAt(p));)p+=e;return s.slice(t,p)},S=(r=1)=>s[p+=r],Wr=r=>p=r,C=(r=0,t)=>{let e,o,n;for(t&&f.enter?.(r,t);(e=f.space())&&e!==t&&(n=f.step(o,r,e,C));)o=n;return t&&(e==t?(p++,f.exit?.(r,t)):E("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),o},hr=(r=p)=>{for(;s.charCodeAt(r)<=32;)r++;return s.charCodeAt(r)},zr=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,Jr=(r,t=r.length)=>s.substr(p,t)===r&&!f.id(s.charCodeAt(p+t)),Kr=()=>(S(),C(0,41)),d=[],L={},g=(r,t=32,e,o=r.charCodeAt(0))=>H({op:r,l:r.length,p:L[r]=!d[o]&&L[r]||t,map:e,word:r.toUpperCase()!==r,kw:!1}),h=(r,t,e=!1)=>g(r,t,(o,n)=>o&&(n=C(t-(e?.5:0)))&&[r,o,n]),_=(r,t,e)=>g(r,t,o=>e?o&&[r,o]:!o&&(o=C(t-.5))&&[r,o]),Vr=(r,t)=>g(r,200,e=>!e&&[,t]),M=(r,t,e,o)=>g(r,t,(n,l,c=n)=>(l=C(t-(e?.5:0)),n?.[0]!==r&&(n=[r,n||null]),l?.[0]===r?n.push(...l.slice(1)):l?n.push(l):o||hr()===r.charCodeAt(0)?n.push(null):c&&n.length===2&&(n=n[1]),n)),Q=(r,t)=>g(r[0],t,e=>!e&&[r,C(0,r.charCodeAt(1))||null]),N=(r,t)=>g(r[0],t,e=>e&&[r,e,C(0,r.charCodeAt(1))||null]),cr=(r,t)=>(f.space(),t=s.charCodeAt(p),f.id(t)&&(t<48||t>57)?w(f.id):C(r)),v=(r,t)=>g(r,t,(e,o)=>e&&(o=cr(t))&&[r,e,o]),Yr=(r,t,e)=>(L[r]??=t,H({op:r,l:r.length,p:t,map:e,word:!0,kw:!0})),X=(r,t,e=(o,n,l,c=p,A,u,y)=>{for(y=0;u=r[y++];)if(!(u.kw&&o)&&!(l?u.op!==l:!((u.l<2||u.op.charCodeAt(1)===s.charCodeAt(p+1)&&(u.l<3||s.substr(p,u.l)===u.op))&&(!u.word||!f.id(s.charCodeAt(p+u.l)))&&(l=u.op)))&&!(n>=u.p)&&!(u.kw&&f.prop&&!f.prop(p+u.l))){if(p+=u.l,A=u.map(o))return fr(A,c);p=c,l=0,u.word||o||t||r[y]||E()}return t?.(o,n,l)})=>(e.ops=r,e.tail=t,e),H=(r,t=r.op.charCodeAt(0),e=d[t])=>d[t]=e?.ops?X([r,...e.ops],e.tail):X([r],e);f.space=r=>{for(;(r=s.charCodeAt(p))<=32;)p++;return r};f.step=(r,t,e,o,n)=>(n=d[e])&&n(r,t)||(r?null:w(f.id)||null);var D={},m=(r,t,e=D[r])=>D[r]=(...o)=>t(...o)||e?.(...o),i=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):D[r[0]]?.(...r.slice(1))??E(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:t=>t?.[r];var F=46,k=48,I=57,G=69,W=101,Ar=43,Cr=45,z=95,J=110,dr=97,gr=102,yr=65,Er=70,K=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),Sr=r=>r===F&&(r=s.charCodeAt(p+1))!==F&&!(f.id(r)&&r>I&&r!==W&&r!==G)||r>=k&&r<=I||r===z||((r===G||r===W)&&((r=s.charCodeAt(p+1))>=k&&r<=I||r===Ar||r===Cr)?2:0),$=r=>{let t=K(w(Sr));return s.charCodeAt(p)===J?(S(),[,BigInt(t)]):(r=+t)!=r?E():[,r]},wr=r=>t=>t===z||t>=k&&t<=I&&t-k<r||r===16&&(t>=dr&&t<=gr||t>=yr&&t<=Er);f.number=null;d[F]=r=>!r&&s.charCodeAt(p+1)>=k&&s.charCodeAt(p+1)<=I&&$();for(let r=k;r<=I;r++)d[r]=t=>t?void 0:$();d[k]=(r,t)=>{if(!r){for(let e in f.number)if(e[0]==="0"&&(s.charCodeAt(p+1)|32)===e.charCodeAt(1)){S(2);let o=K(w(wr(t=f.number[e])));return s.charCodeAt(p)===J?(S(),[,BigInt("0"+e[1]+o)]):[,parseInt(o,t)]}return $()}};var _r=92,V=34,Y=39,Z=117,q=120,kr=123,Ir=125,x=10,Rr=13,Pr={n:`
|
|
4
|
+
`,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,o="",n=String.fromCharCode(r))=>{if(t||!f.string?.[n])return;S();let l=()=>{let c=s.charCodeAt(p+1);if(c===x)return 2;if(c===Rr)return s.charCodeAt(p+2)===x?3:2;if(c===q||c===Z&&s.charCodeAt(p+2)!==kr){let A=c===q?2:4,u=0,y;for(let T=0;T<A;T++){if((y=j(s.charCodeAt(p+2+T)))<0)return o+=s[p+1],2;u=u*16+y}return o+=String.fromCharCode(u),2+A}if(c===Z){let A=0,u=p+3,y;for(;(y=j(s.charCodeAt(u)))>=0;)A=A*16+y,u++;return u>p+3&&A<=1114111&&s.charCodeAt(u)===Ir?(o+=String.fromCodePoint(A),u-p+1):(o+=s[p+1],2)}return o+=Pr[s[p+1]]||s[p+1],2};return w(c=>c-r&&(c!==_r?(o+=s[p],1):l())),s[p]===n?S():E("Bad string"),[,o]};d[V]=a(V);d[Y]=a(Y);f.string={'"':!0};var Ur=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>h(r,Ur,!0));var Tr=30,Lr=40,Dr=140;_("!",Dr);h("||",Tr);h("&&",Lr);var Mr=50,Nr=60,Fr=70,b=100,$r=140;h("|",Mr);h("&",Fr);h("^",Nr);h(">>",b);h("<<",b);_("~",$r);var R=90;h("<",R);h(">",R);h("<=",R);h(">=",R);var rr=80;h("==",rr);h("!=",rr);var tr=110,B=120,er=140;h("+",tr);h("-",tr);h("*",B);h("/",B);h("%",B);_("+",er);_("-",er);var P=150;g("++",P,r=>r?["++",r,null]:["++",C(P-1)]);g("--",P,r=>r?["--",r,null]:["--",C(P-1)]);var Br=5,Or=10;M(",",Or);M(";",Br,!0,!0);var Xr=170;Q("()",Xr);var or=170,Qr=160;N("[]",or);v(".",or);N("()",Qr);var ir=(r,t,e,o)=>typeof r=="string"?n=>t(n,r,n):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o,n)):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n),n)):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)m(r,(t,e)=>(e=i(e),ir(t,(o,n,l)=>nr[r](o,n,e(l)))));m("!",r=>(r=i(r),t=>!r(t)));m("||",(r,t)=>(r=i(r),t=i(t),e=>r(e)||t(e)));m("&&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&&t(e)));m("~",r=>(r=i(r),t=>~r(t)));m("|",(r,t)=>(r=i(r),t=i(t),e=>r(e)|t(e)));m("&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&t(e)));m("^",(r,t)=>(r=i(r),t=i(t),e=>r(e)^t(e)));m(">>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>t(e)));m("<<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<<t(e)));m(">",(r,t)=>(r=i(r),t=i(t),e=>r(e)>t(e)));m("<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<t(e)));m(">=",(r,t)=>(r=i(r),t=i(t),e=>r(e)>=t(e)));m("<=",(r,t)=>(r=i(r),t=i(t),e=>r(e)<=t(e)));m("==",(r,t)=>(r=i(r),t=i(t),e=>r(e)==t(e)));m("!=",(r,t)=>(r=i(r),t=i(t),e=>r(e)!=t(e)));m("+",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)+t(e)):(r=i(r),e=>+r(e)));m("-",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)-t(e)):(r=i(r),e=>-r(e)));m("*",(r,t)=>(r=i(r),t=i(t),e=>r(e)*t(e)));m("/",(r,t)=>(r=i(r),t=i(t),e=>r(e)/t(e)));m("%",(r,t)=>(r=i(r),t=i(t),e=>r(e)%t(e)));var O=(r,t,e,o)=>typeof r=="string"?n=>t(n,r):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o)):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n))):r[0]==="()"&&r.length===2?O(r[1],t):(()=>{throw Error("Invalid increment target")})();m("++",(r,t)=>O(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));m("--",(r,t)=>O(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var pr=(...r)=>(r=r.map(i),t=>{let e;for(let o of r)e=o(t);return e});m(",",pr);m(";",pr);var lr=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",U=r=>{throw Error(r)};m("[]",(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]),o=>e(o)):(e=i(e),o=>[e(o)])),e=>r.flatMap(o=>o(e))):(t==null&&U("Missing index"),r=i(r),t=i(t),e=>{let o=t(e);return lr(o)?void 0:r(e)[o]}));m(".",(r,t)=>(r=i(r),t=t[0]?t:t[1],lr(t)?()=>{}:e=>r(e)[t]));m("()",(r,t)=>{if(t===void 0)return r==null?U("Empty ()"):i(r);let e=n=>n?.[0]===","&&n.slice(1).some(l=>l==null||e(l));e(t)&&U("Empty argument");let o=t?t[0]===","?(t=t.slice(1).map(i),n=>t.map(l=>l(n))):(t=i(t),n=>[t(n)]):()=>[];return sr(r,(n,l,c)=>n[l](...o(c)))});var sr=(r,t,e,o)=>r==null?U("Empty ()"):r[0]==="()"&&r.length==2?sr(r[1],t):typeof r=="string"?n=>t(n,r,n):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o,n)):r[0]==="?."?(e=i(r[1]),o=r[2],n=>{let l=e(n);return l==null?void 0:t(l,o,n)}):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n),n)):r[0]==="?.[]"?(e=i(r[1]),o=i(r[2]),n=>{let l=e(n);return l==null?void 0:t(l,o(n),n)}):(r=i(r),n=>t([r(n)],0,n));var mr=new WeakMap,vr=(r,...t)=>typeof r=="string"?i(f(r)):mr.get(r)||mr.set(r,Hr(r,t)).get(r),ur=57344,Hr=(r,t)=>{let e=r.reduce((l,c,A)=>l+(A?String.fromCharCode(ur+A-1):"")+c,""),o=f(e),n=l=>{if(typeof l=="string"&&l.length===1){let c=l.charCodeAt(0)-ur,A;if(c>=0&&c<t.length)return A=t[c],Gr(A)?A:[,A]}return Array.isArray(l)?l.map(n):l};return i(n(o))},Gr=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Jt=vr;export{N as access,h as binary,i as compile,s as cur,Jt as default,E as err,C as expr,Q as group,zr as id,p as idx,Yr as keyword,Vr as literal,fr as loc,d as lookup,v as member,M as nary,w as next,m as operator,D as operators,Kr as parens,f as parse,hr as peek,L as prec,cr as propName,Wr as seek,S as skip,g as token,_ as unary,Jr as word};
|