Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "astq", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Abstract Syntax Tree (AST) Query Engine", | ||
@@ -5,0 +5,0 @@ "main": "lib/astq.browser.js", |
@@ -27,3 +27,3 @@ /* | ||
(function (global){ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.ASTY=e()}}(function(){return function e(t,n,r){function i(u,a){if(!n[u]){if(!t[u]){var f="function"==typeof _dereq_&&_dereq_;if(!a&&f)return f(u,!0);if(o)return o(u,!0);var s=new Error("Cannot find module '"+u+"'");throw s.code="MODULE_NOT_FOUND",s}var l=n[u]={exports:{}};t[u][0].call(l.exports,function(e){var n=t[u][1][e];return i(n?n:e)},l,l.exports,e,t,n,r)}return n[u].exports}for(var o="function"==typeof _dereq_&&_dereq_,u=0;u<r.length;u++)i(r[u]);return i}({1:[function(e,t){"use strict";var n=function(e,t,n){t&&Object.defineProperties(e,t),n&&Object.defineProperties(e.prototype,n)},r=function(){function e(){}return n(e,null,{init:{value:function(e,t,n){if("undefined"==typeof e)throw new Error("init: invalid argument");if(this.ASTy=!0,this.T=e,this.L={L:0,C:0,O:0},this.A={},this.C=[],this.P=null,"object"==typeof t)for(var r in t)t.hasOwnProperty(r)&&this.set(r,t[r]);return"object"==typeof n&&n instanceof Array&&this.add(n),this},writable:!0,enumerable:!0,configurable:!0},type:{value:function(e){if(0===arguments.length)return this.T;if(1===arguments.length)return this.T=e,this;throw new Error("type: invalid number of arguments")},writable:!0,enumerable:!0,configurable:!0},pos:{value:function(e,t,n){if(0===arguments.length)return this.L;if(arguments.length<=3)return this.L.L=e||0,this.L.C=t||0,this.L.O=n||0,this;throw new Error("pos: invalid number of arguments")},writable:!0,enumerable:!0,configurable:!0},set:{value:function(){if(1===arguments.length&&"object"==typeof arguments[0]){var e=this,t=arguments;Object.keys(t[0]).forEach(function(n){e.A[n]=t[0][n]})}else{if(2!==arguments.length)throw new Error("set: invalid arguments");this.A[arguments[0]]=arguments[1]}return this},writable:!0,enumerable:!0,configurable:!0},get:{value:function(e){if(1!==arguments.length)throw new Error("get: invalid number of arguments");if("string"!=typeof e)throw new Error("get: invalid argument");return this.A[e]},writable:!0,enumerable:!0,configurable:!0},attrs:{value:function(){return Object.keys(this.A)},writable:!0,enumerable:!0,configurable:!0},add:{value:function(){if(0===arguments.length)throw new Error("add: missing argument(s)");var e=function(e,t){if(!("object"==typeof t&&"string"==typeof t.T&&"object"==typeof t.L&&"object"==typeof t.A&&"object"==typeof t.P&&"object"==typeof t.C&&t.C instanceof Array))throw new Error("add: invalid AST node: "+JSON.stringify(t));e.C.push(t),t.P=e};if(null!==arguments){var t=this;Array.prototype.slice.call(arguments,0).forEach(function(n){"object"==typeof n&&n instanceof Array?n.forEach(function(n){e(t,n)}):null!==n&&e(t,n)})}return this},writable:!0,enumerable:!0,configurable:!0},del:{value:function(){if(0===arguments.length)throw new Error("del: invalid argument");var e=this;return Array.prototype.slice.call(arguments,0).forEach(function(t){for(var n=!1,r=0;r<e.C.length;r++)if(e.C[r]===t){e.C.splice(r,1),t.P=null,n=!0;break}if(!n)throw new Error("del: child not found")}),this},writable:!0,enumerable:!0,configurable:!0},childs:{value:function(){return this.C},writable:!0,enumerable:!0,configurable:!0},parent:{value:function(){return this.P},writable:!0,enumerable:!0,configurable:!0}}),e}();t.exports=r},{}],2:[function(e,t){"use strict";var n=function(e,t,n){t&&Object.defineProperties(e,t),n&&Object.defineProperties(e.prototype,n)},r=function(){function e(){}return n(e,null,{dump:{value:function(e){void 0===e&&(e=1/0);var t="";return this.walk(function(n,r){if(!(r>e)){for(var i=0;r>i;i++)t+=" ";t+=n.T+" ";var o=Object.keys(n.A);if(o.length>0){t+="(";var u=!0;o.forEach(function(e){u?u=!1:t+=", ",t+=e+": ";var r=n.A[e];switch(typeof r){case"string":t+='"'+r.replace(/\n/,"\\n").replace(/"/,'\\"')+'"';break;case"object":t+=r instanceof RegExp?"/"+r.toString().replace(/^\//,"").replace(/\/$/,"").replace(/\//g,"\\/")+"/":JSON.stringify(r);break;default:t+=JSON.stringify(r)}}),t+=") "}t+="["+n.L.L+"/"+n.L.C+"]\n"}},"downward"),t},writable:!0,enumerable:!0,configurable:!0}}),e}();t.exports=r},{}],3:[function(e,t){"use strict";var n=function(e,t,n){t&&Object.defineProperties(e,t),n&&Object.defineProperties(e.prototype,n)},r=function(){function e(){}return n(e,null,{merge:{value:function(e,t,n){if("object"!=typeof e)throw new Error("merge: invalid AST node argument");"undefined"==typeof t&&(t=!1),"undefined"==typeof n&&(n={});var r=this;if(t){var i=e.pos();r.pos(i.L,i.C,i.O)}return e.attrs().forEach(function(t){var i="undefined"!=typeof n[t]?n[t]:t;null!==i&&r.set(i,e.get(t))}),e.childs().forEach(function(e){r.add(e)}),this},writable:!0,enumerable:!0,configurable:!0}}),e}();t.exports=r},{}],4:[function(e,t){"use strict";var n=function(e,t,n){t&&Object.defineProperties(e,t),n&&Object.defineProperties(e.prototype,n)},r=function(){function e(){}return n(e,null,{walk:{value:function(e,t){"undefined"==typeof t&&(t="downward");var n=function(r,i,o){("downward"===t||"both"===t)&&e.call(null,r,i,o,"downward"),r.C.forEach(function(e){n(e,i+1,r)}),("upward"===t||"both"===t)&&e.call(null,r,i,o,"upward")};return n(this,0,null),this},writable:!0,enumerable:!0,configurable:!0}}),e}();t.exports=r},{}],5:[function(e,t){"use strict";var n=function(e,t,n){t&&Object.defineProperties(e,t),n&&Object.defineProperties(e.prototype,n)},r=e("./asty-base.js"),i=e("./asty-merge.js"),o=e("./asty-walk.js"),u=e("./asty-dump.js"),a=function(){function e(){var t=this;if(!(this instanceof e))return new e;this.ASTYNode=function(){};var n=[r,i,o,u];return n.forEach(function(e){for(var n in e.prototype)e.prototype.hasOwnProperty(n)&&(t.ASTYNode.prototype[n]=e.prototype[n])}),this}return n(e,null,{extend:{value:function(e){for(var t in e)e.hasOwnProperty(t)&&(this.ASTYNode.prototype[t]=e[t]);return this},writable:!0,enumerable:!0,configurable:!0},create:{value:function(e){return(new this.ASTYNode).init(e)},writable:!0,enumerable:!0,configurable:!0},isA:{value:function(e){return"object"==typeof e&&e instanceof this.ASTYNode&&"boolean"==typeof e.ASTy&&e.ASTy===!0},writable:!0,enumerable:!0,configurable:!0}}),e}();t.exports=a},{"./asty-base.js":1,"./asty-dump.js":2,"./asty-merge.js":3,"./asty-walk.js":4}]},{},[1,2,3,4,5])(5)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.ASTY=e()}}(function(){return function e(t,n,r){function i(u,a){if(!n[u]){if(!t[u]){var f="function"==typeof _dereq_&&_dereq_;if(!a&&f)return f(u,!0);if(o)return o(u,!0);var s=new Error("Cannot find module '"+u+"'");throw s.code="MODULE_NOT_FOUND",s}var c=n[u]={exports:{}};t[u][0].call(c.exports,function(e){var n=t[u][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[u].exports}for(var o="function"==typeof _dereq_&&_dereq_,u=0;u<r.length;u++)i(r[u]);return i}({1:[function(e,t){"use strict";var n=function(e,t,n){t&&Object.defineProperties(e,t),n&&Object.defineProperties(e.prototype,n)},r=function(){function e(){}return n(e,null,{init:{value:function(e,t,n){if("undefined"==typeof e)throw new Error("init: invalid argument");if(this.ASTy=!0,this.T=e,this.L={L:0,C:0,O:0},this.A={},this.C=[],this.P=null,"object"==typeof t)for(var r in t)t.hasOwnProperty(r)&&this.set(r,t[r]);return"object"==typeof n&&n instanceof Array&&this.add(n),this},writable:!0,configurable:!0},type:{value:function(e){if(0===arguments.length)return this.T;if(1===arguments.length)return this.T=e,this;throw new Error("type: invalid number of arguments")},writable:!0,configurable:!0},pos:{value:function(e,t,n){if(0===arguments.length)return this.L;if(arguments.length<=3)return this.L.L=e||0,this.L.C=t||0,this.L.O=n||0,this;throw new Error("pos: invalid number of arguments")},writable:!0,configurable:!0},set:{value:function(){var e=this,t=arguments;if(1===arguments.length&&"object"==typeof arguments[0])!function(){var n=t;Object.keys(n[0]).forEach(function(t){e.A[t]=n[0][t]})}();else{if(2!==arguments.length)throw new Error("set: invalid arguments");this.A[arguments[0]]=arguments[1]}return this},writable:!0,configurable:!0},get:{value:function(e){if(1!==arguments.length)throw new Error("get: invalid number of arguments");if("string"!=typeof e)throw new Error("get: invalid argument");return this.A[e]},writable:!0,configurable:!0},attrs:{value:function(){return Object.keys(this.A)},writable:!0,configurable:!0},add:{value:function(){var e=this;if(0===arguments.length)throw new Error("add: missing argument(s)");var t=function(e,t){if(!("object"==typeof t&&"string"==typeof t.T&&"object"==typeof t.L&&"object"==typeof t.A&&"object"==typeof t.P&&"object"==typeof t.C&&t.C instanceof Array))throw new Error("add: invalid AST node: "+JSON.stringify(t));e.C.push(t),t.P=e};return null!==arguments&&Array.prototype.slice.call(arguments,0).forEach(function(n){"object"==typeof n&&n instanceof Array?n.forEach(function(n){t(e,n)}):null!==n&&t(e,n)}),this},writable:!0,configurable:!0},del:{value:function(){var e=this;if(0===arguments.length)throw new Error("del: invalid argument");return Array.prototype.slice.call(arguments,0).forEach(function(t){for(var n=!1,r=0;r<e.C.length;r++)if(e.C[r]===t){e.C.splice(r,1),t.P=null,n=!0;break}if(!n)throw new Error("del: child not found")}),this},writable:!0,configurable:!0},childs:{value:function(){return this.C},writable:!0,configurable:!0},parent:{value:function(){return this.P},writable:!0,configurable:!0}}),e}();t.exports=r},{}],2:[function(e,t){"use strict";var n=function(e,t,n){t&&Object.defineProperties(e,t),n&&Object.defineProperties(e.prototype,n)},r=function(){function e(){}return n(e,null,{dump:{value:function(e){void 0===e&&(e=1/0);var t="";return this.walk(function(n,r){if(!(r>e)){for(var i=0;r>i;i++)t+=" ";t+=n.T+" ";var o=Object.keys(n.A);o.length>0&&!function(){t+="(";var e=!0;o.forEach(function(r){e?e=!1:t+=", ",t+=r+": ";var i=n.A[r];switch(typeof i){case"string":t+='"'+i.replace(/\n/,"\\n").replace(/"/,'\\"')+'"';break;case"object":t+=i instanceof RegExp?"/"+i.toString().replace(/^\//,"").replace(/\/$/,"").replace(/\//g,"\\/")+"/":JSON.stringify(i);break;default:t+=JSON.stringify(i)}}),t+=") "}(),t+="["+n.L.L+"/"+n.L.C+"]\n"}},"downward"),t},writable:!0,configurable:!0}}),e}();t.exports=r},{}],3:[function(e,t){"use strict";var n=function(e,t,n){t&&Object.defineProperties(e,t),n&&Object.defineProperties(e.prototype,n)},r=function(){function e(){}return n(e,null,{merge:{value:function(e,t,n){var r=this;if("object"!=typeof e)throw new Error("merge: invalid AST node argument");if("undefined"==typeof t&&(t=!1),"undefined"==typeof n&&(n={}),t){var i=e.pos();this.pos(i.L,i.C,i.O)}return e.attrs().forEach(function(t){var i="undefined"!=typeof n[t]?n[t]:t;null!==i&&r.set(i,e.get(t))}),e.childs().forEach(function(e){r.add(e)}),this},writable:!0,configurable:!0}}),e}();t.exports=r},{}],4:[function(e,t){"use strict";var n=function(e,t,n){t&&Object.defineProperties(e,t),n&&Object.defineProperties(e.prototype,n)},r=function(){function e(){}return n(e,null,{walk:{value:function(e,t){"undefined"==typeof t&&(t="downward");var n=function(r,i,o){("downward"===t||"both"===t)&&e.call(null,r,i,o,"downward"),r.C.forEach(function(e){n(e,i+1,r)}),("upward"===t||"both"===t)&&e.call(null,r,i,o,"upward")};return n(this,0,null),this},writable:!0,configurable:!0}}),e}();t.exports=r},{}],5:[function(e,t){"use strict";var n=function(e,t,n){t&&Object.defineProperties(e,t),n&&Object.defineProperties(e.prototype,n)},r=e("./asty-base.js"),i=e("./asty-merge.js"),o=e("./asty-walk.js"),u=e("./asty-dump.js"),a=function(){function e(){var t=this;if(!(this instanceof e))return new e;this.ASTYNode=function(){};var n=[[r,"init","type","pos","set","get","attrs","add","del","childs","parent"],[i,"merge"],[o,"walk"],[u,"dump"]];return n.forEach(function(e){var n=e[0].prototype;e.slice(1).forEach(function(e){t.ASTYNode.prototype[e]=n[e]})}),this}return n(e,null,{extend:{value:function(e){for(var t in e)e.hasOwnProperty(t)&&(this.ASTYNode.prototype[t]=e[t]);return this},writable:!0,configurable:!0},create:{value:function(e){return(new this.ASTYNode).init(e)},writable:!0,configurable:!0},isA:{value:function(e){return"object"==typeof e&&e instanceof this.ASTYNode&&"boolean"==typeof e.ASTy&&e.ASTy===!0},writable:!0,configurable:!0}}),e}();t.exports=a},{"./asty-base.js":1,"./asty-dump.js":2,"./asty-merge.js":3,"./asty-walk.js":4}]},{},[1,2,3,4,5])(5)}); | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
@@ -43,19 +43,19 @@ | ||
},{}],6:[function(_dereq_,module,exports){ | ||
"use strict";var _prototypeProperties=function(e,t,r){t&&Object.defineProperties(e,t),r&&Object.defineProperties(e.prototype,r)},ASTQAdapter=function(){function e(){return this._adapters=[],this}return _prototypeProperties(e,null,{register:{value:function(e){return this._adapters.unshift(e),this},writable:!0,enumerable:!0,configurable:!0},unregister:{value:function(e){if(void 0===e)this._adapters=[];else{for(var t=[],r=0;r<this._adapters.length;r++)this._adapters[r]!==e&&t.push(this._adapters[r]);this._adapters=t}return this},writable:!0,enumerable:!0,configurable:!0},select:{value:function(e){for(var t=0;t<this._adapters.length;t++)if(this._adapters[t].taste(e))return this._adapters[t];return void 0},writable:!0,enumerable:!0,configurable:!0}}),e}();module.exports=ASTQAdapter; | ||
"use strict";var _prototypeProperties=function(t,e,r){e&&Object.defineProperties(t,e),r&&Object.defineProperties(t.prototype,r)},ASTQAdapter=function(){function t(){return this._adapters=[],this}return _prototypeProperties(t,null,{register:{value:function(t){return this._adapters.unshift(t),this},writable:!0,configurable:!0},unregister:{value:function(t){if(void 0===t)this._adapters=[];else{for(var e=[],r=0;r<this._adapters.length;r++)this._adapters[r]!==t&&e.push(this._adapters[r]);this._adapters=e}return this},writable:!0,configurable:!0},select:{value:function(t){for(var e=0;e<this._adapters.length;e++)if(this._adapters[e].taste(t))return this._adapters[e];return void 0},writable:!0,configurable:!0}}),t}();module.exports=ASTQAdapter; | ||
},{}],7:[function(_dereq_,module,exports){ | ||
"use strict";var _prototypeProperties=function(e,t,r){t&&Object.defineProperties(e,t),r&&Object.defineProperties(e.prototype,r)},ASTQCache=function(){function e(){return this._index={},this._oldHead={newer:null},this._newHead={older:null},this._oldHead.newer=this._newHead,this._newHead.older=this._oldHead,this._cur=0,this._max=1/0,this._dispose=function(){},this}return _prototypeProperties(e,null,{limit:{value:function(e){var t=this._max;return arguments.length>0&&(this._max=e,this._purge()),t},writable:!0,enumerable:!0,configurable:!0},dispose:{value:function(e){return this._dispose=e,this},writable:!0,enumerable:!0,configurable:!0},length:{value:function(){return this._cur},writable:!0,enumerable:!0,configurable:!0},keys:{value:function(){return this.each(function(e,t){this.push(t)},[])},writable:!0,enumerable:!0,configurable:!0},values:{value:function(){return this.each(function(e){this.push(e)},[])},writable:!0,enumerable:!0,configurable:!0},each:{value:function(e,t){arguments<2&&(t=this);for(var r=0,i=this._newHead.older;i!==this._oldHead;)e.call(t,i.val,i.key,r++),i=i.older;return t},writable:!0,enumerable:!0,configurable:!0},has:{value:function(e){var t=this._index[e];return void 0!==t},writable:!0,enumerable:!0,configurable:!0},peek:{value:function(e){var t=this._index[e];return void 0===t?void 0:t.expires<Date.now()?void this.del(t.key):t.val},writable:!0,enumerable:!0,configurable:!0},touch:{value:function(e){var t=this._index[e];return void 0!==t&&this._promote(t),this},writable:!0,enumerable:!0,configurable:!0},get:{value:function(e){var t=this.peek(e);return this.touch(e),t},writable:!0,enumerable:!0,configurable:!0},set:{value:function(e,t,r){arguments.length<3&&(r=1/0),r+=Date.now();var i=this._index[e];if(void 0===i)i={older:null,newer:null,key:e,val:t,expires:r},this._index[e]=i,this._attach(i),this._cur++,this._purge();else{var n=i.val;i.val=t,this._promote(i),this._dispose(void 0,i.key,n,"set")}return this},writable:!0,enumerable:!0,configurable:!0},del:{value:function(e){var t=this._index[e];if(void 0===t)throw new Error("ASTQ::Cache#del: no such item");return delete this._index[e],this._detach(t),this._cur--,this._dispose(void 0,e,t.val,"del"),this},writable:!0,enumerable:!0,configurable:!0},clear:{value:function(){for(;this._cur>0;)this.del(this._oldHead.newer.key);return this},writable:!0,enumerable:!0,configurable:!0},_purge:{value:function(){for(;this._cur>this._max;)this.del(this._oldHead.newer.key)},writable:!0,enumerable:!0,configurable:!0},_promote:{value:function(e){this._detach(e),this._attach(e)},writable:!0,enumerable:!0,configurable:!0},_detach:{value:function(e){e.older.newer=e.newer,e.newer.older=e.older,e.older=null,e.newer=null},writable:!0,enumerable:!0,configurable:!0},_attach:{value:function(e){e.older=this._newHead.older,e.newer=this._newHead,e.newer.older=e,e.older.newer=e},writable:!0,enumerable:!0,configurable:!0}}),e}();module.exports=ASTQCache; | ||
"use strict";var _prototypeProperties=function(e,t,i){t&&Object.defineProperties(e,t),i&&Object.defineProperties(e.prototype,i)},ASTQCache=function(){function e(){return this._index={},this._oldHead={newer:null},this._newHead={older:null},this._oldHead.newer=this._newHead,this._newHead.older=this._oldHead,this._cur=0,this._max=1/0,this._dispose=function(){},this}return _prototypeProperties(e,null,{limit:{value:function(e){var t=this._max;return arguments.length>0&&(this._max=e,this._purge()),t},writable:!0,configurable:!0},dispose:{value:function(e){return this._dispose=e,this},writable:!0,configurable:!0},length:{value:function(){return this._cur},writable:!0,configurable:!0},keys:{value:function(){return this.each(function(e,t){this.push(t)},[])},writable:!0,configurable:!0},values:{value:function(){return this.each(function(e){this.push(e)},[])},writable:!0,configurable:!0},each:{value:function(e,t){arguments<2&&(t=this);for(var i=0,r=this._newHead.older;r!==this._oldHead;)e.call(t,r.val,r.key,i++),r=r.older;return t},writable:!0,configurable:!0},has:{value:function(e){var t=this._index[e];return void 0!==t},writable:!0,configurable:!0},peek:{value:function(e){var t=this._index[e];return void 0===t?void 0:t.expires<Date.now()?void this.del(t.key):t.val},writable:!0,configurable:!0},touch:{value:function(e){var t=this._index[e];return void 0!==t&&this._promote(t),this},writable:!0,configurable:!0},get:{value:function(e){var t=this.peek(e);return this.touch(e),t},writable:!0,configurable:!0},set:{value:function(e,t,i){arguments.length<3&&(i=1/0),i+=Date.now();var r=this._index[e];if(void 0===r)r={older:null,newer:null,key:e,val:t,expires:i},this._index[e]=r,this._attach(r),this._cur++,this._purge();else{var n=r.val;r.val=t,this._promote(r),this._dispose(void 0,r.key,n,"set")}return this},writable:!0,configurable:!0},del:{value:function(e){var t=this._index[e];if(void 0===t)throw new Error("ASTQ::Cache#del: no such item");return delete this._index[e],this._detach(t),this._cur--,this._dispose(void 0,e,t.val,"del"),this},writable:!0,configurable:!0},clear:{value:function(){for(;this._cur>0;)this.del(this._oldHead.newer.key);return this},writable:!0,configurable:!0},_purge:{value:function(){for(;this._cur>this._max;)this.del(this._oldHead.newer.key)},writable:!0,configurable:!0},_promote:{value:function(e){this._detach(e),this._attach(e)},writable:!0,configurable:!0},_detach:{value:function(e){e.older.newer=e.newer,e.newer.older=e.older,e.older=null,e.newer=null},writable:!0,configurable:!0},_attach:{value:function(e){e.older=this._newHead.older,e.newer=this._newHead,e.newer.older=e,e.older.newer=e},writable:!0,configurable:!0}}),e}();module.exports=ASTQCache; | ||
},{}],8:[function(_dereq_,module,exports){ | ||
"use strict";var stdfuncs={type:function(t,n){return t.getNodeType(n)},depth:function(t,n){for(var r=1,e=n;null!==(e=t.getParentNode(e));)r++;return r},pos:function(t,n){var r=t.getParentNode(n);if(null===r)return 1;for(var e=t.getChildNodes(r),u=0;u<e.length;u++)if(e[u]===n)return u+1;throw new Error("cannot find myself")},nth:function(t,n,r){r=parseInt(r,10);var e=t.getParentNode(n);if(null!==e){var u=t.getChildNodes(e);0>r&&(r=u-(r+1));for(var o=0;o<u.length;o++)if(u[o]===n)return o+1===r;return!1}return 1===r?!0:!1},first:function(t,n){return stdfuncs.nth(t,n,1)},last:function(t,n){return stdfuncs.nth(t,n,-1)},count:function(t,n,r){return"object"==typeof r&&r instanceof Array?r.length:"object"==typeof r?Object.keys(r).length:"string"==typeof r?r.length:String(r).length},substr:function(t,n,r,e,u){return String(r).substr(e,u)},lc:function(t,n,r){return String(r).toLowerCase()},uc:function(t,n,r){return String(r).toUpperCase()}};module.exports=stdfuncs; | ||
},{}],9:[function(_dereq_,module,exports){ | ||
"use strict";var _prototypeProperties=function(e,r,t){r&&Object.defineProperties(e,r),t&&Object.defineProperties(e.prototype,t)},ASTQFuncs=function(){function e(){return this._funcs={},this}return _prototypeProperties(e,null,{register:{value:function(e,r){this._funcs[e]=r},writable:!0,enumerable:!0,configurable:!0},run:{value:function(e,r){var t=this._funcs[e];if("function"!=typeof t)throw new Error('invalid function "'+e+'"');return t.apply(null,r)},writable:!0,enumerable:!0,configurable:!0}}),e}();module.exports=ASTQFuncs; | ||
"use strict";var _prototypeProperties=function(t,e,r){e&&Object.defineProperties(t,e),r&&Object.defineProperties(t.prototype,r)},ASTQFuncs=function(){function t(){return this._funcs={},this}return _prototypeProperties(t,null,{register:{value:function(t,e){this._funcs[t]=e},writable:!0,configurable:!0},run:{value:function(t,e){var r=this._funcs[t];if("function"!=typeof r)throw new Error('invalid function "'+t+'"');return r.apply(null,e)},writable:!0,configurable:!0}}),t}();module.exports=ASTQFuncs; | ||
},{}],10:[function(_dereq_,module,exports){ | ||
"use strict";var _prototypeProperties=function(e,r,t){r&&Object.defineProperties(e,r),t&&Object.defineProperties(e.prototype,t)},_inherits=function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(e.__proto__=r)},util=_dereq_("./astq-util.js"),ASTQQueryTrace=_dereq_("./astq-query-trace.js"),ASTQQueryExec=function(e){function r(e,r,t,i){this.adapter=e,this.params=r,this.funcs=t,this.trace=i}return _inherits(r,e),_prototypeProperties(r,null,{execQuery:{value:function(e,r){var t=this;this.traceBegin(e,r);var i=[];return e.childs().forEach(function(e){i=i.concat(t.execPath(e,r))}),this.traceEnd(e,r,i),i},writable:!0,enumerable:!0,configurable:!0},execPath:{value:function(e,r){var t=this;this.traceBegin(e,r);var i=[r];return e.childs().forEach(function(e){var r=[];i.forEach(function(i){r=r.concat(t.execStep(e,i))}),i=r}),this.traceEnd(e,r,i),i},writable:!0,enumerable:!0,configurable:!0},execStep:{value:function(e,r){var t=this;this.traceBegin(e,r);var i=e.childs(),a=null,c=null,n=null,u=0;if(u<i.length&&"Axis"===i[u].type()&&(a=i[u++]),u<i.length&&"Match"===i[u].type()&&(c=i[u++]),u<i.length&&"Filter"===i[u].type()&&(n=i[u++]),null===c)throw new Error("no matching part in query step");var l=[],s=c.get("id"),o=function(e){var r=t.adapter.getNodeType(e);if("*"===s||s===r){var i=!0;null!==n&&(t.execFilter(n,e)||(i=!1)),i&&l.push(e)}};if(null!==a){var h=a.get("op");if("/"===h)this.adapter.getChildNodes(r).forEach(function(e){return o(e)});else if("//"===h)!function(){var e=function(r){o(r),t.adapter.getChildNodes(r).forEach(function(r){return e(r)})};t.adapter.getChildNodes(r).forEach(function(r){return e(r)})}();else if("<~"===h){var p=this.adapter.getParentNode(r);if(null!==p){for(var x=this.adapter.getChildNodes(p),b=null,d=0;d<x.length&&x[d]!==r;d++)b=x[d];o(b)}}else if("<~~"===h){var p=this.adapter.getParentNode(r);if(null!==p)for(var x=this.adapter.getChildNodes(p),f=0;f<x.length&&x[f]!==r;f++)o(x[f])}else if("~>"===h){var p=this.adapter.getParentNode(r);if(null!==p){var x=this.adapter.getChildNodes(p),g=void 0;for(g=0;g<x.length&&x[g]!==r;g++);g<x.length&&(g++,o(x[g]))}}else if("~~>"===h){var p=this.adapter.getParentNode(r);if(null!==p){var x=this.adapter.getChildNodes(p),E=void 0;for(E=0;E<x.length&&x[E]!==r;E++);if(E<x.length)for(E++;E<x.length;)o(x[E++])}}else if("~^"===h){var p=this.adapter.getParentNode(r);null!==p&&o(p)}else if("~~^"===h)for(var v=r;;){var p=this.adapter.getParentNode(v);if(null===p)break;o(p),v=p}}else o(r);return this.traceEnd(e,r,l),l},writable:!0,enumerable:!0,configurable:!0},execFilter:{value:function(e,r){this.traceBegin(e,r);var t=e.childs()[0],i=this.execExpr(t,r);return i=util.truthy(i),this.traceEnd(e,r,i),i},writable:!0,enumerable:!0,configurable:!0},execExpr:{value:function(e,r){switch(e.type()){case"ConditionalBinary":return this.execExprConditionalBinary(e,r);case"ConditionalTernary":return this.execExprConditionalTernary(e,r);case"Logical":return this.execExprLogical(e,r);case"Bitwise":return this.execExprBitwise(e,r);case"Relational":return this.execExprRelational(e,r);case"Arithmetical":return this.execExprArithmetical(e,r);case"Unary":return this.execExprUnary(e,r);case"FuncCall":return this.execExprFuncCall(e,r);case"Attribute":return this.execExprAttribute(e,r);case"Param":return this.execExprParam(e,r);case"LiteralString":return this.execExprLiteralString(e,r);case"LiteralRegExp":return this.execExprLiteralRegExp(e,r);case"LiteralNumber":return this.execExprLiteralNumber(e,r);case"LiteralValue":return this.execExprLiteralValue(e,r);case"Path":return this.execExprPath(e,r)}},writable:!0,enumerable:!0,configurable:!0},execExprConditionalBinary:{value:function(e,r){this.traceBegin(e,r);var t=this.execExpr(e.childs()[0],r);return util.truthy(t)||(t=this.execExpr(e.childs()[1],r)),this.traceEnd(e,r,t),t},writable:!0,enumerable:!0,configurable:!0},execExprConditionalTernary:{value:function(e,r){this.traceBegin(e,r);var t=this.execExpr(e.childs()[0],r);return t=util.truthy(t)?this.execExpr(e.childs()[1],r):this.execExpr(e.childs()[2],r),this.traceEnd(e,r,t),t},writable:!0,enumerable:!0,configurable:!0},execExprLogical:{value:function(e,r){this.traceBegin(e,r);var t=!1;switch(e.get("op")){case"&&":t=util.truthy(this.execExpr(e.childs()[0],r)),t&&(t=t&&util.truthy(this.execExpr(e.childs()[1],r)));break;case"||":t=util.truthy(this.execExpr(e.childs()[0],r)),t||(t=t||util.truthy(this.execExpr(e.childs()[1],r)))}return this.traceEnd(e,r,t),t},writable:!0,enumerable:!0,configurable:!0},execExprBitwise:{value:function(e,r){this.traceBegin(e,r);var t=util.coerce(this.execExpr(e.childs()[0],r),"number"),i=util.coerce(this.execExpr(e.childs()[1],r),"number"),a=void 0;switch(e.get("op")){case"&":a=t&i;break;case"|":a=t|i;break;case"<<":a=t<<i;break;case">>":a=t>>i}return this.traceEnd(e,r,a),a},writable:!0,enumerable:!0,configurable:!0},execExprRelational:{value:function(e,r){this.traceBegin(e,r);var t=this.execExpr(e.childs()[0],r),i=this.execExpr(e.childs()[1],r),a=void 0;switch(e.get("op")){case"==":a=t===i;break;case"!=":a=t!==i;break;case"<=":a=util.coerce(t,"number")<=util.coerce(i,"number");break;case">=":a=util.coerce(t,"number")>=util.coerce(i,"number");break;case"<":a=util.coerce(t,"number")<util.coerce(i,"number");break;case">":a=util.coerce(t,"number")>util.coerce(i,"number");break;case"=~":a=null!==util.coerce(t,"string").match(util.coerce(i,"regexp"));break;case"!~":a=null===util.coerce(t,"string").match(util.coerce(i,"regexp"))}return this.traceEnd(e,r,a),a},writable:!0,enumerable:!0,configurable:!0},execExprArithmetical:{value:function(e,r){this.traceBegin(e,r);var t=this.execExpr(e.childs()[0],r),i=this.execExpr(e.childs()[1],r),a=void 0;switch(e.get("op")){case"+":a="string"==typeof t?t+util.coerce(i,"string"):util.coerce(t,"number")+util.coerce(i,"number");break;case"-":a=util.coerce(t,"number")+util.coerce(i,"number");break;case"*":a=util.coerce(t,"number")*util.coerce(i,"number");break;case"/":a=util.coerce(t,"number")/util.coerce(i,"number");break;case"%":a=util.coerce(t,"number")%util.coerce(i,"number");break;case"**":a=Math.pow(util.coerce(t,"number"),util.coerce(i,"number"))}return this.traceEnd(e,r,a),a},writable:!0,enumerable:!0,configurable:!0},execExprUnary:{value:function(e,r){this.traceBegin(e,r);var t=this.execExpr(e.childs()[0],r),i=void 0;switch(e.get("op")){case"!":i=!util.coerce(t,"boolean");break;case"~":i=~util.coerce(t,"number")}return this.traceEnd(e,r,i),i},writable:!0,enumerable:!0,configurable:!0},execExprFuncCall:{value:function(e,r){var t=this;this.traceBegin(e,r);var i=e.get("id"),a=[this.adapter,r];e.childs().forEach(function(e){a.push(t.execExpr(e,r))});var c=this.funcs.run(i,a);return this.traceEnd(e,r,c),c},writable:!0,enumerable:!0,configurable:!0},execExprAttribute:{value:function(e,r){this.traceBegin(e,r);var t=e.get("id"),i=this.adapter.getNodeAttrValue(r,t);return this.traceEnd(e,r,i),i},writable:!0,enumerable:!0,configurable:!0},execExprParam:{value:function(e,r){this.traceBegin(e,r);var t=e.get("id");if("undefined"==typeof this.params[t])throw new Error('invalid parameter "'+t+'"');var i=this.params[t];return this.traceEnd(e,r,i),i},writable:!0,enumerable:!0,configurable:!0},execExprLiteralString:{value:function(e,r){this.traceBegin(e,r);var t=e.get("value");return this.traceEnd(e,r,t),t},writable:!0,enumerable:!0,configurable:!0},execExprLiteralRegExp:{value:function(e,r){this.traceBegin(e,r);var t=e.get("value");return this.traceEnd(e,r,t),t},writable:!0,enumerable:!0,configurable:!0},execExprLiteralNumber:{value:function(e,r){this.traceBegin(e,r);var t=e.get("value");return this.traceEnd(e,r,t),t},writable:!0,enumerable:!0,configurable:!0},execExprLiteralValue:{value:function(e,r){this.traceBegin(e,r);var t=e.get("value");return this.traceEnd(e,r,t),t},writable:!0,enumerable:!0,configurable:!0},execExprPath:{value:function(e,r){this.traceBegin(e,r);var t=this.execPath(e,r);return this.traceEnd(e,r,t),t},writable:!0,enumerable:!0,configurable:!0}}),r}(ASTQQueryTrace);module.exports=ASTQQueryExec; | ||
"use strict";var _prototypeProperties=function(e,r,t){r&&Object.defineProperties(e,r),t&&Object.defineProperties(e.prototype,t)},_inherits=function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),r&&(e.__proto__=r)},util=_dereq_("./astq-util.js"),ASTQQueryTrace=_dereq_("./astq-query-trace.js"),ASTQQueryExec=function(e){function r(e,r,t,i){this.adapter=e,this.params=r,this.funcs=t,this.trace=i}return _inherits(r,e),_prototypeProperties(r,null,{execQuery:{value:function(e,r){var t=this;this.traceBegin(e,r);var i=[];return e.childs().forEach(function(e){i=i.concat(t.execPath(e,r))}),this.traceEnd(e,r,i),i},writable:!0,configurable:!0},execPath:{value:function(e,r){var t=this;this.traceBegin(e,r);var i=[r];return e.childs().forEach(function(e){var r=[];i.forEach(function(i){r=r.concat(t.execStep(e,i))}),i=r}),this.traceEnd(e,r,i),i},writable:!0,configurable:!0},execStep:{value:function(e,r){var t=this;this.traceBegin(e,r);var i=e.childs(),a=null,c=null,n=null,u=0;if(u<i.length&&"Axis"===i[u].type()&&(a=i[u++]),u<i.length&&"Match"===i[u].type()&&(c=i[u++]),u<i.length&&"Filter"===i[u].type()&&(n=i[u++]),null===c)throw new Error("no matching part in query step");var l=[],s=c.get("id"),o=function(e){var r=t.adapter.getNodeType(e);if("*"===s||s===r){var i=!0;null!==n&&(t.execFilter(n,e)||(i=!1)),i&&l.push(e)}};if(null!==a){var h=a.get("op");if("/"===h)this.adapter.getChildNodes(r).forEach(function(e){return o(e)});else if("//"===h)!function(){var e=function(r){o(r),t.adapter.getChildNodes(r).forEach(function(r){return e(r)})};t.adapter.getChildNodes(r).forEach(function(r){return e(r)})}();else if("<~"===h){var p=this.adapter.getParentNode(r);if(null!==p){for(var x=this.adapter.getChildNodes(p),d=null,f=0;f<x.length&&x[f]!==r;f++)d=x[f];o(d)}}else if("<~~"===h){var b=this.adapter.getParentNode(r);if(null!==b)for(var x=this.adapter.getChildNodes(b),g=0;g<x.length&&x[g]!==r;g++)o(x[g])}else if("~>"===h){var E=this.adapter.getParentNode(r);if(null!==E){var x=this.adapter.getChildNodes(E),v=void 0;for(v=0;v<x.length&&x[v]!==r;v++);v<x.length&&(v++,o(x[v]))}}else if("~~>"===h){var m=this.adapter.getParentNode(r);if(null!==m){var x=this.adapter.getChildNodes(m),y=void 0;for(y=0;y<x.length&&x[y]!==r;y++);if(y<x.length)for(y++;y<x.length;)o(x[y++])}}else if("~^"===h){var w=this.adapter.getParentNode(r);null!==w&&o(w)}else if("~~^"===h)for(var B=r;;){{this.adapter.getParentNode(B)}if(null===parent)break;o(parent),B=parent}}else o(r);return this.traceEnd(e,r,l),l},writable:!0,configurable:!0},execFilter:{value:function(e,r){this.traceBegin(e,r);var t=e.childs()[0],i=this.execExpr(t,r);return i=util.truthy(i),this.traceEnd(e,r,i),i},writable:!0,configurable:!0},execExpr:{value:function(e,r){switch(e.type()){case"ConditionalBinary":return this.execExprConditionalBinary(e,r);case"ConditionalTernary":return this.execExprConditionalTernary(e,r);case"Logical":return this.execExprLogical(e,r);case"Bitwise":return this.execExprBitwise(e,r);case"Relational":return this.execExprRelational(e,r);case"Arithmetical":return this.execExprArithmetical(e,r);case"Unary":return this.execExprUnary(e,r);case"FuncCall":return this.execExprFuncCall(e,r);case"Attribute":return this.execExprAttribute(e,r);case"Param":return this.execExprParam(e,r);case"LiteralString":return this.execExprLiteralString(e,r);case"LiteralRegExp":return this.execExprLiteralRegExp(e,r);case"LiteralNumber":return this.execExprLiteralNumber(e,r);case"LiteralValue":return this.execExprLiteralValue(e,r);case"Path":return this.execExprPath(e,r)}},writable:!0,configurable:!0},execExprConditionalBinary:{value:function(e,r){this.traceBegin(e,r);var t=this.execExpr(e.childs()[0],r);return util.truthy(t)||(t=this.execExpr(e.childs()[1],r)),this.traceEnd(e,r,t),t},writable:!0,configurable:!0},execExprConditionalTernary:{value:function(e,r){this.traceBegin(e,r);var t=this.execExpr(e.childs()[0],r);return t=util.truthy(t)?this.execExpr(e.childs()[1],r):this.execExpr(e.childs()[2],r),this.traceEnd(e,r,t),t},writable:!0,configurable:!0},execExprLogical:{value:function(e,r){this.traceBegin(e,r);var t=!1;switch(e.get("op")){case"&&":t=util.truthy(this.execExpr(e.childs()[0],r)),t&&(t=t&&util.truthy(this.execExpr(e.childs()[1],r)));break;case"||":t=util.truthy(this.execExpr(e.childs()[0],r)),t||(t=t||util.truthy(this.execExpr(e.childs()[1],r)))}return this.traceEnd(e,r,t),t},writable:!0,configurable:!0},execExprBitwise:{value:function(e,r){this.traceBegin(e,r);var t=util.coerce(this.execExpr(e.childs()[0],r),"number"),i=util.coerce(this.execExpr(e.childs()[1],r),"number"),a=void 0;switch(e.get("op")){case"&":a=t&i;break;case"|":a=t|i;break;case"<<":a=t<<i;break;case">>":a=t>>i}return this.traceEnd(e,r,a),a},writable:!0,configurable:!0},execExprRelational:{value:function(e,r){this.traceBegin(e,r);var t=this.execExpr(e.childs()[0],r),i=this.execExpr(e.childs()[1],r),a=void 0;switch(e.get("op")){case"==":a=t===i;break;case"!=":a=t!==i;break;case"<=":a=util.coerce(t,"number")<=util.coerce(i,"number");break;case">=":a=util.coerce(t,"number")>=util.coerce(i,"number");break;case"<":a=util.coerce(t,"number")<util.coerce(i,"number");break;case">":a=util.coerce(t,"number")>util.coerce(i,"number");break;case"=~":a=null!==util.coerce(t,"string").match(util.coerce(i,"regexp"));break;case"!~":a=null===util.coerce(t,"string").match(util.coerce(i,"regexp"))}return this.traceEnd(e,r,a),a},writable:!0,configurable:!0},execExprArithmetical:{value:function(e,r){this.traceBegin(e,r);var t=this.execExpr(e.childs()[0],r),i=this.execExpr(e.childs()[1],r),a=void 0;switch(e.get("op")){case"+":a="string"==typeof t?t+util.coerce(i,"string"):util.coerce(t,"number")+util.coerce(i,"number");break;case"-":a=util.coerce(t,"number")+util.coerce(i,"number");break;case"*":a=util.coerce(t,"number")*util.coerce(i,"number");break;case"/":a=util.coerce(t,"number")/util.coerce(i,"number");break;case"%":a=util.coerce(t,"number")%util.coerce(i,"number");break;case"**":a=Math.pow(util.coerce(t,"number"),util.coerce(i,"number"))}return this.traceEnd(e,r,a),a},writable:!0,configurable:!0},execExprUnary:{value:function(e,r){this.traceBegin(e,r);var t=this.execExpr(e.childs()[0],r),i=void 0;switch(e.get("op")){case"!":i=!util.coerce(t,"boolean");break;case"~":i=~util.coerce(t,"number")}return this.traceEnd(e,r,i),i},writable:!0,configurable:!0},execExprFuncCall:{value:function(e,r){var t=this;this.traceBegin(e,r);var i=e.get("id"),a=[this.adapter,r];e.childs().forEach(function(e){a.push(t.execExpr(e,r))});var c=this.funcs.run(i,a);return this.traceEnd(e,r,c),c},writable:!0,configurable:!0},execExprAttribute:{value:function(e,r){this.traceBegin(e,r);var t=e.get("id"),i=this.adapter.getNodeAttrValue(r,t);return this.traceEnd(e,r,i),i},writable:!0,configurable:!0},execExprParam:{value:function(e,r){this.traceBegin(e,r);var t=e.get("id");if("undefined"==typeof this.params[t])throw new Error('invalid parameter "'+t+'"');var i=this.params[t];return this.traceEnd(e,r,i),i},writable:!0,configurable:!0},execExprLiteralString:{value:function(e,r){this.traceBegin(e,r);var t=e.get("value");return this.traceEnd(e,r,t),t},writable:!0,configurable:!0},execExprLiteralRegExp:{value:function(e,r){this.traceBegin(e,r);var t=e.get("value");return this.traceEnd(e,r,t),t},writable:!0,configurable:!0},execExprLiteralNumber:{value:function(e,r){this.traceBegin(e,r);var t=e.get("value");return this.traceEnd(e,r,t),t},writable:!0,configurable:!0},execExprLiteralValue:{value:function(e,r){this.traceBegin(e,r);var t=e.get("value");return this.traceEnd(e,r,t),t},writable:!0,configurable:!0},execExprPath:{value:function(e,r){this.traceBegin(e,r);var t=this.execPath(e,r);return this.traceEnd(e,r,t),t},writable:!0,configurable:!0}}),r}(ASTQQueryTrace);module.exports=ASTQQueryExec; | ||
},{"./astq-query-trace.js":11,"./astq-util.js":13}],11:[function(_dereq_,module,exports){ | ||
"use strict";var _prototypeProperties=function(e,r,t){r&&Object.defineProperties(e,r),t&&Object.defineProperties(e.prototype,t)},util=_dereq_("./astq-util.js"),ASTQQueryTrace=function(){function e(){}return _prototypeProperties(e,null,{prefixOf:{value:function(e,r){for(var t=0,i=e;null!==(i=i.parent());)t++;var a=util.pad("",4*t);t=0;for(var i=r;null!==(i=this.adapter.getParentNode(i));)t++;var o=util.pad("",4*t);return{prefix1:a,prefix2:o}},writable:!0,enumerable:!0,configurable:!0},traceBegin:{value:function(e,r){if(this.trace){var t=this.prefixOf(e,r),i=t.prefix1,a=t.prefix2;console.log("ASTQ: execute: | "+util.pad(i+e.type()+" (",-60)+" | "+a+this.adapter.getNodeType(r))}},writable:!0,enumerable:!0,configurable:!0},traceEnd:{value:function(e,r,t){var i=this;if(this.trace){var a=this.prefixOf(e,r),o=a.prefix1,n=a.prefix2,p=void 0;void 0===t?p="undefined":"object"==typeof t&&t instanceof Array?(p="[",t.forEach(function(e){p+="node("+i.adapter.getNodeType(e)+"),"}),p=p.replace(/,$/,"")+"]"):p=typeof t+"("+t+")",p.length>60&&(p=p.substr(0,60)+"..."),console.log("ASTQ: execute: | "+util.pad(o+"): "+p,-60)+" | "+n+this.adapter.getNodeType(r))}},writable:!0,enumerable:!0,configurable:!0}}),e}();module.exports=ASTQQueryTrace; | ||
"use strict";var _prototypeProperties=function(e,t,r){t&&Object.defineProperties(e,t),r&&Object.defineProperties(e.prototype,r)},util=_dereq_("./astq-util.js"),ASTQQueryTrace=function(){function e(){}return _prototypeProperties(e,null,{prefixOf:{value:function(e,t){for(var r=0,i=e;null!==(i=i.parent());)r++;var o=util.pad("",4*r);for(r=0,i=t;null!==(i=this.adapter.getParentNode(i));)r++;var a=util.pad("",4*r);return{prefix1:o,prefix2:a}},writable:!0,configurable:!0},traceBegin:{value:function(e,t){if(this.trace){var r=this.prefixOf(e,t),i=r.prefix1,o=r.prefix2;console.log("ASTQ: execute: | "+util.pad(i+e.type()+" (",-60)+" | "+o+this.adapter.getNodeType(t))}},writable:!0,configurable:!0},traceEnd:{value:function(e,t,r){var i=this;if(this.trace){var o=this.prefixOf(e,t),a=o.prefix1,n=o.prefix2,p=void 0;void 0===r?p="undefined":"object"==typeof r&&r instanceof Array?(p="[",r.forEach(function(e){p+="node("+i.adapter.getNodeType(e)+"),"}),p=p.replace(/,$/,"")+"]"):p=typeof r+"("+r+")",p.length>60&&(p=p.substr(0,60)+"..."),console.log("ASTQ: execute: | "+util.pad(a+"): "+p,-60)+" | "+n+this.adapter.getNodeType(t))}},writable:!0,configurable:!0}}),e}();module.exports=ASTQQueryTrace; | ||
},{"./astq-util.js":13}],12:[function(_dereq_,module,exports){ | ||
"use strict";var _prototypeProperties=function(t,e,r){e&&Object.defineProperties(t,e),r&&Object.defineProperties(t.prototype,r)},ASTY=_dereq_("asty"),PEGUtil=_dereq_("pegjs-util"),ASTQQueryParse=function(){function t(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function e(t,e,r,n,s,u){this.message=t,this.expected=e,this.found=r,this.offset=n,this.line=s,this.column=u,this.name="SyntaxError"}function r(t){function r(){return ru}function n(){return i(ru).line}function s(){return i(ru).column}function u(t){throw a(t,null,ru)}function i(e){function r(e,r,n){var s,u;for(s=r;n>s;s++)u=t.charAt(s),"\n"===u?(e.seenCR||e.line++,e.column=1,e.seenCR=!1):"\r"===u||"\u2028"===u||"\u2029"===u?(e.line++,e.column=1,e.seenCR=!0):(e.column++,e.seenCR=!1)}return nu!==e&&(nu>e&&(nu=0,su={line:1,column:1,seenCR:!1}),r(su,nu,e),nu=e),su}function l(t){uu>eu||(eu>uu&&(uu=eu,iu=[]),iu.push(t))}function a(r,n,s){function u(t){var e=1;for(t.sort(function(t,e){return t.description<e.description?-1:t.description>e.description?1:0});e<t.length;)t[e-1]===t[e]?t.splice(e,1):e++}function l(t,e){function r(t){function e(t){return t.charCodeAt(0).toString(16).toUpperCase()}return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(t){return"\\x0"+e(t)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(t){return"\\x"+e(t)}).replace(/[\u0180-\u0FFF]/g,function(t){return"\\u0"+e(t)}).replace(/[\u1080-\uFFFF]/g,function(t){return"\\u"+e(t)})}var n,s,u,i=new Array(t.length);for(u=0;u<t.length;u++)i[u]=t[u].description;return n=t.length>1?i.slice(0,-1).join(", ")+" or "+i[t.length-1]:i[0],s=e?'"'+r(e)+'"':"end of input","Expected "+n+" but "+s+" found."}var a=i(s),o=s<t.length?t.charAt(s):null;return null!==n&&u(n),new e(null!==r?r:l(n,o),n,o,s,a.line,a.column)}function o(){var t,e,r,n,s,u=36*eu+0,i=au[u];return i?(eu=i.nextPos,i.result):(t=eu,e=k(),e!==$?(r=c(),r!==$?(n=k(),n!==$?(s=M(),s!==$?(ru=t,e=K(r),t=e):(eu=t,t=J)):(eu=t,t=J)):(eu=t,t=J)):(eu=t,t=J),au[u]={nextPos:eu,result:t},t)}function c(){var e,r,n,s,u,i,a,o,c=36*eu+1,f=au[c];if(f)return eu=f.nextPos,f.result;if(e=eu,r=p(),r!==$){for(n=[],s=eu,u=k(),u!==$?(44===t.charCodeAt(eu)?(i=W,eu++):(i=$,0===lu&&l(X)),i!==$?(a=k(),a!==$?(o=p(),o!==$?(u=[u,i,a,o],s=u):(eu=s,s=J)):(eu=s,s=J)):(eu=s,s=J)):(eu=s,s=J);s!==$;)n.push(s),s=eu,u=k(),u!==$?(44===t.charCodeAt(eu)?(i=W,eu++):(i=$,0===lu&&l(X)),i!==$?(a=k(),a!==$?(o=p(),o!==$?(u=[u,i,a,o],s=u):(eu=s,s=J)):(eu=s,s=J)):(eu=s,s=J)):(eu=s,s=J);n!==$?(ru=e,r=te(r,n),e=r):(eu=e,e=J)}else eu=e,e=J;return au[c]={nextPos:eu,result:e},e}function p(){var t,e,r,n,s,u,i=36*eu+2,l=au[i];if(l)return eu=l.nextPos,l.result;if(t=eu,e=f(),e!==$){for(r=[],n=eu,s=k(),s!==$?(u=d(),u!==$?(s=[s,u],n=s):(eu=n,n=J)):(eu=n,n=J);n!==$;)r.push(n),n=eu,s=k(),s!==$?(u=d(),u!==$?(s=[s,u],n=s):(eu=n,n=J)):(eu=n,n=J);r!==$?(ru=t,e=ee(e,r),t=e):(eu=t,t=J)}else eu=t,t=J;return au[i]={nextPos:eu,result:t},t}function f(){var t,e,r,n,s,u,i=36*eu+3,l=au[i];return l?(eu=l.nextPos,l.result):(t=eu,e=h(),e===$&&(e=re),e!==$?(r=k(),r!==$?(n=v(),n!==$?(s=k(),s!==$?(u=A(),u===$&&(u=re),u!==$?(ru=t,e=ne(e,n,u),t=e):(eu=t,t=J)):(eu=t,t=J)):(eu=t,t=J)):(eu=t,t=J)):(eu=t,t=J),au[i]={nextPos:eu,result:t},t)}function d(){var t,e,r,n,s,u,i=36*eu+4,l=au[i];return l?(eu=l.nextPos,l.result):(t=eu,e=h(),e!==$?(r=k(),r!==$?(n=v(),n!==$?(s=k(),s!==$?(u=A(),u===$&&(u=re),u!==$?(ru=t,e=ne(e,n,u),t=e):(eu=t,t=J)):(eu=t,t=J)):(eu=t,t=J)):(eu=t,t=J)):(eu=t,t=J),au[i]={nextPos:eu,result:t},t)}function h(){var e,r,n,s=36*eu+5,u=au[s];return u?(eu=u.nextPos,u.result):(lu++,e=eu,r=eu,t.substr(eu,2)===ue?(n=ue,eu+=2):(n=$,0===lu&&l(ie)),n===$&&(47===t.charCodeAt(eu)?(n=le,eu++):(n=$,0===lu&&l(ae)),n===$&&(t.substr(eu,3)===oe?(n=oe,eu+=3):(n=$,0===lu&&l(ce)),n===$&&(t.substr(eu,2)===pe?(n=pe,eu+=2):(n=$,0===lu&&l(fe)),n===$&&(t.substr(eu,3)===de?(n=de,eu+=3):(n=$,0===lu&&l(he)),n===$&&(t.substr(eu,2)===ve?(n=ve,eu+=2):(n=$,0===lu&&l(Ae)),n===$&&(t.substr(eu,3)===ye?(n=ye,eu+=3):(n=$,0===lu&&l(xe)),n===$&&(t.substr(eu,2)===be?(n=be,eu+=2):(n=$,0===lu&&l(Pe))))))))),n!==$&&(n=t.substring(r,eu)),r=n,r!==$&&(ru=e,r=ge(r)),e=r,lu--,e===$&&(r=$,0===lu&&l(se)),au[s]={nextPos:eu,result:e},e)}function v(){var e,r,n=36*eu+6,s=au[n];return s?(eu=s.nextPos,s.result):(e=eu,r=j(),r!==$&&(ru=e,r=Ce(r)),e=r,e===$&&(e=eu,42===t.charCodeAt(eu)?(r=me,eu++):(r=$,0===lu&&l(Se)),r!==$&&(ru=e,r=Qe()),e=r),au[n]={nextPos:eu,result:e},e)}function A(){var e,r,n,s,u,i,a=36*eu+7,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,91===t.charCodeAt(eu)?(r=Ee,eu++):(r=$,0===lu&&l(we)),r!==$?(n=k(),n!==$?(s=y(),s!==$?(u=k(),u!==$?(93===t.charCodeAt(eu)?(i=Fe,eu++):(i=$,0===lu&&l(Re)),i!==$?(ru=e,r=Te(s),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),au[a]={nextPos:eu,result:e},e)}function y(){var e,r,n,s,u,i,a,o,c,p,f=36*eu+8,d=au[f];return d?(eu=d.nextPos,d.result):(e=eu,r=x(),r!==$?(n=k(),n!==$?(t.substr(eu,2)===Le?(s=Le,eu+=2):(s=$,0===lu&&l(Ne)),s!==$?(u=k(),u!==$?(i=x(),i!==$?(ru=e,r=qe(r,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=eu,r=x(),r!==$?(n=k(),n!==$?(63===t.charCodeAt(eu)?(s=_e,eu++):(s=$,0===lu&&l(je)),s!==$?(u=k(),u!==$?(i=x(),i!==$?(a=k(),a!==$?(58===t.charCodeAt(eu)?(o=ze,eu++):(o=$,0===lu&&l(Ie)),o!==$?(c=k(),c!==$?(p=x(),p!==$?(ru=e,r=Ue(r,i,p),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=x())),au[f]={nextPos:eu,result:e},e)}function x(){var e,r,n,s,u,i,a=36*eu+9,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,r=b(),r!==$?(n=k(),n!==$?(s=eu,t.substr(eu,2)===Ze?(u=Ze,eu+=2):(u=$,0===lu&&l(Ve)),u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(u=k(),u!==$?(i=x(),i!==$?(ru=e,r=ke(r,s,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=b()),au[a]={nextPos:eu,result:e},e)}function b(){var e,r,n,s,u,i,a=36*eu+10,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,r=P(),r!==$?(n=k(),n!==$?(s=eu,t.substr(eu,2)===Be?(u=Be,eu+=2):(u=$,0===lu&&l(Ge)),u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(u=k(),u!==$?(i=b(),i!==$?(ru=e,r=ke(r,s,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=P()),au[a]={nextPos:eu,result:e},e)}function P(){var e,r,n,s,u,i,a=36*eu+11,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,r=g(),r!==$?(n=k(),n!==$?(s=eu,124===t.charCodeAt(eu)?(u=Me,eu++):(u=$,0===lu&&l(Oe)),u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(u=k(),u!==$?(i=P(),i!==$?(ru=e,r=Ye(r,s,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=g()),au[a]={nextPos:eu,result:e},e)}function g(){var e,r,n,s,u,i,a=36*eu+12,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,r=C(),r!==$?(n=k(),n!==$?(s=eu,94===t.charCodeAt(eu)?(u=$e,eu++):(u=$,0===lu&&l(De)),u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(u=k(),u!==$?(i=g(),i!==$?(ru=e,r=Ye(r,s,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=C()),au[a]={nextPos:eu,result:e},e)}function C(){var e,r,n,s,u,i,a=36*eu+13,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,r=m(),r!==$?(n=k(),n!==$?(s=eu,38===t.charCodeAt(eu)?(u=He,eu++):(u=$,0===lu&&l(Je)),u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(u=k(),u!==$?(i=C(),i!==$?(ru=e,r=Ye(r,s,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=m()),au[a]={nextPos:eu,result:e},e)}function m(){var e,r,n,s,u,i,a=36*eu+14,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,r=S(),r!==$?(n=k(),n!==$?(s=eu,t.substr(eu,2)===Ke?(u=Ke,eu+=2):(u=$,0===lu&&l(We)),u===$&&(t.substr(eu,2)===Xe?(u=Xe,eu+=2):(u=$,0===lu&&l(tr)),u===$&&(t.substr(eu,2)===er?(u=er,eu+=2):(u=$,0===lu&&l(rr)),u===$&&(t.substr(eu,2)===nr?(u=nr,eu+=2):(u=$,0===lu&&l(sr)),u===$&&(60===t.charCodeAt(eu)?(u=ur,eu++):(u=$,0===lu&&l(ir)),u===$&&(62===t.charCodeAt(eu)?(u=lr,eu++):(u=$,0===lu&&l(ar)),u===$&&(t.substr(eu,2)===or?(u=or,eu+=2):(u=$,0===lu&&l(cr)),u===$&&(t.substr(eu,2)===pr?(u=pr,eu+=2):(u=$,0===lu&&l(fr))))))))),u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(u=k(),u!==$?(i=m(),i!==$?(ru=e,r=dr(r,s,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=S()),au[a]={nextPos:eu,result:e},e)}function S(){var e,r,n,s,u,i,a=36*eu+15,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,r=Q(),r!==$?(n=k(),n!==$?(s=eu,t.substr(eu,2)===hr?(u=hr,eu+=2):(u=$,0===lu&&l(vr)),u===$&&(t.substr(eu,2)===Ar?(u=Ar,eu+=2):(u=$,0===lu&&l(yr))),u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(u=k(),u!==$?(i=S(),i!==$?(ru=e,r=Ye(r,s,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=Q()),au[a]={nextPos:eu,result:e},e)}function Q(){var e,r,n,s,u,i,a=36*eu+16,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,r=E(),r!==$?(n=k(),n!==$?(s=eu,43===t.charCodeAt(eu)?(u=xr,eu++):(u=$,0===lu&&l(br)),u===$&&(45===t.charCodeAt(eu)?(u=Pr,eu++):(u=$,0===lu&&l(gr))),u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(u=k(),u!==$?(i=Q(),i!==$?(ru=e,r=Cr(r,s,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=E()),au[a]={nextPos:eu,result:e},e)}function E(){var e,r,n,s,u,i,a=36*eu+17,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,r=w(),r!==$?(n=k(),n!==$?(s=eu,t.substr(eu,2)===mr?(u=mr,eu+=2):(u=$,0===lu&&l(Sr)),u===$&&(42===t.charCodeAt(eu)?(u=me,eu++):(u=$,0===lu&&l(Se)),u===$&&(47===t.charCodeAt(eu)?(u=le,eu++):(u=$,0===lu&&l(ae)),u===$&&(37===t.charCodeAt(eu)?(u=Qr,eu++):(u=$,0===lu&&l(Er))))),u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(u=k(),u!==$?(i=E(),i!==$?(ru=e,r=Cr(r,s,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=w()),au[a]={nextPos:eu,result:e},e)}function w(){var e,r,n,s=36*eu+18,u=au[s];return u?(eu=u.nextPos,u.result):(e=eu,r=eu,33===t.charCodeAt(eu)?(n=wr,eu++):(n=$,0===lu&&l(Fr)),n===$&&(126===t.charCodeAt(eu)?(n=Rr,eu++):(n=$,0===lu&&l(Tr))),n!==$&&(n=t.substring(r,eu)),r=n,r!==$?(n=F(),n!==$?(ru=e,r=Lr(r,n),e=r):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=F()),au[s]={nextPos:eu,result:e},e)}function F(){var t,e=36*eu+19,r=au[e];return r?(eu=r.nextPos,r.result):(t=R(),t===$&&(t=L(),t===$&&(t=N(),t===$&&(t=q(),t===$&&(t=_(),t===$&&(t=p()))))),au[e]={nextPos:eu,result:t},t)}function R(){var e,r,n,s,u,i,a,o,c=36*eu+20,p=au[c];return p?(eu=p.nextPos,p.result):(e=eu,r=j(),r!==$?(n=k(),n!==$?(40===t.charCodeAt(eu)?(s=Nr,eu++):(s=$,0===lu&&l(qr)),s!==$?(u=k(),u!==$?(i=T(),i===$&&(i=re),i!==$?(a=k(),a!==$?(41===t.charCodeAt(eu)?(o=_r,eu++):(o=$,0===lu&&l(jr)),o!==$?(ru=e,r=zr(r,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),au[c]={nextPos:eu,result:e},e)}function T(){var e,r,n,s,u,i,a,o,c=36*eu+21,p=au[c];if(p)return eu=p.nextPos,p.result;if(e=eu,r=y(),r!==$){for(n=[],s=eu,u=k(),u!==$?(44===t.charCodeAt(eu)?(i=W,eu++):(i=$,0===lu&&l(X)),i!==$?(a=k(),a!==$?(o=y(),o!==$?(u=[u,i,a,o],s=u):(eu=s,s=J)):(eu=s,s=J)):(eu=s,s=J)):(eu=s,s=J);s!==$;)n.push(s),s=eu,u=k(),u!==$?(44===t.charCodeAt(eu)?(i=W,eu++):(i=$,0===lu&&l(X)),i!==$?(a=k(),a!==$?(o=y(),o!==$?(u=[u,i,a,o],s=u):(eu=s,s=J)):(eu=s,s=J)):(eu=s,s=J)):(eu=s,s=J);n!==$?(ru=e,r=Ir(r,n),e=r):(eu=e,e=J)}else eu=e,e=J;return au[c]={nextPos:eu,result:e},e}function L(){var e,r,n,s=36*eu+22,u=au[s];return u?(eu=u.nextPos,u.result):(lu++,e=eu,64===t.charCodeAt(eu)?(r=Zr,eu++):(r=$,0===lu&&l(Vr)),r!==$?(n=j(),n!==$?(ru=e,r=kr(n),e=r):(eu=e,e=J)):(eu=e,e=J),lu--,e===$&&(r=$,0===lu&&l(Ur)),au[s]={nextPos:eu,result:e},e)}function N(){var e,r,n,s,u,i,a=36*eu+23,o=au[a];return o?(eu=o.nextPos,o.result):(lu++,e=eu,123===t.charCodeAt(eu)?(r=Gr,eu++):(r=$,0===lu&&l(Mr)),r!==$?(n=k(),n!==$?(s=j(),s!==$?(u=k(),u!==$?(125===t.charCodeAt(eu)?(i=Or,eu++):(i=$,0===lu&&l(Yr)),i!==$?(ru=e,r=$r(s),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),lu--,e===$&&(r=$,0===lu&&l(Br)),au[a]={nextPos:eu,result:e},e)}function q(){var t,e=36*eu+24,r=au[e];return r?(eu=r.nextPos,r.result):(t=z(),t===$&&(t=U(),t===$&&(t=Z(),t===$&&(t=V()))),au[e]={nextPos:eu,result:t},t)}function _(){var e,r,n,s,u,i,a=36*eu+25,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,40===t.charCodeAt(eu)?(r=Nr,eu++):(r=$,0===lu&&l(qr)),r!==$?(n=k(),n!==$?(s=y(),s!==$?(u=k(),u!==$?(41===t.charCodeAt(eu)?(i=_r,eu++):(i=$,0===lu&&l(jr)),i!==$?(ru=e,r=Dr(s),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),au[a]={nextPos:eu,result:e},e)}function j(){var e,r,n,s,u,i,a,o=36*eu+26,c=au[o];if(c)return eu=c.nextPos,c.result;if(lu++,e=eu,r=eu,n=eu,s=eu,lu++,u=V(),lu--,u===$?s=Jr:(eu=s,s=J),s!==$)if(Kr.test(t.charAt(eu))?(u=t.charAt(eu),eu++):(u=$,0===lu&&l(Wr)),u!==$){for(i=[],Xr.test(t.charAt(eu))?(a=t.charAt(eu),eu++):(a=$,0===lu&&l(tn));a!==$;)i.push(a),Xr.test(t.charAt(eu))?(a=t.charAt(eu),eu++):(a=$,0===lu&&l(tn));i!==$?(s=[s,u,i],n=s):(eu=n,n=J)}else eu=n,n=J;else eu=n,n=J;return n!==$&&(n=t.substring(r,eu)),r=n,r!==$&&(ru=e,r=en(r)),e=r,lu--,e===$&&(r=$,0===lu&&l(Hr)),au[o]={nextPos:eu,result:e},e}function z(){var e,r,n,s,u,i=36*eu+27,a=au[i];if(a)return eu=a.nextPos,a.result;if(lu++,e=eu,34===t.charCodeAt(eu)?(r=nn,eu++):(r=$,0===lu&&l(sn)),r!==$){for(n=[],s=I(),s===$&&(un.test(t.charAt(eu))?(s=t.charAt(eu),eu++):(s=$,0===lu&&l(ln)));s!==$;)n.push(s),s=I(),s===$&&(un.test(t.charAt(eu))?(s=t.charAt(eu),eu++):(s=$,0===lu&&l(ln)));n!==$?(34===t.charCodeAt(eu)?(s=nn,eu++):(s=$,0===lu&&l(sn)),s!==$?(ru=e,r=an(n),e=r):(eu=e,e=J)):(eu=e,e=J)}else eu=e,e=J;if(e===$)if(e=eu,39===t.charCodeAt(eu)?(r=on,eu++):(r=$,0===lu&&l(cn)),r!==$){for(n=eu,s=[],t.substr(eu,2)===pn?(u=pn,eu+=2):(u=$,0===lu&&l(fn)),u===$&&(dn.test(t.charAt(eu))?(u=t.charAt(eu),eu++):(u=$,0===lu&&l(hn)));u!==$;)s.push(u),t.substr(eu,2)===pn?(u=pn,eu+=2):(u=$,0===lu&&l(fn)),u===$&&(dn.test(t.charAt(eu))?(u=t.charAt(eu),eu++):(u=$,0===lu&&l(hn)));s!==$&&(s=t.substring(n,eu)),n=s,n!==$?(39===t.charCodeAt(eu)?(s=on,eu++):(s=$,0===lu&&l(cn)),s!==$?(ru=e,r=vn(n),e=r):(eu=e,e=J)):(eu=e,e=J)}else eu=e,e=J;return lu--,e===$&&(r=$,0===lu&&l(rn)),au[i]={nextPos:eu,result:e},e}function I(){var e,r,n,s,u,i,a,o,c=36*eu+28,p=au[c];return p?(eu=p.nextPos,p.result):(lu++,e=eu,t.substr(eu,2)===yn?(r=yn,eu+=2):(r=$,0===lu&&l(xn)),r!==$&&(ru=e,r=bn()),e=r,e===$&&(e=eu,t.substr(eu,2)===Pn?(r=Pn,eu+=2):(r=$,0===lu&&l(gn)),r!==$&&(ru=e,r=Cn()),e=r,e===$&&(e=eu,39===t.charCodeAt(eu)?(r=on,eu++):(r=$,0===lu&&l(cn)),r!==$&&(ru=e,r=mn()),e=r,e===$&&(e=eu,t.substr(eu,2)===Sn?(r=Sn,eu+=2):(r=$,0===lu&&l(Qn)),r!==$&&(ru=e,r=En()),e=r,e===$&&(e=eu,t.substr(eu,2)===wn?(r=wn,eu+=2):(r=$,0===lu&&l(Fn)),r!==$&&(ru=e,r=Rn()),e=r,e===$&&(e=eu,t.substr(eu,2)===Tn?(r=Tn,eu+=2):(r=$,0===lu&&l(Ln)),r!==$&&(ru=e,r=Nn()),e=r,e===$&&(e=eu,t.substr(eu,2)===qn?(r=qn,eu+=2):(r=$,0===lu&&l(_n)),r!==$&&(ru=e,r=jn()),e=r,e===$&&(e=eu,t.substr(eu,2)===zn?(r=zn,eu+=2):(r=$,0===lu&&l(In)),r!==$&&(ru=e,r=Un()),e=r,e===$&&(e=eu,t.substr(eu,2)===Zn?(r=Zn,eu+=2):(r=$,0===lu&&l(Vn)),r!==$&&(ru=e,r=kn()),e=r,e===$&&(e=eu,t.substr(eu,2)===Bn?(r=Bn,eu+=2):(r=$,0===lu&&l(Gn)),r!==$&&(ru=e,r=Mn()),e=r,e===$&&(e=eu,t.substr(eu,2)===On?(r=On,eu+=2):(r=$,0===lu&&l(Yn)),r!==$?(n=eu,s=eu,$n.test(t.charAt(eu))?(u=t.charAt(eu),eu++):(u=$,0===lu&&l(Dn)),u!==$?($n.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(Dn)),i!==$?(u=[u,i],s=u):(eu=s,s=J)):(eu=s,s=J),s!==$&&(s=t.substring(n,eu)),n=s,n!==$?(ru=e,r=Hn(n),e=r):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=eu,t.substr(eu,2)===Jn?(r=Jn,eu+=2):(r=$,0===lu&&l(Kn)),r!==$?(n=eu,s=eu,$n.test(t.charAt(eu))?(u=t.charAt(eu),eu++):(u=$,0===lu&&l(Dn)),u!==$?($n.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(Dn)),i!==$?($n.test(t.charAt(eu))?(a=t.charAt(eu),eu++):(a=$,0===lu&&l(Dn)),a!==$?($n.test(t.charAt(eu))?(o=t.charAt(eu),eu++):(o=$,0===lu&&l(Dn)),o!==$?(u=[u,i,a,o],s=u):(eu=s,s=J)):(eu=s,s=J)):(eu=s,s=J)):(eu=s,s=J),s!==$&&(s=t.substring(n,eu)),n=s,n!==$?(ru=e,r=Hn(n),e=r):(eu=e,e=J)):(eu=e,e=J)))))))))))),lu--,e===$&&(r=$,0===lu&&l(An)),au[c]={nextPos:eu,result:e},e)}function U(){var e,r,n,s,u,i=36*eu+29,a=au[i];if(a)return eu=a.nextPos,a.result;if(lu++,e=eu,47===t.charCodeAt(eu)?(r=le,eu++):(r=$,0===lu&&l(ae)),r!==$){for(n=eu,s=[],t.substr(eu,2)===Xn?(u=Xn,eu+=2):(u=$,0===lu&&l(ts)),u===$&&(es.test(t.charAt(eu))?(u=t.charAt(eu),eu++):(u=$,0===lu&&l(rs)));u!==$;)s.push(u),t.substr(eu,2)===Xn?(u=Xn,eu+=2):(u=$,0===lu&&l(ts)),u===$&&(es.test(t.charAt(eu))?(u=t.charAt(eu),eu++):(u=$,0===lu&&l(rs)));s!==$&&(s=t.substring(n,eu)),n=s,n!==$?(47===t.charCodeAt(eu)?(s=le,eu++):(s=$,0===lu&&l(ae)),s!==$?(ru=e,r=ns(n),e=r):(eu=e,e=J)):(eu=e,e=J)}else eu=e,e=J;return lu--,e===$&&(r=$,0===lu&&l(Wn)),au[i]={nextPos:eu,result:e},e}function Z(){var e,r,n,s,u,i,a,o,c,p,f,d,h=36*eu+30,v=au[h];if(v)return eu=v.nextPos,v.result;if(lu++,e=eu,r=eu,us.test(t.charAt(eu))?(n=t.charAt(eu),eu++):(n=$,0===lu&&l(is)),n===$&&(n=re),n!==$&&(n=t.substring(r,eu)),r=n,r!==$)if(t.substr(eu,2)===ls?(n=ls,eu+=2):(n=$,0===lu&&l(as)),n!==$){if(s=eu,u=[],os.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(cs)),i!==$)for(;i!==$;)u.push(i),os.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(cs));else u=J;u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(ru=e,r=ps(r,s),e=r):(eu=e,e=J)}else eu=e,e=J;else eu=e,e=J;if(e===$){if(e=eu,r=eu,us.test(t.charAt(eu))?(n=t.charAt(eu),eu++):(n=$,0===lu&&l(is)),n===$&&(n=re),n!==$&&(n=t.substring(r,eu)),r=n,r!==$)if(t.substr(eu,2)===fs?(n=fs,eu+=2):(n=$,0===lu&&l(ds)),n!==$){if(s=eu,u=[],hs.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(vs)),i!==$)for(;i!==$;)u.push(i),hs.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(vs));else u=J;u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(ru=e,r=As(r,s),e=r):(eu=e,e=J)}else eu=e,e=J;else eu=e,e=J;if(e===$){if(e=eu,r=eu,us.test(t.charAt(eu))?(n=t.charAt(eu),eu++):(n=$,0===lu&&l(is)),n===$&&(n=re),n!==$&&(n=t.substring(r,eu)),r=n,r!==$)if(t.substr(eu,2)===ys?(n=ys,eu+=2):(n=$,0===lu&&l(xs)),n!==$){if(s=eu,u=[],$n.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(Dn)),i!==$)for(;i!==$;)u.push(i),$n.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(Dn));else u=J;u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(ru=e,r=bs(r,s),e=r):(eu=e,e=J)}else eu=e,e=J;else eu=e,e=J;if(e===$){if(e=eu,r=eu,n=eu,us.test(t.charAt(eu))?(s=t.charAt(eu),eu++):(s=$,0===lu&&l(is)),s===$&&(s=re),s!==$){for(u=[],Ps.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(gs));i!==$;)u.push(i),Ps.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(gs));if(u!==$)if(46===t.charCodeAt(eu)?(i=Cs,eu++):(i=$,0===lu&&l(ms)),i!==$){if(a=[],Ps.test(t.charAt(eu))?(o=t.charAt(eu),eu++):(o=$,0===lu&&l(gs)),o!==$)for(;o!==$;)a.push(o),Ps.test(t.charAt(eu))?(o=t.charAt(eu),eu++):(o=$,0===lu&&l(gs));else a=J;if(a!==$){if(o=eu,Ss.test(t.charAt(eu))?(c=t.charAt(eu),eu++):(c=$,0===lu&&l(Qs)),c!==$)if(us.test(t.charAt(eu))?(p=t.charAt(eu),eu++):(p=$,0===lu&&l(is)),p===$&&(p=re),p!==$){if(f=[],Ps.test(t.charAt(eu))?(d=t.charAt(eu),eu++):(d=$,0===lu&&l(gs)),d!==$)for(;d!==$;)f.push(d),Ps.test(t.charAt(eu))?(d=t.charAt(eu),eu++):(d=$,0===lu&&l(gs));else f=J;f!==$?(c=[c,p,f],o=c):(eu=o,o=J)}else eu=o,o=J;else eu=o,o=J;o===$&&(o=re),o!==$?(s=[s,u,i,a,o],n=s):(eu=n,n=J)}else eu=n,n=J}else eu=n,n=J;else eu=n,n=J}else eu=n,n=J;if(n!==$&&(n=t.substring(r,eu)),r=n,r!==$&&(ru=e,r=Es(r)),e=r,e===$){if(e=eu,r=eu,n=eu,us.test(t.charAt(eu))?(s=t.charAt(eu),eu++):(s=$,0===lu&&l(is)),s===$&&(s=re),s!==$){if(u=[],Ps.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(gs)),i!==$)for(;i!==$;)u.push(i),Ps.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(gs));else u=J;u!==$?(s=[s,u],n=s):(eu=n,n=J)}else eu=n,n=J;n!==$&&(n=t.substring(r,eu)),r=n,r!==$&&(ru=e,r=ws(r)),e=r}}}}return lu--,e===$&&(r=$,0===lu&&l(ss)),au[h]={nextPos:eu,result:e},e}function V(){var e,r,n=36*eu+31,s=au[n];return s?(eu=s.nextPos,s.result):(lu++,e=eu,t.substr(eu,4)===Rs?(r=Rs,eu+=4):(r=$,0===lu&&l(Ts)),r!==$&&(ru=e,r=Ls()),e=r,e===$&&(e=eu,t.substr(eu,5)===Ns?(r=Ns,eu+=5):(r=$,0===lu&&l(qs)),r!==$&&(ru=e,r=_s()),e=r,e===$&&(e=eu,t.substr(eu,4)===js?(r=js,eu+=4):(r=$,0===lu&&l(zs)),r!==$&&(ru=e,r=Is()),e=r,e===$&&(e=eu,t.substr(eu,3)===Us?(r=Us,eu+=3):(r=$,0===lu&&l(Zs)),r!==$&&(ru=e,r=Vs()),e=r,e===$&&(e=eu,t.substr(eu,9)===ks?(r=ks,eu+=9):(r=$,0===lu&&l(Bs)),r!==$&&(ru=e,r=Gs()),e=r)))),lu--,e===$&&(r=$,0===lu&&l(Fs)),au[n]={nextPos:eu,result:e},e)}function k(){var t,e,r=36*eu+32,n=au[r];if(n)return eu=n.nextPos,n.result;for(lu++,t=[],e=B(),e===$&&(e=G());e!==$;)t.push(e),e=B(),e===$&&(e=G());return lu--,t===$&&(e=$,0===lu&&l(Ms)),au[r]={nextPos:eu,result:t},t}function B(){var e,r,n,s,u,i,a=36*eu+33,o=au[a];if(o)return eu=o.nextPos,o.result;if(lu++,e=eu,t.substr(eu,2)===Ys?(r=Ys,eu+=2):(r=$,0===lu&&l($s)),r!==$){for(n=[],s=eu,u=eu,lu++,t.substr(eu,2)===Ds?(i=Ds,eu+=2):(i=$,0===lu&&l(Hs)),lu--,i===$?u=Jr:(eu=u,u=J),u!==$?(t.length>eu?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(Js)),i!==$?(u=[u,i],s=u):(eu=s,s=J)):(eu=s,s=J);s!==$;)n.push(s),s=eu,u=eu,lu++,t.substr(eu,2)===Ds?(i=Ds,eu+=2):(i=$,0===lu&&l(Hs)),lu--,i===$?u=Jr:(eu=u,u=J),u!==$?(t.length>eu?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(Js)),i!==$?(u=[u,i],s=u):(eu=s,s=J)):(eu=s,s=J);n!==$?(t.substr(eu,2)===Ds?(s=Ds,eu+=2):(s=$,0===lu&&l(Hs)),s!==$?(r=[r,n,s],e=r):(eu=e,e=J)):(eu=e,e=J)}else eu=e,e=J;return lu--,e===$&&(r=$,0===lu&&l(Os)),au[a]={nextPos:eu,result:e},e}function G(){var e,r,n=36*eu+34,s=au[n];if(s)return eu=s.nextPos,s.result;if(lu++,e=[],Ws.test(t.charAt(eu))?(r=t.charAt(eu),eu++):(r=$,0===lu&&l(Xs)),r!==$)for(;r!==$;)e.push(r),Ws.test(t.charAt(eu))?(r=t.charAt(eu),eu++):(r=$,0===lu&&l(Xs));else e=J;return lu--,e===$&&(r=$,0===lu&&l(Ks)),au[n]={nextPos:eu,result:e},e}function M(){var e,r,n=36*eu+35,s=au[n];return s?(eu=s.nextPos,s.result):(lu++,e=eu,lu++,t.length>eu?(r=t.charAt(eu),eu++):(r=$,0===lu&&l(Js)),lu--,r===$?e=Jr:(eu=e,e=J),lu--,e===$&&(r=$,0===lu&&l(tu)),au[n]={nextPos:eu,result:e},e)}var O,Y=arguments.length>1?arguments[1]:{},$={},D={query:o},H=o,J=$,K=function(t){return t},W=",",X={type:"literal",value:",",description:'","'},te=function(t,e){return cu("Query").add(ou(t,e,3))},ee=function(t,e){return cu("Path").add(ou(t,e,1))},re=null,ne=function(t,e,r){return cu("Step").add(t,e,r)},se={type:"other",description:"axis"},ue="//",ie={type:"literal",value:"//",description:'"//"'},le="/",ae={type:"literal",value:"/",description:'"/"'},oe="~~>",ce={type:"literal",value:"~~>",description:'"~~>"'},pe="~>",fe={type:"literal",value:"~>",description:'"~>"'},de="<~~",he={type:"literal",value:"<~~",description:'"<~~"'},ve="<~",Ae={type:"literal",value:"<~",description:'"<~"'},ye="~~^",xe={type:"literal",value:"~~^",description:'"~~^"'},be="~^",Pe={type:"literal",value:"~^",description:'"~^"'},ge=function(t){return cu("Axis").set({op:t})},Ce=function(t){return cu("Match").merge(t)},me="*",Se={type:"literal",value:"*",description:'"*"'},Qe=function(){return cu("Match").set({id:"*"})},Ee="[",we={type:"literal",value:"[",description:'"["'},Fe="]",Re={type:"literal",value:"]",description:'"]"'},Te=function(t){return cu("Filter").add(t)},Le="?:",Ne={type:"literal",value:"?:",description:'"?:"'},qe=function(t,e){return cu("ConditionalBinary").add(t,e)},_e="?",je={type:"literal",value:"?",description:'"?"'},ze=":",Ie={type:"literal",value:":",description:'":"'},Ue=function(t,e,r){return cu("ConditionalTernary").add(t,e,r)},Ze="||",Ve={type:"literal",value:"||",description:'"||"'},ke=function(t,e,r){return cu("Logical").set({op:e}).add(t,r)},Be="&&",Ge={type:"literal",value:"&&",description:'"&&"'},Me="|",Oe={type:"literal",value:"|",description:'"|"'},Ye=function(t,e,r){return cu("Bitwise").set({op:e}).add(t,r)},$e="^",De={type:"literal",value:"^",description:'"^"'},He="&",Je={type:"literal",value:"&",description:'"&"'},Ke="==",We={type:"literal",value:"==",description:'"=="'},Xe="!=",tr={type:"literal",value:"!=",description:'"!="'},er="<=",rr={type:"literal",value:"<=",description:'"<="'},nr=">=",sr={type:"literal",value:">=",description:'">="'},ur="<",ir={type:"literal",value:"<",description:'"<"'},lr=">",ar={type:"literal",value:">",description:'">"'},or="=~",cr={type:"literal",value:"=~",description:'"=~"'},pr="!~",fr={type:"literal",value:"!~",description:'"!~"'},dr=function(t,e,r){return cu("Relational").set({op:e}).add(t,r)},hr="<<",vr={type:"literal",value:"<<",description:'"<<"'},Ar=">>",yr={type:"literal",value:">>",description:'">>"'},xr="+",br={type:"literal",value:"+",description:'"+"'},Pr="-",gr={type:"literal",value:"-",description:'"-"'},Cr=function(t,e,r){return cu("Arithmetical").set({op:e}).add(t,r)},mr="**",Sr={type:"literal",value:"**",description:'"**"'},Qr="%",Er={type:"literal",value:"%",description:'"%"'},wr="!",Fr={type:"literal",value:"!",description:'"!"'},Rr="~",Tr={type:"literal",value:"~",description:'"~"'},Lr=function(t,e){return cu("Unary").set({op:t}).add(e)},Nr="(",qr={type:"literal",value:"(",description:'"("'},_r=")",jr={type:"literal",value:")",description:'")"'},zr=function(t,e){return cu("FuncCall").merge(t).add(e)},Ir=function(t,e){return ou(t,e,3)},Ur={type:"other",description:"node attribute"},Zr="@",Vr={type:"literal",value:"@",description:'"@"'},kr=function(t){return cu("Attribute").merge(t)},Br={type:"other",description:"query parameter reference"},Gr="{",Mr={type:"literal",value:"{",description:'"{"'},Or="}",Yr={type:"literal",value:"}",description:'"}"'},$r=function(t){return cu("Param").merge(t)},Dr=function(t){return t},Hr={type:"other",description:"identifier"},Jr=void 0,Kr=/^[a-zA-Z_]/,Wr={type:"class",value:"[a-zA-Z_]",description:"[a-zA-Z_]"},Xr=/^[a-zA-Z0-9_\-]/,tn={type:"class",value:"[a-zA-Z0-9_\\-]",description:"[a-zA-Z0-9_\\-]"},en=function(t){return cu("Identifier").set({id:t})},rn={type:"other",description:"quoted string literal"},nn='"',sn={type:"literal",value:'"',description:'"\\""'},un=/^[^"]/,ln={type:"class",value:'[^"]',description:'[^"]'},an=function(t){return cu("LiteralString").set({value:t.join("")})},on="'",cn={type:"literal",value:"'",description:'"\'"'},pn="\\'",fn={type:"literal",value:"\\'",description:'"\\\\\'"'},dn=/^[^']/,hn={type:"class",value:"[^']",description:"[^']"},vn=function(t){return cu("LiteralString").set({value:t.replace(/\\'/g,"'")})},An={type:"other",description:"escaped string character"},yn="\\\\",xn={type:"literal",value:"\\\\",description:'"\\\\\\\\"'},bn=function(){return"\\"},Pn='\\"',gn={type:"literal",value:'\\"',description:'"\\\\\\""'},Cn=function(){return'"'},mn=function(){return"'"},Sn="\\b",Qn={type:"literal",value:"\\b",description:'"\\\\b"'},En=function(){return"\b"},wn="\\v",Fn={type:"literal",value:"\\v",description:'"\\\\v"'},Rn=function(){return""},Tn="\\f",Ln={type:"literal",value:"\\f",description:'"\\\\f"'},Nn=function(){return"\f"},qn="\\t",_n={type:"literal",value:"\\t",description:'"\\\\t"'},jn=function(){return" "},zn="\\r",In={type:"literal",value:"\\r",description:'"\\\\r"'},Un=function(){return"\r"},Zn="\\n",Vn={type:"literal",value:"\\n",description:'"\\\\n"'},kn=function(){return"\n"},Bn="\\e",Gn={type:"literal",value:"\\e",description:'"\\\\e"'},Mn=function(){return""},On="\\x",Yn={type:"literal",value:"\\x",description:'"\\\\x"'},$n=/^[0-9a-fA-F]/,Dn={type:"class",value:"[0-9a-fA-F]",description:"[0-9a-fA-F]"},Hn=function(t){return String.fromCharCode(parseInt(t,16))},Jn="\\u",Kn={type:"literal",value:"\\u",description:'"\\\\u"'},Wn={type:"other",description:"regular expression literal"},Xn="\\/",ts={type:"literal",value:"\\/",description:'"\\\\/"'},es=/^[^\/]/,rs={type:"class",value:"[^\\/]",description:"[^\\/]"},ns=function(t){var e;try{e=new RegExp(t.replace(/\\\//g,"/"))}catch(r){u(r.message)}return cu("LiteralRegExp").set({value:e})},ss={type:"other",description:"numeric literal"},us=/^[+\-]/,is={type:"class",value:"[+\\-]",description:"[+\\-]"},ls="0b",as={type:"literal",value:"0b",description:'"0b"'},os=/^[01]/,cs={type:"class",value:"[01]",description:"[01]"},ps=function(t,e){return cu("LiteralNumber").set({value:parseInt(t+e,2)})},fs="0o",ds={type:"literal",value:"0o",description:'"0o"'},hs=/^[0-7]/,vs={type:"class",value:"[0-7]",description:"[0-7]"},As=function(t,e){return cu("LiteralNumber").set({value:parseInt(t+e,8)})},ys="0x",xs={type:"literal",value:"0x",description:'"0x"'},bs=function(t,e){return cu("LiteralNumber").set({value:parseInt(t+e,16)})},Ps=/^[0-9]/,gs={type:"class",value:"[0-9]",description:"[0-9]"},Cs=".",ms={type:"literal",value:".",description:'"."'},Ss=/^[eE]/,Qs={type:"class",value:"[eE]",description:"[eE]"},Es=function(t){return cu("LiteralNumber").set({value:parseFloat(t)})},ws=function(t){return cu("LiteralNumber").set({value:parseInt(t,10)})},Fs={type:"other",description:"global value"},Rs="true",Ts={type:"literal",value:"true",description:'"true"'},Ls=function(){return cu("LiteralValue").set({value:!0})},Ns="false",qs={type:"literal",value:"false",description:'"false"'},_s=function(){return cu("LiteralValue").set({value:!1})},js="null",zs={type:"literal",value:"null",description:'"null"'},Is=function(){return cu("LiteralValue").set({value:null})},Us="NaN",Zs={type:"literal",value:"NaN",description:'"NaN"'},Vs=function(){return cu("LiteralValue").set({value:0/0})},ks="undefined",Bs={type:"literal",value:"undefined",description:'"undefined"'},Gs=function(){return cu("LiteralValue").set({value:void 0})},Ms={type:"other",description:"optional blank"},Os={type:"other",description:"multi-line comment"},Ys="/*",$s={type:"literal",value:"/*",description:'"/*"'},Ds="*/",Hs={type:"literal",value:"*/",description:'"*/"'},Js={type:"any",description:"any character"},Ks={type:"other",description:"any whitespaces"},Ws=/^[ \t\r\n]/,Xs={type:"class",value:"[ \\t\\r\\n]",description:"[ \\t\\r\\n]"},tu={type:"other",description:"end of file"},eu=0,ru=0,nu=0,su={line:1,column:1,seenCR:!1},uu=0,iu=[],lu=0,au={};if("startRule"in Y){if(!(Y.startRule in D))throw new Error("Can't start parsing from rule \""+Y.startRule+'".');H=D[Y.startRule]}var ou=Y.util.makeUnroll(n,s,r,e),cu=Y.util.makeAST(n,s,r,Y);if(O=H(),O!==$&&eu===t.length)return O;throw O!==$&&eu<t.length&&l({type:"end",description:"end of input"}),a(null,iu,uu)}return t(e,Error),{SyntaxError:e,parse:r}}(),ASTQQueryExec=_dereq_("./astq-query-exec.js"),ASTQQuery=function(){function t(t){this.asty=new ASTY,this.ast=null,t&&this.compile(t)}return _prototypeProperties(t,null,{compile:{value:function(t,e){var r=this;e&&console.log("ASTQ: compile: +-------------------------------------------------------------------------------------------------------\nASTQ: compile: | "+t);var n=PEGUtil.parse(ASTQQueryParse,t,{startRule:"query",makeAST:function(t,e,n,s){return r.asty.create.apply(r.asty,s).pos(t,e,n)}});if(null!==n.error)throw new Error("ASTQ: compile: query parsing failed:\n"+PEGUtil.errorMessage(n.error,!0).replace(/^/gm,"ERROR: "));return this.ast=n.ast,e&&console.log("ASTQ: compile: +-------------------------------------------------------------------------------------------------------\n"+this.dump().replace(/\n$/,"").replace(/^/gm,"ASTQ: compile: | ")),this},writable:!0,enumerable:!0,configurable:!0},dump:{value:function(){return this.ast.dump()},writable:!0,enumerable:!0,configurable:!0},execute:{value:function(t,e,r,n,s){s&&console.log("ASTQ: execute: +--------------------------------------------------------------+----------------------------------------");var u=new ASTQQueryExec(e,r,n,s);return u.execQuery(this.ast,t)},writable:!0,enumerable:!0,configurable:!0}}),t}();module.exports=ASTQQuery; | ||
"use strict";var _prototypeProperties=function(t,e,r){e&&Object.defineProperties(t,e),r&&Object.defineProperties(t.prototype,r)},ASTY=_dereq_("asty"),PEGUtil=_dereq_("pegjs-util"),ASTQQueryParse=function(){function t(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function e(t,e,r,n,s,u){this.message=t,this.expected=e,this.found=r,this.offset=n,this.line=s,this.column=u,this.name="SyntaxError"}function r(t){function r(){return ru}function n(){return i(ru).line}function s(){return i(ru).column}function u(t){throw a(t,null,ru)}function i(e){function r(e,r,n){var s,u;for(s=r;n>s;s++)u=t.charAt(s),"\n"===u?(e.seenCR||e.line++,e.column=1,e.seenCR=!1):"\r"===u||"\u2028"===u||"\u2029"===u?(e.line++,e.column=1,e.seenCR=!0):(e.column++,e.seenCR=!1)}return nu!==e&&(nu>e&&(nu=0,su={line:1,column:1,seenCR:!1}),r(su,nu,e),nu=e),su}function l(t){uu>eu||(eu>uu&&(uu=eu,iu=[]),iu.push(t))}function a(r,n,s){function u(t){var e=1;for(t.sort(function(t,e){return t.description<e.description?-1:t.description>e.description?1:0});e<t.length;)t[e-1]===t[e]?t.splice(e,1):e++}function l(t,e){function r(t){function e(t){return t.charCodeAt(0).toString(16).toUpperCase()}return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(t){return"\\x0"+e(t)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(t){return"\\x"+e(t)}).replace(/[\u0180-\u0FFF]/g,function(t){return"\\u0"+e(t)}).replace(/[\u1080-\uFFFF]/g,function(t){return"\\u"+e(t)})}var n,s,u,i=new Array(t.length);for(u=0;u<t.length;u++)i[u]=t[u].description;return n=t.length>1?i.slice(0,-1).join(", ")+" or "+i[t.length-1]:i[0],s=e?'"'+r(e)+'"':"end of input","Expected "+n+" but "+s+" found."}var a=i(s),o=s<t.length?t.charAt(s):null;return null!==n&&u(n),new e(null!==r?r:l(n,o),n,o,s,a.line,a.column)}function o(){var t,e,r,n,s,u=36*eu+0,i=au[u];return i?(eu=i.nextPos,i.result):(t=eu,e=k(),e!==$?(r=c(),r!==$?(n=k(),n!==$?(s=M(),s!==$?(ru=t,e=K(r),t=e):(eu=t,t=J)):(eu=t,t=J)):(eu=t,t=J)):(eu=t,t=J),au[u]={nextPos:eu,result:t},t)}function c(){var e,r,n,s,u,i,a,o,c=36*eu+1,f=au[c];if(f)return eu=f.nextPos,f.result;if(e=eu,r=p(),r!==$){for(n=[],s=eu,u=k(),u!==$?(44===t.charCodeAt(eu)?(i=W,eu++):(i=$,0===lu&&l(X)),i!==$?(a=k(),a!==$?(o=p(),o!==$?(u=[u,i,a,o],s=u):(eu=s,s=J)):(eu=s,s=J)):(eu=s,s=J)):(eu=s,s=J);s!==$;)n.push(s),s=eu,u=k(),u!==$?(44===t.charCodeAt(eu)?(i=W,eu++):(i=$,0===lu&&l(X)),i!==$?(a=k(),a!==$?(o=p(),o!==$?(u=[u,i,a,o],s=u):(eu=s,s=J)):(eu=s,s=J)):(eu=s,s=J)):(eu=s,s=J);n!==$?(ru=e,r=te(r,n),e=r):(eu=e,e=J)}else eu=e,e=J;return au[c]={nextPos:eu,result:e},e}function p(){var t,e,r,n,s,u,i=36*eu+2,l=au[i];if(l)return eu=l.nextPos,l.result;if(t=eu,e=f(),e!==$){for(r=[],n=eu,s=k(),s!==$?(u=d(),u!==$?(s=[s,u],n=s):(eu=n,n=J)):(eu=n,n=J);n!==$;)r.push(n),n=eu,s=k(),s!==$?(u=d(),u!==$?(s=[s,u],n=s):(eu=n,n=J)):(eu=n,n=J);r!==$?(ru=t,e=ee(e,r),t=e):(eu=t,t=J)}else eu=t,t=J;return au[i]={nextPos:eu,result:t},t}function f(){var t,e,r,n,s,u,i=36*eu+3,l=au[i];return l?(eu=l.nextPos,l.result):(t=eu,e=h(),e===$&&(e=re),e!==$?(r=k(),r!==$?(n=v(),n!==$?(s=k(),s!==$?(u=A(),u===$&&(u=re),u!==$?(ru=t,e=ne(e,n,u),t=e):(eu=t,t=J)):(eu=t,t=J)):(eu=t,t=J)):(eu=t,t=J)):(eu=t,t=J),au[i]={nextPos:eu,result:t},t)}function d(){var t,e,r,n,s,u,i=36*eu+4,l=au[i];return l?(eu=l.nextPos,l.result):(t=eu,e=h(),e!==$?(r=k(),r!==$?(n=v(),n!==$?(s=k(),s!==$?(u=A(),u===$&&(u=re),u!==$?(ru=t,e=ne(e,n,u),t=e):(eu=t,t=J)):(eu=t,t=J)):(eu=t,t=J)):(eu=t,t=J)):(eu=t,t=J),au[i]={nextPos:eu,result:t},t)}function h(){var e,r,n,s=36*eu+5,u=au[s];return u?(eu=u.nextPos,u.result):(lu++,e=eu,r=eu,t.substr(eu,2)===ue?(n=ue,eu+=2):(n=$,0===lu&&l(ie)),n===$&&(47===t.charCodeAt(eu)?(n=le,eu++):(n=$,0===lu&&l(ae)),n===$&&(t.substr(eu,3)===oe?(n=oe,eu+=3):(n=$,0===lu&&l(ce)),n===$&&(t.substr(eu,2)===pe?(n=pe,eu+=2):(n=$,0===lu&&l(fe)),n===$&&(t.substr(eu,3)===de?(n=de,eu+=3):(n=$,0===lu&&l(he)),n===$&&(t.substr(eu,2)===ve?(n=ve,eu+=2):(n=$,0===lu&&l(Ae)),n===$&&(t.substr(eu,3)===ye?(n=ye,eu+=3):(n=$,0===lu&&l(xe)),n===$&&(t.substr(eu,2)===be?(n=be,eu+=2):(n=$,0===lu&&l(Pe))))))))),n!==$&&(n=t.substring(r,eu)),r=n,r!==$&&(ru=e,r=ge(r)),e=r,lu--,e===$&&(r=$,0===lu&&l(se)),au[s]={nextPos:eu,result:e},e)}function v(){var e,r,n=36*eu+6,s=au[n];return s?(eu=s.nextPos,s.result):(e=eu,r=j(),r!==$&&(ru=e,r=Ce(r)),e=r,e===$&&(e=eu,42===t.charCodeAt(eu)?(r=me,eu++):(r=$,0===lu&&l(Se)),r!==$&&(ru=e,r=Qe()),e=r),au[n]={nextPos:eu,result:e},e)}function A(){var e,r,n,s,u,i,a=36*eu+7,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,91===t.charCodeAt(eu)?(r=Ee,eu++):(r=$,0===lu&&l(we)),r!==$?(n=k(),n!==$?(s=y(),s!==$?(u=k(),u!==$?(93===t.charCodeAt(eu)?(i=Fe,eu++):(i=$,0===lu&&l(Re)),i!==$?(ru=e,r=Te(s),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),au[a]={nextPos:eu,result:e},e)}function y(){var e,r,n,s,u,i,a,o,c,p,f=36*eu+8,d=au[f];return d?(eu=d.nextPos,d.result):(e=eu,r=x(),r!==$?(n=k(),n!==$?(t.substr(eu,2)===Le?(s=Le,eu+=2):(s=$,0===lu&&l(Ne)),s!==$?(u=k(),u!==$?(i=x(),i!==$?(ru=e,r=qe(r,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=eu,r=x(),r!==$?(n=k(),n!==$?(63===t.charCodeAt(eu)?(s=_e,eu++):(s=$,0===lu&&l(je)),s!==$?(u=k(),u!==$?(i=x(),i!==$?(a=k(),a!==$?(58===t.charCodeAt(eu)?(o=ze,eu++):(o=$,0===lu&&l(Ie)),o!==$?(c=k(),c!==$?(p=x(),p!==$?(ru=e,r=Ue(r,i,p),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=x())),au[f]={nextPos:eu,result:e},e)}function x(){var e,r,n,s,u,i,a=36*eu+9,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,r=b(),r!==$?(n=k(),n!==$?(s=eu,t.substr(eu,2)===Ze?(u=Ze,eu+=2):(u=$,0===lu&&l(Ve)),u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(u=k(),u!==$?(i=x(),i!==$?(ru=e,r=ke(r,s,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=b()),au[a]={nextPos:eu,result:e},e)}function b(){var e,r,n,s,u,i,a=36*eu+10,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,r=P(),r!==$?(n=k(),n!==$?(s=eu,t.substr(eu,2)===Be?(u=Be,eu+=2):(u=$,0===lu&&l(Ge)),u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(u=k(),u!==$?(i=b(),i!==$?(ru=e,r=ke(r,s,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=P()),au[a]={nextPos:eu,result:e},e)}function P(){var e,r,n,s,u,i,a=36*eu+11,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,r=g(),r!==$?(n=k(),n!==$?(s=eu,124===t.charCodeAt(eu)?(u=Me,eu++):(u=$,0===lu&&l(Oe)),u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(u=k(),u!==$?(i=P(),i!==$?(ru=e,r=Ye(r,s,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=g()),au[a]={nextPos:eu,result:e},e)}function g(){var e,r,n,s,u,i,a=36*eu+12,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,r=C(),r!==$?(n=k(),n!==$?(s=eu,94===t.charCodeAt(eu)?(u=$e,eu++):(u=$,0===lu&&l(De)),u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(u=k(),u!==$?(i=g(),i!==$?(ru=e,r=Ye(r,s,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=C()),au[a]={nextPos:eu,result:e},e)}function C(){var e,r,n,s,u,i,a=36*eu+13,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,r=m(),r!==$?(n=k(),n!==$?(s=eu,38===t.charCodeAt(eu)?(u=He,eu++):(u=$,0===lu&&l(Je)),u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(u=k(),u!==$?(i=C(),i!==$?(ru=e,r=Ye(r,s,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=m()),au[a]={nextPos:eu,result:e},e)}function m(){var e,r,n,s,u,i,a=36*eu+14,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,r=S(),r!==$?(n=k(),n!==$?(s=eu,t.substr(eu,2)===Ke?(u=Ke,eu+=2):(u=$,0===lu&&l(We)),u===$&&(t.substr(eu,2)===Xe?(u=Xe,eu+=2):(u=$,0===lu&&l(tr)),u===$&&(t.substr(eu,2)===er?(u=er,eu+=2):(u=$,0===lu&&l(rr)),u===$&&(t.substr(eu,2)===nr?(u=nr,eu+=2):(u=$,0===lu&&l(sr)),u===$&&(60===t.charCodeAt(eu)?(u=ur,eu++):(u=$,0===lu&&l(ir)),u===$&&(62===t.charCodeAt(eu)?(u=lr,eu++):(u=$,0===lu&&l(ar)),u===$&&(t.substr(eu,2)===or?(u=or,eu+=2):(u=$,0===lu&&l(cr)),u===$&&(t.substr(eu,2)===pr?(u=pr,eu+=2):(u=$,0===lu&&l(fr))))))))),u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(u=k(),u!==$?(i=m(),i!==$?(ru=e,r=dr(r,s,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=S()),au[a]={nextPos:eu,result:e},e)}function S(){var e,r,n,s,u,i,a=36*eu+15,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,r=Q(),r!==$?(n=k(),n!==$?(s=eu,t.substr(eu,2)===hr?(u=hr,eu+=2):(u=$,0===lu&&l(vr)),u===$&&(t.substr(eu,2)===Ar?(u=Ar,eu+=2):(u=$,0===lu&&l(yr))),u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(u=k(),u!==$?(i=S(),i!==$?(ru=e,r=Ye(r,s,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=Q()),au[a]={nextPos:eu,result:e},e)}function Q(){var e,r,n,s,u,i,a=36*eu+16,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,r=E(),r!==$?(n=k(),n!==$?(s=eu,43===t.charCodeAt(eu)?(u=xr,eu++):(u=$,0===lu&&l(br)),u===$&&(45===t.charCodeAt(eu)?(u=Pr,eu++):(u=$,0===lu&&l(gr))),u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(u=k(),u!==$?(i=Q(),i!==$?(ru=e,r=Cr(r,s,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=E()),au[a]={nextPos:eu,result:e},e)}function E(){var e,r,n,s,u,i,a=36*eu+17,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,r=w(),r!==$?(n=k(),n!==$?(s=eu,t.substr(eu,2)===mr?(u=mr,eu+=2):(u=$,0===lu&&l(Sr)),u===$&&(42===t.charCodeAt(eu)?(u=me,eu++):(u=$,0===lu&&l(Se)),u===$&&(47===t.charCodeAt(eu)?(u=le,eu++):(u=$,0===lu&&l(ae)),u===$&&(37===t.charCodeAt(eu)?(u=Qr,eu++):(u=$,0===lu&&l(Er))))),u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(u=k(),u!==$?(i=E(),i!==$?(ru=e,r=Cr(r,s,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=w()),au[a]={nextPos:eu,result:e},e)}function w(){var e,r,n,s=36*eu+18,u=au[s];return u?(eu=u.nextPos,u.result):(e=eu,r=eu,33===t.charCodeAt(eu)?(n=wr,eu++):(n=$,0===lu&&l(Fr)),n===$&&(126===t.charCodeAt(eu)?(n=Rr,eu++):(n=$,0===lu&&l(Tr))),n!==$&&(n=t.substring(r,eu)),r=n,r!==$?(n=F(),n!==$?(ru=e,r=Lr(r,n),e=r):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=F()),au[s]={nextPos:eu,result:e},e)}function F(){var t,e=36*eu+19,r=au[e];return r?(eu=r.nextPos,r.result):(t=R(),t===$&&(t=L(),t===$&&(t=N(),t===$&&(t=q(),t===$&&(t=_(),t===$&&(t=p()))))),au[e]={nextPos:eu,result:t},t)}function R(){var e,r,n,s,u,i,a,o,c=36*eu+20,p=au[c];return p?(eu=p.nextPos,p.result):(e=eu,r=j(),r!==$?(n=k(),n!==$?(40===t.charCodeAt(eu)?(s=Nr,eu++):(s=$,0===lu&&l(qr)),s!==$?(u=k(),u!==$?(i=T(),i===$&&(i=re),i!==$?(a=k(),a!==$?(41===t.charCodeAt(eu)?(o=_r,eu++):(o=$,0===lu&&l(jr)),o!==$?(ru=e,r=zr(r,i),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),au[c]={nextPos:eu,result:e},e)}function T(){var e,r,n,s,u,i,a,o,c=36*eu+21,p=au[c];if(p)return eu=p.nextPos,p.result;if(e=eu,r=y(),r!==$){for(n=[],s=eu,u=k(),u!==$?(44===t.charCodeAt(eu)?(i=W,eu++):(i=$,0===lu&&l(X)),i!==$?(a=k(),a!==$?(o=y(),o!==$?(u=[u,i,a,o],s=u):(eu=s,s=J)):(eu=s,s=J)):(eu=s,s=J)):(eu=s,s=J);s!==$;)n.push(s),s=eu,u=k(),u!==$?(44===t.charCodeAt(eu)?(i=W,eu++):(i=$,0===lu&&l(X)),i!==$?(a=k(),a!==$?(o=y(),o!==$?(u=[u,i,a,o],s=u):(eu=s,s=J)):(eu=s,s=J)):(eu=s,s=J)):(eu=s,s=J);n!==$?(ru=e,r=Ir(r,n),e=r):(eu=e,e=J)}else eu=e,e=J;return au[c]={nextPos:eu,result:e},e}function L(){var e,r,n,s=36*eu+22,u=au[s];return u?(eu=u.nextPos,u.result):(lu++,e=eu,64===t.charCodeAt(eu)?(r=Zr,eu++):(r=$,0===lu&&l(Vr)),r!==$?(n=j(),n!==$?(ru=e,r=kr(n),e=r):(eu=e,e=J)):(eu=e,e=J),lu--,e===$&&(r=$,0===lu&&l(Ur)),au[s]={nextPos:eu,result:e},e)}function N(){var e,r,n,s,u,i,a=36*eu+23,o=au[a];return o?(eu=o.nextPos,o.result):(lu++,e=eu,123===t.charCodeAt(eu)?(r=Gr,eu++):(r=$,0===lu&&l(Mr)),r!==$?(n=k(),n!==$?(s=j(),s!==$?(u=k(),u!==$?(125===t.charCodeAt(eu)?(i=Or,eu++):(i=$,0===lu&&l(Yr)),i!==$?(ru=e,r=$r(s),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),lu--,e===$&&(r=$,0===lu&&l(Br)),au[a]={nextPos:eu,result:e},e)}function q(){var t,e=36*eu+24,r=au[e];return r?(eu=r.nextPos,r.result):(t=z(),t===$&&(t=U(),t===$&&(t=Z(),t===$&&(t=V()))),au[e]={nextPos:eu,result:t},t)}function _(){var e,r,n,s,u,i,a=36*eu+25,o=au[a];return o?(eu=o.nextPos,o.result):(e=eu,40===t.charCodeAt(eu)?(r=Nr,eu++):(r=$,0===lu&&l(qr)),r!==$?(n=k(),n!==$?(s=y(),s!==$?(u=k(),u!==$?(41===t.charCodeAt(eu)?(i=_r,eu++):(i=$,0===lu&&l(jr)),i!==$?(ru=e,r=Dr(s),e=r):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J)):(eu=e,e=J),au[a]={nextPos:eu,result:e},e)}function j(){var e,r,n,s,u,i,a,o=36*eu+26,c=au[o];if(c)return eu=c.nextPos,c.result;if(lu++,e=eu,r=eu,n=eu,s=eu,lu++,u=V(),lu--,u===$?s=Jr:(eu=s,s=J),s!==$)if(Kr.test(t.charAt(eu))?(u=t.charAt(eu),eu++):(u=$,0===lu&&l(Wr)),u!==$){for(i=[],Xr.test(t.charAt(eu))?(a=t.charAt(eu),eu++):(a=$,0===lu&&l(tn));a!==$;)i.push(a),Xr.test(t.charAt(eu))?(a=t.charAt(eu),eu++):(a=$,0===lu&&l(tn));i!==$?(s=[s,u,i],n=s):(eu=n,n=J)}else eu=n,n=J;else eu=n,n=J;return n!==$&&(n=t.substring(r,eu)),r=n,r!==$&&(ru=e,r=en(r)),e=r,lu--,e===$&&(r=$,0===lu&&l(Hr)),au[o]={nextPos:eu,result:e},e}function z(){var e,r,n,s,u,i=36*eu+27,a=au[i];if(a)return eu=a.nextPos,a.result;if(lu++,e=eu,34===t.charCodeAt(eu)?(r=nn,eu++):(r=$,0===lu&&l(sn)),r!==$){for(n=[],s=I(),s===$&&(un.test(t.charAt(eu))?(s=t.charAt(eu),eu++):(s=$,0===lu&&l(ln)));s!==$;)n.push(s),s=I(),s===$&&(un.test(t.charAt(eu))?(s=t.charAt(eu),eu++):(s=$,0===lu&&l(ln)));n!==$?(34===t.charCodeAt(eu)?(s=nn,eu++):(s=$,0===lu&&l(sn)),s!==$?(ru=e,r=an(n),e=r):(eu=e,e=J)):(eu=e,e=J)}else eu=e,e=J;if(e===$)if(e=eu,39===t.charCodeAt(eu)?(r=on,eu++):(r=$,0===lu&&l(cn)),r!==$){for(n=eu,s=[],t.substr(eu,2)===pn?(u=pn,eu+=2):(u=$,0===lu&&l(fn)),u===$&&(dn.test(t.charAt(eu))?(u=t.charAt(eu),eu++):(u=$,0===lu&&l(hn)));u!==$;)s.push(u),t.substr(eu,2)===pn?(u=pn,eu+=2):(u=$,0===lu&&l(fn)),u===$&&(dn.test(t.charAt(eu))?(u=t.charAt(eu),eu++):(u=$,0===lu&&l(hn)));s!==$&&(s=t.substring(n,eu)),n=s,n!==$?(39===t.charCodeAt(eu)?(s=on,eu++):(s=$,0===lu&&l(cn)),s!==$?(ru=e,r=vn(n),e=r):(eu=e,e=J)):(eu=e,e=J)}else eu=e,e=J;return lu--,e===$&&(r=$,0===lu&&l(rn)),au[i]={nextPos:eu,result:e},e}function I(){var e,r,n,s,u,i,a,o,c=36*eu+28,p=au[c];return p?(eu=p.nextPos,p.result):(lu++,e=eu,t.substr(eu,2)===yn?(r=yn,eu+=2):(r=$,0===lu&&l(xn)),r!==$&&(ru=e,r=bn()),e=r,e===$&&(e=eu,t.substr(eu,2)===Pn?(r=Pn,eu+=2):(r=$,0===lu&&l(gn)),r!==$&&(ru=e,r=Cn()),e=r,e===$&&(e=eu,39===t.charCodeAt(eu)?(r=on,eu++):(r=$,0===lu&&l(cn)),r!==$&&(ru=e,r=mn()),e=r,e===$&&(e=eu,t.substr(eu,2)===Sn?(r=Sn,eu+=2):(r=$,0===lu&&l(Qn)),r!==$&&(ru=e,r=En()),e=r,e===$&&(e=eu,t.substr(eu,2)===wn?(r=wn,eu+=2):(r=$,0===lu&&l(Fn)),r!==$&&(ru=e,r=Rn()),e=r,e===$&&(e=eu,t.substr(eu,2)===Tn?(r=Tn,eu+=2):(r=$,0===lu&&l(Ln)),r!==$&&(ru=e,r=Nn()),e=r,e===$&&(e=eu,t.substr(eu,2)===qn?(r=qn,eu+=2):(r=$,0===lu&&l(_n)),r!==$&&(ru=e,r=jn()),e=r,e===$&&(e=eu,t.substr(eu,2)===zn?(r=zn,eu+=2):(r=$,0===lu&&l(In)),r!==$&&(ru=e,r=Un()),e=r,e===$&&(e=eu,t.substr(eu,2)===Zn?(r=Zn,eu+=2):(r=$,0===lu&&l(Vn)),r!==$&&(ru=e,r=kn()),e=r,e===$&&(e=eu,t.substr(eu,2)===Bn?(r=Bn,eu+=2):(r=$,0===lu&&l(Gn)),r!==$&&(ru=e,r=Mn()),e=r,e===$&&(e=eu,t.substr(eu,2)===On?(r=On,eu+=2):(r=$,0===lu&&l(Yn)),r!==$?(n=eu,s=eu,$n.test(t.charAt(eu))?(u=t.charAt(eu),eu++):(u=$,0===lu&&l(Dn)),u!==$?($n.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(Dn)),i!==$?(u=[u,i],s=u):(eu=s,s=J)):(eu=s,s=J),s!==$&&(s=t.substring(n,eu)),n=s,n!==$?(ru=e,r=Hn(n),e=r):(eu=e,e=J)):(eu=e,e=J),e===$&&(e=eu,t.substr(eu,2)===Jn?(r=Jn,eu+=2):(r=$,0===lu&&l(Kn)),r!==$?(n=eu,s=eu,$n.test(t.charAt(eu))?(u=t.charAt(eu),eu++):(u=$,0===lu&&l(Dn)),u!==$?($n.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(Dn)),i!==$?($n.test(t.charAt(eu))?(a=t.charAt(eu),eu++):(a=$,0===lu&&l(Dn)),a!==$?($n.test(t.charAt(eu))?(o=t.charAt(eu),eu++):(o=$,0===lu&&l(Dn)),o!==$?(u=[u,i,a,o],s=u):(eu=s,s=J)):(eu=s,s=J)):(eu=s,s=J)):(eu=s,s=J),s!==$&&(s=t.substring(n,eu)),n=s,n!==$?(ru=e,r=Hn(n),e=r):(eu=e,e=J)):(eu=e,e=J)))))))))))),lu--,e===$&&(r=$,0===lu&&l(An)),au[c]={nextPos:eu,result:e},e)}function U(){var e,r,n,s,u,i=36*eu+29,a=au[i];if(a)return eu=a.nextPos,a.result;if(lu++,e=eu,47===t.charCodeAt(eu)?(r=le,eu++):(r=$,0===lu&&l(ae)),r!==$){for(n=eu,s=[],t.substr(eu,2)===Xn?(u=Xn,eu+=2):(u=$,0===lu&&l(ts)),u===$&&(es.test(t.charAt(eu))?(u=t.charAt(eu),eu++):(u=$,0===lu&&l(rs)));u!==$;)s.push(u),t.substr(eu,2)===Xn?(u=Xn,eu+=2):(u=$,0===lu&&l(ts)),u===$&&(es.test(t.charAt(eu))?(u=t.charAt(eu),eu++):(u=$,0===lu&&l(rs)));s!==$&&(s=t.substring(n,eu)),n=s,n!==$?(47===t.charCodeAt(eu)?(s=le,eu++):(s=$,0===lu&&l(ae)),s!==$?(ru=e,r=ns(n),e=r):(eu=e,e=J)):(eu=e,e=J)}else eu=e,e=J;return lu--,e===$&&(r=$,0===lu&&l(Wn)),au[i]={nextPos:eu,result:e},e}function Z(){var e,r,n,s,u,i,a,o,c,p,f,d,h=36*eu+30,v=au[h];if(v)return eu=v.nextPos,v.result;if(lu++,e=eu,r=eu,us.test(t.charAt(eu))?(n=t.charAt(eu),eu++):(n=$,0===lu&&l(is)),n===$&&(n=re),n!==$&&(n=t.substring(r,eu)),r=n,r!==$)if(t.substr(eu,2)===ls?(n=ls,eu+=2):(n=$,0===lu&&l(as)),n!==$){if(s=eu,u=[],os.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(cs)),i!==$)for(;i!==$;)u.push(i),os.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(cs));else u=J;u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(ru=e,r=ps(r,s),e=r):(eu=e,e=J)}else eu=e,e=J;else eu=e,e=J;if(e===$){if(e=eu,r=eu,us.test(t.charAt(eu))?(n=t.charAt(eu),eu++):(n=$,0===lu&&l(is)),n===$&&(n=re),n!==$&&(n=t.substring(r,eu)),r=n,r!==$)if(t.substr(eu,2)===fs?(n=fs,eu+=2):(n=$,0===lu&&l(ds)),n!==$){if(s=eu,u=[],hs.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(vs)),i!==$)for(;i!==$;)u.push(i),hs.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(vs));else u=J;u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(ru=e,r=As(r,s),e=r):(eu=e,e=J)}else eu=e,e=J;else eu=e,e=J;if(e===$){if(e=eu,r=eu,us.test(t.charAt(eu))?(n=t.charAt(eu),eu++):(n=$,0===lu&&l(is)),n===$&&(n=re),n!==$&&(n=t.substring(r,eu)),r=n,r!==$)if(t.substr(eu,2)===ys?(n=ys,eu+=2):(n=$,0===lu&&l(xs)),n!==$){if(s=eu,u=[],$n.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(Dn)),i!==$)for(;i!==$;)u.push(i),$n.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(Dn));else u=J;u!==$&&(u=t.substring(s,eu)),s=u,s!==$?(ru=e,r=bs(r,s),e=r):(eu=e,e=J)}else eu=e,e=J;else eu=e,e=J;if(e===$){if(e=eu,r=eu,n=eu,us.test(t.charAt(eu))?(s=t.charAt(eu),eu++):(s=$,0===lu&&l(is)),s===$&&(s=re),s!==$){for(u=[],Ps.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(gs));i!==$;)u.push(i),Ps.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(gs));if(u!==$)if(46===t.charCodeAt(eu)?(i=Cs,eu++):(i=$,0===lu&&l(ms)),i!==$){if(a=[],Ps.test(t.charAt(eu))?(o=t.charAt(eu),eu++):(o=$,0===lu&&l(gs)),o!==$)for(;o!==$;)a.push(o),Ps.test(t.charAt(eu))?(o=t.charAt(eu),eu++):(o=$,0===lu&&l(gs));else a=J;if(a!==$){if(o=eu,Ss.test(t.charAt(eu))?(c=t.charAt(eu),eu++):(c=$,0===lu&&l(Qs)),c!==$)if(us.test(t.charAt(eu))?(p=t.charAt(eu),eu++):(p=$,0===lu&&l(is)),p===$&&(p=re),p!==$){if(f=[],Ps.test(t.charAt(eu))?(d=t.charAt(eu),eu++):(d=$,0===lu&&l(gs)),d!==$)for(;d!==$;)f.push(d),Ps.test(t.charAt(eu))?(d=t.charAt(eu),eu++):(d=$,0===lu&&l(gs));else f=J;f!==$?(c=[c,p,f],o=c):(eu=o,o=J)}else eu=o,o=J;else eu=o,o=J;o===$&&(o=re),o!==$?(s=[s,u,i,a,o],n=s):(eu=n,n=J)}else eu=n,n=J}else eu=n,n=J;else eu=n,n=J}else eu=n,n=J;if(n!==$&&(n=t.substring(r,eu)),r=n,r!==$&&(ru=e,r=Es(r)),e=r,e===$){if(e=eu,r=eu,n=eu,us.test(t.charAt(eu))?(s=t.charAt(eu),eu++):(s=$,0===lu&&l(is)),s===$&&(s=re),s!==$){if(u=[],Ps.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(gs)),i!==$)for(;i!==$;)u.push(i),Ps.test(t.charAt(eu))?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(gs));else u=J;u!==$?(s=[s,u],n=s):(eu=n,n=J)}else eu=n,n=J;n!==$&&(n=t.substring(r,eu)),r=n,r!==$&&(ru=e,r=ws(r)),e=r}}}}return lu--,e===$&&(r=$,0===lu&&l(ss)),au[h]={nextPos:eu,result:e},e}function V(){var e,r,n=36*eu+31,s=au[n];return s?(eu=s.nextPos,s.result):(lu++,e=eu,t.substr(eu,4)===Rs?(r=Rs,eu+=4):(r=$,0===lu&&l(Ts)),r!==$&&(ru=e,r=Ls()),e=r,e===$&&(e=eu,t.substr(eu,5)===Ns?(r=Ns,eu+=5):(r=$,0===lu&&l(qs)),r!==$&&(ru=e,r=_s()),e=r,e===$&&(e=eu,t.substr(eu,4)===js?(r=js,eu+=4):(r=$,0===lu&&l(zs)),r!==$&&(ru=e,r=Is()),e=r,e===$&&(e=eu,t.substr(eu,3)===Us?(r=Us,eu+=3):(r=$,0===lu&&l(Zs)),r!==$&&(ru=e,r=Vs()),e=r,e===$&&(e=eu,t.substr(eu,9)===ks?(r=ks,eu+=9):(r=$,0===lu&&l(Bs)),r!==$&&(ru=e,r=Gs()),e=r)))),lu--,e===$&&(r=$,0===lu&&l(Fs)),au[n]={nextPos:eu,result:e},e)}function k(){var t,e,r=36*eu+32,n=au[r];if(n)return eu=n.nextPos,n.result;for(lu++,t=[],e=B(),e===$&&(e=G());e!==$;)t.push(e),e=B(),e===$&&(e=G());return lu--,t===$&&(e=$,0===lu&&l(Ms)),au[r]={nextPos:eu,result:t},t}function B(){var e,r,n,s,u,i,a=36*eu+33,o=au[a];if(o)return eu=o.nextPos,o.result;if(lu++,e=eu,t.substr(eu,2)===Ys?(r=Ys,eu+=2):(r=$,0===lu&&l($s)),r!==$){for(n=[],s=eu,u=eu,lu++,t.substr(eu,2)===Ds?(i=Ds,eu+=2):(i=$,0===lu&&l(Hs)),lu--,i===$?u=Jr:(eu=u,u=J),u!==$?(t.length>eu?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(Js)),i!==$?(u=[u,i],s=u):(eu=s,s=J)):(eu=s,s=J);s!==$;)n.push(s),s=eu,u=eu,lu++,t.substr(eu,2)===Ds?(i=Ds,eu+=2):(i=$,0===lu&&l(Hs)),lu--,i===$?u=Jr:(eu=u,u=J),u!==$?(t.length>eu?(i=t.charAt(eu),eu++):(i=$,0===lu&&l(Js)),i!==$?(u=[u,i],s=u):(eu=s,s=J)):(eu=s,s=J);n!==$?(t.substr(eu,2)===Ds?(s=Ds,eu+=2):(s=$,0===lu&&l(Hs)),s!==$?(r=[r,n,s],e=r):(eu=e,e=J)):(eu=e,e=J)}else eu=e,e=J;return lu--,e===$&&(r=$,0===lu&&l(Os)),au[a]={nextPos:eu,result:e},e}function G(){var e,r,n=36*eu+34,s=au[n];if(s)return eu=s.nextPos,s.result;if(lu++,e=[],Ws.test(t.charAt(eu))?(r=t.charAt(eu),eu++):(r=$,0===lu&&l(Xs)),r!==$)for(;r!==$;)e.push(r),Ws.test(t.charAt(eu))?(r=t.charAt(eu),eu++):(r=$,0===lu&&l(Xs));else e=J;return lu--,e===$&&(r=$,0===lu&&l(Ks)),au[n]={nextPos:eu,result:e},e}function M(){var e,r,n=36*eu+35,s=au[n];return s?(eu=s.nextPos,s.result):(lu++,e=eu,lu++,t.length>eu?(r=t.charAt(eu),eu++):(r=$,0===lu&&l(Js)),lu--,r===$?e=Jr:(eu=e,e=J),lu--,e===$&&(r=$,0===lu&&l(tu)),au[n]={nextPos:eu,result:e},e)}var O,Y=arguments.length>1?arguments[1]:{},$={},D={query:o},H=o,J=$,K=function(t){return t},W=",",X={type:"literal",value:",",description:'","'},te=function(t,e){return cu("Query").add(ou(t,e,3))},ee=function(t,e){return cu("Path").add(ou(t,e,1))},re=null,ne=function(t,e,r){return cu("Step").add(t,e,r)},se={type:"other",description:"axis"},ue="//",ie={type:"literal",value:"//",description:'"//"'},le="/",ae={type:"literal",value:"/",description:'"/"'},oe="~~>",ce={type:"literal",value:"~~>",description:'"~~>"'},pe="~>",fe={type:"literal",value:"~>",description:'"~>"'},de="<~~",he={type:"literal",value:"<~~",description:'"<~~"'},ve="<~",Ae={type:"literal",value:"<~",description:'"<~"'},ye="~~^",xe={type:"literal",value:"~~^",description:'"~~^"'},be="~^",Pe={type:"literal",value:"~^",description:'"~^"'},ge=function(t){return cu("Axis").set({op:t})},Ce=function(t){return cu("Match").merge(t)},me="*",Se={type:"literal",value:"*",description:'"*"'},Qe=function(){return cu("Match").set({id:"*"})},Ee="[",we={type:"literal",value:"[",description:'"["'},Fe="]",Re={type:"literal",value:"]",description:'"]"'},Te=function(t){return cu("Filter").add(t)},Le="?:",Ne={type:"literal",value:"?:",description:'"?:"'},qe=function(t,e){return cu("ConditionalBinary").add(t,e)},_e="?",je={type:"literal",value:"?",description:'"?"'},ze=":",Ie={type:"literal",value:":",description:'":"'},Ue=function(t,e,r){return cu("ConditionalTernary").add(t,e,r)},Ze="||",Ve={type:"literal",value:"||",description:'"||"'},ke=function(t,e,r){return cu("Logical").set({op:e}).add(t,r)},Be="&&",Ge={type:"literal",value:"&&",description:'"&&"'},Me="|",Oe={type:"literal",value:"|",description:'"|"'},Ye=function(t,e,r){return cu("Bitwise").set({op:e}).add(t,r)},$e="^",De={type:"literal",value:"^",description:'"^"'},He="&",Je={type:"literal",value:"&",description:'"&"'},Ke="==",We={type:"literal",value:"==",description:'"=="'},Xe="!=",tr={type:"literal",value:"!=",description:'"!="'},er="<=",rr={type:"literal",value:"<=",description:'"<="'},nr=">=",sr={type:"literal",value:">=",description:'">="'},ur="<",ir={type:"literal",value:"<",description:'"<"'},lr=">",ar={type:"literal",value:">",description:'">"'},or="=~",cr={type:"literal",value:"=~",description:'"=~"'},pr="!~",fr={type:"literal",value:"!~",description:'"!~"'},dr=function(t,e,r){return cu("Relational").set({op:e}).add(t,r)},hr="<<",vr={type:"literal",value:"<<",description:'"<<"'},Ar=">>",yr={type:"literal",value:">>",description:'">>"'},xr="+",br={type:"literal",value:"+",description:'"+"'},Pr="-",gr={type:"literal",value:"-",description:'"-"'},Cr=function(t,e,r){return cu("Arithmetical").set({op:e}).add(t,r)},mr="**",Sr={type:"literal",value:"**",description:'"**"'},Qr="%",Er={type:"literal",value:"%",description:'"%"'},wr="!",Fr={type:"literal",value:"!",description:'"!"'},Rr="~",Tr={type:"literal",value:"~",description:'"~"'},Lr=function(t,e){return cu("Unary").set({op:t}).add(e)},Nr="(",qr={type:"literal",value:"(",description:'"("'},_r=")",jr={type:"literal",value:")",description:'")"'},zr=function(t,e){return cu("FuncCall").merge(t).add(e)},Ir=function(t,e){return ou(t,e,3)},Ur={type:"other",description:"node attribute"},Zr="@",Vr={type:"literal",value:"@",description:'"@"'},kr=function(t){return cu("Attribute").merge(t)},Br={type:"other",description:"query parameter reference"},Gr="{",Mr={type:"literal",value:"{",description:'"{"'},Or="}",Yr={type:"literal",value:"}",description:'"}"'},$r=function(t){return cu("Param").merge(t)},Dr=function(t){return t},Hr={type:"other",description:"identifier"},Jr=void 0,Kr=/^[a-zA-Z_]/,Wr={type:"class",value:"[a-zA-Z_]",description:"[a-zA-Z_]"},Xr=/^[a-zA-Z0-9_\-]/,tn={type:"class",value:"[a-zA-Z0-9_\\-]",description:"[a-zA-Z0-9_\\-]"},en=function(t){return cu("Identifier").set({id:t})},rn={type:"other",description:"quoted string literal"},nn='"',sn={type:"literal",value:'"',description:'"\\""'},un=/^[^"]/,ln={type:"class",value:'[^"]',description:'[^"]'},an=function(t){return cu("LiteralString").set({value:t.join("")})},on="'",cn={type:"literal",value:"'",description:'"\'"'},pn="\\'",fn={type:"literal",value:"\\'",description:'"\\\\\'"'},dn=/^[^']/,hn={type:"class",value:"[^']",description:"[^']"},vn=function(t){return cu("LiteralString").set({value:t.replace(/\\'/g,"'")})},An={type:"other",description:"escaped string character"},yn="\\\\",xn={type:"literal",value:"\\\\",description:'"\\\\\\\\"'},bn=function(){return"\\"},Pn='\\"',gn={type:"literal",value:'\\"',description:'"\\\\\\""'},Cn=function(){return'"'},mn=function(){return"'"},Sn="\\b",Qn={type:"literal",value:"\\b",description:'"\\\\b"'},En=function(){return"\b"},wn="\\v",Fn={type:"literal",value:"\\v",description:'"\\\\v"'},Rn=function(){return""},Tn="\\f",Ln={type:"literal",value:"\\f",description:'"\\\\f"'},Nn=function(){return"\f"},qn="\\t",_n={type:"literal",value:"\\t",description:'"\\\\t"'},jn=function(){return" "},zn="\\r",In={type:"literal",value:"\\r",description:'"\\\\r"'},Un=function(){return"\r"},Zn="\\n",Vn={type:"literal",value:"\\n",description:'"\\\\n"'},kn=function(){return"\n"},Bn="\\e",Gn={type:"literal",value:"\\e",description:'"\\\\e"'},Mn=function(){return""},On="\\x",Yn={type:"literal",value:"\\x",description:'"\\\\x"'},$n=/^[0-9a-fA-F]/,Dn={type:"class",value:"[0-9a-fA-F]",description:"[0-9a-fA-F]"},Hn=function(t){return String.fromCharCode(parseInt(t,16))},Jn="\\u",Kn={type:"literal",value:"\\u",description:'"\\\\u"'},Wn={type:"other",description:"regular expression literal"},Xn="\\/",ts={type:"literal",value:"\\/",description:'"\\\\/"'},es=/^[^\/]/,rs={type:"class",value:"[^\\/]",description:"[^\\/]"},ns=function(t){var e;try{e=new RegExp(t.replace(/\\\//g,"/"))}catch(r){u(r.message)}return cu("LiteralRegExp").set({value:e})},ss={type:"other",description:"numeric literal"},us=/^[+\-]/,is={type:"class",value:"[+\\-]",description:"[+\\-]"},ls="0b",as={type:"literal",value:"0b",description:'"0b"'},os=/^[01]/,cs={type:"class",value:"[01]",description:"[01]"},ps=function(t,e){return cu("LiteralNumber").set({value:parseInt(t+e,2)})},fs="0o",ds={type:"literal",value:"0o",description:'"0o"'},hs=/^[0-7]/,vs={type:"class",value:"[0-7]",description:"[0-7]"},As=function(t,e){return cu("LiteralNumber").set({value:parseInt(t+e,8)})},ys="0x",xs={type:"literal",value:"0x",description:'"0x"'},bs=function(t,e){return cu("LiteralNumber").set({value:parseInt(t+e,16)})},Ps=/^[0-9]/,gs={type:"class",value:"[0-9]",description:"[0-9]"},Cs=".",ms={type:"literal",value:".",description:'"."'},Ss=/^[eE]/,Qs={type:"class",value:"[eE]",description:"[eE]"},Es=function(t){return cu("LiteralNumber").set({value:parseFloat(t)})},ws=function(t){return cu("LiteralNumber").set({value:parseInt(t,10)})},Fs={type:"other",description:"global value"},Rs="true",Ts={type:"literal",value:"true",description:'"true"'},Ls=function(){return cu("LiteralValue").set({value:!0})},Ns="false",qs={type:"literal",value:"false",description:'"false"'},_s=function(){return cu("LiteralValue").set({value:!1})},js="null",zs={type:"literal",value:"null",description:'"null"'},Is=function(){return cu("LiteralValue").set({value:null})},Us="NaN",Zs={type:"literal",value:"NaN",description:'"NaN"'},Vs=function(){return cu("LiteralValue").set({value:0/0})},ks="undefined",Bs={type:"literal",value:"undefined",description:'"undefined"'},Gs=function(){return cu("LiteralValue").set({value:void 0})},Ms={type:"other",description:"optional blank"},Os={type:"other",description:"multi-line comment"},Ys="/*",$s={type:"literal",value:"/*",description:'"/*"'},Ds="*/",Hs={type:"literal",value:"*/",description:'"*/"'},Js={type:"any",description:"any character"},Ks={type:"other",description:"any whitespaces"},Ws=/^[ \t\r\n]/,Xs={type:"class",value:"[ \\t\\r\\n]",description:"[ \\t\\r\\n]"},tu={type:"other",description:"end of file"},eu=0,ru=0,nu=0,su={line:1,column:1,seenCR:!1},uu=0,iu=[],lu=0,au={};if("startRule"in Y){if(!(Y.startRule in D))throw new Error("Can't start parsing from rule \""+Y.startRule+'".');H=D[Y.startRule]}var ou=Y.util.makeUnroll(n,s,r,e),cu=Y.util.makeAST(n,s,r,Y);if(O=H(),O!==$&&eu===t.length)return O;throw O!==$&&eu<t.length&&l({type:"end",description:"end of input"}),a(null,iu,uu)}return t(e,Error),{SyntaxError:e,parse:r}}(),ASTQQueryExec=_dereq_("./astq-query-exec.js"),ASTQQuery=function(){function t(t){this.asty=new ASTY,this.ast=null,t&&this.compile(t)}return _prototypeProperties(t,null,{compile:{value:function(t,e){var r=this;e&&console.log("ASTQ: compile: +-------------------------------------------------------------------------------------------------------\nASTQ: compile: | "+t);var n=PEGUtil.parse(ASTQQueryParse,t,{startRule:"query",makeAST:function(t,e,n,s){return r.asty.create.apply(r.asty,s).pos(t,e,n)}});if(null!==n.error)throw new Error("ASTQ: compile: query parsing failed:\n"+PEGUtil.errorMessage(n.error,!0).replace(/^/gm,"ERROR: "));return this.ast=n.ast,e&&console.log("ASTQ: compile: +-------------------------------------------------------------------------------------------------------\n"+this.dump().replace(/\n$/,"").replace(/^/gm,"ASTQ: compile: | ")),this},writable:!0,configurable:!0},dump:{value:function(){return this.ast.dump()},writable:!0,configurable:!0},execute:{value:function(t,e,r,n,s){s&&console.log("ASTQ: execute: +--------------------------------------------------------------+----------------------------------------");var u=new ASTQQueryExec(e,r,n,s);return u.execQuery(this.ast,t)},writable:!0,configurable:!0}}),t}();module.exports=ASTQQuery; | ||
},{"./astq-query-exec.js":10,"asty":1,"pegjs-util":2}],13:[function(_dereq_,module,exports){ | ||
"use strict";var ASTQUtil={pad:function(e,r){return 0>r?e.length>-r?e.substr(0,-r):e+Array(-r+1-e.length).join(" "):e.length>r?e.substr(0,r):Array(r+1-e.length).join(" ")+e},truthy:function(e){var r=void 0;switch(typeof e){case"boolean":r=e;break;case"number":r=0!==e&&!isNaN(e);break;case"string":r=""!==e;break;case"object":r=!1,null!==e&&(r=!0,e instanceof Array&&(r=e.length>0));break;default:r=!1}return r},coerce:function(e,r){var t=void 0;try{switch(r){case"boolean":t=Boolean(e);break;case"number":t=Number(e);break;case"string":t=String(e);break;case"regexp":t=new RegExp(e);break;default:t=e}}catch(a){throw new Error("cannot coerce value into type "+r)}return t}};module.exports=ASTQUtil; | ||
},{}],14:[function(_dereq_,module,exports){ | ||
"use strict";var _prototypeProperties=function(e,r,t){r&&Object.defineProperties(e,r),t&&Object.defineProperties(e.prototype,t)},ASTQAdapter=_dereq_("./astq-adapter.js"),ASTQAdapterASTY=_dereq_("./astq-adapter-asty.js"),ASTQAdapterMOZAST=_dereq_("./astq-adapter-xmldom.js"),ASTQAdapterXMLDOM=_dereq_("./astq-adapter-xmldom.js"),ASTQFuncs=_dereq_("./astq-funcs.js"),ASTQFuncsSTD=_dereq_("./astq-funcs-std.js"),ASTQCache=_dereq_("./astq-cache.js"),ASTQQuery=_dereq_("./astq-query.js"),ASTQ=function(){function e(){if(!(this instanceof e))return new e;this._adapter=new ASTQAdapter,this._funcs=new ASTQFuncs,this._cache=new ASTQCache,this._adapter.register(ASTQAdapterMOZAST),this._adapter.register(ASTQAdapterXMLDOM),this._adapter.register(ASTQAdapterASTY);for(var r in ASTQFuncsSTD)this.func(r,ASTQFuncsSTD[r])}return _prototypeProperties(e,null,{adapter:{value:function r(r){if(1!==arguments.length)throw new Error("ASTQ#adapter: invalid number of arguments");return this._adapter.unregister(),this._adapter.register(r),this},writable:!0,enumerable:!0,configurable:!0},func:{value:function t(e,t){if(2!==arguments.length)throw new Error("ASTQ#func: invalid number of arguments");return this._funcs.register(e,t),this},writable:!0,enumerable:!0,configurable:!0},cache:{value:function(e){if(1!==arguments.length)throw new Error("ASTQ#cache: invalid number of arguments");return this._cache.limit(e),this},writable:!0,enumerable:!0,configurable:!0},compile:{value:function(e,r){if(arguments.length<1)throw new Error("ASTQ#compile: too less arguments");if(arguments.length>2)throw new Error("ASTQ#compile: too many arguments");void 0===r&&(r=!1);var t=this._cache.get(e);return void 0===t&&(t=new ASTQQuery,t.compile(e,r),this._cache.set(e,t)),t},writable:!0,enumerable:!0,configurable:!0},execute:{value:function(e,r,t,n){if(arguments.length<2)throw new Error("ASTQ#execute: too less arguments");if(arguments.length>4)throw new Error("ASTQ#execute: too many arguments");void 0===t&&(t={}),void 0===n&&(n=!1);var a=this._adapter.select(e);if(void 0===a)throw new Error("ASTQ#execute: no suitable adapter found for node");return r.execute(e,a,t,this._funcs,n)},writable:!0,enumerable:!0,configurable:!0},query:{value:function(e,r,t,n){if(arguments.length<2)throw new Error("ASTQ#query: too less arguments");if(arguments.length>4)throw new Error("ASTQ#query: too many arguments");return void 0===t&&(t={}),void 0===n&&(n=!1),this.execute(e,this.compile(r,n),t,n)},writable:!0,enumerable:!0,configurable:!0}}),e}();module.exports=ASTQ; | ||
"use strict";var _prototypeProperties=function(e,r,t){r&&Object.defineProperties(e,r),t&&Object.defineProperties(e.prototype,t)},ASTQAdapter=_dereq_("./astq-adapter.js"),ASTQAdapterASTY=_dereq_("./astq-adapter-asty.js"),ASTQAdapterMOZAST=_dereq_("./astq-adapter-xmldom.js"),ASTQAdapterXMLDOM=_dereq_("./astq-adapter-xmldom.js"),ASTQFuncs=_dereq_("./astq-funcs.js"),ASTQFuncsSTD=_dereq_("./astq-funcs-std.js"),ASTQCache=_dereq_("./astq-cache.js"),ASTQQuery=_dereq_("./astq-query.js"),ASTQ=function(){function e(){if(!(this instanceof e))return new e;this._adapter=new ASTQAdapter,this._funcs=new ASTQFuncs,this._cache=new ASTQCache,this._adapter.register(ASTQAdapterMOZAST),this._adapter.register(ASTQAdapterXMLDOM),this._adapter.register(ASTQAdapterASTY);for(var r in ASTQFuncsSTD)this.func(r,ASTQFuncsSTD[r])}return _prototypeProperties(e,null,{adapter:{value:function r(r){if(1!==arguments.length)throw new Error("ASTQ#adapter: invalid number of arguments");return this._adapter.unregister(),this._adapter.register(r),this},writable:!0,configurable:!0},func:{value:function t(e,t){if(2!==arguments.length)throw new Error("ASTQ#func: invalid number of arguments");return this._funcs.register(e,t),this},writable:!0,configurable:!0},cache:{value:function(e){if(1!==arguments.length)throw new Error("ASTQ#cache: invalid number of arguments");return this._cache.limit(e),this},writable:!0,configurable:!0},compile:{value:function(e,r){if(arguments.length<1)throw new Error("ASTQ#compile: too less arguments");if(arguments.length>2)throw new Error("ASTQ#compile: too many arguments");void 0===r&&(r=!1);var t=this._cache.get(e);return void 0===t&&(t=new ASTQQuery,t.compile(e,r),this._cache.set(e,t)),t},writable:!0,configurable:!0},execute:{value:function(e,r,t,n){if(arguments.length<2)throw new Error("ASTQ#execute: too less arguments");if(arguments.length>4)throw new Error("ASTQ#execute: too many arguments");void 0===t&&(t={}),void 0===n&&(n=!1);var a=this._adapter.select(e);if(void 0===a)throw new Error("ASTQ#execute: no suitable adapter found for node");return r.execute(e,a,t,this._funcs,n)},writable:!0,configurable:!0},query:{value:function(e,r,t,n){if(arguments.length<2)throw new Error("ASTQ#query: too less arguments");if(arguments.length>4)throw new Error("ASTQ#query: too many arguments");return void 0===t&&(t={}),void 0===n&&(n=!1),this.execute(e,this.compile(r,n),t,n)},writable:!0,configurable:!0}}),e}();module.exports=ASTQ; | ||
},{"./astq-adapter-asty.js":3,"./astq-adapter-xmldom.js":5,"./astq-adapter.js":6,"./astq-cache.js":7,"./astq-funcs-std.js":8,"./astq-funcs.js":9,"./astq-query.js":12}]},{},[3,4,5,6,7,8,9,10,11,12,13,14])(14) | ||
@@ -62,0 +62,0 @@ }); |
{ | ||
"name": "astq", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Abstract Syntax Tree (AST) Query Engine", | ||
@@ -25,3 +25,3 @@ "keywords": [ "abstract", "syntax", "tree", "query", "engine", "adaptable" ], | ||
"pegjs-util": "~1.0.0", | ||
"asty": "~1.0.0" | ||
"asty": "~1.0.2" | ||
}, | ||
@@ -36,3 +36,3 @@ "devDependencies": { | ||
"chai": "~1.10.0", | ||
"6to5ify": "~3.1.2", | ||
"6to5ify": "~4.0.0", | ||
"minifyify": "~6.1.0", | ||
@@ -39,0 +39,0 @@ "browserify-header": "~0.9.1", |
@@ -220,2 +220,18 @@ | ||
Implementation Notice | ||
--------------------- | ||
Although ASTq is written in ECMAScript 6, it is transpiled to ECMAScript | ||
5 and this way runs in really all(!) current (as of 2015) JavaScript | ||
environments, of course. | ||
Additionally, there are two transpilation results: first, there is | ||
`astq.browser.js` (plus `astq.browser.map`) for Browser environments. | ||
This is a size-compressed variant but still with source-map for | ||
debugging and with the external dependencies `asty`, `pegjs-otf` and | ||
`pegjs-util` directly embedded. Second, there is `astq.node.js` for | ||
Node.js/IO.js environments. This is a variant without compression and no | ||
source-maps and with the external dependencies `asty`, `pegjs-otf` and | ||
`pegjs-util` kept. | ||
License | ||
@@ -222,0 +238,0 @@ ------- |
@@ -59,3 +59,3 @@ /* | ||
if (num < 0) | ||
num = pchilds - (num + 1); | ||
num = pchilds - (num + 1) | ||
for (let i = 0; i < pchilds.length; i++) | ||
@@ -62,0 +62,0 @@ if (pchilds[i] === T) |
@@ -34,9 +34,7 @@ /* | ||
let prefix1 = util.pad("", 4 * depth) | ||
depth = 0 | ||
let node = T | ||
node = T | ||
while ((node = this.adapter.getParentNode(node)) !== null) | ||
depth++ | ||
let prefix2 = util.pad("", 4 * depth) | ||
return { prefix1, prefix2 } | ||
@@ -43,0 +41,0 @@ } |
Sorry, the diff of this file is not supported yet
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
427322
260
6697
Updatedasty@~1.0.2