subscript 10.1.7 → 10.1.8
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/feature/op/arrow.js +19 -13
- package/jessie.min.js +7 -7
- package/justin.min.js +6 -6
- package/package.json +1 -1
package/feature/op/arrow.js
CHANGED
|
@@ -14,25 +14,31 @@ binary('=>', ASSIGN, true);
|
|
|
14
14
|
|
|
15
15
|
// Compile
|
|
16
16
|
operator('=>', (a, b) => {
|
|
17
|
+
// Normalize params: () → [], x → [x], (a, b) → [a, b]
|
|
17
18
|
a = a?.[0] === '()' ? a[1] : a;
|
|
18
|
-
|
|
19
|
+
const ps = !a ? [] : a[0] === ',' ? a.slice(1) : [a];
|
|
20
|
+
// Check for rest param
|
|
19
21
|
let restIdx = -1, restName = null;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
const last = ps[ps.length - 1];
|
|
23
|
+
if (Array.isArray(last) && last[0] === '...') {
|
|
24
|
+
restIdx = ps.length - 1;
|
|
25
|
+
restName = last[1];
|
|
26
|
+
ps.length--;
|
|
24
27
|
}
|
|
25
28
|
// Arrow body: {} is always block (need parens for object: ({...}))
|
|
26
29
|
// Block body returns undefined unless explicit return
|
|
27
30
|
const isBlock = b?.[0] === '{}';
|
|
28
31
|
b = compile(isBlock ? ['{', b[1]] : b);
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
return ctx => (...args) => {
|
|
33
|
+
const l = {};
|
|
34
|
+
ps.forEach((p, i) => l[p] = args[i]);
|
|
35
|
+
if (restName) l[restName] = args.slice(restIdx);
|
|
36
|
+
const fnCtx = new Proxy(l, {
|
|
37
|
+
get: (l, k) => k in l ? l[k] : ctx?.[k],
|
|
38
|
+
set: (l, k, v) => ((k in l ? l : ctx)[k] = v, true),
|
|
39
|
+
has: (l, k) => k in l || (ctx ? k in ctx : false)
|
|
40
|
+
});
|
|
41
|
+
try { const r = b(fnCtx); return isBlock ? undefined : r; }
|
|
42
|
+
catch (e) { if (e === RETURN) return e[0]; throw e; }
|
|
37
43
|
};
|
|
38
44
|
});
|
package/jessie.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
`),n=t.pop(),o=m.slice(Math.max(0,e-40),e),
|
|
1
|
+
var l,m,c=r=>(l=0,m=r,c.newline=!1,r=h(),m[l]?R():r||""),R=(r="Unexpected token",e=l,t=m.slice(0,e).split(`
|
|
2
|
+
`),n=t.pop(),o=m.slice(Math.max(0,e-40),e),p="\u032D",f=(m[e]||" ")+p,u=m.slice(e+1,e+20))=>{throw SyntaxError(`${r} at ${t.length+1}:${n.length+1}
|
|
3
3
|
${m[e-41]!==`
|
|
4
|
-
`,""+o}${
|
|
5
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Mr=r=>(e,t,n="")=>{if(!(e||!c.string?.[String.fromCharCode(r)]))return y(),
|
|
6
|
-
`,"/*":"*/"};var
|
|
7
|
-
`)for(;m.charCodeAt(n)>=Ge;)n++;else{for(;m[n]&&m.substr(n,t[1].length)!==t[1];)n++;m[n]&&(n+=t[1].length)}
|
|
8
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},re=()=>{let r=[];for(let e="",t;(t=m.charCodeAt(
|
|
4
|
+
`,""+o}${f}${u}`)},q=(r,e=l)=>(Array.isArray(r)&&(r.loc=e),r),I=(r,e=l,t)=>{for(;t=r(m.charCodeAt(l));)l+=t;return m.slice(e,l)},y=(r=1)=>m[l+=r],P=r=>l=r,h=(r=0,e)=>{let t,n,o,p,f;for(e&&c.asi&&(c.newline=!1);(t=c.space())&&(f=c.newline,1)&&t!==e&&(o=((p=k[t])&&p(n,r))??(n&&f&&c.asi?.(n,r,h))??(!n&&I(c.id)));)n=o;return e&&(t==e?l++:R("Unclosed "+String.fromCharCode(e-(e>42?2:1)))),n},d=c.space=(r,e=l)=>{for(;(r=m.charCodeAt(l))<=32;)c.asi&&r===10&&(c.newline=!0),l++;return r},_r=(r=l)=>{for(;m.charCodeAt(r)<=32;)r++;return m.charCodeAt(r)},Tt=c.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,N=(r,e=r.length)=>m.substr(l,e)===r&&!c.id(m.charCodeAt(l+e)),v=()=>(y(),h(0,41)),k=[],j={},T=(r,e=32,t,n=r.charCodeAt(0),o=r.length,p=k[n],f=r.toUpperCase()!==r,u,a)=>(e=j[r]=!p&&j[r]||e,k[n]=(w,S,C,E=l)=>(u=C,(C?r==C:(o<2||r.charCodeAt(1)===m.charCodeAt(l+1)&&(o<3||m.substr(l,o)==r))&&(!f||!c.id(m.charCodeAt(l+o)))&&(u=C=r))&&S<e&&(l+=o,(a=t(w))?q(a,E):(l=E,u=0,!f&&!p&&R()),a)||p?.(w,S,u))),A=(r,e,t=!1)=>T(r,e,n=>n&&(o=>o&&[r,n,o])(h(e-(t?.5:0)))),O=(r,e,t)=>T(r,e,n=>t?n&&[r,n]:!n&&(n=h(e-.5))&&[r,n]),H=(r,e)=>T(r,200,t=>!t&&[,e]),ur=(r,e,t)=>T(r,e,(n,o)=>(o=h(e-(t?.5:0)),n?.[0]!==r&&(n=[r,n||null]),o?.[0]===r?n.push(...o.slice(1)):n.push(o||null),n)),W=(r,e)=>T(r[0],e,t=>!t&&[r,h(0,r.charCodeAt(1))||null]),lr=(r,e)=>T(r[0],e,t=>t&&[r,t,h(0,r.charCodeAt(1))||null]),fr={},s=(r,e,t=fr[r])=>fr[r]=(...n)=>e(...n)||t?.(...n),i=r=>Array.isArray(r)?r[0]==null?(e=>()=>e)(r[1]):fr[r[0]]?.(...r.slice(1))??R(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:e=>e?.[r];var b=46,z=48,rr=57,me=69,de=101,he=43,ae=45,x=95,Ae=110,ye=97,ge=102,we=65,Ee=70,Or=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),cr=r=>{let e=Or(I(t=>t===b&&m.charCodeAt(l+1)!==b||t>=z&&t<=rr||t===x||((t===me||t===de)&&((t=m.charCodeAt(l+1))>=z&&t<=rr||t===he||t===ae)?2:0)));return m.charCodeAt(l)===Ae?(y(),[,BigInt(e)]):(r=+e)!=r?R():[,r]},Ce={2:r=>r===48||r===49||r===x,8:r=>r>=48&&r<=55||r===x,16:r=>r>=z&&r<=rr||r>=ye&&r<=ge||r>=we&&r<=Ee||r===x};c.number=null;k[b]=r=>!r&&m.charCodeAt(l+1)!==b&&cr();for(let r=z;r<=rr;r++)k[r]=e=>e?void 0:cr();k[z]=r=>{if(r)return;let e=c.number;if(e){for(let[t,n]of Object.entries(e))if(t[0]==="0"&&m[l+1]?.toLowerCase()===t[1])return y(2),[,parseInt(Or(I(Ce[n])),n)]}return cr()};var Se=92,vr=34,Pr=39,ke={n:`
|
|
5
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Mr=r=>(e,t,n="")=>{if(!(e||!c.string?.[String.fromCharCode(r)]))return y(),I(o=>o-r&&(o===Se?(n+=ke[m[l+1]]||m[l+1],2):(n+=m[l],1))),m[l]===String.fromCharCode(r)?y():R("Bad string"),[,n]};k[vr]=Mr(vr);k[Pr]=Mr(Pr);c.string={'"':!0};var Te=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>A(r,Te,!0));var Lr=(r,e,t,n)=>typeof r=="string"?o=>e(o,r,o):r[0]==="."?(t=i(r[1]),n=r[2],o=>e(t(o),n,o)):r[0]==="[]"&&r.length===3?(t=i(r[1]),n=i(r[2]),o=>e(t(o),n(o),o)):r[0]==="()"&&r.length===2?Lr(r[1],e):(()=>{throw Error("Invalid assignment target")})(),Ur={"=":(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 Ur)s(r,(e,t)=>(t=i(t),Lr(e,(n,o,p)=>Ur[r](n,o,t(p)))));var Ie=30,Re=40,Fr=140;A("!",Fr);O("!",Fr);A("||",Ie);A("&&",Re);s("!",r=>(r=i(r),e=>!r(e)));s("||",(r,e)=>(r=i(r),e=i(e),t=>r(t)||e(t)));s("&&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&&e(t)));var Ne=50,_e=60,Oe=70,Br=100,ve=140;A("|",Ne);A("&",Oe);A("^",_e);A(">>",Br);A("<<",Br);O("~",ve);s("~",r=>(r=i(r),e=>~r(e)));s("|",(r,e)=>(r=i(r),e=i(e),t=>r(t)|e(t)));s("&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&e(t)));s("^",(r,e)=>(r=i(r),e=i(e),t=>r(t)^e(t)));s(">>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>e(t)));s("<<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<<e(t)));var er=90;A("<",er);A(">",er);A("<=",er);A(">=",er);s(">",(r,e)=>(r=i(r),e=i(e),t=>r(t)>e(t)));s("<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<e(t)));s(">=",(r,e)=>(r=i(r),e=i(e),t=>r(t)>=e(t)));s("<=",(r,e)=>(r=i(r),e=i(e),t=>r(t)<=e(t)));var Gr=80;A("==",Gr);A("!=",Gr);s("==",(r,e)=>(r=i(r),e=i(e),t=>r(t)==e(t)));s("!=",(r,e)=>(r=i(r),e=i(e),t=>r(t)!=e(t)));var Xr=110,mr=120,Dr=140;A("+",Xr);A("-",Xr);A("*",mr);A("/",mr);A("%",mr);O("+",Dr);O("-",Dr);s("+",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)+e(t)):(r=i(r),t=>+r(t)));s("-",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)-e(t)):(r=i(r),t=>-r(t)));s("*",(r,e)=>(r=i(r),e=i(e),t=>r(t)*e(t)));s("/",(r,e)=>(r=i(r),e=i(e),t=>r(t)/e(t)));s("%",(r,e)=>(r=i(r),e=i(e),t=>r(t)%e(t)));var tr=150;T("++",tr,r=>r?["++",r,null]:["++",h(tr-1)]);T("--",tr,r=>r?["--",r,null]:["--",h(tr-1)]);var dr=(r,e,t,n)=>typeof r=="string"?o=>e(o,r):r[0]==="."?(t=i(r[1]),n=r[2],o=>e(t(o),n)):r[0]==="[]"&&r.length===3?(t=i(r[1]),n=i(r[2]),o=>e(t(o),n(o))):r[0]==="()"&&r.length===2?dr(r[1],e):(()=>{throw Error("Invalid increment target")})();s("++",(r,e)=>dr(r,e===null?(t,n)=>t[n]++:(t,n)=>++t[n]));s("--",(r,e)=>dr(r,e===null?(t,n)=>t[n]--:(t,n)=>--t[n]));var Pe=5,Me=10,Ue=170;W("()",Ue);ur(",",Me);ur(";",Pe,!0);var Kr=(...r)=>(r=r.map(i),e=>{let t;for(let n of r)t=n(e);return t});s(",",Kr);s(";",Kr);var G=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",hr=170;lr("[]",hr);A(".",hr);lr("()",hr);var nr=r=>{throw Error(r)};s("[]",(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]),n=>t(n)):(t=i(t),n=>[t(n)])),t=>r.flatMap(n=>n(t))):(e==null&&nr("Missing index"),r=i(r),e=i(e),t=>{let n=e(t);return G(n)?void 0:r(t)[n]}));s(".",(r,e)=>(r=i(r),e=e[0]?e:e[1],G(e)?()=>{}:t=>r(t)[e]));s("()",(r,e)=>{if(e===void 0)return r==null?nr("Empty ()"):i(r);let t=o=>o?.[0]===","&&o.slice(1).some(p=>p==null||t(p));t(e)&&nr("Empty argument");let n=e?e[0]===","?(e=e.slice(1).map(i),o=>e.map(p=>p(o))):(e=i(e),o=>[e(o)]):()=>[];return ar(r,(o,p,f)=>o[p](...n(f)))});var L=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&L(r[1])||r[0]==="{}"),ar=(r,e,t,n)=>r==null?nr("Empty ()"):r[0]==="()"&&r.length==2?ar(r[1],e):typeof r=="string"?o=>e(o,r,o):r[0]==="."?(t=i(r[1]),n=r[2],o=>e(t(o),n,o)):r[0]==="?."?(t=i(r[1]),n=r[2],o=>{let p=t(o);return p==null?void 0:e(p,n,o)}):r[0]==="[]"&&r.length===3?(t=i(r[1]),n=i(r[2]),o=>e(t(o),n(o),o)):r[0]==="?.[]"?(t=i(r[1]),n=i(r[2]),o=>{let p=t(o);return p==null?void 0:e(p,n(o),o)}):(r=i(r),o=>e([r(o)],0,o)),X=ar;var Qr=new WeakMap,Le=(r,...e)=>typeof r=="string"?i(c(r)):Qr.get(r)||Qr.set(r,Fe(r,e)).get(r),$r=57344,Fe=(r,e)=>{let t=r.reduce((p,f,u)=>p+(u?String.fromCharCode($r+u-1):"")+f,""),n=c(t),o=p=>{if(typeof p=="string"&&p.length===1){let f=p.charCodeAt(0)-$r,u;if(f>=0&&f<e.length)return u=e[f],Be(u)?u:[,u]}return Array.isArray(p)?p.map(o):p};return i(o(n))},Be=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Hr=Le;var Ge=32,Xe=c.space;c.comment??={"//":`
|
|
6
|
+
`,"/*":"*/"};var Ar;c.space=()=>{Ar||(Ar=Object.entries(c.comment).map(([o,p])=>[o,p,o.charCodeAt(0)]));for(var r;r=Xe();){for(var e=0,t;t=Ar[e++];)if(r===t[2]&&m.substr(l,t[0].length)===t[0]){var n=l+t[0].length;if(t[1]===`
|
|
7
|
+
`)for(;m.charCodeAt(n)>=Ge;)n++;else{for(;m[n]&&m.substr(n,t[1].length)!==t[1];)n++;m[n]&&(n+=t[1].length)}P(n),r=0;break}if(r)return r}return r};var jr=80;A("===",jr);A("!==",jr);s("===",(r,e)=>(r=i(r),e=i(e),t=>r(t)===e(t)));s("!==",(r,e)=>(r=i(r),e=i(e),t=>r(t)!==e(t)));var De=30;A("??",De);s("??",(r,e)=>(r=i(r),e=i(e),t=>r(t)??e(t)));var Ke=130,Qe=20;A("**",Ke,!0);A("**=",Qe,!0);s("**",(r,e)=>(r=i(r),e=i(e),t=>r(t)**e(t)));var $e=r=>{throw Error(r)};s("**=",(r,e)=>(L(r)||$e("Invalid assignment target"),e=i(e),X(r,(t,n,o)=>t[n]**=e(o))));var Wr=90;A("in",Wr);A("of",Wr);s("in",(r,e)=>(r=i(r),e=i(e),t=>r(t)in e(t)));var He=20,je=100,We=r=>{throw Error(r)};A(">>>",je);A(">>>=",He,!0);s(">>>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>>e(t)));s(">>>=",(r,e)=>(L(r)||We("Invalid assignment target"),e=i(e),X(r,(t,n,o)=>t[n]>>>=e(o))));var ze=r=>r[0]?.[0]===","?r[0].slice(1):r,D=(r,e,t)=>{if(typeof r=="string"){t[r]=e;return}let[n,...o]=r,p=ze(o);if(n==="{}"){let f=[];for(let u of p){if(Array.isArray(u)&&u[0]==="..."){let E={};for(let _ in e)f.includes(_)||(E[_]=e[_]);t[u[1]]=E;break}let a,w,S;typeof u=="string"?a=w=u:u[0]==="="?(typeof u[1]=="string"?a=w=u[1]:[,a,w]=u[1],S=u[2]):[,a,w]=u,f.push(a);let C=e[a];C===void 0&&S&&(C=i(S)(t)),D(w,C,t)}}else if(n==="[]"){let f=0;for(let u of p){if(u===null){f++;continue}if(Array.isArray(u)&&u[0]==="..."){t[u[1]]=e.slice(f);break}let a=u,w;Array.isArray(u)&&u[0]==="="&&([,a,w]=u);let S=e[f++];S===void 0&&w&&(S=i(w)(t)),D(a,S,t)}}};var yr=20,or=r=>{throw Error(r)};A("||=",yr,!0);A("&&=",yr,!0);A("??=",yr,!0);s("=",(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"?n=>{n[t]=e(n)}:n=>D(t,e(n),n)}return L(r)||or("Invalid assignment target"),e=i(e),X(r,(t,n,o)=>t[n]=e(o))});s("||=",(r,e)=>(L(r)||or("Invalid assignment target"),e=i(e),X(r,(t,n,o)=>t[n]||=e(o))));s("&&=",(r,e)=>(L(r)||or("Invalid assignment target"),e=i(e),X(r,(t,n,o)=>t[n]&&=e(o))));s("??=",(r,e)=>(L(r)||or("Invalid assignment target"),e=i(e),X(r,(t,n,o)=>t[n]??=e(o))));var gr=5,zr=123,Jr=125,g=(r,e,t,n=r.charCodeAt(0),o=r.length,p=k[n],f)=>k[n]=(u,a,w,S=l)=>!u&&(w?r==w:(o<2||m.substr(l,o)==r)&&(w=r))&&a<e&&!c.id(m.charCodeAt(l+o))&&_r(l+o)!==58&&(P(l+o),(f=t())?q(f,S):P(S),f)||p?.(u,a,w),wr=(r,e,t,n=r.charCodeAt(0),o=r.length,p=k[n],f)=>k[n]=(u,a,w,S=l)=>u&&(w?r==w:(o<2||m.substr(l,o)==r)&&(w=r))&&a<e&&!c.id(m.charCodeAt(l+o))&&(P(l+o),q(f=t(u),S),f)||p?.(u,a,w),F=()=>(d()===zr||R("Expected {"),y(),h(gr-.5,Jr)||null),B=()=>d()!==zr?h(gr+.5):(y(),h(gr-.5,Jr)||null);H("true",!0);H("false",!1);H("null",null);g("undefined",200,()=>[]);H("NaN",NaN);H("Infinity",1/0);var Er=20;T("?",Er,(r,e,t)=>r&&(e=h(Er-1))&&I(n=>n===58)&&(t=h(Er-1),["?",r,e,t]));s("?",(r,e,t)=>(r=i(r),e=i(e),t=i(t),n=>r(n)?e(n):t(n)));var U=Symbol("break"),K=Symbol("continue"),M=[];var Je=20;A("=>",Je,!0);s("=>",(r,e)=>{r=r?.[0]==="()"?r[1]:r;let t=r?r[0]===","?r.slice(1):[r]:[],n=-1,o=null,p=t[t.length-1];Array.isArray(p)&&p[0]==="..."&&(n=t.length-1,o=p[1],t.length--);let f=e?.[0]==="{}";return e=i(f?["{",e[1]]:e),u=>(...a)=>{let w={};t.forEach((C,E)=>w[C]=a[E]),o&&(w[o]=a.slice(n));let S=new Proxy(w,{get:(C,E)=>E in C?C[E]:u?.[E],set:(C,E,_)=>((E in C?C:u)[E]=_,!0),has:(C,E)=>E in C||(u?E in u:!1)});try{let C=e(S);return f?void 0:C}catch(C){if(C===M)return C[0];throw C}}});var Ve=140;O("...",Ve);s("...",r=>(r=i(r),e=>Object.entries(r(e))));var Vr=170;T("?.",Vr,(r,e)=>{if(!r)return;let t=d();return t===40?(y(),["?.()",r,h(0,41)||null]):t===91?(y(),["?.[]",r,h(0,93)]):(e=h(Vr),e?["?.",r,e]:void 0)});s("?.",(r,e)=>(r=i(r),G(e)?()=>{}:t=>r(t)?.[e]));s("?.[]",(r,e)=>(r=i(r),e=i(e),t=>{let n=e(t);return G(n)?void 0:r(t)?.[n]}));s("?.()",(r,e)=>{let t=e?e[0]===","?(e=e.slice(1).map(i),o=>e.map(p=>p(o))):(e=i(e),o=>[e(o)]):()=>[];if(r[0]==="?."){let o=i(r[1]),p=r[2];return G(p)?()=>{}:f=>o(f)?.[p]?.(...t(f))}if(r[0]==="?.[]"){let o=i(r[1]),p=i(r[2]);return f=>{let u=o(f),a=p(f);return G(a)?void 0:u?.[a]?.(...t(f))}}if(r[0]==="."){let o=i(r[1]),p=r[2];return G(p)?()=>{}:f=>o(f)?.[p]?.(...t(f))}if(r[0]==="[]"&&r.length===3){let o=i(r[1]),p=i(r[2]);return f=>{let u=o(f),a=p(f);return G(a)?void 0:u?.[a]?.(...t(f))}}let n=i(r);return o=>n(o)?.(...t(o))});var J=140;O("typeof",J);O("void",J);O("delete",J);g("new",J,()=>N(".target")?(y(7),["new.target"]):["new",h(J)]);s("typeof",r=>(r=i(r),e=>typeof r(e)));s("void",r=>(r=i(r),e=>(r(e),void 0)));s("delete",r=>{if(r[0]==="."){let e=i(r[1]),t=r[2];return n=>delete e(n)[t]}if(r[0]==="[]"){let e=i(r[1]),t=i(r[2]);return n=>delete e(n)[t(n)]}return()=>!0});s("new",r=>{let e=i(r?.[0]==="()"?r[1]:r),t=r?.[0]==="()"?r[2]:null,n=t?t[0]===","?(o=>p=>o.map(f=>f(p)))(t.slice(1).map(i)):(o=>p=>[o(p)])(i(t)):()=>[];return o=>new(e(o))(...n(o))});var ir=Symbol("accessor"),Cr=20,Ye=40,Yr=41,Zr=123,qr=125,xr=r=>e=>{if(e)return;d();let t=I(c.id);if(!t||(d(),m.charCodeAt(l)!==Ye))return!1;y();let n=h(0,Yr);return d(),m.charCodeAt(l)!==Zr?!1:(y(),[r,t,n,h(0,qr)])};T("get",Cr-1,xr("get"));T("set",Cr-1,xr("set"));T("(",Cr-1,r=>{if(!r||typeof r!="string")return;let e=h(0,Yr)||null;if(d(),m.charCodeAt(l)===Zr)return y(),[":",r,["=>",["()",e],h(0,qr)||null]]});s("get",(r,e)=>(e=e?i(e):()=>{},t=>[[ir,r,{get:function(){let n=Object.create(t||{});return n.this=this,e(n)}}]]));s("set",(r,e,t)=>(t=t?i(t):()=>{},n=>[[ir,r,{set:function(o){let p=Object.create(n||{});p.this=this,p[e]=o,t(p)}}]]));var Ze=20,br=200,qe=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);W("[]",br);W("{}",br);A(":",Ze-1,!0);s("{}",(r,e)=>{if(e!==void 0)return;if(!qe(r))return i(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let t=r.map(n=>i(typeof n=="string"?[":",n,n]:n));return n=>{let o={},p={};for(let f of t.flatMap(u=>u(n)))if(f[0]===ir){let[,u,a]=f;p[u]={...p[u],...a,configurable:!0,enumerable:!0}}else o[f[0]]=f[1];for(let f in p)Object.defineProperty(o,f,p[f]);return o}});s("{",r=>(r=r?i(r):()=>{},e=>r(Object.create(e))));s(":",(r,e)=>(e=i(e),Array.isArray(r)?(r=i(r),t=>[[r(t),e(t)]]):t=>[[r,e(t)]]));var xe=170,sr=96,be=36,rt=123,et=92,tt={n:`
|
|
8
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},re=()=>{let r=[];for(let e="",t;(t=m.charCodeAt(l))!==sr;)t?t===et?(y(),e+=tt[m[l]]||m[l],y()):t===be&&m.charCodeAt(l+1)===rt?(e&&r.push([,e]),e="",y(2),r.push(h(0,125))):(e+=m[l],y(),t=m.charCodeAt(l),t===sr&&e&&r.push([,e])):R("Unterminated template");return y(),r},nt=k[sr];k[sr]=(r,e)=>r&&e<xe?c.asi&&c.newline?void 0:(y(),["``",r,...re()]):r?nt?.(r,e):(y(),(t=>t.length<2&&t[0]?.[0]===void 0?t[0]||[,""]:["`",...t])(re()));s("`",(...r)=>(r=r.map(i),e=>r.map(t=>t(e)).join("")));s("``",(r,...e)=>{r=i(r);let t=[],n=[];for(let p of e)Array.isArray(p)&&p[0]===void 0?t.push(p[1]):n.push(i(p));let o=Object.assign([...t],{raw:t});return p=>r(p)(o,...n.map(f=>f(p)))});c.string["'"]=!0;c.number={"0x":16,"0b":2,"0o":8};var Sr=5,ot=10,it=20,ee=r=>{let e=h(ot-1);return e?.[0]==="in"||e?.[0]==="of"?[e[0],[r,e[1]],e[2]]:e?.[0]===","?[r,...e.slice(1)]:[r,e]};g("let",Sr+1,()=>ee("let"));g("const",Sr+1,()=>ee("const"));g("var",Sr,()=>(d(),["var",h(it)]));var te=(...r)=>(r=r.map(e=>{if(typeof e=="string")return t=>{t[e]=void 0};if(e[0]==="="){let[,t,n]=e,o=i(n);return typeof t=="string"?p=>{p[t]=o(p)}:p=>D(t,o(p),p)}return i(e)}),e=>{for(let t of r)t(e)});s("let",te);s("const",te);s("var",r=>typeof r=="string"?e=>{e[r]=void 0}:()=>{});var st=200;g("function",st,()=>{d();let r=!1;m[l]==="*"&&(r=!0,y(),d());let e=I(c.id);return e&&d(),r?["function*",e,v()||null,F()]:["function",e,v()||null,F()]});s("function",(r,e,t)=>{t=t?i(t):()=>{};let n=e?e[0]===","?e.slice(1):[e]:[],o=null,p=-1,f=n[n.length-1];return Array.isArray(f)&&f[0]==="..."&&(p=n.length-1,o=f[1],n.length--),u=>{let a=(...w)=>{let S={};n.forEach((E,_)=>S[E]=w[_]),o&&(S[o]=w.slice(p));let C=new Proxy(S,{get:(E,_)=>_ in E?E[_]:u[_],set:(E,_,ce)=>((_ in E?E:u)[_]=ce,!0),has:(E,_)=>_ in E||_ in u});try{return t(C)}catch(E){if(E===M)return E[0];throw E}};return r&&(u[r]=a),a}});s("function*",(r,e,t)=>{throw Error("Generator functions are not supported in evaluation")});var pr=140,kr=20;O("await",pr);g("yield",pr,()=>(d(),m[l]==="*"?(y(),d(),["yield*",h(kr)]):["yield",h(kr)]));g("async",pr,()=>{if(d(),N("function"))return["async",h(pr)];let r=h(kr-.5);return r&&["async",r]});s("async",r=>{let e=i(r);return t=>{let n=e(t);return async function(...o){return n(...o)}}});s("await",r=>(r=i(r),async e=>await r(e)));s("yield",r=>(r=r?i(r):null,e=>{throw{__yield__:r?r(e):void 0}}));s("yield*",r=>(r=i(r),e=>{throw{__yield_all__:r(e)}}));var Tr=200,pt=140,ft=90,ut=Symbol("static");O("static",pt);A("instanceof",ft);T("#",Tr,r=>{if(r)return;let e=I(c.id);return e?"#"+e:void 0});g("class",Tr,()=>{d();let r=I(c.id)||null;if(r==="extends")r=null,d();else{if(d(),!N("extends"))return["class",r,null,F()];y(7),d()}return["class",r,h(Tr),F()]});var lt=r=>{throw Error(r)};s("instanceof",(r,e)=>(r=i(r),e=i(e),t=>r(t)instanceof e(t)));s("class",(r,e,t)=>(e=e?i(e):null,t=t?i(t):null,n=>{let o=e?e(n):Object,p=function(...f){if(!(this instanceof p))return lt("Class constructor must be called with new");let u=e?Reflect.construct(o,f,p):this;return p.prototype.__constructor__&&p.prototype.__constructor__.apply(u,f),u};if(Object.setPrototypeOf(p.prototype,o.prototype),Object.setPrototypeOf(p,o),t){let f=Object.create(n);f.super=o;let u=t(f),a=Array.isArray(u)&&typeof u[0]?.[0]=="string"?u:[];for(let[w,S]of a)w==="constructor"?p.prototype.__constructor__=S:p.prototype[w]=S}return r&&(n[r]=p),p}));s("static",r=>(r=i(r),e=>[[ut,r(e)]]));var ct=140,Ir=47,mt=92,dt=r=>r===mt?2:r&&r!==Ir,ht=r=>r===103||r===105||r===109||r===115||r===117||r===121;T("/",ct,r=>{if(r)return;let e=m.charCodeAt(l);if(e===Ir||e===42||e===43||e===63||e===61)return;let t=I(dt);m.charCodeAt(l)===Ir||R("Unterminated regex"),y();let n=I(ht);try{new RegExp(t,n)}catch(o){R("Invalid regex: "+o.message)}return n?["//",t,n]:["//",t]});s("//",(r,e)=>{let t=new RegExp(r,e||"");return()=>t});var at=5,At=59,yt=()=>{let r=l;return d()===At&&y(),d(),N("else")?(y(4),!0):(P(r),!1)};g("if",at+1,()=>{d();let r=["if",v(),B()];return yt()&&r.push(B()),r});s("if",(r,e,t)=>(r=i(r),e=i(e),t=t!==void 0?i(t):null,n=>r(n)?e(n):t?.(n)));var Q=5,V=125,Y=59;g("while",Q+1,()=>(d(),["while",v(),B()]));g("do",Q+1,()=>(r=>(d(),y(5),d(),["do",r,v()]))(B()));g("for",Q+1,()=>(d(),N("await")?(y(5),d(),["for await",v(),B()]):["for",v(),B()]));g("break",Q+1,()=>{c.asi&&(c.newline=!1);let r=l;d();let e=m.charCodeAt(l);if(!e||e===V||e===Y||c.newline)return["break"];let t=I(c.id);if(!t)return["break"];d();let n=m.charCodeAt(l);return!n||n===V||n===Y||c.newline?["break",t]:(P(r),["break"])});g("continue",Q+1,()=>{c.asi&&(c.newline=!1);let r=l;d();let e=m.charCodeAt(l);if(!e||e===V||e===Y||c.newline)return["continue"];let t=I(c.id);if(!t)return["continue"];d();let n=m.charCodeAt(l);return!n||n===V||n===Y||c.newline?["continue",t]:(P(r),["continue"])});g("return",Q+1,()=>{c.asi&&(c.newline=!1);let r=d();return!r||r===V||r===Y||c.newline?["return"]:["return",h(Q)]});s("while",(r,e)=>(r=i(r),e=i(e),t=>{let n;for(;r(t);)try{n=e(t)}catch(o){if(o===U)break;if(o===K)continue;if(o===M)return o[0];throw o}return n}));s("do",(r,e)=>(r=i(r),e=i(e),t=>{let n;do try{n=r(t)}catch(o){if(o===U)break;if(o===K)continue;if(o===M)return o[0];throw o}while(e(t));return n}));s("for",(r,e)=>{if(Array.isArray(r)&&r[0]===";"){let[,t,n,o]=r;return t=t?i(t):null,n=n?i(n):()=>!0,o=o?i(o):null,e=i(e),p=>{let f;for(t?.(p);n(p);o?.(p))try{f=e(p)}catch(u){if(u===U)break;if(u===K)continue;if(u===M)return u[0];throw u}return f}}if(Array.isArray(r)&&(r[0]==="in"||r[0]==="of")){let[t,n,o]=r;if(Array.isArray(n)&&(n[0]==="let"||n[0]==="const"||n[0]==="var")&&(n=n[1]),t==="in")return wt(n,o,e);if(t==="of")return gt(n,o,e)}});var gt=(r,e,t)=>{e=i(e),t=i(t);let n=Array.isArray(r);return o=>{let p,f=n?null:o[r];for(let u of e(o)){n?D(r,u,o):o[r]=u;try{p=t(o)}catch(a){if(a===U)break;if(a===K)continue;if(a===M)return a[0];throw a}}return n||(o[r]=f),p}},wt=(r,e,t)=>{e=i(e),t=i(t);let n=Array.isArray(r);return o=>{let p,f=n?null:o[r];for(let u in e(o)){n?D(r,u,o):o[r]=u;try{p=t(o)}catch(a){if(a===U)break;if(a===K)continue;if(a===M)return a[0];throw a}}return n||(o[r]=f),p}};s("break",()=>()=>{throw U});s("continue",()=>()=>{throw K});s("return",r=>(r=r!==void 0?i(r):null,e=>{throw M[0]=r?.(e),M}));var Z=5;g("try",Z+1,()=>["try",F()]);wr("catch",Z+1,r=>(d(),["catch",r,v(),F()]));wr("finally",Z+1,r=>["finally",r,F()]);g("throw",Z+1,()=>{if(c.asi&&(c.newline=!1),d(),c.newline)throw SyntaxError("Unexpected newline after throw");return["throw",h(Z)]});s("try",r=>(r=r?i(r):null,e=>r?.(e)));s("catch",(r,e,t)=>{let n=r?.[1]?i(r[1]):null;return t=t?i(t):null,o=>{let p;try{p=n?.(o)}catch(f){if(f===U||f===K||f===M)throw f;if(e!==null&&t){let u=e in o,a=o[e];o[e]=f;try{p=t(o)}finally{u?o[e]=a:delete o[e]}}else if(e===null)throw f}return p}});s("finally",(r,e)=>(r=r?i(r):null,e=e?i(e):null,t=>{let n;try{n=r?.(t)}finally{e?.(t)}return n}));s("throw",r=>(r=i(r),e=>{throw r(e)}));var ie=5,Et=20,ne=58,Ct=59,se=125,Rr=0,pe=(r,e=r.length,t=r.charCodeAt(0),n=k[t])=>k[t]=(o,p,f)=>N(r)&&!o&&Rr||n?.(o,p,f);pe("case");pe("default");var oe=r=>{let e=[];for(;(r=d())!==se&&!N("case")&&!N("default");){if(r===Ct){y();continue}e.push(h(ie-.5))||R()}return e.length>1?[";",...e]:e[0]||null},St=()=>{d()===123||R("Expected {"),y(),Rr++;let r=[];try{for(;d()!==se;)if(N("case")){P(l+4),d();let e=h(Et-.5);d()===ne&&y(),r.push(["case",e,oe()])}else N("default")?(P(l+7),d()===ne&&y(),r.push(["default",oe()])):R("Expected case or default")}finally{Rr--}return y(),r};g("switch",ie+1,()=>d()===40&&["switch",v(),...St()]);s("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 n=r(t),o=!1,p;for(let[u,a]of e)if(o||u===null||u(t)===n)for(o=!0,f=0;f<a.length;f++)try{p=a[f](t)}catch(w){if(w===U)return p;throw w}var f;return p}):t=>r(t)));var fe=5;g("debugger",fe+1,()=>["debugger"]);g("with",fe+1,()=>(d(),["with",v(),B()]));var Nr=5,$=10,ue=42,kt=k[ue];k[ue]=(r,e)=>r?kt?.(r,e):(y(),"*");T("from",$+1,r=>r?r[0]!=="="&&r[0]!==","&&(d(),["from",r,h($+1)]):!1);T("as",$+2,r=>r?(d(),["as",r,h($+2)]):!1);g("import",Nr,()=>N(".meta")?(y(5),["import.meta"]):["import",h($)]);g("export",Nr,()=>(d(),["export",h(Nr)]));g("default",$+1,()=>d()!==58&&(d(),["default",h($)]));s("import",()=>()=>{});s("export",()=>()=>{});s("from",(r,e)=>()=>{});s("as",(r,e)=>()=>{});s("default",r=>i(r));var le=j.asi??j[";"];c.asi=(r,e,t,n,o)=>e<le&&(n=t(le-.5))&&(o=n?.[0]===";"?n.slice(1):[n],r?.[0]===";"?(r.push(...o),r):[";",r,...o]);export{lr as access,A as binary,i as compile,m as cur,Hr as default,R as err,h as expr,W as group,Tt as id,l as idx,H as literal,q as loc,k as lookup,ur as nary,I as next,s as operator,fr as operators,v as parens,c as parse,_r as peek,j as prec,P as seek,y as skip,d as space,T as token,O as unary,N as word};
|
package/justin.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var m,c,d=r=>(m=0,c=r,d.newline=!1,r=A(),c[m]?
|
|
2
|
-
`),o=t.pop(),i=c.slice(Math.max(0,e-40),e),p="\u032D",
|
|
1
|
+
var m,c,d=r=>(m=0,c=r,d.newline=!1,r=A(),c[m]?N():r||""),N=(r="Unexpected token",e=m,t=c.slice(0,e).split(`
|
|
2
|
+
`),o=t.pop(),i=c.slice(Math.max(0,e-40),e),p="\u032D",l=(c[e]||" ")+p,f=c.slice(e+1,e+20))=>{throw SyntaxError(`${r} at ${t.length+1}:${o.length+1}
|
|
3
3
|
${c[e-41]!==`
|
|
4
|
-
`,""+i}${
|
|
5
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},cr=r=>(e,t,o="")=>{if(!(e||!d.string?.[String.fromCharCode(r)]))return h(),
|
|
4
|
+
`,""+i}${l}${f}`)},V=(r,e=m)=>(Array.isArray(r)&&(r.loc=e),r),R=(r,e=m,t)=>{for(;t=r(c.charCodeAt(m));)m+=t;return c.slice(e,m)},h=(r=1)=>c[m+=r],U=r=>m=r,A=(r=0,e)=>{let t,o,i,p,l;for(e&&d.asi&&(d.newline=!1);(t=d.space())&&(l=d.newline,1)&&t!==e&&(i=((p=w[t])&&p(o,r))??(o&&l&&d.asi?.(o,r,A))??(!o&&R(d.id)));)o=i;return e&&(t==e?m++:N("Unclosed "+String.fromCharCode(e-(e>42?2:1)))),o},v=d.space=(r,e=m)=>{for(;(r=c.charCodeAt(m))<=32;)d.asi&&r===10&&(d.newline=!0),m++;return r},pr=(r=m)=>{for(;c.charCodeAt(r)<=32;)r++;return c.charCodeAt(r)},Te=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,lr=(r,e=r.length)=>c.substr(m,e)===r&&!d.id(c.charCodeAt(m+e)),ae=()=>(h(),A(0,41)),w=[],sr={},E=(r,e=32,t,o=r.charCodeAt(0),i=r.length,p=w[o],l=r.toUpperCase()!==r,f,g)=>(e=sr[r]=!p&&sr[r]||e,w[o]=(C,I,y,S=m)=>(f=y,(y?r==y:(i<2||r.charCodeAt(1)===c.charCodeAt(m+1)&&(i<3||c.substr(m,i)==r))&&(!l||!d.id(c.charCodeAt(m+i)))&&(f=y=r))&&I<e&&(m+=i,(g=t(C))?V(g,S):(m=S,f=0,!l&&!p&&N()),g)||p?.(C,I,f))),u=(r,e,t=!1)=>E(r,e,o=>o&&(i=>i&&[r,o,i])(A(e-(t?.5:0)))),k=(r,e,t)=>E(r,e,o=>t?o&&[r,o]:!o&&(o=A(e-.5))&&[r,o]),P=(r,e)=>E(r,200,t=>!t&&[,e]),Y=(r,e,t)=>E(r,e,(o,i)=>(i=A(e-(t?.5:0)),o?.[0]!==r&&(o=[r,o||null]),i?.[0]===r?o.push(...i.slice(1)):o.push(i||null),o)),_=(r,e)=>E(r[0],e,t=>!t&&[r,A(0,r.charCodeAt(1))||null]),Z=(r,e)=>E(r[0],e,t=>t&&[r,t,A(0,r.charCodeAt(1))||null]),J={},s=(r,e,t=J[r])=>J[r]=(...o)=>e(...o)||t?.(...o),n=r=>Array.isArray(r)?r[0]==null?(e=>()=>e)(r[1]):J[r[0]]?.(...r.slice(1))??N(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:e=>e?.[r];var F=46,B=48,G=57,_r=69,Br=101,Mr=43,Dr=45,D=95,Fr=110,Gr=97,Xr=102,$r=65,Qr=70,fr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),q=r=>{let e=fr(R(t=>t===F&&c.charCodeAt(m+1)!==F||t>=B&&t<=G||t===D||((t===_r||t===Br)&&((t=c.charCodeAt(m+1))>=B&&t<=G||t===Mr||t===Dr)?2:0)));return c.charCodeAt(m)===Fr?(h(),[,BigInt(e)]):(r=+e)!=r?N():[,r]},Hr={2:r=>r===48||r===49||r===D,8:r=>r>=48&&r<=55||r===D,16:r=>r>=B&&r<=G||r>=Gr&&r<=Xr||r>=$r&&r<=Qr||r===D};d.number=null;w[F]=r=>!r&&c.charCodeAt(m+1)!==F&&q();for(let r=B;r<=G;r++)w[r]=e=>e?void 0:q();w[B]=r=>{if(r)return;let e=d.number;if(e){for(let[t,o]of Object.entries(e))if(t[0]==="0"&&c[m+1]?.toLowerCase()===t[1])return h(2),[,parseInt(fr(R(Hr[o])),o)]}return q()};var Kr=92,mr=34,ur=39,jr={n:`
|
|
5
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},cr=r=>(e,t,o="")=>{if(!(e||!d.string?.[String.fromCharCode(r)]))return h(),R(i=>i-r&&(i===Kr?(o+=jr[c[m+1]]||c[m+1],2):(o+=c[m],1))),c[m]===String.fromCharCode(r)?h():N("Bad string"),[,o]};w[mr]=cr(mr);w[ur]=cr(ur);d.string={'"':!0};var Wr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>u(r,Wr,!0));var Ar=(r,e,t,o)=>typeof r=="string"?i=>e(i,r,i):r[0]==="."?(t=n(r[1]),o=r[2],i=>e(t(i),o,i)):r[0]==="[]"&&r.length===3?(t=n(r[1]),o=n(r[2]),i=>e(t(i),o(i),i)):r[0]==="()"&&r.length===2?Ar(r[1],e):(()=>{throw Error("Invalid assignment target")})(),dr={"=":(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 dr)s(r,(e,t)=>(t=n(t),Ar(e,(o,i,p)=>dr[r](o,i,t(p)))));var zr=30,Jr=40,gr=140;u("!",gr);k("!",gr);u("||",zr);u("&&",Jr);s("!",r=>(r=n(r),e=>!r(e)));s("||",(r,e)=>(r=n(r),e=n(e),t=>r(t)||e(t)));s("&&",(r,e)=>(r=n(r),e=n(e),t=>r(t)&&e(t)));var Vr=50,Yr=60,Zr=70,hr=100,qr=140;u("|",Vr);u("&",Zr);u("^",Yr);u(">>",hr);u("<<",hr);k("~",qr);s("~",r=>(r=n(r),e=>~r(e)));s("|",(r,e)=>(r=n(r),e=n(e),t=>r(t)|e(t)));s("&",(r,e)=>(r=n(r),e=n(e),t=>r(t)&e(t)));s("^",(r,e)=>(r=n(r),e=n(e),t=>r(t)^e(t)));s(">>",(r,e)=>(r=n(r),e=n(e),t=>r(t)>>e(t)));s("<<",(r,e)=>(r=n(r),e=n(e),t=>r(t)<<e(t)));var X=90;u("<",X);u(">",X);u("<=",X);u(">=",X);s(">",(r,e)=>(r=n(r),e=n(e),t=>r(t)>e(t)));s("<",(r,e)=>(r=n(r),e=n(e),t=>r(t)<e(t)));s(">=",(r,e)=>(r=n(r),e=n(e),t=>r(t)>=e(t)));s("<=",(r,e)=>(r=n(r),e=n(e),t=>r(t)<=e(t)));var yr=80;u("==",yr);u("!=",yr);s("==",(r,e)=>(r=n(r),e=n(e),t=>r(t)==e(t)));s("!=",(r,e)=>(r=n(r),e=n(e),t=>r(t)!=e(t)));var Cr=110,x=120,Sr=140;u("+",Cr);u("-",Cr);u("*",x);u("/",x);u("%",x);k("+",Sr);k("-",Sr);s("+",(r,e)=>e!==void 0?(r=n(r),e=n(e),t=>r(t)+e(t)):(r=n(r),t=>+r(t)));s("-",(r,e)=>e!==void 0?(r=n(r),e=n(e),t=>r(t)-e(t)):(r=n(r),t=>-r(t)));s("*",(r,e)=>(r=n(r),e=n(e),t=>r(t)*e(t)));s("/",(r,e)=>(r=n(r),e=n(e),t=>r(t)/e(t)));s("%",(r,e)=>(r=n(r),e=n(e),t=>r(t)%e(t)));var $=150;E("++",$,r=>r?["++",r,null]:["++",A($-1)]);E("--",$,r=>r?["--",r,null]:["--",A($-1)]);var b=(r,e,t,o)=>typeof r=="string"?i=>e(i,r):r[0]==="."?(t=n(r[1]),o=r[2],i=>e(t(i),o)):r[0]==="[]"&&r.length===3?(t=n(r[1]),o=n(r[2]),i=>e(t(i),o(i))):r[0]==="()"&&r.length===2?b(r[1],e):(()=>{throw Error("Invalid increment target")})();s("++",(r,e)=>b(r,e===null?(t,o)=>t[o]++:(t,o)=>++t[o]));s("--",(r,e)=>b(r,e===null?(t,o)=>t[o]--:(t,o)=>--t[o]));var xr=5,br=10,re=170;_("()",re);Y(",",br);Y(";",xr,!0);var Er=(...r)=>(r=r.map(n),e=>{let t;for(let o of r)t=o(e);return t});s(",",Er);s(";",Er);var a=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",rr=170;Z("[]",rr);u(".",rr);Z("()",rr);var Q=r=>{throw Error(r)};s("[]",(r,e)=>e===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(t=>t==null?(()=>{}):t[0]==="..."?(t=n(t[1]),o=>t(o)):(t=n(t),o=>[t(o)])),t=>r.flatMap(o=>o(t))):(e==null&&Q("Missing index"),r=n(r),e=n(e),t=>{let o=e(t);return a(o)?void 0:r(t)[o]}));s(".",(r,e)=>(r=n(r),e=e[0]?e:e[1],a(e)?()=>{}:t=>r(t)[e]));s("()",(r,e)=>{if(e===void 0)return r==null?Q("Empty ()"):n(r);let t=i=>i?.[0]===","&&i.slice(1).some(p=>p==null||t(p));t(e)&&Q("Empty argument");let o=e?e[0]===","?(e=e.slice(1).map(n),i=>e.map(p=>p(i))):(e=n(e),i=>[e(i)]):()=>[];return er(r,(i,p,l)=>i[p](...o(l)))});var T=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&T(r[1])||r[0]==="{}"),er=(r,e,t,o)=>r==null?Q("Empty ()"):r[0]==="()"&&r.length==2?er(r[1],e):typeof r=="string"?i=>e(i,r,i):r[0]==="."?(t=n(r[1]),o=r[2],i=>e(t(i),o,i)):r[0]==="?."?(t=n(r[1]),o=r[2],i=>{let p=t(i);return p==null?void 0:e(p,o,i)}):r[0]==="[]"&&r.length===3?(t=n(r[1]),o=n(r[2]),i=>e(t(i),o(i),i)):r[0]==="?.[]"?(t=n(r[1]),o=n(r[2]),i=>{let p=t(i);return p==null?void 0:e(p,o(i),i)}):(r=n(r),i=>e([r(i)],0,i)),O=er;var wr=new WeakMap,ee=(r,...e)=>typeof r=="string"?n(d(r)):wr.get(r)||wr.set(r,te(r,e)).get(r),Ir=57344,te=(r,e)=>{let t=r.reduce((p,l,f)=>p+(f?String.fromCharCode(Ir+f-1):"")+l,""),o=d(t),i=p=>{if(typeof p=="string"&&p.length===1){let l=p.charCodeAt(0)-Ir,f;if(l>=0&&l<e.length)return f=e[l],oe(f)?f:[,f]}return Array.isArray(p)?p.map(i):p};return n(i(o))},oe=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),ne=ee;var ie=32,se=d.space;d.comment??={"//":`
|
|
6
6
|
`,"/*":"*/"};var tr;d.space=()=>{tr||(tr=Object.entries(d.comment).map(([i,p])=>[i,p,i.charCodeAt(0)]));for(var r;r=se();){for(var e=0,t;t=tr[e++];)if(r===t[2]&&c.substr(m,t[0].length)===t[0]){var o=m+t[0].length;if(t[1]===`
|
|
7
|
-
`)for(;c.charCodeAt(o)>=ie;)o++;else{for(;c[o]&&c.substr(o,t[1].length)!==t[1];)o++;c[o]&&(o+=t[1].length)}U(o),r=0;break}if(r)return r}return r};var
|
|
8
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},
|
|
7
|
+
`)for(;c.charCodeAt(o)>=ie;)o++;else{for(;c[o]&&c.substr(o,t[1].length)!==t[1];)o++;c[o]&&(o+=t[1].length)}U(o),r=0;break}if(r)return r}return r};var kr=80;u("===",kr);u("!==",kr);s("===",(r,e)=>(r=n(r),e=n(e),t=>r(t)===e(t)));s("!==",(r,e)=>(r=n(r),e=n(e),t=>r(t)!==e(t)));var pe=30;u("??",pe);s("??",(r,e)=>(r=n(r),e=n(e),t=>r(t)??e(t)));var le=130,fe=20;u("**",le,!0);u("**=",fe,!0);s("**",(r,e)=>(r=n(r),e=n(e),t=>r(t)**e(t)));var me=r=>{throw Error(r)};s("**=",(r,e)=>(T(r)||me("Invalid assignment target"),e=n(e),O(r,(t,o,i)=>t[o]**=e(i))));var Nr=90;u("in",Nr);u("of",Nr);s("in",(r,e)=>(r=n(r),e=n(e),t=>r(t)in e(t)));var ue=20,ce=100,de=r=>{throw Error(r)};u(">>>",ce);u(">>>=",ue,!0);s(">>>",(r,e)=>(r=n(r),e=n(e),t=>r(t)>>>e(t)));s(">>>=",(r,e)=>(T(r)||de("Invalid assignment target"),e=n(e),O(r,(t,o,i)=>t[o]>>>=e(i))));var Ae=r=>r[0]?.[0]===","?r[0].slice(1):r,H=(r,e,t)=>{if(typeof r=="string"){t[r]=e;return}let[o,...i]=r,p=Ae(i);if(o==="{}"){let l=[];for(let f of p){if(Array.isArray(f)&&f[0]==="..."){let S={};for(let L in e)l.includes(L)||(S[L]=e[L]);t[f[1]]=S;break}let g,C,I;typeof f=="string"?g=C=f:f[0]==="="?(typeof f[1]=="string"?g=C=f[1]:[,g,C]=f[1],I=f[2]):[,g,C]=f,l.push(g);let y=e[g];y===void 0&&I&&(y=n(I)(t)),H(C,y,t)}}else if(o==="[]"){let l=0;for(let f of p){if(f===null){l++;continue}if(Array.isArray(f)&&f[0]==="..."){t[f[1]]=e.slice(l);break}let g=f,C;Array.isArray(f)&&f[0]==="="&&([,g,C]=f);let I=e[l++];I===void 0&&C&&(I=n(C)(t)),H(g,I,t)}}};var or=20,K=r=>{throw Error(r)};u("||=",or,!0);u("&&=",or,!0);u("??=",or,!0);s("=",(r,e)=>{if(Array.isArray(r)&&(r[0]==="let"||r[0]==="const"||r[0]==="var")){let t=r[1];return e=n(e),typeof t=="string"?o=>{o[t]=e(o)}:o=>H(t,e(o),o)}return T(r)||K("Invalid assignment target"),e=n(e),O(r,(t,o,i)=>t[o]=e(i))});s("||=",(r,e)=>(T(r)||K("Invalid assignment target"),e=n(e),O(r,(t,o,i)=>t[o]||=e(i))));s("&&=",(r,e)=>(T(r)||K("Invalid assignment target"),e=n(e),O(r,(t,o,i)=>t[o]&&=e(i))));s("??=",(r,e)=>(T(r)||K("Invalid assignment target"),e=n(e),O(r,(t,o,i)=>t[o]??=e(i))));var j=(r,e,t,o=r.charCodeAt(0),i=r.length,p=w[o],l)=>w[o]=(f,g,C,I=m)=>!f&&(C?r==C:(i<2||c.substr(m,i)==r)&&(C=r))&&g<e&&!d.id(c.charCodeAt(m+i))&&pr(m+i)!==58&&(U(m+i),(l=t())?V(l,I):U(I),l)||p?.(f,g,C);P("true",!0);P("false",!1);P("null",null);j("undefined",200,()=>[]);P("NaN",NaN);P("Infinity",1/0);var nr=20;E("?",nr,(r,e,t)=>r&&(e=A(nr-1))&&R(o=>o===58)&&(t=A(nr-1),["?",r,e,t]));s("?",(r,e,t)=>(r=n(r),e=n(e),t=n(t),o=>r(o)?e(o):t(o)));var Rr=[];var ge=20;u("=>",ge,!0);s("=>",(r,e)=>{r=r?.[0]==="()"?r[1]:r;let t=r?r[0]===","?r.slice(1):[r]:[],o=-1,i=null,p=t[t.length-1];Array.isArray(p)&&p[0]==="..."&&(o=t.length-1,i=p[1],t.length--);let l=e?.[0]==="{}";return e=n(l?["{",e[1]]:e),f=>(...g)=>{let C={};t.forEach((y,S)=>C[y]=g[S]),i&&(C[i]=g.slice(o));let I=new Proxy(C,{get:(y,S)=>S in y?y[S]:f?.[S],set:(y,S,L)=>((S in y?y:f)[S]=L,!0),has:(y,S)=>S in y||(f?S in f:!1)});try{let y=e(I);return l?void 0:y}catch(y){if(y===Rr)return y[0];throw y}}});var he=140;k("...",he);s("...",r=>(r=n(r),e=>Object.entries(r(e))));var Tr=170;E("?.",Tr,(r,e)=>{if(!r)return;let t=v();return t===40?(h(),["?.()",r,A(0,41)||null]):t===91?(h(),["?.[]",r,A(0,93)]):(e=A(Tr),e?["?.",r,e]:void 0)});s("?.",(r,e)=>(r=n(r),a(e)?()=>{}:t=>r(t)?.[e]));s("?.[]",(r,e)=>(r=n(r),e=n(e),t=>{let o=e(t);return a(o)?void 0:r(t)?.[o]}));s("?.()",(r,e)=>{let t=e?e[0]===","?(e=e.slice(1).map(n),i=>e.map(p=>p(i))):(e=n(e),i=>[e(i)]):()=>[];if(r[0]==="?."){let i=n(r[1]),p=r[2];return a(p)?()=>{}:l=>i(l)?.[p]?.(...t(l))}if(r[0]==="?.[]"){let i=n(r[1]),p=n(r[2]);return l=>{let f=i(l),g=p(l);return a(g)?void 0:f?.[g]?.(...t(l))}}if(r[0]==="."){let i=n(r[1]),p=r[2];return a(p)?()=>{}:l=>i(l)?.[p]?.(...t(l))}if(r[0]==="[]"&&r.length===3){let i=n(r[1]),p=n(r[2]);return l=>{let f=i(l),g=p(l);return a(g)?void 0:f?.[g]?.(...t(l))}}let o=n(r);return i=>o(i)?.(...t(i))});var M=140;k("typeof",M);k("void",M);k("delete",M);j("new",M,()=>lr(".target")?(h(7),["new.target"]):["new",A(M)]);s("typeof",r=>(r=n(r),e=>typeof r(e)));s("void",r=>(r=n(r),e=>(r(e),void 0)));s("delete",r=>{if(r[0]==="."){let e=n(r[1]),t=r[2];return o=>delete e(o)[t]}if(r[0]==="[]"){let e=n(r[1]),t=n(r[2]);return o=>delete e(o)[t(o)]}return()=>!0});s("new",r=>{let e=n(r?.[0]==="()"?r[1]:r),t=r?.[0]==="()"?r[2]:null,o=t?t[0]===","?(i=>p=>i.map(l=>l(p)))(t.slice(1).map(n)):(i=>p=>[i(p)])(n(t)):()=>[];return i=>new(e(i))(...o(i))});var W=Symbol("accessor"),ir=20,ye=40,ar=41,Or=123,vr=125,Pr=r=>e=>{if(e)return;v();let t=R(d.id);if(!t||(v(),c.charCodeAt(m)!==ye))return!1;h();let o=A(0,ar);return v(),c.charCodeAt(m)!==Or?!1:(h(),[r,t,o,A(0,vr)])};E("get",ir-1,Pr("get"));E("set",ir-1,Pr("set"));E("(",ir-1,r=>{if(!r||typeof r!="string")return;let e=A(0,ar)||null;if(v(),c.charCodeAt(m)===Or)return h(),[":",r,["=>",["()",e],A(0,vr)||null]]});s("get",(r,e)=>(e=e?n(e):()=>{},t=>[[W,r,{get:function(){let o=Object.create(t||{});return o.this=this,e(o)}}]]));s("set",(r,e,t)=>(t=t?n(t):()=>{},o=>[[W,r,{set:function(i){let p=Object.create(o||{});p.this=this,p[e]=i,t(p)}}]]));var Ce=20,Lr=200,Se=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);_("[]",Lr);_("{}",Lr);u(":",Ce-1,!0);s("{}",(r,e)=>{if(e!==void 0)return;if(!Se(r))return n(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let t=r.map(o=>n(typeof o=="string"?[":",o,o]:o));return o=>{let i={},p={};for(let l of t.flatMap(f=>f(o)))if(l[0]===W){let[,f,g]=l;p[f]={...p[f],...g,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):()=>{},e=>r(Object.create(e))));s(":",(r,e)=>(e=n(e),Array.isArray(r)?(r=n(r),t=>[[r(t),e(t)]]):t=>[[r,e(t)]]));var Ee=170,z=96,we=36,Ie=123,ke=92,Ne={n:`
|
|
8
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Ur=()=>{let r=[];for(let e="",t;(t=c.charCodeAt(m))!==z;)t?t===ke?(h(),e+=Ne[c[m]]||c[m],h()):t===we&&c.charCodeAt(m+1)===Ie?(e&&r.push([,e]),e="",h(2),r.push(A(0,125))):(e+=c[m],h(),t=c.charCodeAt(m),t===z&&e&&r.push([,e])):N("Unterminated template");return h(),r},Re=w[z];w[z]=(r,e)=>r&&e<Ee?d.asi&&d.newline?void 0:(h(),["``",r,...Ur()]):r?Re?.(r,e):(h(),(t=>t.length<2&&t[0]?.[0]===void 0?t[0]||[,""]:["`",...t])(Ur()));s("`",(...r)=>(r=r.map(n),e=>r.map(t=>t(e)).join("")));s("``",(r,...e)=>{r=n(r);let t=[],o=[];for(let p of e)Array.isArray(p)&&p[0]===void 0?t.push(p[1]):o.push(n(p));let i=Object.assign([...t],{raw:t});return p=>r(p)(i,...o.map(l=>l(p)))});d.string["'"]=!0;d.number={"0x":16,"0b":2,"0o":8};export{Z as access,u as binary,n as compile,c as cur,ne as default,N as err,A as expr,_ as group,Te as id,m as idx,P as literal,V as loc,w as lookup,Y as nary,R as next,s as operator,J as operators,ae as parens,d as parse,pr as peek,sr as prec,U as seek,h as skip,v as space,E as token,k as unary,lr as word};
|