Comparing version 0.2.0 to 0.3.0
@@ -16,2 +16,2 @@ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).ModdleXML={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function n(t,e){return t(e={exports:{}},e.exports),e.exports}var i=n((function(t,r){var n,i=e&&e.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(r,"__esModule",{value:!0}),r.DefaultBufferLength=1024;var s=function(){function t(t,e){this.enter=t,this.leave=e,this.result=void 0}return Object.defineProperty(t.prototype,"done",{get:function(){return void 0!==this.result},enumerable:!0,configurable:!0}),t.prototype.doEnter=function(t,e,r){var n=this.enter(t,e,r);return void 0===n||(!1!==n&&(this.result=n),!1)},t}(),o=0,a=function(){function t(t){var e=(void 0===t?{}:t).deserialize;this.id=o++,this.deserialize=e||function(){throw new Error("This node type doesn't define a deserialize function")}}return t.string=function(){return new t({deserialize:function(t){return t}})},t.flag=function(){return new t({deserialize:function(){return!0}})},t.prototype.set=function(t,e){return t[this.id]=e,t},t.prototype.add=function(t){return new u(this,"function"==typeof t?t:O.match(t))},t.error=t.flag(),t.skipped=t.flag(),t.delim=t.string(),t.top=t.flag(),t.repeated=t.flag(),t}();r.NodeProp=a;var u=function(t,e){this.prop=t,this.f=e};r.NodePropSource=u;var O=function(){function t(t,e,r){this.name=t,this.props=e,this.id=r}return t.prototype.prop=function(t){return this.props[t.id]},t.match=function(t){var e=Object.create(null);for(var r in t)for(var n=0,i=r.split(" ");n<i.length;n++){var s=i[n];e[s]=t[r]}return function(t){return e[t.name]}},t.none=new t("",Object.create(null),0),t}();r.NodeType=O;var h=function(){function t(t){this.types=t;for(var e=0;e<t.length;e++)if(t[e].id!=e)throw new RangeError("Node type ids should correspond to array positions when creating a node group")}return t.prototype.extend=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];for(var n=[],i=0,s=this.types;i<s.length;i++){for(var o=s[i],a=null,u=0,h=e;u<h.length;u++){var f=h[u],p=f.f(o);if(void 0!==p){if(!a)for(var c in a=Object.create(null),o.props)a[c]=o.props[c];a[f.prop.id]=p}}n.push(a?new O(o.name,a,o.id):o)}return new t(n)},t}();r.NodeGroup=h;var f=function(){function t(){}return Object.defineProperty(t.prototype,"name",{get:function(){return this.type.name},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"depth",{get:function(){for(var t=0,e=this.parent;e;e=e.parent)t++;return t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){for(var t=this;t.parent;)t=t.parent;return t},enumerable:!0,configurable:!0}),t.prototype.resolve=function(t,e){void 0===e&&(e=0);var r=this.resolveAt(t);if(0!=e)for(;;){var n=e<0?r.childBefore(t):r.childAfter(t);if(!n||(e<0?n.end:n.start)!=t)break;r=n}return r},Object.defineProperty(t.prototype,"firstChild",{get:function(){return this.childAfter(this.start-1)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastChild",{get:function(){return this.childBefore(this.end+1)},enumerable:!0,configurable:!0}),t}();r.Subtree=f;var p=function(t){function e(e,r,n,i){var s=t.call(this)||this;return s.type=e,s.children=r,s.positions=n,s.length=i,s}return i(e,t),Object.defineProperty(e.prototype,"start",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this.length},enumerable:!0,configurable:!0}),e.prototype.toString=function(){var t=this.children.map((function(t){return t.toString()})).join();return this.name?(/\W/.test(this.name)&&!this.type.prop(a.error)?JSON.stringify(this.name):this.name)+(t.length?"("+t+")":""):t},e.prototype.partial=function(t,r,n,i,s){for(var o=0;o<this.children.length;o++){var a=this.positions[o];if(a>r)break;var u=this.children[o],O=a+u.length;O<t||(t<=a&&r>=O?(i.push(u),s.push(a+n)):u instanceof e&&u.partial(t-a,r-a,n+a,i,s))}},e.prototype.applyChanges=function(t){if(0==t.length)return this;var r=[],n=[];function i(t,e,r){for(var n=t.resolve(e),i=e;;){var s=r<0?n.childBefore(i):n.childAfter(i);if(s)return r<0?s.end-1:s.start+1;if(!n.parent)return r<0?0:1e9;i=r<0?n.start:n.end,n=n.parent}}for(var s=0,o=0,a=0;;o++){var u=o==t.length?null:t[o],h=u?i(this,u.fromA,-1):this.length;if(h>a&&this.partial(a,h,s,r,n),!u)break;a=i(this,u.toA,1),s+=u.toB-u.fromB-(u.toA-u.fromA)}return new e(O.none,r,n,this.length+s)},e.prototype.cut=function(t){if(t>=this.length)return this;for(var r=[],n=[],i=0;i<this.children.length;i++){var s=this.positions[i];if(s>=t)break;var o=this.children[i],a=s+o.length;r.push(a<=t?o:o.cut(t-s)),n.push(s)}return new e(this.type,r,n,t)},e.prototype.iterate=function(t){var e=t.from,r=void 0===e?this.start:e,n=t.to,i=void 0===n?this.end:n,o=t.enter,a=t.leave,u=new s(o,a);return this.iterInner(r,i,0,u),u.result},e.prototype.iterInner=function(t,e,r,n){if(!this.type.name||n.doEnter(this.type,r,r+this.length)){if(t<=e)for(var i=0;i<this.children.length&&!n.done;i++){var s=this.children[i],o=(a=this.positions[i]+r)+s.length;if(a>e)break;o<t||s.iterInner(t,e,a,n)}else for(i=this.children.length-1;i>=0&&!n.done;i--){var a;s=this.children[i];if((o=(a=this.positions[i]+r)+s.length)<e)break;a>t||s.iterInner(t,e,a,n)}n.leave&&this.type.name&&n.leave(this.type,r,r+this.length)}},e.prototype.resolveAt=function(t){if(c==this)for(var e=l;;){var r=e.parent;if(!r)break;if(e.start<t&&e.end>t)return e.resolve(t);e=r}return c=this,l=this.resolveInner(t,0,this)},e.prototype.childBefore=function(t){return this.findChild(t,-1,0,this)},e.prototype.childAfter=function(t){return this.findChild(t,1,0,this)},e.prototype.findChild=function(t,r,n,i){for(var s=0;s<this.children.length;s++){var o=this.positions[s]+n,a=-1;if(o>=t)if(r<0&&s>0)a=s-1;else{if(!(r>0))break;a=s}if(a<0&&(o+this.children[s].length>t||r<0&&s==this.children.length-1)&&(a=s),a>=0){var u=this.children[a],O=this.positions[a]+n;if(0==u.length&&O==t)continue;if(u instanceof e)return u.type.name?new w(u,O,i):u.findChild(t,r,O,i);var h=u.findIndex(t,r,O,0,u.buffer.length);if(h>-1)return new g(u,O,h,i)}}return null},e.prototype.resolveInner=function(t,e,r){var n=this.findChild(t,0,e,r);return n?n.resolveAt(t):r},e.prototype.append=function(t){if(t.children.length&&t.positions[0]<this.length)throw new Error("Can't append overlapping trees");return new e(this.type,this.children.concat(t.children),this.positions.concat(t.positions),t.length)},e.prototype.balance=function(t){return void 0===t&&(t=r.DefaultBufferLength),this.children.length<=P?this:S(this.type,this.children,this.positions,0,this.children.length,0,t)},e.build=function(t,e,n,i,s){return void 0===n&&(n=0),void 0===i&&(i=r.DefaultBufferLength),void 0===s&&(s=[]),b(Array.isArray(t)?new v(t,t.length):t,e,n,i,s)},e.empty=new e(O.none,[],[],0),e}(f);r.Tree=p,p.prototype.parent=null;var c=p.empty,l=p.empty,d=function(){function t(t,e,r){this.buffer=t,this.length=e,this.group=r}return t.prototype.toString=function(){for(var t=[],e=0;e<this.buffer.length;)e=this.childToString(e,t);return t.join(",")},t.prototype.childToString=function(t,e){var r=this.buffer[t],n=this.buffer[t+3],i=this.group.types[r],s=i.name;if(/\W/.test(s)&&!i.prop(a.error)&&(s=JSON.stringify(s)),n>(t+=4)){for(var o=[];t<n;)t=this.childToString(t,o);s+="("+o.join(",")+")"}return e.push(s),t},t.prototype.cut=function(e){for(var r=0;r<this.buffer.length&&this.buffer[r+1]<e;)r+=4;for(var n=new Uint16Array(r),i=0;i<r;i+=4)n[i]=this.buffer[i],n[i+1]=this.buffer[i+1],n[i+2]=Math.min(e,this.buffer[i+2]),n[i+3]=Math.min(this.buffer[i+3],r);return new t(n,Math.min(e,this.length),this.group)},t.prototype.iterInner=function(t,e,r,n){if(t<=e)for(var i=0;i<this.buffer.length;)i=this.iterChild(t,e,r,i,n);else this.iterRev(t,e,r,0,this.buffer.length,n)},t.prototype.iterChild=function(t,e,r,n,i){var s=this.group.types[this.buffer[n++]],o=this.buffer[n++]+r,a=this.buffer[n++]+r,u=this.buffer[n++];if(o>e)return this.buffer.length;if(a>=t&&i.doEnter(s,o,a)){for(;n<u&&!i.done;)n=this.iterChild(t,e,r,n,i);i.leave&&i.leave(s,o,a)}return u},t.prototype.parentNodesByEnd=function(t,e){for(var r=this,n=[],i=function(t){var e=r.buffer[t+3];if(e==t+4)return e;for(var s=t+4;s<e;)s=i(s);return n.push(t),e},s=t;s<e;)s=i(s);return n},t.prototype.iterRev=function(t,e,r,n,i,s){var o=this,a=this.parentNodesByEnd(n,i),u=-1,O=-1,h=function(){a.length>0?(u=a.pop(),O=o.buffer[u+3]):O=-1};h();t:for(var f=i;f>n&&!s.done;){for(;O==f;){var p=u,c=this.buffer[p],l=this.buffer[p+1]+r,d=this.buffer[p+2]+r;if(h(),l<=t&&d>=e&&!s.doEnter(this.group.types[c],l,d)){for(f=p;O>p;)h();continue t}}var w=this.buffer[--f],g=this.buffer[--f]+r,v=this.buffer[--f]+r,P=this.buffer[--f];v>t||g<e||(w!=f+4||s.doEnter(this.group.types[P],v,g))&&s.leave&&s.leave(this.group.types[P],v,g)}},t.prototype.findIndex=function(t,e,r,n,i){for(var s=-1,o=n,a=this.buffer;o<i;){var u=a[o+1]+r,O=a[o+2]+r,h=u==O&&u==t;if(u>=t){if(e>0&&!h)return o;break}if(O>t)return o;h||(s=o),o=a[o+3]}return e<0?s:-1},t}();r.TreeBuffer=d;var w=function(t){function e(e,r,n){var i=t.call(this)||this;return i.node=e,i.start=r,i.parent=n,i}return i(e,t),Object.defineProperty(e.prototype,"type",{get:function(){return this.node.type},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this.start+this.node.length},enumerable:!0,configurable:!0}),e.prototype.resolveAt=function(t){return t<=this.start||t>=this.end?this.parent.resolveAt(t):this.node.resolveInner(t,this.start,this)},e.prototype.childBefore=function(t){return this.node.findChild(t,-1,this.start,this)},e.prototype.childAfter=function(t){return this.node.findChild(t,1,this.start,this)},e.prototype.toString=function(){return this.node.toString()},e.prototype.iterate=function(t){var e=t.from,r=void 0===e?this.start:e,n=t.to,i=void 0===n?this.end:n,o=t.enter,a=t.leave,u=new s(o,a);return this.node.iterInner(r,i,this.start,u),u.result},e}(f),g=function(t){function e(e,r,n,i){var s=t.call(this)||this;return s.buffer=e,s.bufferStart=r,s.index=n,s.parent=i,s}return i(e,t),Object.defineProperty(e.prototype,"type",{get:function(){return this.buffer.group.types[this.buffer.buffer[this.index]]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"start",{get:function(){return this.buffer.buffer[this.index+1]+this.bufferStart},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this.buffer.buffer[this.index+2]+this.bufferStart},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endIndex",{get:function(){return this.buffer.buffer[this.index+3]},enumerable:!0,configurable:!0}),e.prototype.childBefore=function(t){var r=this.buffer.findIndex(t,-1,this.bufferStart,this.index+4,this.endIndex);return r<0?null:new e(this.buffer,this.bufferStart,r,this)},e.prototype.childAfter=function(t){var r=this.buffer.findIndex(t,1,this.bufferStart,this.index+4,this.endIndex);return r<0?null:new e(this.buffer,this.bufferStart,r,this)},e.prototype.iterate=function(t){var e=t.from,r=void 0===e?this.start:e,n=t.to,i=void 0===n?this.end:n,o=t.enter,a=t.leave,u=new s(o,a);return r<=i?this.buffer.iterChild(r,i,this.bufferStart,this.index,u):this.buffer.iterRev(r,i,this.bufferStart,this.index,this.endIndex,u),u.result},e.prototype.resolveAt=function(t){if(t<=this.start||t>=this.end)return this.parent.resolveAt(t);var r=this.buffer.findIndex(t,0,this.bufferStart,this.index+4,this.endIndex);return r<0?this:new e(this.buffer,this.bufferStart,r,this).resolveAt(t)},e.prototype.toString=function(){var t=[];return this.buffer.childToString(this.index,t),t.join("")},e}(f),v=function(){function t(t,e){this.buffer=t,this.index=e}return Object.defineProperty(t.prototype,"id",{get:function(){return this.buffer[this.index-4]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"start",{get:function(){return this.buffer[this.index-3]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"end",{get:function(){return this.buffer[this.index-2]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this.buffer[this.index-1]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pos",{get:function(){return this.index},enumerable:!0,configurable:!0}),t.prototype.next=function(){this.index-=4},t.prototype.fork=function(){return new t(this.buffer,this.index)},t}(),P=8,y=a.repeated;function b(t,e,r,n,i){var s=e.types;function o(r,u,O,h){var f,c=t.id,l=t.start,w=t.end,g=t.size,v=l-r;if(g<0)return O.push(i[c]),h.push(v),void t.next();var b,R=s[c];if(w-l<=n&&(f=function(e,r){var i=t.fork(),o=0,a=0,u=0,O=i.end-n;t:for(var h=i.pos-e;i.pos>h;){var f=i.size,p=i.pos-f;if(f<0||p<h||i.start<O||r>-1&&i.id!=r)break;var c=s[i.id].prop(y)?4:0,l=i.start;for(i.next();i.pos>p;){if(i.size<0)break t;s[i.id].prop(y)&&(c+=4),i.next()}a=l,o+=f,u+=c}return o>4?{size:o,start:a,skip:u}:null}(t.pos-u,R.prop(y)?c:-1))){for(var $=new Uint16Array(f.size-f.skip),k=t.pos-f.size,x=$.length;t.pos>k;)x=a(f.start,$,x);b=new d($,w-f.start,e),R.prop(y)&&(b=new p(R,[b],[0],w-f.start)),v=f.start-r}else{k=t.pos-g;t.next();for(var m=[],X=[];t.pos>k;)o(l,k,m,X);m.reverse(),X.reverse(),b=new p(R,m,X,w-l)}O.push(b),h.push(v),!R.prop(y)||0!=t.pos&&t.id==c||function(t,e,r){for(var i=t.length,s=i-1;s>0;s--){var o=t[s-1];if(!(o instanceof p)||o.type!=r)break}if(i-s<P)return;var a=e[i-1],u=S(r,t.slice(s,i).reverse(),e.slice(s,i).reverse(),0,i-s,a,n);t.length=e.length=s+1,t[s]=u,e[s]=a}(O,h,R)}function a(e,r,n){var i=t.id,o=t.start,u=t.end,O=t.size;t.next();var h=n;if(O>4)for(var f=t.pos-(O-4);t.pos>f;)n=a(e,r,n);return s[i].prop(y)||(r[--n]=h,r[--n]=u-e,r[--n]=o-e,r[--n]=i),n}for(var u=[],O=[];t.pos>0;)o(0,0,u,O);var h=u.length?O[0]+u[0].length:0;return new p(e.types[r],u.reverse(),O.reverse(),h)}function S(t,e,r,n,i,s,o){var a=r[i-1]+e[i-1].length-s;if(n==i-1&&0==s){var u=e[n];if(u instanceof p)return u}var O=[],h=[];if(a<=o)for(var f=n;f<i;f++)O.push(e[f]),h.push(r[f]-s);else{var c=Math.max(o,Math.ceil(1.5*a/P));for(f=n;f<i;){var l=f,d=r[f];for(f++;f<i;f++){if(r[f]+e[f].length-d>c)break}if(f==l+1){var w=e[l];if(w instanceof p&&w.type==t){if(w.length>c<<1){for(var g=0;g<w.children.length;g++)O.push(w.children[g]),h.push(w.positions[g]+d-s);continue}}else w=new p(t,[w],[0],w.length);O.push(w)}else O.push(S(t,e,r,l,f,d,o));h.push(d-s)}}return new p(t,O,h,a)}}));r(i);i.DefaultBufferLength,i.NodeProp,i.NodePropSource,i.NodeType,i.NodeGroup,i.Subtree,i.Tree,i.TreeBuffer;var s=n((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}); | ||
***************************************************************************** */ | ||
var r,n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};!function(t){t[t.Unit=100]="Unit",t[t.Deduplicate=200]="Deduplicate",t[t.MaxRecoverStacks=25]="MaxRecoverStacks",t[t.TooBadToRecover=500]="TooBadToRecover",t[t.RecoverSiblingFactor=3]="RecoverSiblingFactor",t[t.MaxParallelBufferLength=800]="MaxParallelBufferLength"}(r||(r={}));var s,o=function(){function t(t,e,r,n,i,s,o,a,u){this.cx=t,this.stack=e,this.state=r,this.reducePos=n,this.pos=i,this.badness=s,this.buffer=o,this.bufferBase=a,this.parent=u}return t.prototype.toString=function(){return"["+this.stack.filter((function(t,e){return e%3==0})).concat(this.state).join(",")+"]"},t.start=function(e,r){return void 0===r&&(r=0),new t(e,[],e.parser.states[0],r,r,0,[],0,null)},t.prototype.pushState=function(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t},t.prototype.reduce=function(t){var e=t>>19,r=65535&t,n=this.cx.parser;if(0==e)return r<=n.maxNode&&this.storeNode(r,this.reducePos,this.reducePos,4,!0),void this.pushState(n.getGoto(this.state,r,!0),this.reducePos);var s=this.stack.length-3*(e-1)-(262144&t?6:0),o=this.stack[s-2],a=this.stack[s-1],u=this.bufferBase+this.buffer.length-a;if(r<=n.maxNode&&(131072&t||!n.group.types[r].prop(i.NodeProp.repeated))){var O=n.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,o,O,u+4,!0)}if(262144&t)this.state=this.stack[s];else{var h=this.stack[s-3];this.state=n.getGoto(h,r,!0)}for(;this.stack.length>s;)this.stack.pop()},t.prototype.storeNode=function(t,e,r,n,i){if(void 0===n&&(n=4),void 0===i&&(i=!1),0==t){var s=this,o=this.buffer.length;if(0==o&&s.parent&&(o=s.bufferBase-s.parent.bufferBase,s=s.parent),o>0&&0==s.buffer[o-4]&&s.buffer[o-1]>-1){if(e==r)return;if(s.buffer[o-2]>=e)return void(s.buffer[o-2]=r)}}if(i&&this.pos!=r){var a=this.buffer.length;if(a>0&&0!=this.buffer[a-4])for(;a>0&&this.buffer[a-2]>r;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,n>4&&(n-=4);this.buffer[a]=t,this.buffer[a+1]=e,this.buffer[a+2]=r,this.buffer[a+3]=n}else this.buffer.push(t,e,r,n)},t.prototype.shift=function(t,e,r){if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){var n=this.pos,i=t,s=this.cx.parser;r>this.pos&&(this.badness=(this.badness>>1)+(this.badness>>2)),(r>this.pos||e<=s.maxNode)&&(this.pos=r,s.stateFlag(i,1)||(this.reducePos=r)),this.pushState(i,n),e<=s.maxNode&&this.buffer.push(e,n,r,4)}else e<=this.cx.parser.maxNode&&this.buffer.push(e,this.pos,r,4),this.pos=r},t.prototype.apply=function(t,e,r){65536&t?this.reduce(t):this.shift(t,e,r)},t.prototype.useNode=function(t,e){var r=this.cx.reused.length-1;(r<0||this.cx.reused[r]!=t)&&(this.cx.reused.push(t),r++);var n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.badness>>=2,this.buffer.push(r,n,this.reducePos,-1)},t.prototype.split=function(){for(var e=this,r=e.buffer.length;r>0&&e.buffer[r-2]>e.reducePos;)r-=4;for(var n=e.buffer.slice(r),i=e.bufferBase+r;e&&i==e.bufferBase;)e=e.parent;return new t(this.cx,this.stack.slice(),this.state,this.reducePos,this.pos,this.badness,n,i,e)},t.prototype.recoverByDelete=function(t,e){var r=t<=this.cx.parser.maxNode;r&&this.storeNode(t,this.pos,e),this.storeNode(0,this.pos,e,r?8:4),this.pos=this.reducePos=e,this.badness+=100},t.prototype.canShift=function(t){for(var e=new a(this);;){var r=this.cx.parser.stateSlot(e.top,4)||this.cx.parser.hasAction(e.top,t);if(0==(65536&r))return!0;if(0==r)return!1;e.reduce(r)}},Object.defineProperty(t.prototype,"ruleStart",{get:function(){var t=this.cx.parser.stateSlot(this.state,5);if(!(65536&t))return 0;var e=this.stack.length-3*(t>>19);return this.stack[e+1]},enumerable:!0,configurable:!0}),t.prototype.startOf=function(t){for(var e=this.stack.length-3;e>=0;e-=3){var r=this.cx.parser.stateSlot(this.stack[e],5);if(t.includes(65535&r)){var n=e-3*(r>>19);return this.stack[n+1]}}return-1},t.prototype.recoverByInsert=function(t){var e=this,r=this.cx.parser.nextStates(this.state);if(r.length>4){for(var n=r.filter((function(r){return r!=e.state&&e.cx.parser.hasAction(r,t)})),i=0;n.length<4&&i<r.length;i++)n.includes(r[i])||n.push(r[i]);r=n}var s=[];for(i=0;i<r.length&&s.length<4;i++)if(r[i]!=this.state){var o=this.split();o.storeNode(0,o.pos,o.pos,4,!0),o.pushState(r[i],this.pos),o.badness+=100,s.push(o)}return s},t.prototype.forceReduce=function(){var t=this.cx.parser.anyReduce(this.state);if(t>>19==0){if(0==(65536&(t=this.cx.parser.stateSlot(this.state,5))))return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.badness+=100}return this.reduce(t),!0},t.prototype.compare=function(t){return this.pos-t.pos||this.badness-t.badness},t.prototype.toTree=function(){return i.Tree.build(u.create(this),this.cx.parser.group,1,this.cx.maxBufferLength,this.cx.reused)},t}();!function(t){t[t.MaxNext=4]="MaxNext"}(s||(s={}));var a=function(){function t(t){this.stack=t,this.top=t.state,this.rest=t.stack,this.offset=this.rest.length}return t.prototype.reduce=function(t){var e=65535&t,r=t>>19;0==r?(this.rest==this.stack.stack&&(this.rest=this.rest.slice()),this.rest.push(this.top,0,0),this.offset+=3):this.offset-=3*(r-1);var n=this.stack.cx.parser.getGoto(this.rest[this.offset-3],e,!0);this.top=n},t}(),u=function(){function t(t,e,r){this.stack=t,this.pos=e,this.index=r,this.buffer=t.buffer,0==this.index&&this.maybeNext()}return t.create=function(e){return new t(e,e.bufferBase+e.buffer.length,e.buffer.length)},t.prototype.maybeNext=function(){var t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)},Object.defineProperty(t.prototype,"id",{get:function(){return this.buffer[this.index-4]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"start",{get:function(){return this.buffer[this.index-3]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"end",{get:function(){return this.buffer[this.index-2]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this.buffer[this.index-1]},enumerable:!0,configurable:!0}),t.prototype.next=function(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()},t.prototype.fork=function(){return new t(this.stack,this.pos,this.index)},t}(),O=function(){function t(){this.start=-1,this.value=-1,this.end=-1}return t.prototype.accept=function(t,e){this.value=t,this.end=e},t}(),h=function(){function t(t,e){void 0===e&&(e=t.length),this.string=t,this.length=e}return t.prototype.get=function(t){return t<0||t>=this.length?-1:this.string.charCodeAt(t)},t.prototype.read=function(t,e){return this.string.slice(t,Math.min(this.length,e))},t.prototype.clip=function(e){return new t(this.string,e)},t}(),f=function(){function t(t,e){this.data=t,this.id=e}return t.prototype.token=function(t,e,r){!function(t,e,r,n,i){var s=0,o=1<<i;t:for(var a=r.start;0!=(o&t[s]);){for(var u=t[s+1],O=s+3;O<u;O+=2)if((t[O+1]&o)>0){var h=t[O];if(-1==r.value||r.value==h||n.cx.parser.overrides(h,r.value)){r.accept(h,a);break}}for(var f=e.get(a++),p=0,c=t[s+2];p<c;){var l=p+c>>1,d=u+l+(l<<1),w=t[d],g=t[d+1];if(f<w)c=l;else{if(!(f>=g)){s=t[d+2];continue t}p=l+1}}break}}(this.data,t,e,r,this.id)},t}();f.prototype.contextual=!1;var p=function(t,e){void 0===e&&(e={}),this.token=t,this.contextual=e&&e.contextual||!1};function c(t,e){void 0===e&&(e=Uint16Array);for(var r=null,n=0,i=0;n<t.length;){for(var s=0;;){var o=t.charCodeAt(n++),a=!1;if(126==o){s=65535;break}o>=92&&o--,o>=34&&o--;var u=o-32;if(u>=46&&(u-=46,a=!0),s+=u,a)break;s*=46}r?r[i++]=s:r=new e(s)}return r}var l="undefined"!=typeof process&&/\bparse\b/.test(process.env.LOG),d=function(){function t(t){this.start=[0],this.index=[0],this.nextStart=0,this.trees=[t]}return t.prototype.nodeAt=function(t){if(t<this.nextStart)return null;for(;;){var e=this.trees.length-1;if(e<0)return this.nextStart=1e9,null;var r=this.trees[e],n=this.index[e];if(n!=r.children.length){var s=r.children[n],o=this.start[e]+r.positions[n];if(s instanceof i.TreeBuffer)this.index[e]++,this.nextStart=o+s.length;else{if(o>=t)return o==t?s:null;this.index[e]++,o+s.length>=t&&(this.trees.push(s),this.start.push(o),this.index.push(0))}}else this.trees.pop(),this.start.pop(),this.index.pop()}},t}(),w=function(t){function e(e){var r=t.call(this)||this;return r.tokenizer=e,r.extended=-1,r.mask=0,r}return function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e.prototype.clear=function(t){this.start=t,this.value=this.extended=-1},e}(O),g=new O,v=function(){function t(){this.tokens=[],this.mainToken=g,this.actions=[]}return t.prototype.getActions=function(t,e){for(var r=0,n=null,i=t.cx.parser,s=i.tokenizers,o=0;o<s.length;o++)if(0!=(1<<o&i.stateSlot(t.state,3))){for(var a=s[o],u=void 0,O=0,h=this.tokens;O<h.length;O++){var f=h[O];if(f.tokenizer==a){u=f;break}}u||this.tokens.push(u=new w(a));var p=i.stateSlot(t.state,3);(a.contextual||u.start!=t.pos||u.mask!=p)&&(this.updateCachedToken(u,t,e),u.mask=p);var c=r;if(u.extended>-1&&(r=this.addActions(t,u.extended,u.end,r)),(r=this.addActions(t,u.value,u.end,r))>c){n=u;break}n&&0==u.value||(n=u)}for(;this.actions.length>r;)this.actions.pop();return n||((n=g).start=t.pos,t.pos==e.length?n.accept(t.cx.parser.eofTerm,t.pos):n.accept(0,t.pos+1)),this.mainToken=n,this.actions},t.prototype.updateCachedToken=function(t,e,r){if(t.clear(e.pos),t.tokenizer.token(r,t,e),t.value>-1){var n=e.cx.parser,i=R(n.data,n.specializeTable,t.value);if(i>=0){var s=n.specializations[i][r.read(t.start,t.end)];null!=s&&(0==(1&s)?t.value=s>>1:t.extended=s>>1)}}else e.pos==r.length?t.accept(e.cx.parser.eofTerm,e.pos):t.accept(0,e.pos+1)},t.prototype.putAction=function(t,e,r,n){for(var i=0;i<n;i+=3)if(this.actions[i]==t)return n;return this.actions[n++]=t,this.actions[n++]=e,this.actions[n++]=r,n},t.prototype.addActions=function(t,e,r,n){for(var i=t.state,s=t.cx.parser,o=s.data,a=0;a<2;a++)for(var u=s.stateSlot(i,a?2:1),O=void 0;65535!=(O=o[u]);u+=3)(O==e||0==O&&0==n)&&(n=this.putAction(o[u+1]|o[u+2]<<16,e,r,n));return n},t}(),P=function(t,e,r,n,i){void 0===n&&(n=null),void 0===i&&(i=-1),this.parser=t,this.maxBufferLength=e,this.input=r,this.parent=n,this.wrapType=i,this.reused=[],this.tokens=new v},y=function(){function t(t,e,r){var n=void 0===r?{}:r,s=n.cache,a=void 0===s?void 0:s,u=n.strict,O=void 0!==u&&u,h=n.bufferLength,f=void 0===h?i.DefaultBufferLength:h;this.stacks=[o.start(new P(t,f,e))],this.strict=O,this.cache=a?new d(a):null}return t.prototype.takeStack=function(){var t=this.stacks,e=t[0],r=t.pop();if(0==t.length)return e;t[0]=r;for(var n=0;;){var i=1+(n<<1);if(i>=t.length)break;var s=t[i];if(i+1<t.length&&s.compare(t[i+1])>=0&&(s=t[i+1],i++),r.compare(s)<0)break;t[i]=r,t[n]=s,n=i}return e},t.prototype.putStack=function(t){if(t.badness>=200)for(var e=0;e<this.stacks.length;e++){var r=this.stacks[e];if(r.state==t.state&&r.pos==t.pos){var n=t.badness-r.badness||t.stack.length-r.stack.length;if(n<0)return this.stacks[e]=t,!0;if(n>=0)return!1}}else if(0==t.badness&&this.stacks.length&&t.buffer.length>800){if(this.stacks.reduce((function(t,e){return Math.max(t,e.buffer.length)}),0)>t.buffer.length)return!1}for(var i=this.stacks.push(t)-1;i>0;){var s=i>>1,o=this.stacks[s];if(t.compare(o)>=0)break;this.stacks[i]=o,this.stacks[s]=t,i=s}return!0},t.prototype.advance=function(){var t=this.takeStack(),e=t.pos,r=t.cx,n=r.input,s=r.parser,a=l?t+" -> ":"";if(this.cache)for(var u=this.cache.nodeAt(e);u;){var O=s.group.types[u.type.id]==u.type?s.getGoto(t.state,u.type.id):-1;if(O>-1&&!k(u))return t.useNode(u,O),l&&console.log(a+t+" (via reuse of "+s.getName(u.type.id)+")"),this.putStack(t),null;if(0==u.children.length||u.positions[0]>0)break;var h=u.children[0];if(!(h instanceof i.Tree))break;u=h}var f=s.startNested(t.state);t:if(f>-1){var p=s.nested[f],c=p.grammar,d=p.end,w=p.placeholder,g=void 0,v=null,y=void 0,b=void 0;if("function"==typeof c){var S=c(n,t);if(S.stay)break t;v=S.parseNode,y=S.parser,g=S.filterEnd,b=S.wrapType}else y=c;var R=this.scanForNestEnd(t,d,g),$=t.cx.input.clip(R);if(v||!y){var x=v?v($,t.pos):i.Tree.empty;x.length!=R-t.pos&&(x=new i.Tree(x.type,x.children,x.positions,R-t.pos)),null!=b&&(x=new i.Tree(s.group.types[b],[x],[0],x.length)),t.useNode(x,s.getGoto(t.state,w,!0)),this.putStack(t)}else{var m=o.start(new P(y,t.cx.maxBufferLength,$,t,b),t.pos);l&&console.log(a+m+" (nested)"),this.putStack(m)}return null}var X=s.stateSlot(t.state,4);if(X>0)return t.reduce(X),this.putStack(t),l&&console.log(a+t+" (via always-reduce "+s.getName(65535&X)+")"),null;for(var j=t.cx.tokens.getActions(t,n),q=0;q<j.length;){var T=j[q++],Q=j[q++],U=j[q++],Z=q==j.length?t:t.split();Z.apply(T,Q,U),l&&console.log(a+Z+" (via "+(0==(65536&T)?"shift":"reduce of "+s.getName(65535&T))+" for "+s.getName(Q)+" @ "+e+(Z==t?"":", split")+")"),this.putStack(Z)}if(j.length>0)return null;if(e==n.length&&s.stateFlag(t.state,2))return this.finishStack(t);var E=this.stacks.reduce((function(t,e){return Math.min(t,e.badness)}),1e9);if(E<=t.badness&&(this.stacks.length>=25||t.badness>Math.min(500,3*E)))return null;var _=t.cx.tokens.mainToken,N=_.end,V=_.value;if(this.strict){if(this.stacks.length)return null;throw new SyntaxError("No parse at "+e+" with "+s.getName(V)+" (stack is "+t+")")}for(var W=0,Y=t.recoverByInsert(V);W<Y.length;W++){var I=Y[W];l&&console.log(a+I+" (via recover-insert)"),this.putStack(I)}var A=t.split();if(A.forceReduce())l&&console.log(a+A+" (via force-reduce)"),this.putStack(A);else if(e==n.length)return this.finishStack(t);if(N==e){if(e==n.length)return null;N++,V=0}return t.recoverByDelete(V,N),l&&console.log(a+t+" (via recover-delete "+s.getName(V)+")"),this.putStack(t),null},t.prototype.finishStack=function(t){return t.cx.parent?(this.putStack(this.finishNested(t)),null):t.toTree()},Object.defineProperty(t.prototype,"pos",{get:function(){return this.stacks[0].pos},enumerable:!0,configurable:!0}),t.prototype.forceFinish=function(){for(var t=this.stacks[0].split();!t.cx.parser.stateFlag(t.state,2)&&t.forceReduce(););return t.toTree()},t.prototype.scanForNestEnd=function(t,e,r){for(var n=t.cx.input,i=t.pos;i<n.length;i++)if(g.start=i,g.value=-1,e.token(n,g,t),g.value>-1&&(!r||r(n.read(i,g.end))))return i;return n.length},t.prototype.finishNested=function(t){var e=t.cx.parent,r=t.toTree(),n=e.cx.parser,s=n.nested[n.startNested(e.state)];return r=new i.Tree(r.type,r.children,r.positions.map((function(t){return t-e.pos})),t.pos-e.pos),t.cx.wrapType>-1&&(r=new i.Tree(n.group.types[t.cx.wrapType],[r],[0],r.length)),e.useNode(r,n.getGoto(e.state,s.placeholder,!0)),l&&console.log(e+" (via unnest "+(t.cx.wrapType>-1?n.getName(t.cx.wrapType):r.type.name)+")"),this.stacks.some((function(t){return t.cx.parent==e}))&&(this.stacks=this.stacks.filter((function(t){return t.cx.parent!=e})).sort((function(t,e){return t.compare(e)}))),e},t}(),b=function(){function t(t,e,r,n,i,s,o,a,u,O){void 0===O&&(O=null),this.states=t,this.data=e,this.goto=r,this.group=n,this.tokenizers=i,this.nested=s,this.specializeTable=o,this.specializations=a,this.tokenPrecTable=u,this.termNames=O,this.nextStateCache=[],this.maxNode=this.group.types.length-1;for(var h=0,f=this.states.length/6;h<f;h++)this.nextStateCache[h]=null}return t.prototype.parse=function(t,e){"string"==typeof t&&(t=new h(t));for(var r=new y(this,t,e);;){var n=r.advance();if(n)return n}},t.prototype.startParse=function(t,e){return new y(this,t,e)},t.prototype.getGoto=function(t,e,r){void 0===r&&(r=!1);var n=this.goto;if(e>=n[0])return-1;for(var i=n[e+1];;){var s=n[i++],o=1&s,a=n[i++];if(o&&r)return a;for(var u=i+(s>>1);i<u;i++)if(n[i]==t)return a;if(o)return-1}},t.prototype.hasAction=function(t,e){for(var r=this.data,n=0;n<2;n++)for(var i=this.stateSlot(t,n?2:1),s=void 0;65535!=(s=r[i]);i+=3)if(s==e||0==s)return r[i+1]|r[i+2]<<16;return 0},t.prototype.stateSlot=function(t,e){return this.states[6*t+e]},t.prototype.stateFlag=function(t,e){return(this.stateSlot(t,0)&e)>0},t.prototype.startNested=function(t){var e=this.stateSlot(t,0);return 4&e?e>>10:-1},t.prototype.anyReduce=function(t){var e=this.stateSlot(t,4);if(e>0)return e;for(var r=this.stateSlot(t,1);;r+=3){if(65535==this.data[r])return 0;var n=this.data[r+2];if(1&n)return this.data[r+1]|n<<16}},t.prototype.nextStates=function(t){var e=this.nextStateCache[t];if(e)return e;for(var r=[],n=this.stateSlot(t,1);65535!=this.data[n];n+=3)0!=(1&this.data[n+2])||r.includes(this.data[n+1])||r.push(this.data[n+1]);for(var i=this.goto,s=i[0],o=0;o<s;o++)for(var a=i[o+1];;){for(var u=i[a++],O=i[a++],h=a+(u>>1);a<h;a++)i[a]!=t||r.includes(O)||r.push(O);if(1&u)break}return this.nextStateCache[t]=r},t.prototype.overrides=function(t,e){var r=R(this.data,this.tokenPrecTable,e);return r<0||R(this.data,this.tokenPrecTable,t)<r},t.prototype.withNested=function(e){return new t(this.states,this.data,this.goto,this.group,this.tokenizers,this.nested.map((function(t){return Object.prototype.hasOwnProperty.call(e,t.name)?{name:t.name,grammar:e[t.name],end:t.end,placeholder:t.placeholder}:t})),this.specializeTable,this.specializations,this.tokenPrecTable,this.termNames)},t.prototype.withProps=function(){for(var e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return new t(this.states,this.data,this.goto,(e=this.group).extend.apply(e,r),this.tokenizers,this.nested,this.specializeTable,this.specializations,this.tokenPrecTable,this.termNames)},t.prototype.getName=function(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.group.types[t].name||t)},Object.defineProperty(t.prototype,"eofTerm",{get:function(){return this.maxNode+1},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasNested",{get:function(){return this.nested.length>0},enumerable:!0,configurable:!0}),t.deserialize=function(e){for(var r=c(e.tokenData),n=e.nodeNames.split(" "),s=0;s<e.repeatNodeCount;s++)n.push("");var o=[];for(s=0;s<n.length;s++)o.push(S);function a(t,e,r){o[t]==S&&(o[t]=Object.create(null)),e.set(o[t],e.deserialize(r))}a(0,i.NodeProp.error,"");for(s=o.length-e.repeatNodeCount;s<o.length;s++)a(s,i.NodeProp.repeated,"");if(e.nodeProps)for(var u=0,O=e.nodeProps;u<O.length;u++){var h=O[u],p=h[0];for(s=1;s<h.length;s+=2)a(h[s],p,h[s+1])}var l=new i.NodeGroup(n.map((function(t,e){return new i.NodeType(t,o[e],e)})));return new t(c(e.states,Uint32Array),c(e.stateData),c(e.goto),l,e.tokenizers.map((function(t){return"number"==typeof t?new f(r,t):t})),(e.nested||[]).map((function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return{name:e,grammar:r,end:new f(c(n),0),placeholder:i}})),e.specializeTable,(e.specializations||[]).map($),e.tokenPrec,e.termNames)},t}(),S=Object.create(null);function R(t,e,r){for(var n=e,i=void 0;65535!=(i=t[n]);n++)if(i==r)return n-e;return-1}function $(t){if(!(t instanceof Object))return t;var e=Object.create(null);for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}function k(t){var e=!1,r=!1,n=0==t.type.id;return n||t.iterate({enter:function(t){return e||(0==t.id?n=e=!0:void 0)},leave:function(t){e=!0}}),n||t.iterate({from:t.length,to:0,enter:function(t){return r||(0==t.id?n=r=!0:void 0)},leave:function(t){r=!0}}),n}e.NodeGroup=i.NodeGroup,e.NodeProp=i.NodeProp,e.NodeType=i.NodeType,e.Subtree=i.Subtree,e.Tree=i.Tree,e.ExternalTokenizer=p,e.ParseContext=y,e.Parser=b,e.Stack=o,e.Token=O,e.TokenGroup=f}));r(s);s.NodeGroup;var o=s.NodeProp,a=(s.NodeType,s.Subtree,s.Tree,s.ExternalTokenizer,s.ParseContext,s.Parser);s.Stack,s.Token,s.TokenGroup;function u(t,e){return e?t.type===e.type?t.type:"any":t.type}function O(t,e){return t.type=e,t.toString=function(){return`TaggedFunction[${e}] ${Function.prototype.toString.call(t)}`},t}function h(t){return`Test<${t}>`}function f(t,e,r,n){this.start=t,this.startValue=e,this.endValue=r,this.end=n,this.includes=t=>this.includesFrom(t)&&this.includesTo(t),this.includesFrom=t=>["(","]"].includes(this.start)?t>this.startValue:t>=this.startValue,this.includesTo=t=>[")","["].includes(this.end)?t<this.endValue:t<=this.endValue}const p=new function(t){this.parser=t,this.unaryTest=(t,e,r)=>(r={...r,__INPUT:t},this.evaluate(`__INPUT in (${e})`,r)),this.injectBuiltins=t=>t,this.parseName=t=>{let e;const r=/([.\/\-'+*]+)|([^\s.\/\-'+*]+)/g,n=[];let i=!1;for(;e=r.exec(t);){const[t,r,s]=e;r?(i=!1,n.length&&n.push("\\s*"),n.push(r.replace(/[+*]/g,"\\$&"))):(n.length&&(i?n.push("\\s+"):n.push("\\s*")),i=!0,n.push(s))}return n},this.findNames=t=>{return Object.keys(t).filter(t=>/[\s.\/\-'+*]/.test(t)).map(t=>{const e="_"+(0).toString(36),r=this.parseName(t);return{name:t,replacement:e,replacer:new RegExp(r.join(""),"g")}})},this.replaceNames=(t,e,r)=>{for(const{name:n,replacement:i,replacer:s}of r)t=t.replace(s,(function(t){const r=i.padEnd(t.length,"_");return e[r]||(e={...e,[t]:e[n]}),r}));return{input:t,context:e}},this.parse=(e,r)=>{const n=this.injectBuiltins(r),i=this.findNames(n),{context:s,input:o}=this.replaceNames(e,n,i);return{context:s,input:o,tree:t.parse(o)}},this.evaluate=(t,e)=>{const{tree:r,context:n}=this.parse(t,e),i={args:[]},s=[i];return r.iterate({enter(e,r,n){const i=t.slice(r,n);s.push({nodeKey:`${e.name}-${i}`,nodeInput:i,args:[]})},leave(t,e,r){const{nodeKey:n,nodeInput:i,args:o}=s.pop(),a=s[s.length-1],p=function(t,e,r){"evalNode"===process.env.LOG&&console.log(t.name,e,r);switch(t.name){case"ArithOp":return t=>{const r=e=>(r,n)=>{const i=r(t),s=n(t);return null===i||null===s?null:e(i,s)};switch(e){case"+":return r((t,e)=>t+e);case"-":return r((t,e)=>t-e);case"*":return r((t,e)=>t*e);case"/":return r((t,e)=>e?t/e:null);case"**":case"^":return r((t,e)=>t**e)}};case"CompareOp":return O(t=>{switch(e){case">":return e=>r=>r(t)>e(t);case">=":return e=>r=>r(t)>=e(t);case"<":return e=>r=>r(t)<e(t);case"<=":return e=>r=>r(t)<=e(t);case"=":return e=>r=>r(t)==e(t);case"!=":return e=>r=>r(t)!=e(t)}},h("boolean"));case"null":return t=>null;case"Disjunction":return O(t=>{const e=r[0](t),n=r[2](t);return!(!e&&!n)},h("boolean"));case"Conjunction":return O(t=>{const e=r[0](t),n=r[2](t);return!(!e||!n)},h("boolean"));case"Context":return t=>r.slice(1,-1).map(e=>e(t)).reduce((t,[e,r])=>(t[e]=r,t),{});case"ContextEntry":return t=>{return["function"==typeof r[0]?r[0](t):r[0],r[1](t)]};case"Key":return r[0];case"QualifiedName":return t=>(function(t,e){return e[t]})(r.join("."),t);case"Name":return e;case"and":return null;case"InTester":return t=>e=>r=>{const n=e(t);return(Array.isArray(n)?n:[n]).every(t=>(function(t,e){if("function"==typeof t)return t(e);return r=>t==e(r)})(t,r))};case"InExtractor":return t=>(e,r)=>{const n=r(t);if(!Array.isArray(n))throw new Error("<a> in <b> must target <b> : Collection");return n.map(t=>({[e]:t}))};case"IterationContext":return t=>{const e=r[0](t),n=r[1]&&r[1](t);return n?function(t,e){if("number"==typeof t&&"number"==typeof e){return function(t,e=0){const r=[...Array(t).keys()].map(t=>t+e);return r.__isRange=!0,r}(e-t+1,t)}throw new Error("unsupported range")}(e,n):e};case"Type":return r[0];case"InExpressions":return t=>{return function(t){const e=(t,r,...n)=>r?e(((t,e)=>[].concat(...t.map(t=>e.map(e=>[].concat(t,e)))))(t,r),...n):t;return e(...t)}(r.map(e=>e(t))).map(t=>Array.isArray(t)?Object.assign({},...t):t)};case"InExpression":return t=>{const[e,n,i]=r;return n(t)(e,i)};case"InstanceOf":return O(t=>{return r[0](t)instanceof r[1](t)},h("boolean"));case"every":return O(t=>(e,r)=>{return e(t).every(t=>r(t))},h("boolean"));case"some":return O(t=>(e,r)=>{return e(t).some(t=>r(t))},h("boolean"));case"between":return O(t=>(e,r,n)=>r(t)<=e(t)<=n(t),"boolean");case"NumericLiteral":return O(t=>e.includes(".")?parseFloat(e):parseInt(e),"number");case"BooleanLiteral":return O(t=>"true"===e,"boolean");case"StringLiteral":return O(t=>e.slice(1,-1),"string");case"PositionalParameters":return t=>r;case"FunctionInvocation":return t=>r[0](t)(...r[1](t).map(e=>e(t)));case"IfExpression":return function(){const t=r[1],e=r[3],n=r[5];return O(r=>t(r)?e(r):n?n(r):null,u(e,n))}();case"Parameters":return 3===r.length?r[1]:t=>[];case"(":return"(";case")":return")";case"[":return"[";case"]":return"]";case"{":return"{";case"}":return"}";case"Comparison":return t=>5===r.length?"("===r[2]?r[1](t)(r[3])(r[0]):r[1](t)(r[0],r[2],r[4]):r[1](t)(r[2])(r[0]);case"QuantifiedExpression":return t=>{return r[0](t)(r[1],r[3])};case"ForExpression":return t=>{const e=r[r.length-1],n=r[1](t),i=[];for(const t of n)i.push(e({...t,partial:i}));return i};case"UnaryExpression":return function(){const t=r[0],e=r[1];return O(r=>t(r)(()=>0,e),e.type)}();case"ArithmeticExpression":return function(){const[t,e,n]=r;return O(r=>e(r)(t,n),u(t,n))}();case"PositiveUnaryTest":return r[0];case"PositiveUnaryTests":return t=>r.map(e=>e(t));case"ParenthesizedExpression":return r[1];case"PathExpression":return t=>{const e=r[0](t),n=r[1];return Array.isArray(e)?e.map(t=>t[n]):e[n]};case"FilterExpression":return t=>{const e=r[0](t),n=r[2];if("number"===n.type){const r=n(t);return e?r<0?e[e.length+r]||null:e[r-1]||null:null}return"boolean"===n.type?n(t)?e:Array.isArray(e)?[]:null:e.filter(e=>{return n({...t,...e})})};case"SuperSimplePositiveUnaryTest":return O(t=>1===r.length?r[0](t):r[0](t)(r[1]),"test");case"List":return t=>r.slice(1,-1).map(e=>e(t));case"Interval":return t=>{const e=new f(r[0],r[1](t),r[2](t),r[3]);return r=>e.includes(r(t))};case"Script":return function(){const t=r[r.length-1];return O(e=>t(e),t.type)}()}}(t,i,o);a.args.push(p)}}),i.args[i.args.length-1](n)}}(a.deserialize({states:"6[OSOPOOO!`OPO(3BXOSOPO'#DTO$[OPO'#DWOROP'#Eb'#EbOROP'#Ea'#EaO&pOPO'#DiOSOPO'#DjO'QOPO'#DkO&pOPO'#DhOROP'#Dh'#DhOROP'#ES'#ESO(aOPO'#DpOROP'#Ed'#EdOROP'#ER'#ERQSOPOOO(kOPO'#C^OSOPO'#CgO(oOPO'#CkO(sOPO'#DlOSOPO,59aO(wOPO,59aOSOPO,59jOSOPO,59jOSOPO,59jO*TOPO,59pO*XOPO,59sOSOPO,59tO*]OPO'#D^OROP,59w,59wOSOPO,59]OSOPO,59_OROP'#Cy'#CyOSOPO,59aO+lOPO,59oO.QOPO'#EZO0fOPO'#DyOROP,59r,59rOROP'#Ec'#EcO0jOPO,5:TO0nOPO'#D]O1kOPO'#EaO2tOPO'#ESO3}OPO,5:UO4}OPO'#EeO6QOPO,5:VOROP,5:S,5:SOROP'#Ds'#DsO6UOPO'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q!a!w!z#P#U#V#W#[#e#g#|$P$U$V$[$gUvUX!tTyVWUwUVWQ!OXR#h!t!c^OQVW_adefghklnoq!a!w!z#P#U#V#W#[#e#g#|$P$U$V$[$gR}WR#`!]R#{#_R!S[R!}!R",nodeNames:"⚠ Script ForExpression Name for InExpressions InExpression InExtractor in IterationContext return IfExpression if then else QuantifiedExpression some every InExpressions InExpression satisfies Disjunction or Conjunction and Comparison CompareOp CompareOp between InTester PositiveUnaryTest ( PositiveUnaryTests ) ArithmeticExpression ArithOp ArithOp ArithOp ArithOp UnaryExpression InstanceOf Type QualifiedName PathExpression FilterExpression [ ] FunctionInvocation Parameters NamedParameters ParameterName PositionalParameters null NumericLiteral StringLiteral BooleanLiteral DateTimeLiteral ? SuperSimplePositiveUnaryTest Interval ParenthesizedExpression List FunctionDefinition function FormalParameter external Context { ContextEntry Key }",nodeProps:[[o.top,1,!0]],repeatNodeCount:9,tokenData:"De~R!TXY$bY^$bpq$bqr%Vrs%btu%sxy(Xyz(^z{(c{|(p|}(u}!O(z!O!P*O!P!Q*`!Q![)e![!]*e!^!_*j!_!`%]!`!a*w!a!b%s!c!}%s!}#O+P#P#Q+U#Q#R(k#R#S%s#T#W%s#W#X+Z#X#Y%s#Y#Z0i#Z#]%s#]#^6f#^#h%s#h#i@e#i#o%s#o#pDT#q#rDY#y#z$b$f$g$b#BY#BZ$b$IS$I_$b$I`$Ib%s$I|$JO$b$JT$JU$b$KV$KW$b$Kh%#t%s&/x&Et%s&FU&FV$b&FV;'S%s;'S;:jD_?&r?Ah%s?BY?Mn%s~$gY!t~X^$bpq$b#y#z$b$f$g$b#BY#BZ$b$IS$I_$b$I|$JO$b$JT$JU$b$KV$KW$b&FU&FV$b~%YP!_!`%]~%bOj~~%eROr%brs%ns~%b~%sO!W~~%x_R~tu&w!Q![&w!a!b&w!c!}&w#R#S&w#T#o&w1p4U&w$I`$Ib&w$Je$Jg&w$Kh%#t&w&/x&Et&w&FV;'S&w;'S;:j(R?&r?Ah&w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luate=function(t,e){return p.evaluate(t,e)},t.unaryTest=function(t,e,r){return p.unaryTest(t,e,r)},Object.defineProperty(t,"__esModule",{value:!0})})); | ||
var r,n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};!function(t){t[t.Unit=100]="Unit",t[t.Deduplicate=200]="Deduplicate",t[t.MaxRecoverStacks=25]="MaxRecoverStacks",t[t.TooBadToRecover=500]="TooBadToRecover",t[t.RecoverSiblingFactor=3]="RecoverSiblingFactor",t[t.MaxParallelBufferLength=800]="MaxParallelBufferLength"}(r||(r={}));var s,o=function(){function t(t,e,r,n,i,s,o,a,u){this.cx=t,this.stack=e,this.state=r,this.reducePos=n,this.pos=i,this.badness=s,this.buffer=o,this.bufferBase=a,this.parent=u}return t.prototype.toString=function(){return"["+this.stack.filter((function(t,e){return e%3==0})).concat(this.state).join(",")+"]"},t.start=function(e,r){return void 0===r&&(r=0),new t(e,[],e.parser.states[0],r,r,0,[],0,null)},t.prototype.pushState=function(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t},t.prototype.reduce=function(t){var e=t>>19,r=65535&t,n=this.cx.parser;if(0==e)return r<=n.maxNode&&this.storeNode(r,this.reducePos,this.reducePos,4,!0),void this.pushState(n.getGoto(this.state,r,!0),this.reducePos);var s=this.stack.length-3*(e-1)-(262144&t?6:0),o=this.stack[s-2],a=this.stack[s-1],u=this.bufferBase+this.buffer.length-a;if(r<=n.maxNode&&(131072&t||!n.group.types[r].prop(i.NodeProp.repeated))){var O=n.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,o,O,u+4,!0)}if(262144&t)this.state=this.stack[s];else{var h=this.stack[s-3];this.state=n.getGoto(h,r,!0)}for(;this.stack.length>s;)this.stack.pop()},t.prototype.storeNode=function(t,e,r,n,i){if(void 0===n&&(n=4),void 0===i&&(i=!1),0==t){var s=this,o=this.buffer.length;if(0==o&&s.parent&&(o=s.bufferBase-s.parent.bufferBase,s=s.parent),o>0&&0==s.buffer[o-4]&&s.buffer[o-1]>-1){if(e==r)return;if(s.buffer[o-2]>=e)return void(s.buffer[o-2]=r)}}if(i&&this.pos!=r){var a=this.buffer.length;if(a>0&&0!=this.buffer[a-4])for(;a>0&&this.buffer[a-2]>r;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,n>4&&(n-=4);this.buffer[a]=t,this.buffer[a+1]=e,this.buffer[a+2]=r,this.buffer[a+3]=n}else this.buffer.push(t,e,r,n)},t.prototype.shift=function(t,e,r){if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){var n=this.pos,i=t,s=this.cx.parser;r>this.pos&&(this.badness=(this.badness>>1)+(this.badness>>2)),(r>this.pos||e<=s.maxNode)&&(this.pos=r,s.stateFlag(i,1)||(this.reducePos=r)),this.pushState(i,n),e<=s.maxNode&&this.buffer.push(e,n,r,4)}else e<=this.cx.parser.maxNode&&this.buffer.push(e,this.pos,r,4),this.pos=r},t.prototype.apply=function(t,e,r){65536&t?this.reduce(t):this.shift(t,e,r)},t.prototype.useNode=function(t,e){var r=this.cx.reused.length-1;(r<0||this.cx.reused[r]!=t)&&(this.cx.reused.push(t),r++);var n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.badness>>=2,this.buffer.push(r,n,this.reducePos,-1)},t.prototype.split=function(){for(var e=this,r=e.buffer.length;r>0&&e.buffer[r-2]>e.reducePos;)r-=4;for(var n=e.buffer.slice(r),i=e.bufferBase+r;e&&i==e.bufferBase;)e=e.parent;return new t(this.cx,this.stack.slice(),this.state,this.reducePos,this.pos,this.badness,n,i,e)},t.prototype.recoverByDelete=function(t,e){var r=t<=this.cx.parser.maxNode;r&&this.storeNode(t,this.pos,e),this.storeNode(0,this.pos,e,r?8:4),this.pos=this.reducePos=e,this.badness+=100},t.prototype.canShift=function(t){for(var e=new a(this);;){var r=this.cx.parser.stateSlot(e.top,4)||this.cx.parser.hasAction(e.top,t);if(0==(65536&r))return!0;if(0==r)return!1;e.reduce(r)}},Object.defineProperty(t.prototype,"ruleStart",{get:function(){var t=this.cx.parser.stateSlot(this.state,5);if(!(65536&t))return 0;var e=this.stack.length-3*(t>>19);return this.stack[e+1]},enumerable:!0,configurable:!0}),t.prototype.startOf=function(t){for(var e=this.stack.length-3;e>=0;e-=3){var r=this.cx.parser.stateSlot(this.stack[e],5);if(t.includes(65535&r)){var n=e-3*(r>>19);return this.stack[n+1]}}return-1},t.prototype.recoverByInsert=function(t){var e=this,r=this.cx.parser.nextStates(this.state);if(r.length>4){for(var n=r.filter((function(r){return r!=e.state&&e.cx.parser.hasAction(r,t)})),i=0;n.length<4&&i<r.length;i++)n.includes(r[i])||n.push(r[i]);r=n}var s=[];for(i=0;i<r.length&&s.length<4;i++)if(r[i]!=this.state){var o=this.split();o.storeNode(0,o.pos,o.pos,4,!0),o.pushState(r[i],this.pos),o.badness+=100,s.push(o)}return s},t.prototype.forceReduce=function(){var t=this.cx.parser.anyReduce(this.state);if(t>>19==0){if(0==(65536&(t=this.cx.parser.stateSlot(this.state,5))))return!1;this.storeNode(0,this.reducePos,this.reducePos,4,!0),this.badness+=100}return this.reduce(t),!0},t.prototype.compare=function(t){return this.pos-t.pos||this.badness-t.badness},t.prototype.toTree=function(){return i.Tree.build(u.create(this),this.cx.parser.group,1,this.cx.maxBufferLength,this.cx.reused)},t}();!function(t){t[t.MaxNext=4]="MaxNext"}(s||(s={}));var a=function(){function t(t){this.stack=t,this.top=t.state,this.rest=t.stack,this.offset=this.rest.length}return t.prototype.reduce=function(t){var e=65535&t,r=t>>19;0==r?(this.rest==this.stack.stack&&(this.rest=this.rest.slice()),this.rest.push(this.top,0,0),this.offset+=3):this.offset-=3*(r-1);var n=this.stack.cx.parser.getGoto(this.rest[this.offset-3],e,!0);this.top=n},t}(),u=function(){function t(t,e,r){this.stack=t,this.pos=e,this.index=r,this.buffer=t.buffer,0==this.index&&this.maybeNext()}return t.create=function(e){return new t(e,e.bufferBase+e.buffer.length,e.buffer.length)},t.prototype.maybeNext=function(){var t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)},Object.defineProperty(t.prototype,"id",{get:function(){return this.buffer[this.index-4]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"start",{get:function(){return this.buffer[this.index-3]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"end",{get:function(){return this.buffer[this.index-2]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this.buffer[this.index-1]},enumerable:!0,configurable:!0}),t.prototype.next=function(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()},t.prototype.fork=function(){return new t(this.stack,this.pos,this.index)},t}(),O=function(){function t(){this.start=-1,this.value=-1,this.end=-1}return t.prototype.accept=function(t,e){this.value=t,this.end=e},t}(),h=function(){function t(t,e){void 0===e&&(e=t.length),this.string=t,this.length=e}return t.prototype.get=function(t){return t<0||t>=this.length?-1:this.string.charCodeAt(t)},t.prototype.read=function(t,e){return this.string.slice(t,Math.min(this.length,e))},t.prototype.clip=function(e){return new t(this.string,e)},t}(),f=function(){function t(t,e){this.data=t,this.id=e}return t.prototype.token=function(t,e,r){!function(t,e,r,n,i){var s=0,o=1<<i;t:for(var a=r.start;0!=(o&t[s]);){for(var u=t[s+1],O=s+3;O<u;O+=2)if((t[O+1]&o)>0){var h=t[O];if(-1==r.value||r.value==h||n.cx.parser.overrides(h,r.value)){r.accept(h,a);break}}for(var f=e.get(a++),p=0,c=t[s+2];p<c;){var l=p+c>>1,d=u+l+(l<<1),w=t[d],g=t[d+1];if(f<w)c=l;else{if(!(f>=g)){s=t[d+2];continue t}p=l+1}}break}}(this.data,t,e,r,this.id)},t}();f.prototype.contextual=!1;var p=function(t,e){void 0===e&&(e={}),this.token=t,this.contextual=e&&e.contextual||!1};function c(t,e){void 0===e&&(e=Uint16Array);for(var r=null,n=0,i=0;n<t.length;){for(var s=0;;){var o=t.charCodeAt(n++),a=!1;if(126==o){s=65535;break}o>=92&&o--,o>=34&&o--;var u=o-32;if(u>=46&&(u-=46,a=!0),s+=u,a)break;s*=46}r?r[i++]=s:r=new e(s)}return r}var l="undefined"!=typeof process&&/\bparse\b/.test(process.env.LOG),d=function(){function t(t){this.start=[0],this.index=[0],this.nextStart=0,this.trees=[t]}return t.prototype.nodeAt=function(t){if(t<this.nextStart)return null;for(;;){var e=this.trees.length-1;if(e<0)return this.nextStart=1e9,null;var r=this.trees[e],n=this.index[e];if(n!=r.children.length){var s=r.children[n],o=this.start[e]+r.positions[n];if(s instanceof i.TreeBuffer)this.index[e]++,this.nextStart=o+s.length;else{if(o>=t)return o==t?s:null;this.index[e]++,o+s.length>=t&&(this.trees.push(s),this.start.push(o),this.index.push(0))}}else this.trees.pop(),this.start.pop(),this.index.pop()}},t}(),w=function(t){function e(e){var r=t.call(this)||this;return r.tokenizer=e,r.extended=-1,r.mask=0,r}return function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e.prototype.clear=function(t){this.start=t,this.value=this.extended=-1},e}(O),g=new O,v=function(){function t(){this.tokens=[],this.mainToken=g,this.actions=[]}return t.prototype.getActions=function(t,e){for(var r=0,n=null,i=t.cx.parser,s=i.tokenizers,o=0;o<s.length;o++)if(0!=(1<<o&i.stateSlot(t.state,3))){for(var a=s[o],u=void 0,O=0,h=this.tokens;O<h.length;O++){var f=h[O];if(f.tokenizer==a){u=f;break}}u||this.tokens.push(u=new w(a));var p=i.stateSlot(t.state,3);(a.contextual||u.start!=t.pos||u.mask!=p)&&(this.updateCachedToken(u,t,e),u.mask=p);var c=r;if(u.extended>-1&&(r=this.addActions(t,u.extended,u.end,r)),(r=this.addActions(t,u.value,u.end,r))>c){n=u;break}n&&0==u.value||(n=u)}for(;this.actions.length>r;)this.actions.pop();return n||((n=g).start=t.pos,t.pos==e.length?n.accept(t.cx.parser.eofTerm,t.pos):n.accept(0,t.pos+1)),this.mainToken=n,this.actions},t.prototype.updateCachedToken=function(t,e,r){if(t.clear(e.pos),t.tokenizer.token(r,t,e),t.value>-1){var n=e.cx.parser,i=R(n.data,n.specializeTable,t.value);if(i>=0){var s=n.specializations[i][r.read(t.start,t.end)];null!=s&&(0==(1&s)?t.value=s>>1:t.extended=s>>1)}}else e.pos==r.length?t.accept(e.cx.parser.eofTerm,e.pos):t.accept(0,e.pos+1)},t.prototype.putAction=function(t,e,r,n){for(var i=0;i<n;i+=3)if(this.actions[i]==t)return n;return this.actions[n++]=t,this.actions[n++]=e,this.actions[n++]=r,n},t.prototype.addActions=function(t,e,r,n){for(var i=t.state,s=t.cx.parser,o=s.data,a=0;a<2;a++)for(var u=s.stateSlot(i,a?2:1),O=void 0;65535!=(O=o[u]);u+=3)(O==e||0==O&&0==n)&&(n=this.putAction(o[u+1]|o[u+2]<<16,e,r,n));return n},t}(),P=function(t,e,r,n,i){void 0===n&&(n=null),void 0===i&&(i=-1),this.parser=t,this.maxBufferLength=e,this.input=r,this.parent=n,this.wrapType=i,this.reused=[],this.tokens=new v},y=function(){function t(t,e,r){var n=void 0===r?{}:r,s=n.cache,a=void 0===s?void 0:s,u=n.strict,O=void 0!==u&&u,h=n.bufferLength,f=void 0===h?i.DefaultBufferLength:h;this.stacks=[o.start(new P(t,f,e))],this.strict=O,this.cache=a?new d(a):null}return t.prototype.takeStack=function(){var t=this.stacks,e=t[0],r=t.pop();if(0==t.length)return e;t[0]=r;for(var n=0;;){var i=1+(n<<1);if(i>=t.length)break;var s=t[i];if(i+1<t.length&&s.compare(t[i+1])>=0&&(s=t[i+1],i++),r.compare(s)<0)break;t[i]=r,t[n]=s,n=i}return e},t.prototype.putStack=function(t){if(t.badness>=200)for(var e=0;e<this.stacks.length;e++){var r=this.stacks[e];if(r.state==t.state&&r.pos==t.pos){var n=t.badness-r.badness||t.stack.length-r.stack.length;if(n<0)return this.stacks[e]=t,!0;if(n>=0)return!1}}else if(0==t.badness&&this.stacks.length&&t.buffer.length>800){if(this.stacks.reduce((function(t,e){return Math.max(t,e.buffer.length)}),0)>t.buffer.length)return!1}for(var i=this.stacks.push(t)-1;i>0;){var s=i>>1,o=this.stacks[s];if(t.compare(o)>=0)break;this.stacks[i]=o,this.stacks[s]=t,i=s}return!0},t.prototype.advance=function(){var t=this.takeStack(),e=t.pos,r=t.cx,n=r.input,s=r.parser,a=l?t+" -> ":"";if(this.cache)for(var u=this.cache.nodeAt(e);u;){var O=s.group.types[u.type.id]==u.type?s.getGoto(t.state,u.type.id):-1;if(O>-1&&!k(u))return t.useNode(u,O),l&&console.log(a+t+" (via reuse of "+s.getName(u.type.id)+")"),this.putStack(t),null;if(0==u.children.length||u.positions[0]>0)break;var h=u.children[0];if(!(h instanceof i.Tree))break;u=h}var f=s.startNested(t.state);t:if(f>-1){var p=s.nested[f],c=p.grammar,d=p.end,w=p.placeholder,g=void 0,v=null,y=void 0,b=void 0;if("function"==typeof c){var S=c(n,t);if(S.stay)break t;v=S.parseNode,y=S.parser,g=S.filterEnd,b=S.wrapType}else y=c;var R=this.scanForNestEnd(t,d,g),$=t.cx.input.clip(R);if(v||!y){var x=v?v($,t.pos):i.Tree.empty;x.length!=R-t.pos&&(x=new i.Tree(x.type,x.children,x.positions,R-t.pos)),null!=b&&(x=new i.Tree(s.group.types[b],[x],[0],x.length)),t.useNode(x,s.getGoto(t.state,w,!0)),this.putStack(t)}else{var m=o.start(new P(y,t.cx.maxBufferLength,$,t,b),t.pos);l&&console.log(a+m+" (nested)"),this.putStack(m)}return null}var X=s.stateSlot(t.state,4);if(X>0)return t.reduce(X),this.putStack(t),l&&console.log(a+t+" (via always-reduce "+s.getName(65535&X)+")"),null;for(var j=t.cx.tokens.getActions(t,n),q=0;q<j.length;){var T=j[q++],Q=j[q++],U=j[q++],Z=q==j.length?t:t.split();Z.apply(T,Q,U),l&&console.log(a+Z+" (via "+(0==(65536&T)?"shift":"reduce of "+s.getName(65535&T))+" for "+s.getName(Q)+" @ "+e+(Z==t?"":", split")+")"),this.putStack(Z)}if(j.length>0)return null;if(e==n.length&&s.stateFlag(t.state,2))return this.finishStack(t);var E=this.stacks.reduce((function(t,e){return Math.min(t,e.badness)}),1e9);if(E<=t.badness&&(this.stacks.length>=25||t.badness>Math.min(500,3*E)))return null;var _=t.cx.tokens.mainToken,N=_.end,V=_.value;if(this.strict){if(this.stacks.length)return null;throw new SyntaxError("No parse at "+e+" with "+s.getName(V)+" (stack is "+t+")")}for(var W=0,Y=t.recoverByInsert(V);W<Y.length;W++){var I=Y[W];l&&console.log(a+I+" (via recover-insert)"),this.putStack(I)}var A=t.split();if(A.forceReduce())l&&console.log(a+A+" (via force-reduce)"),this.putStack(A);else if(e==n.length)return this.finishStack(t);if(N==e){if(e==n.length)return null;N++,V=0}return t.recoverByDelete(V,N),l&&console.log(a+t+" (via recover-delete "+s.getName(V)+")"),this.putStack(t),null},t.prototype.finishStack=function(t){return t.cx.parent?(this.putStack(this.finishNested(t)),null):t.toTree()},Object.defineProperty(t.prototype,"pos",{get:function(){return this.stacks[0].pos},enumerable:!0,configurable:!0}),t.prototype.forceFinish=function(){for(var t=this.stacks[0].split();!t.cx.parser.stateFlag(t.state,2)&&t.forceReduce(););return t.toTree()},t.prototype.scanForNestEnd=function(t,e,r){for(var n=t.cx.input,i=t.pos;i<n.length;i++)if(g.start=i,g.value=-1,e.token(n,g,t),g.value>-1&&(!r||r(n.read(i,g.end))))return i;return n.length},t.prototype.finishNested=function(t){var e=t.cx.parent,r=t.toTree(),n=e.cx.parser,s=n.nested[n.startNested(e.state)];return r=new i.Tree(r.type,r.children,r.positions.map((function(t){return t-e.pos})),t.pos-e.pos),t.cx.wrapType>-1&&(r=new i.Tree(n.group.types[t.cx.wrapType],[r],[0],r.length)),e.useNode(r,n.getGoto(e.state,s.placeholder,!0)),l&&console.log(e+" (via unnest "+(t.cx.wrapType>-1?n.getName(t.cx.wrapType):r.type.name)+")"),this.stacks.some((function(t){return t.cx.parent==e}))&&(this.stacks=this.stacks.filter((function(t){return t.cx.parent!=e})).sort((function(t,e){return t.compare(e)}))),e},t}(),b=function(){function t(t,e,r,n,i,s,o,a,u,O){void 0===O&&(O=null),this.states=t,this.data=e,this.goto=r,this.group=n,this.tokenizers=i,this.nested=s,this.specializeTable=o,this.specializations=a,this.tokenPrecTable=u,this.termNames=O,this.nextStateCache=[],this.maxNode=this.group.types.length-1;for(var h=0,f=this.states.length/6;h<f;h++)this.nextStateCache[h]=null}return t.prototype.parse=function(t,e){"string"==typeof t&&(t=new h(t));for(var r=new y(this,t,e);;){var n=r.advance();if(n)return n}},t.prototype.startParse=function(t,e){return new y(this,t,e)},t.prototype.getGoto=function(t,e,r){void 0===r&&(r=!1);var n=this.goto;if(e>=n[0])return-1;for(var i=n[e+1];;){var s=n[i++],o=1&s,a=n[i++];if(o&&r)return a;for(var u=i+(s>>1);i<u;i++)if(n[i]==t)return a;if(o)return-1}},t.prototype.hasAction=function(t,e){for(var r=this.data,n=0;n<2;n++)for(var i=this.stateSlot(t,n?2:1),s=void 0;65535!=(s=r[i]);i+=3)if(s==e||0==s)return r[i+1]|r[i+2]<<16;return 0},t.prototype.stateSlot=function(t,e){return this.states[6*t+e]},t.prototype.stateFlag=function(t,e){return(this.stateSlot(t,0)&e)>0},t.prototype.startNested=function(t){var e=this.stateSlot(t,0);return 4&e?e>>10:-1},t.prototype.anyReduce=function(t){var e=this.stateSlot(t,4);if(e>0)return e;for(var r=this.stateSlot(t,1);;r+=3){if(65535==this.data[r])return 0;var n=this.data[r+2];if(1&n)return this.data[r+1]|n<<16}},t.prototype.nextStates=function(t){var e=this.nextStateCache[t];if(e)return e;for(var r=[],n=this.stateSlot(t,1);65535!=this.data[n];n+=3)0!=(1&this.data[n+2])||r.includes(this.data[n+1])||r.push(this.data[n+1]);for(var i=this.goto,s=i[0],o=0;o<s;o++)for(var a=i[o+1];;){for(var u=i[a++],O=i[a++],h=a+(u>>1);a<h;a++)i[a]!=t||r.includes(O)||r.push(O);if(1&u)break}return this.nextStateCache[t]=r},t.prototype.overrides=function(t,e){var r=R(this.data,this.tokenPrecTable,e);return r<0||R(this.data,this.tokenPrecTable,t)<r},t.prototype.withNested=function(e){return new t(this.states,this.data,this.goto,this.group,this.tokenizers,this.nested.map((function(t){return Object.prototype.hasOwnProperty.call(e,t.name)?{name:t.name,grammar:e[t.name],end:t.end,placeholder:t.placeholder}:t})),this.specializeTable,this.specializations,this.tokenPrecTable,this.termNames)},t.prototype.withProps=function(){for(var e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return new t(this.states,this.data,this.goto,(e=this.group).extend.apply(e,r),this.tokenizers,this.nested,this.specializeTable,this.specializations,this.tokenPrecTable,this.termNames)},t.prototype.getName=function(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.group.types[t].name||t)},Object.defineProperty(t.prototype,"eofTerm",{get:function(){return this.maxNode+1},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hasNested",{get:function(){return this.nested.length>0},enumerable:!0,configurable:!0}),t.deserialize=function(e){for(var r=c(e.tokenData),n=e.nodeNames.split(" "),s=0;s<e.repeatNodeCount;s++)n.push("");var o=[];for(s=0;s<n.length;s++)o.push(S);function a(t,e,r){o[t]==S&&(o[t]=Object.create(null)),e.set(o[t],e.deserialize(r))}a(0,i.NodeProp.error,"");for(s=o.length-e.repeatNodeCount;s<o.length;s++)a(s,i.NodeProp.repeated,"");if(e.nodeProps)for(var u=0,O=e.nodeProps;u<O.length;u++){var h=O[u],p=h[0];for(s=1;s<h.length;s+=2)a(h[s],p,h[s+1])}var l=new i.NodeGroup(n.map((function(t,e){return new i.NodeType(t,o[e],e)})));return new t(c(e.states,Uint32Array),c(e.stateData),c(e.goto),l,e.tokenizers.map((function(t){return"number"==typeof t?new f(r,t):t})),(e.nested||[]).map((function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return{name:e,grammar:r,end:new f(c(n),0),placeholder:i}})),e.specializeTable,(e.specializations||[]).map($),e.tokenPrec,e.termNames)},t}(),S=Object.create(null);function R(t,e,r){for(var n=e,i=void 0;65535!=(i=t[n]);n++)if(i==r)return n-e;return-1}function $(t){if(!(t instanceof Object))return t;var e=Object.create(null);for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}function k(t){var e=!1,r=!1,n=0==t.type.id;return n||t.iterate({enter:function(t){return e||(0==t.id?n=e=!0:void 0)},leave:function(t){e=!0}}),n||t.iterate({from:t.length,to:0,enter:function(t){return r||(0==t.id?n=r=!0:void 0)},leave:function(t){r=!0}}),n}e.NodeGroup=i.NodeGroup,e.NodeProp=i.NodeProp,e.NodeType=i.NodeType,e.Subtree=i.Subtree,e.Tree=i.Tree,e.ExternalTokenizer=p,e.ParseContext=y,e.Parser=b,e.Stack=o,e.Token=O,e.TokenGroup=f}));r(s);s.NodeGroup;var o=s.NodeProp,a=(s.NodeType,s.Subtree,s.Tree,s.ExternalTokenizer,s.ParseContext,s.Parser);s.Stack,s.Token,s.TokenGroup;function u(t,e){return e?t.type===e.type?t.type:"any":t.type}function O(t,e){return t.type=e,t.toString=function(){return`TaggedFunction[${e}] ${Function.prototype.toString.call(t)}`},t}function h(t){return!1!==t&&null!==t}function f(t){return`Test<${t}>`}function p(t,e,r,n){this.start=t,this.startValue=e,this.endValue=r,this.end=n,this.includes=t=>this.includesFrom(t)&&this.includesTo(t),this.includesFrom=t=>["(","]"].includes(this.start)?t>this.startValue:t>=this.startValue,this.includesTo=t=>[")","["].includes(this.end)?t<this.endValue:t<=this.endValue}const c=new function(t){this.parser=t,this.unaryTest=(t,e,r)=>(r={...r,__INPUT:t},this.evaluate(`__INPUT in (${e})`,r)),this.injectBuiltins=t=>t,this.parseName=t=>{let e;const r=/([.\/\-'+*]+)|([^\s.\/\-'+*]+)/g,n=[];let i=!1;for(;e=r.exec(t);){const[t,r,s]=e;r?(i=!1,n.length&&n.push("\\s*"),n.push(r.replace(/[+*]/g,"\\$&"))):(n.length&&(i?n.push("\\s+"):n.push("\\s*")),i=!0,n.push(s))}return n},this.findNames=t=>{return Object.keys(t).filter(t=>/[\s.\/\-'+*]/.test(t)).map(t=>{const e="_"+(0).toString(36),r=this.parseName(t);return{name:t,replacement:e,replacer:new RegExp(r.join(""),"g")}})},this.replaceNames=(t,e,r)=>{for(const{name:n,replacement:i,replacer:s}of r)t=t.replace(s,(function(t){const r=i.padEnd(t.length,"_");return e[r]||(e={...e,[t]:e[n]}),r}));return{input:t,context:e}},this.parse=(e,r)=>{const n=this.injectBuiltins(r),i=this.findNames(n),{context:s,input:o}=this.replaceNames(e,n,i);return{context:s,input:o,tree:t.parse(o)}},this.evaluate=(t,e)=>{const{tree:r,context:n}=this.parse(t,e),i={args:[]},s=[i];return r.iterate({enter(e,r,n){const i=t.slice(r,n);s.push({nodeKey:`${e.name}-${i}`,nodeInput:i,args:[]})},leave(t,e,r){const{nodeKey:n,nodeInput:i,args:o}=s.pop(),a=s[s.length-1],c=function(t,e,r){"evalNode"===process.env.LOG&&console.log(t.name,e,r);switch(t.name){case"ArithOp":return t=>{const r=e=>(r,n)=>{const i=r(t),s=n(t);return null===i||null===s?null:e(i,s)};switch(e){case"+":return r((t,e)=>t+e);case"-":return r((t,e)=>t-e);case"*":return r((t,e)=>t*e);case"/":return r((t,e)=>e?t/e:null);case"**":case"^":return r((t,e)=>t**e)}};case"CompareOp":return O(t=>{const r=e=>r=>n=>{const i=n(t),s=r(t);return!!e(i,s)&&i};switch(e){case">":return r((t,e)=>t>e);case">=":return r((t,e)=>t>=e);case"<":return r((t,e)=>t<e);case"<=":return r((t,e)=>t<=e);case"=":return r((t,e)=>t==e);case"!=":return r((t,e)=>t!=e)}},f("boolean"));case"null":return t=>null;case"Disjunction":return O(t=>{const e=r[0](t),n=r[2](t);return e||n},f("boolean"));case"Conjunction":return O(t=>{const e=r[0](t),n=r[2](t);return e&&n},f("boolean"));case"Context":return t=>r.slice(1,-1).map(e=>e(t)).reduce((t,[e,r])=>(t[e]=r,t),{});case"ContextEntry":return t=>{return["function"==typeof r[0]?r[0](t):r[0],r[1](t)]};case"Key":return r[0];case"QualifiedName":return t=>(function(t,e){if(t in e)return e[t];return null})(r.join("."),t);case"Name":return e;case"and":return null;case"InTester":return t=>e=>r=>{const n=e(t),i=r(t);return!!(Array.isArray(n)?n:[n]).every(t=>(function(t,e){if("function"==typeof t)return t(e);return r=>t==e(r)})(t,()=>i))&&i};case"InExtractor":return t=>(e,r)=>{const n=r(t);if(!Array.isArray(n))throw new Error("<a> in <b> must target <b> : Collection");return n.map(t=>({[e]:t}))};case"IterationContext":return t=>{const e=r[0](t),n=r[1]&&r[1](t);return n?function(t,e){if("number"==typeof t&&"number"==typeof e){return function(t,e=0){const r=[...Array(t).keys()].map(t=>t+e);return r.__isRange=!0,r}(e-t+1,t)}throw new Error("unsupported range")}(e,n):e};case"Type":return r[0];case"InExpressions":return t=>{return function(t){const e=(t,r,...n)=>r?e(((t,e)=>[].concat(...t.map(t=>e.map(e=>[].concat(t,e)))))(t,r),...n):t;return e(...t)}(r.map(e=>e(t))).map(t=>Array.isArray(t)?Object.assign({},...t):t)};case"InExpression":return t=>{const[e,n,i]=r;return n(t)(e,i)};case"InstanceOf":return O(t=>{return r[0](t)instanceof r[1](t)},f("boolean"));case"every":return O(t=>(e,r)=>{return e(t).every(t=>h(r(t)))},f("boolean"));case"some":return O(t=>(e,r)=>{return e(t).some(t=>h(r(t)))},f("boolean"));case"between":return O(t=>(e,r,n)=>{const i=e(t);return r(t)<=i<=n(t)&&i},"boolean");case"NumericLiteral":return O(t=>e.includes(".")?parseFloat(e):parseInt(e),"number");case"BooleanLiteral":return O(t=>"true"===e,"boolean");case"StringLiteral":return O(t=>e.slice(1,-1),"string");case"PositionalParameters":return t=>r;case"FunctionInvocation":return t=>r[0](t)(...r[1](t).map(e=>e(t)));case"IfExpression":return function(){const t=r[1],e=r[3],n=r[5];return O(r=>h(t(r))?e(r):n?n(r):null,u(e,n))}();case"Parameters":return 3===r.length?r[1]:t=>[];case"(":return"(";case")":return")";case"[":return"[";case"]":return"]";case"{":return"{";case"}":return"}";case"Comparison":return t=>5===r.length?"("===r[2]?r[1](t)(r[3])(r[0]):r[1](t)(r[0],r[2],r[4]):r[1](t)(r[2])(r[0]);case"QuantifiedExpression":return t=>{return r[0](t)(r[1],r[3])};case"ForExpression":return t=>{const e=r[r.length-1],n=r[1](t),i=[];for(const t of n)i.push(e({...t,partial:i}));return i};case"UnaryExpression":return function(){const t=r[0],e=r[1];return O(r=>t(r)(()=>0,e),e.type)}();case"ArithmeticExpression":return function(){const[t,e,n]=r;return O(r=>e(r)(t,n),u(t,n))}();case"PositiveUnaryTest":return r[0];case"PositiveUnaryTests":return t=>r.map(e=>e(t));case"ParenthesizedExpression":return r[1];case"PathExpression":return t=>{const e=r[0](t),n=r[1];return Array.isArray(e)?e.map(t=>t[n]):e[n]};case"FilterExpression":return t=>{const e=r[0](t),n=r[2];if("number"===n.type){const r=n(t);return e?r<0?e[e.length+r]||null:e[r-1]||null:null}return"boolean"===n.type?n(t)?e:Array.isArray(e)?[]:null:e.map(e=>{const r={...t,item:e,...Object.entries(e).reduce((function(t,[e,r]){return t["item."+e]=r,t}),{}),...e};return n(r)}).filter(h)};case"SuperSimplePositiveUnaryTest":return O(t=>1===r.length?r[0](t):r[0](t)(r[1]),"test");case"List":return t=>r.slice(1,-1).map(e=>e(t));case"Interval":return t=>{const e=new p(r[0],r[1](t),r[2](t),r[3]);return r=>e.includes(r(t))};case"Script":return function(){const t=r[r.length-1];return O(e=>t(e),t.type)}()}}(t,i,o);a.args.push(c)}}),i.args[i.args.length-1](n)}}(a.deserialize({states:"6[OSOPOOO!`OPO(3BXOSOPO'#DTO$[OPO'#DWOROP'#Eb'#EbOROP'#Ea'#EaO&pOPO'#DiOSOPO'#DjO'QOPO'#DkO&pOPO'#DhOROP'#Dh'#DhOROP'#ES'#ESO(aOPO'#DpOROP'#Ed'#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X!ZR#u#XQ$O#bR$]$OSsR!jR!rsQ$_$RR$e$_S!v|!iR#i!vQ#y#_R$X#yQ!{!RR#l!{SPO_QrQQxVQ|WQ!XaQ!^dU!_e!a$PQ!bfQ!cgQ!dhQ!hkQ!ilQ!onQ!poQ!qqQ#j!wQ#k!zQ#n#PQ#r#UQ#s#VQ#t#WQ#w#[Q$R#eQ$S#gQ$Z#|Q$b$UQ$c$VQ$d$[R$h$g!`^OQW_adefghklnoq!a!w!z#P#U#V#W#[#e#g#|$P$U$V$[$gR{VR#T!VR#Z!ZR$Q#bTuR!jR!llR$a$RQ!x|R#d!i!^TOQ_adefghklnoq!a!w!z#P#U#V#W#[#e#g#|$P$U$V$[$gUvUX!tTyVWUwUVWQ!OXR#h!t!c^OQVW_adefghklnoq!a!w!z#P#U#V#W#[#e#g#|$P$U$V$[$gR}WR#`!]R#{#_R!S[R!}!R",nodeNames:"⚠ Script ForExpression Name for InExpressions InExpression InExtractor in IterationContext return IfExpression if then else QuantifiedExpression some every InExpressions InExpression satisfies Disjunction or Conjunction and Comparison CompareOp CompareOp between InTester PositiveUnaryTest ( PositiveUnaryTests ) ArithmeticExpression ArithOp ArithOp ArithOp ArithOp UnaryExpression InstanceOf Type QualifiedName PathExpression FilterExpression [ ] FunctionInvocation Parameters NamedParameters ParameterName PositionalParameters null NumericLiteral StringLiteral BooleanLiteral DateTimeLiteral ? SuperSimplePositiveUnaryTest Interval ParenthesizedExpression List FunctionDefinition function FormalParameter external Context { ContextEntry Key }",nodeProps:[[o.top,1,!0]],repeatNodeCount:9,tokenData:"De~R!TXY$bY^$bpq$bqr%Vrs%btu%sxy(Xyz(^z{(c{|(p|}(u}!O(z!O!P*O!P!Q*`!Q![)e![!]*e!^!_*j!_!`%]!`!a*w!a!b%s!c!}%s!}#O+P#P#Q+U#Q#R(k#R#S%s#T#W%s#W#X+Z#X#Y%s#Y#Z0i#Z#]%s#]#^6f#^#h%s#h#i@e#i#o%s#o#pDT#q#rDY#y#z$b$f$g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`$Ib&w$Je$Jg&w$Kh%#t&w&/x&Et&w&FV;'S&w;'S;:j'{?&r?Ah&w?BY?Mn&w~COaR~tu&w!Q![&w!a!b&w!c!}&w#R#S&w#T#X&w#X#Y5`#Y#o&w1p4U&w$I`$Ib&w$Je$Jg&w$Kh%#t&w&/x&Et&w&FV;'S&w;'S;:j'{?&r?Ah&w?BY?Mn&w~DYO!e~~D_O!h~~DbP;=`<%l%s",tokenizers:[0],specializeTable:3359,specializations:[{for:8,in:16,return:20,if:24,then:26,else:28,some:32,every:34,satisfies:40,or:44,and:48,between:56,null:104,"?":114,function:126,external:130}],tokenPrec:3351}));t.evaluate=function(t,e){return c.evaluate(t,e)},t.unaryTest=function(t,e,r){return c.unaryTest(t,e,r)},Object.defineProperty(t,"__esModule",{value:!0})})); |
@@ -215,10 +215,21 @@ import { Parser, NodeProp } from 'lezer'; | ||
const compare = (fn) => { | ||
return (b) => (a) => { | ||
const _a = a(context); | ||
const _b = b(context); | ||
return fn(_a, _b) ? _a : false; | ||
}; | ||
}; | ||
switch (input) { | ||
case '>': return (b) => (a) => a(context) > b(context); | ||
case '>=': return (b) => (a) => a(context) >= b(context); | ||
case '<': return (b) => (a) => a(context) < b(context); | ||
case '<=': return (b) => (a) => a(context) <= b(context); | ||
case '=': return (b) => (a) => a(context) == b(context); | ||
case '!=': return (b) => (a) => a(context) != b(context); | ||
case '>': return compare((a, b) => a > b); | ||
case '>=': return compare((a, b) => a >= b); | ||
case '<': return compare((a, b) => a < b); | ||
case '<=': return compare((a, b) => a <= b); | ||
case '=': return compare((a, b) => a == b); | ||
case '!=': return compare((a, b) => a != b); | ||
} | ||
}, Test('boolean')); | ||
@@ -236,3 +247,3 @@ | ||
return !!(a || b); | ||
return a || b; | ||
}, Test('boolean')); | ||
@@ -246,3 +257,3 @@ | ||
return !!(a && b); | ||
return a && b; | ||
}, Test('boolean')); | ||
@@ -284,3 +295,7 @@ | ||
return (Array.isArray(tests) ? tests : [ tests ]).every(test => compareValOrFn(test, a)); | ||
const left = a(context); | ||
return (Array.isArray(tests) ? tests : [ tests ]).every( | ||
test => compareValOrFn(test, () => left) | ||
) ? left : false; | ||
}; | ||
@@ -349,3 +364,3 @@ | ||
const contexts = _contexts(context); | ||
return contexts.every(ctx => _condition(ctx)); | ||
return contexts.every(ctx => isTruthy(_condition(ctx))); | ||
}; | ||
@@ -358,3 +373,3 @@ | ||
const contexts = _contexts(context); | ||
return contexts.some(ctx => _condition(ctx)); | ||
return contexts.some(ctx => isTruthy(_condition(ctx))); | ||
}; | ||
@@ -364,3 +379,8 @@ }, Test('boolean')); | ||
case 'between': return tag( | ||
(context) => (expr, start, end) => start(context) <= expr(context) <= end(context), | ||
(context) => (expr, start, end) => { | ||
const left = expr(context); | ||
return start(context) <= left <= end(context) ? left : false; | ||
}, | ||
'boolean' | ||
@@ -390,3 +410,3 @@ ); | ||
if (ifCondition(context)) { | ||
if (isTruthy(ifCondition(context))) { | ||
return thenValue(context); | ||
@@ -535,11 +555,17 @@ } else { | ||
// a[test] | ||
return filterTarget.filter(el => { | ||
return filterTarget.map(el => { | ||
const filter = filterFn({ | ||
const iterationContext = { | ||
...context, | ||
item: el, | ||
...Object.entries(el).reduce(function(itemScope, [key, value]) { | ||
itemScope[ 'item.' + key ] = value; | ||
return itemScope; | ||
}, {}), | ||
...el | ||
}); | ||
}; | ||
return filter; | ||
}); | ||
return filterFn(iterationContext); | ||
}).filter(isTruthy); | ||
}; | ||
@@ -580,3 +606,8 @@ | ||
function getFromContext(variable, context) { | ||
return context[variable]; | ||
if (variable in context) { | ||
return context[variable]; | ||
} | ||
return null; | ||
} | ||
@@ -646,2 +677,6 @@ | ||
function isTruthy(obj) { | ||
return obj !== false && obj !== null; | ||
} | ||
function Test(type) { | ||
@@ -648,0 +683,0 @@ return `Test<${type}>`; |
@@ -219,10 +219,21 @@ 'use strict'; | ||
const compare = (fn) => { | ||
return (b) => (a) => { | ||
const _a = a(context); | ||
const _b = b(context); | ||
return fn(_a, _b) ? _a : false; | ||
}; | ||
}; | ||
switch (input) { | ||
case '>': return (b) => (a) => a(context) > b(context); | ||
case '>=': return (b) => (a) => a(context) >= b(context); | ||
case '<': return (b) => (a) => a(context) < b(context); | ||
case '<=': return (b) => (a) => a(context) <= b(context); | ||
case '=': return (b) => (a) => a(context) == b(context); | ||
case '!=': return (b) => (a) => a(context) != b(context); | ||
case '>': return compare((a, b) => a > b); | ||
case '>=': return compare((a, b) => a >= b); | ||
case '<': return compare((a, b) => a < b); | ||
case '<=': return compare((a, b) => a <= b); | ||
case '=': return compare((a, b) => a == b); | ||
case '!=': return compare((a, b) => a != b); | ||
} | ||
}, Test('boolean')); | ||
@@ -240,3 +251,3 @@ | ||
return !!(a || b); | ||
return a || b; | ||
}, Test('boolean')); | ||
@@ -250,3 +261,3 @@ | ||
return !!(a && b); | ||
return a && b; | ||
}, Test('boolean')); | ||
@@ -288,3 +299,7 @@ | ||
return (Array.isArray(tests) ? tests : [ tests ]).every(test => compareValOrFn(test, a)); | ||
const left = a(context); | ||
return (Array.isArray(tests) ? tests : [ tests ]).every( | ||
test => compareValOrFn(test, () => left) | ||
) ? left : false; | ||
}; | ||
@@ -353,3 +368,3 @@ | ||
const contexts = _contexts(context); | ||
return contexts.every(ctx => _condition(ctx)); | ||
return contexts.every(ctx => isTruthy(_condition(ctx))); | ||
}; | ||
@@ -362,3 +377,3 @@ | ||
const contexts = _contexts(context); | ||
return contexts.some(ctx => _condition(ctx)); | ||
return contexts.some(ctx => isTruthy(_condition(ctx))); | ||
}; | ||
@@ -368,3 +383,8 @@ }, Test('boolean')); | ||
case 'between': return tag( | ||
(context) => (expr, start, end) => start(context) <= expr(context) <= end(context), | ||
(context) => (expr, start, end) => { | ||
const left = expr(context); | ||
return start(context) <= left <= end(context) ? left : false; | ||
}, | ||
'boolean' | ||
@@ -394,3 +414,3 @@ ); | ||
if (ifCondition(context)) { | ||
if (isTruthy(ifCondition(context))) { | ||
return thenValue(context); | ||
@@ -539,11 +559,17 @@ } else { | ||
// a[test] | ||
return filterTarget.filter(el => { | ||
return filterTarget.map(el => { | ||
const filter = filterFn({ | ||
const iterationContext = { | ||
...context, | ||
item: el, | ||
...Object.entries(el).reduce(function(itemScope, [key, value]) { | ||
itemScope[ 'item.' + key ] = value; | ||
return itemScope; | ||
}, {}), | ||
...el | ||
}); | ||
}; | ||
return filter; | ||
}); | ||
return filterFn(iterationContext); | ||
}).filter(isTruthy); | ||
}; | ||
@@ -584,3 +610,8 @@ | ||
function getFromContext(variable, context) { | ||
return context[variable]; | ||
if (variable in context) { | ||
return context[variable]; | ||
} | ||
return null; | ||
} | ||
@@ -650,2 +681,6 @@ | ||
function isTruthy(obj) { | ||
return obj !== false && obj !== null; | ||
} | ||
function Test(type) { | ||
@@ -652,0 +687,0 @@ return `Test<${type}>`; |
{ | ||
"name": "feelin", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "A FEEL parser and interpreter", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -199,10 +199,21 @@ import { parser } from './parser'; | ||
const compare = (fn) => { | ||
return (b) => (a) => { | ||
const _a = a(context); | ||
const _b = b(context); | ||
return fn(_a, _b) ? _a : false; | ||
}; | ||
}; | ||
switch (input) { | ||
case '>': return (b) => (a) => a(context) > b(context); | ||
case '>=': return (b) => (a) => a(context) >= b(context); | ||
case '<': return (b) => (a) => a(context) < b(context); | ||
case '<=': return (b) => (a) => a(context) <= b(context); | ||
case '=': return (b) => (a) => a(context) == b(context); | ||
case '!=': return (b) => (a) => a(context) != b(context); | ||
case '>': return compare((a, b) => a > b); | ||
case '>=': return compare((a, b) => a >= b); | ||
case '<': return compare((a, b) => a < b); | ||
case '<=': return compare((a, b) => a <= b); | ||
case '=': return compare((a, b) => a == b); | ||
case '!=': return compare((a, b) => a != b); | ||
} | ||
}, Test('boolean')); | ||
@@ -220,3 +231,3 @@ | ||
return !!(a || b); | ||
return a || b; | ||
}, Test('boolean')); | ||
@@ -230,3 +241,3 @@ | ||
return !!(a && b); | ||
return a && b; | ||
}, Test('boolean')); | ||
@@ -268,3 +279,7 @@ | ||
return (Array.isArray(tests) ? tests : [ tests ]).every(test => compareValOrFn(test, a)); | ||
const left = a(context); | ||
return (Array.isArray(tests) ? tests : [ tests ]).every( | ||
test => compareValOrFn(test, () => left) | ||
) ? left : false; | ||
}; | ||
@@ -333,3 +348,3 @@ | ||
const contexts = _contexts(context); | ||
return contexts.every(ctx => _condition(ctx)); | ||
return contexts.every(ctx => isTruthy(_condition(ctx))); | ||
}; | ||
@@ -342,3 +357,3 @@ | ||
const contexts = _contexts(context); | ||
return contexts.some(ctx => _condition(ctx)); | ||
return contexts.some(ctx => isTruthy(_condition(ctx))); | ||
}; | ||
@@ -348,3 +363,8 @@ }, Test('boolean')); | ||
case 'between': return tag( | ||
(context) => (expr, start, end) => start(context) <= expr(context) <= end(context), | ||
(context) => (expr, start, end) => { | ||
const left = expr(context); | ||
return start(context) <= left <= end(context) ? left : false; | ||
}, | ||
'boolean' | ||
@@ -374,3 +394,3 @@ ); | ||
if (ifCondition(context)) { | ||
if (isTruthy(ifCondition(context))) { | ||
return thenValue(context); | ||
@@ -498,4 +518,4 @@ } else { | ||
if (!filterTarget) { | ||
return null; | ||
if (!Array.isArray(filterTarget)) { | ||
return filterTarget; | ||
} | ||
@@ -520,11 +540,17 @@ | ||
// a[test] | ||
return filterTarget.filter(el => { | ||
return filterTarget.map(el => { | ||
const filter = filterFn({ | ||
const iterationContext = { | ||
...context, | ||
item: el, | ||
...Object.entries(el).reduce(function(itemScope, [key, value]) { | ||
itemScope[ 'item.' + key ] = value; | ||
return itemScope; | ||
}, {}), | ||
...el | ||
}); | ||
}; | ||
return filter; | ||
}); | ||
return filterFn(iterationContext); | ||
}).filter(isTruthy); | ||
}; | ||
@@ -565,3 +591,8 @@ | ||
function getFromContext(variable, context) { | ||
return context[variable]; | ||
if (variable in context) { | ||
return context[variable]; | ||
} | ||
return null; | ||
} | ||
@@ -631,2 +662,6 @@ | ||
function isTruthy(obj) { | ||
return obj !== false && obj !== null; | ||
} | ||
function Test(type) { | ||
@@ -633,0 +668,0 @@ return `Test<${type}>`; |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
271831
4697