'use strict'; function U(t){return {parse(r,e){let s=t.parse(r,e);switch(s.isOk){case!0:return {isOk:!0,span:[e,e],pos:e,value:s.value};case!1:return {isOk:!1,span:[e,e],pos:e,expected:s.expected}}}}}function l(t){return {parse(r,e){let s=[],n=e;for(;nr)}function i(...t){return {parse(r,e){let s=[],n=e;for(let a of t){let o=a.parse(r,n);switch(o.isOk){case!0:{s.push(o.value),n=o.pos;break}case!1:return o}}return {isOk:!0,span:[e,n],pos:n,value:s}}}}function h(t){return ([r,e])=>e.reduce((s,n)=>t(s,n),r)}function H(t,r,e){return c(i(t,l(r)),h(e))}function f(...t){return {parse(r,e){let[s,...n]=t,a=s.parse(r,e);if(!a.isOk)for(let o of n){let u=o.parse(r,e);switch(u.isOk){case!0:return u;case!1:(!a||a.pos=56320&&a<=57343){e+=4;break}else throw new Error("Malformed Unicode string with missing or invalid low surrogate.")}case n<57344:throw new Error("Malformed Unicode string with invalid high surrogate.");default:{e+=3;break}}}return e}function m(t){return {parse(r,e){let s=Math.min(e+t.length,r.length),n=r.substring(e,s),a=[e,s];switch(n===t){case!0:return {isOk:!0,span:a,pos:s,value:t};case!1:return {isOk:!1,span:a,pos:s,expected:t}}}}}function ce(t){return {parse(r,e){let s=Math.min(e+x(t),r.length),n=r.substring(e,s),a=[e,s];switch(n===t){case!0:return {isOk:!0,span:a,pos:s,value:t};case!1:return {isOk:!1,span:a,pos:s,expected:t}}}}}var k=` `,g=`\r `;function me(){return P(f(m(k),m(g)),"end of line")}function p(t,r){let e=t.global?t:new RegExp(t.source,t.flags+"g");return {parse(s,n){e.lastIndex=n;let a=e.exec(s);if(a&&a.index===n){let[o]=a,u=n+o.length;return {isOk:!0,span:[n,u],pos:u,value:o}}else return {isOk:!1,span:[n,n],pos:n,expected:r}}}}var O=/\p{Letter}/gu,d=/\p{Letter}+/gu;function he(){return p(O,"letter")}function ke(){return p(d,"letters")}function Oe(t){let r=[...t];return {parse(e,s){if(e.length===s)return {isOk:!1,span:[s,s],pos:s,expected:"noneOf @ reached the end of input"};let n=s+1,a=e.substring(s,n);return r.includes(a)?{isOk:!1,span:[s,s],pos:n,expected:`none of: ${r.join(", ")}`}:{isOk:!0,span:[s,n],pos:n,value:a}}}}function y(){return {parse(t,r){return {isOk:!0,span:[r,r],pos:r,value:null}}}}var v=/0[xX][0-9a-fA-F]+/g,w=/0[bB][01]+/g,R=/0[oO][0-8]+/g,b=/(0|[1-9][0-9]*)/g,E=/-?(0|[1-9][0-9]*)/g,S=/-?[0-9]+\.[0-9]+/g;function Re(){return {parse(t,r){let e=p(v,"hexadecimal number").parse(t,r);switch(e.isOk){case!0:return {isOk:!0,span:[r,e.pos],pos:e.pos,value:parseInt(e.value.slice(2),16)};case!1:return e}}}}function be(){return {parse(t,r){let e=p(w,"binary number").parse(t,r);switch(e.isOk){case!0:return {isOk:!0,span:[r,e.pos],pos:e.pos,value:parseInt(e.value.slice(2),2)};case!1:return e}}}}function Ee(){return {parse(t,r){let e=p(R,"octal number").parse(t,r);switch(e.isOk){case!0:return {isOk:!0,span:[r,e.pos],pos:e.pos,value:parseInt(e.value.slice(2),8)};case!1:return e}}}}function Se(){return {parse(t,r){let e=p(b,"whole number").parse(t,r);switch(e.isOk){case!0:return {isOk:!0,span:[r,e.pos],pos:e.pos,value:parseInt(e.value,10)};case!1:return e}}}}function Ae(){return {parse(t,r){let e=p(E,"integer number").parse(t,r);switch(e.isOk){case!0:return {isOk:!0,span:[r,e.pos],pos:e.pos,value:parseInt(e.value,10)};case!1:return e}}}}function Le(){return {parse(t,r){let e=p(S,"float number").parse(t,r);switch(e.isOk){case!0:return {isOk:!0,span:[r,e.pos],pos:e.pos,value:parseFloat(e.value)};case!1:return e}}}}function _e(t){let r=[...t];return {parse(e,s){if(e.length===s)return {isOk:!1,span:[s,s],pos:s,expected:"oneOf @ reached the end of input"};let n=s+1,a=e.substring(s,n);return r.includes(a)?{isOk:!0,span:[s,n],pos:n,value:a}:{isOk:!1,span:[s,s],pos:s,expected:`one of: ${r.join(", ")}`}}}}function Ue(){return {parse(t,r){return {isOk:!0,span:[r,t.length],pos:t.length,value:t.substring(r)}}}}var A=/\s+/g;function Me(){return p(A,"whitespace")}function ze(t){return f(t,y())}function je(t,r){return {parse(e,s){let n=t.parse(e,s);if(n.isOk){let a=l(i(r,t)).parse(e,n.pos),o=[n.value];for(let[,u]of a.value)o.push(u);return {isOk:!0,span:[s,a.pos],pos:a.pos,value:o}}return {isOk:!0,span:[s,s],pos:s,value:[]}}}}function We(t,r){return {parse(e,s){let n=t.parse(e,s);if(n.isOk){let a=l(i(r,t)).parse(e,n.pos),o=[n.value];for(let[,u]of a.value)o.push(u);return {isOk:!0,span:[s,a.pos],pos:a.pos,value:o}}return {isOk:!1,span:[s,n.pos],pos:n.pos,expected:n.expected}}}}var L=([t])=>t,I=([,t])=>t,_=([,t])=>t,G=([t,r,e])=>[t,e];function Je(t,r){return c(i(t,r),L)}function Ke(t,r,e){return c(i(t,r,e),I)}function Ve(t,r){return c(i(t,r),_)}function Ze(t,r,e){return c(i(t,r,e),G)}function rr(t,r){return {parse(e,s){let n=[],a=s;for(;;){let o=r.parse(e,a);switch(o.isOk){case!0:return {isOk:!0,span:[s,o.pos],pos:o.pos,value:[n,o.value]};case!1:{let u=t.parse(e,a);if(u.isOk){n.push(u.value),a=u.pos;continue}return u}}}}}}function tr(t,r){return {parse(e,s){let n=s;for(;;){let a=r.parse(e,n);switch(a.isOk){case!0:return {isOk:!0,span:[s,a.pos],pos:a.pos,value:a.value};case!1:{let o=t.parse(e,n);if(o.isOk){n=o.pos;continue}return o}}}}}}function nr(t,r){return {parse(e,s){let n=t.parse(e,s);switch(n.isOk){case!0:return r({value:n.value,pos:n.pos,input:e}).parse(e,n.pos);case!1:return n}}}} exports.ParserError = T; exports.any = te; exports.attempt = U; exports.binary = be; exports.chainl = H; exports.choice = f; exports.defer = ne; exports.eof = oe; exports.eol = me; exports.error = P; exports.float = Le; exports.grammar = ee; exports.hex = Re; exports.integer = Ae; exports.letter = he; exports.letters = ke; exports.lookahead = Q; exports.many = l; exports.many1 = C; exports.map = c; exports.mapTo = q; exports.noneOf = Oe; exports.nothing = y; exports.octal = Ee; exports.oneOf = _e; exports.optional = ze; exports.regexp = p; exports.rest = Ue; exports.run = J; exports.sepBy = je; exports.sepBy1 = We; exports.sequence = i; exports.skipUntil = tr; exports.string = m; exports.takeLeft = Je; exports.takeMid = Ke; exports.takeRight = Ve; exports.takeSides = Ze; exports.takeUntil = rr; exports.tryRun = V; exports.ustring = ce; exports.when = nr; exports.whitespace = Me; exports.whole = Se; //# sourceMappingURL=out.js.map //# sourceMappingURL=index.cjs.map