subscript 10.8.2 → 10.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/feature/if.js +4 -4
- package/feature/loop.js +7 -3
- package/jessie.min.js +6 -6
- package/package.json +1 -1
package/feature/if.js
CHANGED
|
@@ -16,11 +16,11 @@ export const body = () =>
|
|
|
16
16
|
// would cause the upcoming else-body's parse.step to bail at the first
|
|
17
17
|
// token (statement-precedence boundary), so we clear it once we've confirmed
|
|
18
18
|
// `else` — the else opens a fresh sub-statement.
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
// follows(w) - the same check for any word closing a body: a do's `while`.
|
|
20
|
+
export const follows = (w, from = idx) => {
|
|
21
21
|
if (parse.space() === SEMI) skip();
|
|
22
22
|
parse.space();
|
|
23
|
-
if (word(
|
|
23
|
+
if (word(w)) return skip(w.length), parse.semi = false, true;
|
|
24
24
|
return seek(from), false;
|
|
25
25
|
};
|
|
26
26
|
|
|
@@ -28,6 +28,6 @@ const checkElse = () => {
|
|
|
28
28
|
keyword('if', STATEMENT + 1, () => {
|
|
29
29
|
parse.space();
|
|
30
30
|
const node = ['if', parens(), body()];
|
|
31
|
-
if (
|
|
31
|
+
if (follows('else')) node.push(body());
|
|
32
32
|
return node;
|
|
33
33
|
});
|
package/feature/loop.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Loops: while, do-while, for, for await, break, continue, return - parse half
|
|
2
|
-
import { expr, skip, parse, word, keyword, parens, idx, next, seek, prec, token } from '../parse.js';
|
|
3
|
-
import { body } from './if.js';
|
|
2
|
+
import { expr, skip, parse, word, keyword, parens, idx, next, seek, prec, token, err } from '../parse.js';
|
|
3
|
+
import { body, follows } from './if.js';
|
|
4
4
|
|
|
5
5
|
const STATEMENT = 5, CBRACE = 125, SEMI = 59, COMP = 90;
|
|
6
6
|
|
|
@@ -10,7 +10,11 @@ let inHead = 0;
|
|
|
10
10
|
token('of', COMP, (a, b) => inHead && a && (b = expr(COMP)) && ['of', a, b]);
|
|
11
11
|
|
|
12
12
|
keyword('while', STATEMENT + 1, () => (parse.space(), ['while', parens(), body()]));
|
|
13
|
-
|
|
13
|
+
// A body's `;` stands before its `while` (`do x++; while (c)`), and the test's `)` ends
|
|
14
|
+
// the statement as a `}` does: `do {} while (c) return x` is two statements.
|
|
15
|
+
keyword('do', STATEMENT + 1, b => (
|
|
16
|
+
b = body(), follows('while') || err('Expected while'), parse.space(),
|
|
17
|
+
b = ['do', b, parens()], parse.asi && (parse.newline = true), b));
|
|
14
18
|
|
|
15
19
|
// A for-in/of head is not a plain expression: the grammar makes everything right of
|
|
16
20
|
// the keyword the iteration source, while expression precedence binds relational
|
package/jessie.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var l,m,s=r=>(l=0,m=r,s.enter?.(),r=a(),m[l]?
|
|
1
|
+
var l,m,s=r=>(l=0,m=r,s.enter?.(),r=a(),m[l]?R():r||""),R=(r="Unexpected token",e=l,t=m.slice(0,e).split(`
|
|
2
2
|
`),o=t.pop(),n=m.slice(Math.max(0,e-40),e),p="\u032D",c=(m[e]||" ")+p,u=m.slice(e+1,e+20))=>{throw SyntaxError(`${r} at ${t.length+1}:${o.length+1}
|
|
3
|
-
${n}${c}${u}`)},
|
|
4
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},
|
|
5
|
-
`,"/*":"*/"};s.space=()=>{for(var r,e,t,o,n;r=
|
|
6
|
-
`?n:n+o.length),r=0;break}if(r)return r}return r};var
|
|
7
|
-
`;var Fe=32,Dr=10,go=59,Eo=125,Ue=91,De=40,or=v.asi??v[";"],So=s._baseSpace??=s.space,ko=s._baseStep??=s.step,Br=r=>Array.isArray(r)||typeof r=="string",To=(v[";"]??5)+1,Ur=r=>Array.isArray(r)&&(v[r[0]]<=To||r[0]==="{}"&&Ur(r[1])),No=(r,e)=>{for(;(e=m.charCodeAt(r))<=Fe;){if(e===Dr)return!0;r++}return!1},Ro=(r=l,e)=>{for(;r-- >0&&(e=m.charCodeAt(r))<=Fe;)if(e===Dr)return!0;return!1};s.space=(r,e)=>{for(;;){for(e=l,r=So();e<l;)if(m.charCodeAt(e++)===Dr){s.newline=!0;break}if(r===go&&No(l+1)){k(l+1),s.newline=s.semi=!0;continue}return r}};s.enter=()=>s.newline=s.semi=!1;s.exit=(r,e)=>{e===Eo&&(s.newline=!0,s.semi=!1)};s.step=(r,e,t,o)=>{if(s.semi&&e>=or)return!1;if(r&&!Br(r))return null;if(Br(r)){let p=(t===Ue||t===De)&&Ro();if(s.semi||t===Ue&&(p||Ur(r))||t===De&&(Ur(r)||p&&e>=or))return Ke(r,e,o)??null}let n=s.newline;return ko(r,e,t,o)??(Br(r)&&n?Ke(r,e,o)??null:null)};var Mr=0,Io=2e3,Ke=s.asi=(r,e,t,o,n)=>{if(e>=or||Mr>=Io)return;s.semi=!1;let p=l;Mr++;try{o=t(or-.5)}finally{Mr--}if(!(!o||l===p))return n=o?.[0]===";"?o.slice(1):[o],r?.[0]===";"?(r.push(...n),r):[";",r,...n]};var xe=(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?xe(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),xe(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 Kr=(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?Kr(r[1],e):(()=>{throw Error("Invalid increment target")})();f("++",(r,e)=>Kr(r,e===null?(t,o)=>t[o]++:(t,o)=>++t[o]));f("--",(r,e)=>Kr(r,e===null?(t,o)=>t[o]--:(t,o)=>--t[o]));var He=(...r)=>(r=r.map(i),e=>{let t;for(let o of r)t=o(e);return t});f(",",He);f(";",He);var Qe=r=>r!=null&&(typeof r=="object"||typeof r=="function"),M=r=>Qe(r)?Reflect.ownKeys({[r]:0})[0]:r,P=r=>typeof r=="string"&&(r[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype"),Oo=r=>P(M(r));i.id=r=>r===void 0||Oo(r)?()=>{}:e=>e?.[r];var nr=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&&nr("Missing index"),r=i(r),e=i(e),t=>{let o=M(e(t));return P(o)?void 0:r(t)[o]}));f(".",(r,e)=>(r=i(r),e=M(e[0]?e:e[1]),P(e)?()=>{}:t=>r(t)[e]));f("()",(r,e)=>{if(e===void 0)return r==null?nr("Empty ()"):i(r);let t=p=>p?.[0]===","&&p.slice(1).some(c=>c==null||t(c));t(e)&&nr("Empty argument");let o=e?e[0]===","?(e=e.slice(1).map(i),p=>e.map(c=>c(p))):(e=i(e),p=>[e(p)]):()=>[],n=xr(r);return n<0?()=>{}:Gr(r,n?(p,c,u)=>(c=M(c),P(c)?void 0:p[c](...o(u))):(p,c,u)=>p[c](...o(u)))});var K=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&K(r[1])||r[0]==="{}"),Gr=(r,e,t,o)=>r==null?nr("Empty ()"):r[0]==="()"&&r.length==2?Gr(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)),Fr=r=>Qe(r)?1:P(r)?-1:0,xr=(r,e=r?.[0],t=r?.[2])=>typeof r=="string"?Fr(r):e==="()"&&r.length==2?xr(r[1]):e==="."||e==="?."?Fr(t):(e==="[]"||e==="?.[]")&&r.length===3?Array.isArray(t)&&t[0]==null?Fr(t[1]):1:0,x=(r,e,t=xr(r))=>t<0?()=>{}:Gr(r,t?(o,n,p)=>(n=M(n),P(n)?void 0:e(o,n,p)):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)));var _o=r=>{throw Error(r)};f("**",(r,e)=>(r=i(r),e=i(e),t=>r(t)**e(t)));f("**=",(r,e)=>(K(r)||_o("Invalid assignment target"),e=i(e),x(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 Po=r=>{throw Error(r)};f(">>>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>>e(t)));f(">>>=",(r,e)=>(K(r)||Po("Invalid assignment target"),e=i(e),x(r,(t,o,n)=>t[o]>>>=e(n))));var Lo=r=>r[0]?.[0]===","?r[0].slice(1):r,H=(r,e,t)=>{if(typeof r=="string"){t[r]=e;return}let[o,...n]=r,p=Lo(n);if(o==="{}"){let c=[];for(let u of p){if(Array.isArray(u)&&u[0]==="..."){let g={};for(let I in e)!c.includes(I)&&!P(I)&&(g[I]=e[I]);t[u[1]]=g;break}let d,y,R;typeof u=="string"?d=y=u:u[0]==="="?(typeof u[1]=="string"?d=y=u[1]:[,d,y]=u[1],R=u[2]):[,d,y]=u,c.push(d=M(d));let S=P(d)?void 0:e[d];S===void 0&&R&&(S=i(R)(t)),H(y,S,t)}}else if(o==="[]"){let c=0;for(let u of p){if(u===null){c++;continue}if(Array.isArray(u)&&u[0]==="..."){t[u[1]]=e.slice(c);break}let d=u,y;Array.isArray(u)&&u[0]==="="&&([,d,y]=u);let R=e[c++];R===void 0&&y&&(R=i(y)(t)),H(d,R,t)}}},Hr=(...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=>H(t,n(p),p)}return i(e)}),e=>{for(let t of r)t(e)});f("let",Hr);f("const",Hr);f("var",Hr);var ir=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=>H(t,e(o),o)}return K(r)||ir("Invalid assignment target"),e=i(e),x(r,(t,o,n)=>t[o]=e(n))});f("||=",(r,e)=>(K(r)||ir("Invalid assignment target"),e=i(e),x(r,(t,o,n)=>t[o]||=e(n))));f("&&=",(r,e)=>(K(r)||ir("Invalid assignment target"),e=i(e),x(r,(t,o,n)=>t[o]&&=e(n))));f("??=",(r,e)=>(K(r)||ir("Invalid assignment target"),e=i(e),x(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 B=[];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 c=e?.[0]==="{}";return e=i(c?["{",e[1]]:e),u=>(...d)=>{let y={};t.forEach((S,g)=>y[S]=d[g]),n&&(y[n]=d.slice(o));let R=new Proxy(y,{get:(S,g)=>g in S?S[g]:u?.[g],set:(S,g,I)=>((g in S?S:u)[g]=I,!0),has:(S,g)=>g in S||(u?g in u:!1)});try{let S=e(R);return c?void 0:S}catch(S){if(S===B)return S[0];throw S}}});f("...",r=>(r=i(r),e=>{let t=r(e),o=[];for(let n of Object.keys(t))P(n)||o.push([n,t[n]]);return o}));f("?.",(r,e)=>(r=i(r),e=M(e),P(e)?()=>{}:t=>r(t)?.[e]));f("?.[]",(r,e)=>(r=i(r),e=i(e),t=>{let o=r(t);if(o==null)return;let n=M(e(t));return P(n)?void 0:o[n]}));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=r[0]==="?.",p=i(r[1]),c=M(r[2]);return P(c)?()=>{}:n?u=>p(u)?.[c]?.(...t(u)):u=>p(u)[c]?.(...t(u))}if((r[0]==="[]"||r[0]==="?.[]")&&r.length===3){let n=r[0]==="?.[]",p=i(r[1]),c=i(r[2]);return u=>{let d=p(u);if(n&&d==null)return;let y=M(c(u));return P(y)?void 0:d[y]?.(...t(u))}}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(c=>c(p)))(t.slice(1).map(i)):(n=>p=>[n(p)])(i(t)):()=>[];return n=>new(e(n))(...o(n))});var sr=Symbol("accessor");f("get",(r,e)=>(e=e?i(e):()=>{},t=>[[sr,r,{get:function(){let o=Object.create(t||{});return o.this=this,e(o)}}]]));f("set",(r,e,t)=>(t=t?i(t):()=>{},o=>[[sr,r,{set:function(n){let p=Object.create(o||{});p.this=this,p[e]=n,t(p)}}]]));var vo=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);f("{}",(r,e)=>{if(e!==void 0)return;if(!vo(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 c of t.flatMap(u=>u(o)))if(c[0]===sr){let[,u,d]=c;p[u]={...p[u],...d,configurable:!0,enumerable:!0}}else n[c[0]]=c[1];for(let c in p)Object.defineProperty(n,c,p[c]);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(c=>c(p)))});f("function",(r,e,t)=>{t=t?i(t):()=>{};let o=e?e[0]===","?e.slice(1):[e]:[],n=null,p=-1,c=o[o.length-1];return Array.isArray(c)&&c[0]==="..."&&(p=o.length-1,n=c[1],o.length--),u=>{let d=(...y)=>{let R={};o.forEach((g,I)=>R[g]=y[I]),n&&(R[n]=y.slice(p));let S=new Proxy(R,{get:(g,I)=>I in g?g[I]:u[I],set:(g,I,$e)=>((I in g?g:u)[I]=$e,!0),has:(g,I)=>I in g||I in u});try{return t(S)}catch(g){if(g===B)return g[0];throw g}};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 Bo=Symbol("static"),Mo=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?.(o),p=function(...c){if(!(this instanceof p))return Mo("Class constructor must be called with new");let u=e?Reflect.construct(n,c,p):this;return p.prototype.__constructor__&&p.prototype.__constructor__.apply(u,c),u};if(e&&(Object.setPrototypeOf(p.prototype,n.prototype),Object.setPrototypeOf(p,n)),t){let c=Object.create(o);e&&(c.super=n);let u=t(c),d=Array.isArray(u)&&typeof u[0]?.[0]=="string"?u:[];for(let[y,R]of d)y==="constructor"?p.prototype.__constructor__=R:p.prototype[y]=R}return r&&(o[r]=p),p}));f("static",r=>(r=i(r),e=>[[Bo,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 F=Symbol("break"),Q=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===F)break;if(n===Q)continue;if(n===B)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===F)break;if(n===Q)continue;if(n===B)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 c;for(t?.(p);o(p);n?.(p))try{c=e(p)}catch(u){if(u===F)break;if(u===Q)continue;if(u===B)return u[0];throw u}return c}}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 Do(o,n,e);if(t==="of")return Uo(o,n,e)}});var Uo=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,c=o?null:n[r];for(let u of e(n)){o?H(r,u,n):n[r]=u;try{p=t(n)}catch(d){if(d===F)break;if(d===Q)continue;if(d===B)return d[0];throw d}}return o||(n[r]=c),p}},Do=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,c=o?null:n[r];for(let u in e(n)){o?H(r,u,n):n[r]=u;try{p=t(n)}catch(d){if(d===F)break;if(d===Q)continue;if(d===B)return d[0];throw d}}return o||(n[r]=c),p}};f("break",()=>()=>{throw F});f("continue",()=>()=>{throw Q});f("return",r=>(r=r!==void 0?i(r):null,e=>{throw B[0]=r?.(e),B}));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,c=o?.[1]?i(o[1]):null;return u=>{let d;try{d=r?.(u)}catch(y){if(y===F||y===Q||y===B)throw y;if(n!=null&&p){let R=n in u,S=u[n];u[n]=y;try{d=p(u)}finally{R?u[n]=S:delete u[n]}}else if(!p)throw y}finally{c?.(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,c=0;c<d.length;c++)try{p=d[c](t)}catch(y){if(y===F)return p;throw y}var c;return p}):t=>r(t)));f("import",()=>()=>{});f("export",()=>()=>{});f("from",(r,e)=>()=>{});f("as",(r,e)=>()=>{});f("default",r=>i(r));var Xe=new WeakMap,Ko=(r,...e)=>typeof r=="string"?i(s(r)):Xe.get(r)||Xe.set(r,Fo(r,e)).get(r),je=57344,Fo=(r,e)=>{let t=r.reduce((p,c,u)=>p+(u?String.fromCharCode(je+u-1):"")+c,""),o=s(t),n=p=>{if(typeof p=="string"&&p.length===1){let c=p.charCodeAt(0)-je,u;if(c>=0&&c<e.length)return u=e[c],Go(u)?u:[,u]}return Array.isArray(p)?p.map(n):p};return i(n(o))},Go=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),xo=Ko;export{lr as access,A as binary,i as compile,m as cur,xo as default,O as err,a as expr,z as group,Ho as id,l as idx,w as keyword,$ as literal,We as loc,N as lookup,Xr as member,fr as nary,T as next,f as operator,pr as operators,L as parens,s as parse,U as peek,v as prec,ur as propName,k as seek,h as skip,C as token,_ as unary,E as word};
|
|
3
|
+
${n}${c}${u}`)},qe=(r,e=l)=>(Array.isArray(r)&&(r.loc=e),r),T=(r,e=l,t)=>{for(;t=r(m.charCodeAt(l));)l+=t;return m.slice(e,l)},h=(r=1)=>m[l+=r],k=r=>l=r,a=(r=0,e)=>{let t,o,n;for(e&&s.enter?.(r,e);(t=s.space())&&t!==e&&(n=s.step(o,r,t,a));)o=n;return e&&(t==e?(l++,s.exit?.(r,e)):R("Unclosed "+String.fromCharCode(e-(e>42?2:1)))),o},U=(r=l)=>{for(;m.charCodeAt(r)<=32;)r++;return m.charCodeAt(r)},Ho=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,E=(r,e=r.length)=>m.substr(l,e)===r&&!s.id(m.charCodeAt(l+e)),L=()=>(h(),a(0,41)),N=[],v={},C=(r,e=32,t,o=r.charCodeAt(0))=>$r({op:r,l:r.length,p:v[r]=!N[o]&&v[r]||e,map:t,word:r.toUpperCase()!==r,kw:!1}),A=(r,e,t=!1)=>C(r,e,(o,n)=>o&&(n=a(e-(t?.5:0)))&&[r,o,n]),_=(r,e,t)=>C(r,e,o=>t?o&&[r,o]:!o&&(o=a(e-.5))&&[r,o]),$=(r,e)=>C(r,200,t=>!t&&[,e]),fr=(r,e,t,o)=>C(r,e,(n,p,c=n)=>(p=a(e-(t?.5:0)),n?.[0]!==r&&(n=[r,n||null]),p?.[0]===r?n.push(...p.slice(1)):p?n.push(p):o||U()===r.charCodeAt(0)?n.push(null):c&&n.length===2&&(n=n[1]),n)),z=(r,e)=>C(r[0],e,t=>!t&&[r,a(0,r.charCodeAt(1))||null]),lr=(r,e)=>C(r[0],e,t=>t&&[r,t,a(0,r.charCodeAt(1))||null]),ur=(r,e)=>(s.space(),e=m.charCodeAt(l),s.id(e)&&(e<48||e>57)?T(s.id):a(r)),jr=(r,e)=>C(r,e,(t,o)=>t&&(o=ur(e))&&[r,t,o]),w=(r,e,t)=>(v[r]??=e,$r({op:r,l:r.length,p:e,map:t,word:!0,kw:!0})),Xr=(r,e,t=(o,n,p,c=l,u,d,y)=>{for(y=0;d=r[y++];)if(!(d.kw&&o)&&!(p?d.op!==p:!((d.l<2||d.op.charCodeAt(1)===m.charCodeAt(l+1)&&(d.l<3||m.substr(l,d.l)===d.op))&&(!d.word||!s.id(m.charCodeAt(l+d.l)))&&(p=d.op)))&&!(n>=d.p)&&!(d.kw&&s.prop&&!s.prop(l+d.l))){if(l+=d.l,u=d.map(o))return qe(u,c);l=c,p=0,d.word||o||e||r[y]||R()}return e?.(o,n,p)})=>(t.ops=r,t.tail=e,t),$r=(r,e=r.op.charCodeAt(0),t=N[e])=>N[e]=t?.ops?Xr([r,...t.ops],t.tail):Xr([r],t);s.space=r=>{for(;(r=m.charCodeAt(l))<=32;)l++;return r};s.step=(r,e,t,o,n)=>(n=N[t])&&n(r,e)||(r?null:T(s.id)||null);var pr={},f=(r,e,t=pr[r])=>pr[r]=(...o)=>e(...o)||t?.(...o),i=r=>Array.isArray(r)?r[0]==null?(e=>()=>e)(r[1]):pr[r[0]]?.(...r.slice(1))??R(`Unknown operator: ${r[0]}`,r?.loc):i.id(r);i.id=r=>r===void 0?()=>{}:e=>e?.[r];var cr=46,X=48,W=57,Wr=69,qr=101,ze=43,Je=45,zr=95,Ve=97,Ye=102,Ze=65,be=70,Jr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),rt=r=>r===cr&&(r=m.charCodeAt(l+1))!==cr&&!(s.id(r)&&r>W&&r!==qr&&r!==Wr)||r>=X&&r<=W||r===zr||((r===Wr||r===qr)&&((r=m.charCodeAt(l+1))>=X&&r<=W||r===ze||r===Je)?2:0),mr=r=>(r=+Jr(T(rt)))!=r?R():[,r],et=r=>e=>e===zr||e>=X&&e<=W&&e-X<r||r===16&&(e>=Ve&&e<=Ye||e>=Ze&&e<=be);s.number=null;N[cr]=r=>!r&&m.charCodeAt(l+1)>=X&&m.charCodeAt(l+1)<=W&&mr();for(let r=X;r<=W;r++)N[r]=e=>e?void 0:mr();N[X]=(r,e)=>{if(!r){for(let t in s.number)if(t[0]==="0"&&(m.charCodeAt(l+1)|32)===t.charCodeAt(1)){h(2);let o=Jr(T(et(e=s.number[t])));return[,parseInt(o,e)]}return mr()}};var oe=92,Vr=34,Yr=39,Zr=117,br=120,ne=123,tt=125,re=10,ot=13,nt={n:`
|
|
4
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},ee=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,te=r=>{if(m.charCodeAt(r)!==oe)return;let e=m.charCodeAt(r+1);if(e===br||e===Zr&&m.charCodeAt(r+2)!==ne){let t=e===br?2:4,o=0,n;for(let p=0;p<t;p++){if((n=ee(m.charCodeAt(r+2+p)))<0)return;o=o*16+n}return[o,2+t]}if(e===Zr){let t=0,o=r+3,n;for(;(n=ee(m.charCodeAt(o)))>=0;)t=t*16+n,o++;if(o>r+3&&t<=1114111&&m.charCodeAt(o)===tt)return[t,o-r+1]}},it=()=>{let r=m.charCodeAt(l+1);if(r===re)return["",2];if(r===ot)return["",m.charCodeAt(l+2)===re?3:2];let e=te(l);if(e){let[t,o]=e;if(t>=55296&&t<=56319){let n=te(l+o);n&&n[0]>=56320&&n[0]<=57343&&(t=65536+(t-55296)*1024+n[0]-56320,o+=n[1])}return[String.fromCodePoint(t),o]}return[nt[m[l+1]]||m[l+1],2]},ar=(r,e=!1)=>{let t=l,o,n;for(;(n=m.charCodeAt(l))-r&&!(e&&(n===0||n===36&&m.charCodeAt(l+1)===ne));){if(n!==oe){h();continue}o||(o=[]),o.push(m.slice(t,l));let[c,u]=it();o.push(c),h(u),t=l}let p=m.slice(t,l);return o?(o.push(p),o.join("")):p},ie=r=>(e,t,o="",n=String.fromCharCode(r))=>{if(!(e||!s.string?.[n]))return h(),o+=ar(r),m[l]===n?h():R("Bad string"),[,o]};N[Vr]=ie(Vr);N[Yr]=ie(Yr);s.string={'"':!0};var st=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>A(r,st,!0));var pt=30,ft=40,lt=140;_("!",lt);A("||",pt);A("&&",ft);var ut=50,ct=60,mt=70,se=100,at=140;A("|",ut);A("&",mt);A("^",ct);A(">>",se);A("<<",se);_("~",at);var Y=90;A("<",Y);A(">",Y);A("<=",Y);A(">=",Y);var pe=80;A("==",pe);A("!=",pe);var fe=110,dr=120,le=140;A("+",fe);A("-",fe);A("*",dr);A("/",dr);A("%",dr);_("+",le);_("-",le);var Z=150;C("++",Z,r=>r?["++",r,null]:["++",a(Z-1)]);C("--",Z,r=>r?["--",r,null]:["--",a(Z-1)]);var dt=5,ht=10;fr(",",ht);fr(";",dt,!0,!0);var At=170;z("()",At);var ue=170,yt=160;lr("[]",ue);jr(".",ue);lr("()",yt);var wt=s.space;s.comment??={"//":`
|
|
5
|
+
`,"/*":"*/"};s.space=()=>{for(var r,e,t,o,n;r=wt();){for(t in e=s.comment)if(r===t.charCodeAt(0)&&(t.length<2||m.charCodeAt(l+1)===t.charCodeAt(1))&&(t.length<3||m.substr(l,t.length)===t)){o=e[t],n=m.indexOf(o,l+t.length),k(n<0?m.length:o===`
|
|
6
|
+
`?n:n+o.length),r=0;break}if(r)return r}return r};var ce=80;A("===",ce);A("!==",ce);var Ct=30;A("??",Ct);var gt=130,Et=20;A("**",gt,!0);A("**=",Et,!0);var St=90;A("in",St);var kt=20,Tt=100;A(">>>",Tt);A(">>>=",kt,!0);var hr=20;A("||=",hr,!0);A("&&=",hr,!0);A("??=",hr,!0);$("true",!0);$("false",!1);$("null",null);w("undefined",200,()=>[]);$("NaN",NaN);$("Infinity",1/0);var Ar=20;C("?",Ar,(r,e,t)=>r&&(e=a(Ar-1))&&T(o=>o===58)&&(t=a(Ar-1),["?",r,e,t]));var Nt=20;A("=>",Nt,!0);var Rt=20;_("...",Rt);var me=170;C("?.",me,(r,e)=>{if(!r)return;let t=s.space();return t===40?(h(),["?.()",r,a(0,41)||null]):t===91?(h(),["?.[]",r,a(0,93)]):(e=ur(me),e?["?.",r,e]:void 0)});var yr=140,ae=160,It=ae+1;_("typeof",yr);_("void",yr);_("delete",yr);var Ot=r=>s.space()===40?(h(),["()",r,a(0,41)||null]):r;w("new",It,()=>E(".target")?(h(7),["new.target"]):["new",Ot(a(ae))]);var _t=20,de=200;s.prop=r=>U(r)!==58;z("[]",de);z("{}",de);A(":",_t-1,!0);var Pt=170,b=96,Lt=36,vt=123,he=()=>{let r=[];for(;;){r.push([,ar(b,!0)]);let e=m.charCodeAt(l);if(e===b)return h(),r;(e!==Lt||m.charCodeAt(l+1)!==vt)&&R("Unterminated template"),h(2),r.push(a(0,125))}},Bt=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],Mt=N[b];N[b]=(r,e)=>r&&e<Pt?s.asi&&s.newline?void 0:(h(),["``",r,...he()]):r?Mt?.(r,e):(h(),Bt(he()));s.string["'"]=!0;s.number={"0x":16,"0b":2,"0o":8};var Ut=92,Dt=117,Kt=123,Ft=125,Gt=183,xt=s.id,Ae=r=>r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102,Ht=(r=l+2,e,t=0,o=0)=>{if(m.charCodeAt(l)!==Ut||m.charCodeAt(l+1)!==Dt)return 0;if(m.charCodeAt(r)===Kt){for(;Ae(e=m.charCodeAt(++r));)t=t*16+(e<=57?e-48:(e&31)+9);return r>l+3&&t<=1114111&&m.charCodeAt(r)===Ft?r-l+1:0}for(;o<4&&Ae(m.charCodeAt(r+o));)o++;return o===4?6:0};s.id=r=>xt(r)||r===Gt||Ht();var wr=5,we=10,Cr=r=>{let e=l,t=a(we-1);return t==null?r:r==="let"&&(t==="in"||t==="of")?(k(e),r):t[0]===","?[r,...t.slice(1)]:[r,t]};w("let",wr+1,()=>Cr("let"));w("const",wr+1,()=>Cr("const"));w("var",wr+1,()=>Cr("var"));var ye=r=>Array.isArray(r)&&r[0]==="="&&typeof r[1]=="string";w("using",200,()=>{let r=l;s.space();let e=m.charCodeAt(l);if(s.id(e)&&(e<48||e>57)){let t=l;if(T(s.id),s.space(),m.charCodeAt(l)===61&&m.charCodeAt(l+1)!==61&&m.charCodeAt(l+1)!==62){k(t);let o=a(we-1);if(o[0]===","?o.slice(1).every(ye):ye(o))return o[0]===","?["using",...o.slice(1)]:["using",o]}}return k(r),"using"});var rr=5,Qt=59,D=()=>(s.space()===123||R("Expected {"),h(),a(rr-.5,125)||null),G=()=>s.space()!==123?a(rr+.5):(h(),a(rr-.5,125)||null),gr=(r,e=l)=>(s.space()===Qt&&h(),s.space(),E(r)?(h(r.length),s.semi=!1,!0):(k(e),!1));w("if",rr+1,()=>{s.space();let r=["if",L(),G()];return gr("else")&&r.push(G()),r});var Xt=200;w("function",Xt,()=>{s.space();let r=!1;m[l]==="*"&&(r=!0,h(),s.space());let e=T(s.id);return e&&s.space(),r?["function*",e,L()||null,D()]:["function",e,L()||null,D()]});var Ce=200,Sr=140,Er=20,ge=40;_("await",Sr);var jt=10,$t=13,Ee=r=>{let e;for(;(e=m.charCodeAt(r))<=32;){if(e===jt||e===$t)return!0;r++}return!1};w("yield",Sr,()=>Ee(l)?["yield"]:(s.space(),m[l]==="*"?(h(),s.space(),["yield*",a(Er)]):["yield",a(Er)]));w("async",Ce,()=>{if(Ee(l))return;if(s.space(),E("function"))return["async",a(Sr)];let r=l,e=a(Ce-.5);if(e?.[0]===":")return[":",e[1],["async",e[2]]];if(e&&U()===ge)return["async",e];if((e||U()===ge)&&(k(r),e=a(Er-.5))?.[0]==="=>")return["async",e]});var Se=200;var Wt=90,qt=175,zt=160,Jt=zt-.5;_("static",qt);A("instanceof",Wt);C("#",Se,r=>{if(r)return;let e=T(s.id);return e?"#"+e:void 0});w("class",Se,()=>{s.space();let r=T(s.id)||null;if(r==="extends")r=null,s.space();else{if(s.space(),!E("extends"))return["class",r,null,D()];h(7),s.space()}return["class",r,a(Jt),D()]});var kr=47,Vt=92,Yt=91,Zt=93;C("/",140,r=>{let e=m.charCodeAt(l);if(r||e===kr||e===42||e===43||e===63)return;let t=!1,o=T(p=>p===Vt?2:p===Yt?(t=!0,1):p===Zt?(t=!1,1):p&&(t||p!==kr));m.charCodeAt(l)===kr||R("Unterminated regex"),h();let n=T(p=>p===103||p===105||p===109||p===115||p===117||p===121);return n?["//",o,n]:["//",o]});var j=5,J=125,V=59,ke=90,Tr=0;C("of",ke,(r,e)=>Tr&&r&&(e=a(ke))&&["of",r,e]);w("while",j+1,()=>(s.space(),["while",L(),G()]));w("do",j+1,r=>(r=G(),gr("while")||R("Expected while"),s.space(),r=["do",r,L()],s.asi&&(s.newline=!0),r));var Te={let:1,const:1,var:1},Re=(r,e=r,t)=>{if(Te[r?.[0]]&&Array.isArray(r[1]))return(e=Re(r[1]))?.[0]==="in"||e?.[0]==="of"?[e[0],[r[0],e[1]],r.length>2?[",",e[2],...r.slice(2)]:e[2]]:r;for(;Array.isArray(e)&&v[e[0]]<v.in&&!Te[e[0]];)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},Ne=()=>{Tr++;try{return Re(L())}finally{Tr--}};w("for",j+1,()=>(s.space(),E("await")?(h(5),s.space(),["for await",Ne(),G()]):["for",Ne(),G()]));w("break",j+1,()=>{s.asi&&(s.newline=!1);let r=l,e=s.space();if(!e||e===J||e===V||s.newline)return["break"];let t=T(s.id);if(!t)return["break"];let o=s.space();return!o||o===J||o===V||s.newline?["break",t]:(k(r),["break"])});w("continue",j+1,()=>{s.asi&&(s.newline=!1);let r=l,e=s.space();if(!e||e===J||e===V||s.newline)return["continue"];let t=T(s.id);if(!t)return["continue"];let o=s.space();return!o||o===J||o===V||s.newline?["continue",t]:(k(r),["continue"])});w("return",j+1,()=>{s.asi&&(s.newline=!1);let r=s.space();return!r||r===J||r===V||s.newline?["return"]:["return",a(j)]});var Nr=5;w("try",Nr+1,()=>{let r=["try",D()];return s.space(),E("catch")&&(h(5),s.space(),r.push(["catch",U()===40?L():null,D()])),s.space(),E("finally")&&(h(7),r.push(["finally",D()])),r});w("throw",Nr+1,()=>{if(s.asi&&(s.newline=!1),s.space(),s.newline)throw SyntaxError("Unexpected newline after throw");return["throw",a(Nr)]});var _e=5,bt=20,Ie=58,ro=59,Rr=125,Ir=0,Pe=(r,e=r.length,t=r.charCodeAt(0),o=N[t])=>N[t]=(n,p,c)=>E(r)&&!n&&Ir&&(!s.prop||s.prop(l+e))||o?.(n,p,c);Pe("case");Pe("default");var Oe=r=>{let e=[];for(;(r=s.space())!==Rr&&!E("case")&&!E("default");){if(r===ro){h();continue}s.semi=!1,e.push(a(_e+.5))||R()}return e.length>1?[";",...e]:e[0]||null},eo=()=>{s.space()===123||R("Expected {"),h(),Ir++;let r=[];try{for(;s.space()!==Rr;)if(E("case")){k(l+4),s.space(),s.semi=!1;let e=a(bt-.5);s.space()===Ie&&h(),r.push(["case",e,Oe()])}else E("default")?(k(l+7),s.space()===Ie&&h(),r.push(["default",Oe()])):R("Expected case or default")}finally{Ir--}return h(),s.exit?.(0,Rr),r};w("switch",_e+1,()=>s.space()===40&&["switch",L(),...eo()]);var Or=5,to=20;w("debugger",Or+1,()=>["debugger"]);w("with",Or+1,()=>(s.space(),["with",L(),G()]));var oo=["if","for","while","do","switch","try"];C(":",to-1,r=>typeof r=="string"&&(s.space(),oo.some(e=>E(e)))&&[":",r,a(Or)]);var _r=5,q=10,Le=42,no=34,io=39,ve=(r=U())=>r===no||r===io,so=(r=U())=>ve(r)||s.id(r),po=N[Le];N[Le]=(r,e)=>r?po?.(r,e):(h(),"*");C("from",q+1,r=>r?r[0]!=="="&&r[0]!==","&&ve()&&(s.space(),["from",r,a(q+1)]):!1);C("as",q+2,r=>r?so()&&(s.space(),["as",r,a(q+2)]):!1);w("import",_r,()=>E(".meta")?(h(5),["import.meta"]):["import",a(q)]);w("export",_r,()=>(s.space(),E("default")?(h(7),["export",["default",a(q)]]):["export",a(_r)]));var fo=20,er=200,lo=10,uo=13,co=34,mo=35,ao=39,Be=40,Lr=41,ho=91,vr=123,Br=125,Ao=(r,e)=>{for(;r<e;){let t=m.charCodeAt(r++);if(t===lo||t===uo)return!0}return!1},yo=r=>r===co||r===ao||r===ho||r===mo,Me=()=>T(s.id)||(yo(m.charCodeAt(l))?a(er-.5):null),wo=r=>typeof r=="string"||Array.isArray(r)&&(r[0]===void 0||r[0]==="[]"),tr=r=>e=>{let t=s.newline,o=s.semi,n=r(e);return n||(s.newline=t,s.semi=o),n},Ue=r=>e=>{if(e)return;let t=l;if(s.space(),s.semi||Ao(t,l))return!1;let o=Me();if(!o||(s.space(),m.charCodeAt(l)!==Be))return!1;h();let n=a(0,Lr);return s.space(),m.charCodeAt(l)!==vr?!1:(h(),[r,o,n,a(0,Br)])};C("get",er,tr(Ue("get")));C("set",er,tr(Ue("set")));var Pr=r=>r==null||typeof r=="string"||Array.isArray(r)&&(r[0]===","?r.slice(1).every(Pr):r[0]==="="?typeof r[1]=="string"||Pr(r[1]):r[0]==="..."||r[0]==="{}"||r[0]==="[]"),Co=v["*"];C("*",er,tr(r=>{let e=r&&s.newline;if(r&&!e)return;let t=l,o=Me();if(!o)return r?(k(t),void 0):!1;if(s.space(),m.charCodeAt(l)!==Be)return r?(k(t),void 0):!1;h();let n=a(0,Lr)||null;if(r&&!Pr(n))return k(t),void 0;if(s.space(),m.charCodeAt(l)!==vr)return r?(k(t),void 0):!1;h();let p=[":",o,["function*",null,n,a(0,Br)||null]];return r?r[0]===";"?(r.push(p),r):[";",r,p]:p}));v["*"]=Co;C("(",fo-1,tr(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]),!wo(r))return;let o=a(0,Lr)||null;if(s.space(),m.charCodeAt(l)!==vr)return;h();let n=["function",null,o,a(0,Br)||null];t&&(n=["async",n]);let p=[":",r,n];return e?[e,p]:p}));s.comment["#!"]=`
|
|
7
|
+
`;var Ge=32,Kr=10,go=59,Eo=125,De=91,Ke=40,or=v.asi??v[";"],So=s._baseSpace??=s.space,ko=s._baseStep??=s.step,Mr=r=>Array.isArray(r)||typeof r=="string",To=(v[";"]??5)+1,Dr=r=>Array.isArray(r)&&(v[r[0]]<=To||r[0]==="{}"&&Dr(r[1])),No=(r,e)=>{for(;(e=m.charCodeAt(r))<=Ge;){if(e===Kr)return!0;r++}return!1},Ro=(r=l,e)=>{for(;r-- >0&&(e=m.charCodeAt(r))<=Ge;)if(e===Kr)return!0;return!1};s.space=(r,e)=>{for(;;){for(e=l,r=So();e<l;)if(m.charCodeAt(e++)===Kr){s.newline=!0;break}if(r===go&&No(l+1)){k(l+1),s.newline=s.semi=!0;continue}return r}};s.enter=()=>s.newline=s.semi=!1;s.exit=(r,e)=>{e===Eo&&(s.newline=!0,s.semi=!1)};s.step=(r,e,t,o)=>{if(s.semi&&e>=or)return!1;if(r&&!Mr(r))return null;if(Mr(r)){let p=(t===De||t===Ke)&&Ro();if(s.semi||t===De&&(p||Dr(r))||t===Ke&&(Dr(r)||p&&e>=or))return Fe(r,e,o)??null}let n=s.newline;return ko(r,e,t,o)??(Mr(r)&&n?Fe(r,e,o)??null:null)};var Ur=0,Io=2e3,Fe=s.asi=(r,e,t,o,n)=>{if(e>=or||Ur>=Io)return;s.semi=!1;let p=l;Ur++;try{o=t(or-.5)}finally{Ur--}if(!(!o||l===p))return n=o?.[0]===";"?o.slice(1):[o],r?.[0]===";"?(r.push(...n),r):[";",r,...n]};var He=(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?He(r[1],e):(()=>{throw Error("Invalid assignment target")})(),xe={"=":(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 xe)f(r,(e,t)=>(t=i(t),He(e,(o,n,p)=>xe[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 Fr=(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?Fr(r[1],e):(()=>{throw Error("Invalid increment target")})();f("++",(r,e)=>Fr(r,e===null?(t,o)=>t[o]++:(t,o)=>++t[o]));f("--",(r,e)=>Fr(r,e===null?(t,o)=>t[o]--:(t,o)=>--t[o]));var Qe=(...r)=>(r=r.map(i),e=>{let t;for(let o of r)t=o(e);return t});f(",",Qe);f(";",Qe);var Xe=r=>r!=null&&(typeof r=="object"||typeof r=="function"),M=r=>Xe(r)?Reflect.ownKeys({[r]:0})[0]:r,P=r=>typeof r=="string"&&(r[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype"),Oo=r=>P(M(r));i.id=r=>r===void 0||Oo(r)?()=>{}:e=>e?.[r];var nr=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&&nr("Missing index"),r=i(r),e=i(e),t=>{let o=M(e(t));return P(o)?void 0:r(t)[o]}));f(".",(r,e)=>(r=i(r),e=M(e[0]?e:e[1]),P(e)?()=>{}:t=>r(t)[e]));f("()",(r,e)=>{if(e===void 0)return r==null?nr("Empty ()"):i(r);let t=p=>p?.[0]===","&&p.slice(1).some(c=>c==null||t(c));t(e)&&nr("Empty argument");let o=e?e[0]===","?(e=e.slice(1).map(i),p=>e.map(c=>c(p))):(e=i(e),p=>[e(p)]):()=>[],n=Hr(r);return n<0?()=>{}:xr(r,n?(p,c,u)=>(c=M(c),P(c)?void 0:p[c](...o(u))):(p,c,u)=>p[c](...o(u)))});var K=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&K(r[1])||r[0]==="{}"),xr=(r,e,t,o)=>r==null?nr("Empty ()"):r[0]==="()"&&r.length==2?xr(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)),Gr=r=>Xe(r)?1:P(r)?-1:0,Hr=(r,e=r?.[0],t=r?.[2])=>typeof r=="string"?Gr(r):e==="()"&&r.length==2?Hr(r[1]):e==="."||e==="?."?Gr(t):(e==="[]"||e==="?.[]")&&r.length===3?Array.isArray(t)&&t[0]==null?Gr(t[1]):1:0,x=(r,e,t=Hr(r))=>t<0?()=>{}:xr(r,t?(o,n,p)=>(n=M(n),P(n)?void 0:e(o,n,p)):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)));var _o=r=>{throw Error(r)};f("**",(r,e)=>(r=i(r),e=i(e),t=>r(t)**e(t)));f("**=",(r,e)=>(K(r)||_o("Invalid assignment target"),e=i(e),x(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 Po=r=>{throw Error(r)};f(">>>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>>e(t)));f(">>>=",(r,e)=>(K(r)||Po("Invalid assignment target"),e=i(e),x(r,(t,o,n)=>t[o]>>>=e(n))));var Lo=r=>r[0]?.[0]===","?r[0].slice(1):r,H=(r,e,t)=>{if(typeof r=="string"){t[r]=e;return}let[o,...n]=r,p=Lo(n);if(o==="{}"){let c=[];for(let u of p){if(Array.isArray(u)&&u[0]==="..."){let g={};for(let O in e)!c.includes(O)&&!P(O)&&(g[O]=e[O]);t[u[1]]=g;break}let d,y,I;typeof u=="string"?d=y=u:u[0]==="="?(typeof u[1]=="string"?d=y=u[1]:[,d,y]=u[1],I=u[2]):[,d,y]=u,c.push(d=M(d));let S=P(d)?void 0:e[d];S===void 0&&I&&(S=i(I)(t)),H(y,S,t)}}else if(o==="[]"){let c=0;for(let u of p){if(u===null){c++;continue}if(Array.isArray(u)&&u[0]==="..."){t[u[1]]=e.slice(c);break}let d=u,y;Array.isArray(u)&&u[0]==="="&&([,d,y]=u);let I=e[c++];I===void 0&&y&&(I=i(y)(t)),H(d,I,t)}}},Qr=(...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=>H(t,n(p),p)}return i(e)}),e=>{for(let t of r)t(e)});f("let",Qr);f("const",Qr);f("var",Qr);var ir=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=>H(t,e(o),o)}return K(r)||ir("Invalid assignment target"),e=i(e),x(r,(t,o,n)=>t[o]=e(n))});f("||=",(r,e)=>(K(r)||ir("Invalid assignment target"),e=i(e),x(r,(t,o,n)=>t[o]||=e(n))));f("&&=",(r,e)=>(K(r)||ir("Invalid assignment target"),e=i(e),x(r,(t,o,n)=>t[o]&&=e(n))));f("??=",(r,e)=>(K(r)||ir("Invalid assignment target"),e=i(e),x(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 B=[];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 c=e?.[0]==="{}";return e=i(c?["{",e[1]]:e),u=>(...d)=>{let y={};t.forEach((S,g)=>y[S]=d[g]),n&&(y[n]=d.slice(o));let I=new Proxy(y,{get:(S,g)=>g in S?S[g]:u?.[g],set:(S,g,O)=>((g in S?S:u)[g]=O,!0),has:(S,g)=>g in S||(u?g in u:!1)});try{let S=e(I);return c?void 0:S}catch(S){if(S===B)return S[0];throw S}}});f("...",r=>(r=i(r),e=>{let t=r(e),o=[];for(let n of Object.keys(t))P(n)||o.push([n,t[n]]);return o}));f("?.",(r,e)=>(r=i(r),e=M(e),P(e)?()=>{}:t=>r(t)?.[e]));f("?.[]",(r,e)=>(r=i(r),e=i(e),t=>{let o=r(t);if(o==null)return;let n=M(e(t));return P(n)?void 0:o[n]}));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=r[0]==="?.",p=i(r[1]),c=M(r[2]);return P(c)?()=>{}:n?u=>p(u)?.[c]?.(...t(u)):u=>p(u)[c]?.(...t(u))}if((r[0]==="[]"||r[0]==="?.[]")&&r.length===3){let n=r[0]==="?.[]",p=i(r[1]),c=i(r[2]);return u=>{let d=p(u);if(n&&d==null)return;let y=M(c(u));return P(y)?void 0:d[y]?.(...t(u))}}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(c=>c(p)))(t.slice(1).map(i)):(n=>p=>[n(p)])(i(t)):()=>[];return n=>new(e(n))(...o(n))});var sr=Symbol("accessor");f("get",(r,e)=>(e=e?i(e):()=>{},t=>[[sr,r,{get:function(){let o=Object.create(t||{});return o.this=this,e(o)}}]]));f("set",(r,e,t)=>(t=t?i(t):()=>{},o=>[[sr,r,{set:function(n){let p=Object.create(o||{});p.this=this,p[e]=n,t(p)}}]]));var vo=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);f("{}",(r,e)=>{if(e!==void 0)return;if(!vo(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 c of t.flatMap(u=>u(o)))if(c[0]===sr){let[,u,d]=c;p[u]={...p[u],...d,configurable:!0,enumerable:!0}}else n[c[0]]=c[1];for(let c in p)Object.defineProperty(n,c,p[c]);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(c=>c(p)))});f("function",(r,e,t)=>{t=t?i(t):()=>{};let o=e?e[0]===","?e.slice(1):[e]:[],n=null,p=-1,c=o[o.length-1];return Array.isArray(c)&&c[0]==="..."&&(p=o.length-1,n=c[1],o.length--),u=>{let d=(...y)=>{let I={};o.forEach((g,O)=>I[g]=y[O]),n&&(I[n]=y.slice(p));let S=new Proxy(I,{get:(g,O)=>O in g?g[O]:u[O],set:(g,O,We)=>((O in g?g:u)[O]=We,!0),has:(g,O)=>O in g||O in u});try{return t(S)}catch(g){if(g===B)return g[0];throw g}};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 Bo=Symbol("static"),Mo=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?.(o),p=function(...c){if(!(this instanceof p))return Mo("Class constructor must be called with new");let u=e?Reflect.construct(n,c,p):this;return p.prototype.__constructor__&&p.prototype.__constructor__.apply(u,c),u};if(e&&(Object.setPrototypeOf(p.prototype,n.prototype),Object.setPrototypeOf(p,n)),t){let c=Object.create(o);e&&(c.super=n);let u=t(c),d=Array.isArray(u)&&typeof u[0]?.[0]=="string"?u:[];for(let[y,I]of d)y==="constructor"?p.prototype.__constructor__=I:p.prototype[y]=I}return r&&(o[r]=p),p}));f("static",r=>(r=i(r),e=>[[Bo,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 F=Symbol("break"),Q=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===F)break;if(n===Q)continue;if(n===B)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===F)break;if(n===Q)continue;if(n===B)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 c;for(t?.(p);o(p);n?.(p))try{c=e(p)}catch(u){if(u===F)break;if(u===Q)continue;if(u===B)return u[0];throw u}return c}}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 Do(o,n,e);if(t==="of")return Uo(o,n,e)}});var Uo=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,c=o?null:n[r];for(let u of e(n)){o?H(r,u,n):n[r]=u;try{p=t(n)}catch(d){if(d===F)break;if(d===Q)continue;if(d===B)return d[0];throw d}}return o||(n[r]=c),p}},Do=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,c=o?null:n[r];for(let u in e(n)){o?H(r,u,n):n[r]=u;try{p=t(n)}catch(d){if(d===F)break;if(d===Q)continue;if(d===B)return d[0];throw d}}return o||(n[r]=c),p}};f("break",()=>()=>{throw F});f("continue",()=>()=>{throw Q});f("return",r=>(r=r!==void 0?i(r):null,e=>{throw B[0]=r?.(e),B}));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,c=o?.[1]?i(o[1]):null;return u=>{let d;try{d=r?.(u)}catch(y){if(y===F||y===Q||y===B)throw y;if(n!=null&&p){let I=n in u,S=u[n];u[n]=y;try{d=p(u)}finally{I?u[n]=S:delete u[n]}}else if(!p)throw y}finally{c?.(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,c=0;c<d.length;c++)try{p=d[c](t)}catch(y){if(y===F)return p;throw y}var c;return p}):t=>r(t)));f("import",()=>()=>{});f("export",()=>()=>{});f("from",(r,e)=>()=>{});f("as",(r,e)=>()=>{});f("default",r=>i(r));var je=new WeakMap,Ko=(r,...e)=>typeof r=="string"?i(s(r)):je.get(r)||je.set(r,Fo(r,e)).get(r),$e=57344,Fo=(r,e)=>{let t=r.reduce((p,c,u)=>p+(u?String.fromCharCode($e+u-1):"")+c,""),o=s(t),n=p=>{if(typeof p=="string"&&p.length===1){let c=p.charCodeAt(0)-$e,u;if(c>=0&&c<e.length)return u=e[c],Go(u)?u:[,u]}return Array.isArray(p)?p.map(n):p};return i(n(o))},Go=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),xo=Ko;export{lr as access,A as binary,i as compile,m as cur,xo as default,R as err,a as expr,z as group,Ho as id,l as idx,w as keyword,$ as literal,qe as loc,N as lookup,jr as member,fr as nary,T as next,f as operator,pr as operators,L as parens,s as parse,U as peek,v as prec,ur as propName,k as seek,h as skip,C as token,_ as unary,E as word};
|