Socket
Socket
Sign inDemoInstall

parsimmon

Package Overview
Dependencies
Maintainers
3
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parsimmon - npm Package Compare versions

Comparing version 1.7.2 to 1.7.3

8

build/parsimmon.umd.min.js

@@ -1,7 +0,1 @@

!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.Parsimmon=r():t.Parsimmon=r()}(this,function(){return function(t){function r(e){if(n[e])return n[e].exports;var i=n[e]={i:e,l:!1,exports:{}};return t[e].call(i.exports,i,i.exports,r),i.l=!0,i.exports}var n={};return r.m=t,r.c=n,r.i=function(t){return t},r.d=function(t,n,e){r.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:e})},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},r.p="",r(r.s=5)}([function(t,r,n){"use strict";(function(t){function e(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(t,r){if(e()<r)throw new RangeError("Invalid typed array length");return o.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r),t.__proto__=o.prototype):(null===t&&(t=new o(r)),t.length=r),t}function o(t,r,n){if(!(o.TYPED_ARRAY_SUPPORT||this instanceof o))return new o(t,r,n);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return s(this,t)}return u(this,t,r,n)}function u(t,r,n,e){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?l(t,r,n,e):"string"==typeof r?h(t,r,n):p(t,r)}function f(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function a(t,r,n,e){return f(r),r<=0?i(t,r):void 0!==n?"string"==typeof e?i(t,r).fill(n,e):i(t,r).fill(n):i(t,r)}function s(t,r){if(f(r),t=i(t,r<0?0:0|g(r)),!o.TYPED_ARRAY_SUPPORT)for(var n=0;n<r;++n)t[n]=0;return t}function h(t,r,n){if("string"==typeof n&&""!==n||(n="utf8"),!o.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var e=0|d(r,n);t=i(t,e);var u=t.write(r,n);return u!==e&&(t=t.slice(0,u)),t}function c(t,r){var n=r.length<0?0:0|g(r.length);t=i(t,n);for(var e=0;e<n;e+=1)t[e]=255&r[e];return t}function l(t,r,n,e){if(r.byteLength,n<0||r.byteLength<n)throw new RangeError("'offset' is out of bounds");if(r.byteLength<n+(e||0))throw new RangeError("'length' is out of bounds");return r=void 0===n&&void 0===e?new Uint8Array(r):void 0===e?new Uint8Array(r,n):new Uint8Array(r,n,e),o.TYPED_ARRAY_SUPPORT?(t=r,t.__proto__=o.prototype):t=c(t,r),t}function p(t,r){if(o.isBuffer(r)){var n=0|g(r.length);return t=i(t,n),0===t.length?t:(r.copy(t,0,0,n),t)}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||G(r.length)?i(t,0):c(t,r);if("Buffer"===r.type&&Q(r.data))return c(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function g(t){if(t>=e())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+e().toString(16)+" bytes");return 0|t}function y(t){return+t!=t&&(t=0),o.alloc(+t)}function d(t,r){if(o.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var e=!1;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return J(t).length;default:if(e)return V(t).length;r=(""+r).toLowerCase(),e=!0}}function v(t,r,n){var e=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,r>>>=0,n<=r)return"";for(t||(t="utf8");;)switch(t){case"hex":return Y(this,r,n);case"utf8":case"utf-8":return T(this,r,n);case"ascii":return U(this,r,n);case"latin1":case"binary":return O(this,r,n);case"base64":return B(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,r,n);default:if(e)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),e=!0}}function w(t,r,n){var e=t[r];t[r]=t[n],t[n]=e}function b(t,r,n,e,i){if(0===t.length)return-1;if("string"==typeof n?(e=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof r&&(r=o.from(r,e)),o.isBuffer(r))return 0===r.length?-1:m(t,r,n,e,i);if("number"==typeof r)return r&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,n):Uint8Array.prototype.lastIndexOf.call(t,r,n):m(t,[r],n,e,i);throw new TypeError("val must be string, number or Buffer")}function m(t,r,n,e,i){function o(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}var u=1,f=t.length,a=r.length;if(void 0!==e&&("ucs2"===(e=String(e).toLowerCase())||"ucs-2"===e||"utf16le"===e||"utf-16le"===e)){if(t.length<2||r.length<2)return-1;u=2,f/=2,a/=2,n/=2}var s;if(i){var h=-1;for(s=n;s<f;s++)if(o(t,s)===o(r,-1===h?0:s-h)){if(-1===h&&(h=s),s-h+1===a)return h*u}else-1!==h&&(s-=s-h),h=-1}else for(n+a>f&&(n=f-a),s=n;s>=0;s--){for(var c=!0,l=0;l<a;l++)if(o(t,s+l)!==o(r,l)){c=!1;break}if(c)return s}return-1}function E(t,r,n,e){n=Number(n)||0;var i=t.length-n;e?(e=Number(e))>i&&(e=i):e=i;var o=r.length;if(o%2!=0)throw new TypeError("Invalid hex string");e>o/2&&(e=o/2);for(var u=0;u<e;++u){var f=parseInt(r.substr(2*u,2),16);if(isNaN(f))return u;t[n+u]=f}return u}function A(t,r,n,e){return Z(V(r,t.length-n),t,n,e)}function _(t,r,n,e){return Z(W(r),t,n,e)}function R(t,r,n,e){return _(t,r,n,e)}function P(t,r,n,e){return Z(J(r),t,n,e)}function x(t,r,n,e){return Z(X(r,t.length-n),t,n,e)}function B(t,r,n){return 0===r&&n===t.length?H.fromByteArray(t):H.fromByteArray(t.slice(r,n))}function T(t,r,n){n=Math.min(t.length,n);for(var e=[],i=r;i<n;){var o=t[i],u=null,f=o>239?4:o>223?3:o>191?2:1;if(i+f<=n){var a,s,h,c;switch(f){case 1:o<128&&(u=o);break;case 2:a=t[i+1],128==(192&a)&&(c=(31&o)<<6|63&a)>127&&(u=c);break;case 3:a=t[i+1],s=t[i+2],128==(192&a)&&128==(192&s)&&(c=(15&o)<<12|(63&a)<<6|63&s)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:a=t[i+1],s=t[i+2],h=t[i+3],128==(192&a)&&128==(192&s)&&128==(192&h)&&(c=(15&o)<<18|(63&a)<<12|(63&s)<<6|63&h)>65535&&c<1114112&&(u=c)}}null===u?(u=65533,f=1):u>65535&&(u-=65536,e.push(u>>>10&1023|55296),u=56320|1023&u),e.push(u),i+=f}return S(e)}function S(t){var r=t.length;if(r<=$)return String.fromCharCode.apply(String,t);for(var n="",e=0;e<r;)n+=String.fromCharCode.apply(String,t.slice(e,e+=$));return n}function U(t,r,n){var e="";n=Math.min(t.length,n);for(var i=r;i<n;++i)e+=String.fromCharCode(127&t[i]);return e}function O(t,r,n){var e="";n=Math.min(t.length,n);for(var i=r;i<n;++i)e+=String.fromCharCode(t[i]);return e}function Y(t,r,n){var e=t.length;(!r||r<0)&&(r=0),(!n||n<0||n>e)&&(n=e);for(var i="",o=r;o<n;++o)i+=F(t[o]);return i}function I(t,r,n){for(var e=t.slice(r,n),i="",o=0;o<e.length;o+=2)i+=String.fromCharCode(e[o]+256*e[o+1]);return i}function M(t,r,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>n)throw new RangeError("Trying to access beyond buffer length")}function C(t,r,n,e,i,u){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<u)throw new RangeError('"value" argument is out of bounds');if(n+e>t.length)throw new RangeError("Index out of range")}function L(t,r,n,e){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-n,2);i<o;++i)t[n+i]=(r&255<<8*(e?i:1-i))>>>8*(e?i:1-i)}function k(t,r,n,e){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-n,4);i<o;++i)t[n+i]=r>>>8*(e?i:3-i)&255}function j(t,r,n,e,i,o){if(n+e>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(t,r,n,e,i){return i||j(t,r,n,4,3.4028234663852886e38,-3.4028234663852886e38),K.write(t,r,n,e,23,4),n+4}function N(t,r,n,e,i){return i||j(t,r,n,8,1.7976931348623157e308,-1.7976931348623157e308),K.write(t,r,n,e,52,8),n+8}function z(t){if(t=q(t).replace(tt,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function q(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function F(t){return t<16?"0"+t.toString(16):t.toString(16)}function V(t,r){r=r||1/0;for(var n,e=t.length,i=null,o=[],u=0;u<e;++u){if((n=t.charCodeAt(u))>55295&&n<57344){if(!i){if(n>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(u+1===e){(r-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(r-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((r-=1)<0)break;o.push(n)}else if(n<2048){if((r-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((r-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function W(t){for(var r=[],n=0;n<t.length;++n)r.push(255&t.charCodeAt(n));return r}function X(t,r){for(var n,e,i,o=[],u=0;u<t.length&&!((r-=2)<0);++u)n=t.charCodeAt(u),e=n>>8,i=n%256,o.push(i),o.push(e);return o}function J(t){return H.toByteArray(z(t))}function Z(t,r,n,e){for(var i=0;i<e&&!(i+n>=r.length||i>=t.length);++i)r[i+n]=t[i];return i}function G(t){return t!==t}/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
var H=n(1),K=n(2),Q=n(3);r.Buffer=o,r.SlowBuffer=y,r.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),r.kMaxLength=e(),o.poolSize=8192,o._augment=function(t){return t.__proto__=o.prototype,t},o.from=function(t,r,n){return u(null,t,r,n)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(t,r,n){return a(null,t,r,n)},o.allocUnsafe=function(t){return s(null,t)},o.allocUnsafeSlow=function(t){return s(null,t)},o.isBuffer=function(t){return!(null==t||!t._isBuffer)},o.compare=function(t,r){if(!o.isBuffer(t)||!o.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var n=t.length,e=r.length,i=0,u=Math.min(n,e);i<u;++i)if(t[i]!==r[i]){n=t[i],e=r[i];break}return n<e?-1:e<n?1:0},o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(t,r){if(!Q(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return o.alloc(0);var n;if(void 0===r)for(r=0,n=0;n<t.length;++n)r+=t[n].length;var e=o.allocUnsafe(r),i=0;for(n=0;n<t.length;++n){var u=t[n];if(!o.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(e,i),i+=u.length}return e},o.byteLength=d,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)w(this,r,r+1);return this},o.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)w(this,r,r+3),w(this,r+1,r+2);return this},o.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)w(this,r,r+7),w(this,r+1,r+6),w(this,r+2,r+5),w(this,r+3,r+4);return this},o.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?T(this,0,t):v.apply(this,arguments)},o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===o.compare(this,t)},o.prototype.inspect=function(){var t="",n=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},o.prototype.compare=function(t,r,n,e,i){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===n&&(n=t?t.length:0),void 0===e&&(e=0),void 0===i&&(i=this.length),r<0||n>t.length||e<0||i>this.length)throw new RangeError("out of range index");if(e>=i&&r>=n)return 0;if(e>=i)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,e>>>=0,i>>>=0,this===t)return 0;for(var u=i-e,f=n-r,a=Math.min(u,f),s=this.slice(e,i),h=t.slice(r,n),c=0;c<a;++c)if(s[c]!==h[c]){u=s[c],f=h[c];break}return u<f?-1:f<u?1:0},o.prototype.includes=function(t,r,n){return-1!==this.indexOf(t,r,n)},o.prototype.indexOf=function(t,r,n){return b(this,t,r,n,!0)},o.prototype.lastIndexOf=function(t,r,n){return b(this,t,r,n,!1)},o.prototype.write=function(t,r,n,e){if(void 0===r)e="utf8",n=this.length,r=0;else if(void 0===n&&"string"==typeof r)e=r,n=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(n)?(n|=0,void 0===e&&(e="utf8")):(e=n,n=void 0)}var i=this.length-r;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");e||(e="utf8");for(var o=!1;;)switch(e){case"hex":return E(this,t,r,n);case"utf8":case"utf-8":return A(this,t,r,n);case"ascii":return _(this,t,r,n);case"latin1":case"binary":return R(this,t,r,n);case"base64":return P(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,r,n);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(""+e).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;o.prototype.slice=function(t,r){var n=this.length;t=~~t,r=void 0===r?n:~~r,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),r<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t);var e;if(o.TYPED_ARRAY_SUPPORT)e=this.subarray(t,r),e.__proto__=o.prototype;else{var i=r-t;e=new o(i,void 0);for(var u=0;u<i;++u)e[u]=this[u+t]}return e},o.prototype.readUIntLE=function(t,r,n){t|=0,r|=0,n||M(t,r,this.length);for(var e=this[t],i=1,o=0;++o<r&&(i*=256);)e+=this[t+o]*i;return e},o.prototype.readUIntBE=function(t,r,n){t|=0,r|=0,n||M(t,r,this.length);for(var e=this[t+--r],i=1;r>0&&(i*=256);)e+=this[t+--r]*i;return e},o.prototype.readUInt8=function(t,r){return r||M(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,r){return r||M(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,r){return r||M(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,r){return r||M(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,r){return r||M(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,r,n){t|=0,r|=0,n||M(t,r,this.length);for(var e=this[t],i=1,o=0;++o<r&&(i*=256);)e+=this[t+o]*i;return i*=128,e>=i&&(e-=Math.pow(2,8*r)),e},o.prototype.readIntBE=function(t,r,n){t|=0,r|=0,n||M(t,r,this.length);for(var e=r,i=1,o=this[t+--e];e>0&&(i*=256);)o+=this[t+--e]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*r)),o},o.prototype.readInt8=function(t,r){return r||M(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,r){r||M(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(t,r){r||M(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(t,r){return r||M(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,r){return r||M(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,r){return r||M(t,4,this.length),K.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,r){return r||M(t,4,this.length),K.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,r){return r||M(t,8,this.length),K.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,r){return r||M(t,8,this.length),K.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,r,n,e){if(t=+t,r|=0,n|=0,!e){C(this,t,r,n,Math.pow(2,8*n)-1,0)}var i=1,o=0;for(this[r]=255&t;++o<n&&(i*=256);)this[r+o]=t/i&255;return r+n},o.prototype.writeUIntBE=function(t,r,n,e){if(t=+t,r|=0,n|=0,!e){C(this,t,r,n,Math.pow(2,8*n)-1,0)}var i=n-1,o=1;for(this[r+i]=255&t;--i>=0&&(o*=256);)this[r+i]=t/o&255;return r+n},o.prototype.writeUInt8=function(t,r,n){return t=+t,r|=0,n||C(this,t,r,1,255,0),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},o.prototype.writeUInt16LE=function(t,r,n){return t=+t,r|=0,n||C(this,t,r,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):L(this,t,r,!0),r+2},o.prototype.writeUInt16BE=function(t,r,n){return t=+t,r|=0,n||C(this,t,r,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):L(this,t,r,!1),r+2},o.prototype.writeUInt32LE=function(t,r,n){return t=+t,r|=0,n||C(this,t,r,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):k(this,t,r,!0),r+4},o.prototype.writeUInt32BE=function(t,r,n){return t=+t,r|=0,n||C(this,t,r,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):k(this,t,r,!1),r+4},o.prototype.writeIntLE=function(t,r,n,e){if(t=+t,r|=0,!e){var i=Math.pow(2,8*n-1);C(this,t,r,n,i-1,-i)}var o=0,u=1,f=0;for(this[r]=255&t;++o<n&&(u*=256);)t<0&&0===f&&0!==this[r+o-1]&&(f=1),this[r+o]=(t/u>>0)-f&255;return r+n},o.prototype.writeIntBE=function(t,r,n,e){if(t=+t,r|=0,!e){var i=Math.pow(2,8*n-1);C(this,t,r,n,i-1,-i)}var o=n-1,u=1,f=0;for(this[r+o]=255&t;--o>=0&&(u*=256);)t<0&&0===f&&0!==this[r+o+1]&&(f=1),this[r+o]=(t/u>>0)-f&255;return r+n},o.prototype.writeInt8=function(t,r,n){return t=+t,r|=0,n||C(this,t,r,1,127,-128),o.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},o.prototype.writeInt16LE=function(t,r,n){return t=+t,r|=0,n||C(this,t,r,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):L(this,t,r,!0),r+2},o.prototype.writeInt16BE=function(t,r,n){return t=+t,r|=0,n||C(this,t,r,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):L(this,t,r,!1),r+2},o.prototype.writeInt32LE=function(t,r,n){return t=+t,r|=0,n||C(this,t,r,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):k(this,t,r,!0),r+4},o.prototype.writeInt32BE=function(t,r,n){return t=+t,r|=0,n||C(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),o.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):k(this,t,r,!1),r+4},o.prototype.writeFloatLE=function(t,r,n){return D(this,t,r,!0,n)},o.prototype.writeFloatBE=function(t,r,n){return D(this,t,r,!1,n)},o.prototype.writeDoubleLE=function(t,r,n){return N(this,t,r,!0,n)},o.prototype.writeDoubleBE=function(t,r,n){return N(this,t,r,!1,n)},o.prototype.copy=function(t,r,n,e){if(n||(n=0),e||0===e||(e=this.length),r>=t.length&&(r=t.length),r||(r=0),e>0&&e<n&&(e=n),e===n)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(e<0)throw new RangeError("sourceEnd out of bounds");e>this.length&&(e=this.length),t.length-r<e-n&&(e=t.length-r+n);var i,u=e-n;if(this===t&&n<r&&r<e)for(i=u-1;i>=0;--i)t[i+r]=this[i+n];else if(u<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i<u;++i)t[i+r]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+u),r);return u},o.prototype.fill=function(t,r,n,e){if("string"==typeof t){if("string"==typeof r?(e=r,r=0,n=this.length):"string"==typeof n&&(e=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==e&&"string"!=typeof e)throw new TypeError("encoding must be a string");if("string"==typeof e&&!o.isEncoding(e))throw new TypeError("Unknown encoding: "+e)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0);var u;if("number"==typeof t)for(u=r;u<n;++u)this[u]=t;else{var f=o.isBuffer(t)?t:V(new o(t,e).toString()),a=f.length;for(u=0;u<n-r;++u)this[u+r]=f[u%a]}return this};var tt=/[^+\/0-9A-Za-z-_]/g}).call(r,n(4))},function(t,r,n){"use strict";function e(t){var r=t.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[r-2]?2:"="===t[r-1]?1:0}function i(t){return 3*t.length/4-e(t)}function o(t){var r,n,i,o,u,f,a=t.length;u=e(t),f=new c(3*a/4-u),i=u>0?a-4:a;var s=0;for(r=0,n=0;r<i;r+=4,n+=3)o=h[t.charCodeAt(r)]<<18|h[t.charCodeAt(r+1)]<<12|h[t.charCodeAt(r+2)]<<6|h[t.charCodeAt(r+3)],f[s++]=o>>16&255,f[s++]=o>>8&255,f[s++]=255&o;return 2===u?(o=h[t.charCodeAt(r)]<<2|h[t.charCodeAt(r+1)]>>4,f[s++]=255&o):1===u&&(o=h[t.charCodeAt(r)]<<10|h[t.charCodeAt(r+1)]<<4|h[t.charCodeAt(r+2)]>>2,f[s++]=o>>8&255,f[s++]=255&o),f}function u(t){return s[t>>18&63]+s[t>>12&63]+s[t>>6&63]+s[63&t]}function f(t,r,n){for(var e,i=[],o=r;o<n;o+=3)e=(t[o]<<16)+(t[o+1]<<8)+t[o+2],i.push(u(e));return i.join("")}function a(t){for(var r,n=t.length,e=n%3,i="",o=[],u=0,a=n-e;u<a;u+=16383)o.push(f(t,u,u+16383>a?a:u+16383));return 1===e?(r=t[n-1],i+=s[r>>2],i+=s[r<<4&63],i+="=="):2===e&&(r=(t[n-2]<<8)+t[n-1],i+=s[r>>10],i+=s[r>>4&63],i+=s[r<<2&63],i+="="),o.push(i),o.join("")}r.byteLength=i,r.toByteArray=o,r.fromByteArray=a;for(var s=[],h=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=l.length;p<g;++p)s[p]=l[p],h[l.charCodeAt(p)]=p;h["-".charCodeAt(0)]=62,h["_".charCodeAt(0)]=63},function(t,r){r.read=function(t,r,n,e,i){var o,u,f=8*i-e-1,a=(1<<f)-1,s=a>>1,h=-7,c=n?i-1:0,l=n?-1:1,p=t[r+c];for(c+=l,o=p&(1<<-h)-1,p>>=-h,h+=f;h>0;o=256*o+t[r+c],c+=l,h-=8);for(u=o&(1<<-h)-1,o>>=-h,h+=e;h>0;u=256*u+t[r+c],c+=l,h-=8);if(0===o)o=1-s;else{if(o===a)return u?NaN:1/0*(p?-1:1);u+=Math.pow(2,e),o-=s}return(p?-1:1)*u*Math.pow(2,o-e)},r.write=function(t,r,n,e,i,o){var u,f,a,s=8*o-i-1,h=(1<<s)-1,c=h>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=e?0:o-1,g=e?1:-1,y=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(f=isNaN(r)?1:0,u=h):(u=Math.floor(Math.log(r)/Math.LN2),r*(a=Math.pow(2,-u))<1&&(u--,a*=2),r+=u+c>=1?l/a:l*Math.pow(2,1-c),r*a>=2&&(u++,a/=2),u+c>=h?(f=0,u=h):u+c>=1?(f=(r*a-1)*Math.pow(2,i),u+=c):(f=r*Math.pow(2,c-1)*Math.pow(2,i),u=0));i>=8;t[n+p]=255&f,p+=g,f/=256,i-=8);for(u=u<<i|f,s+=i;s>0;t[n+p]=255&u,p+=g,u/=256,s-=8);t[n+p-g]|=128*y}},function(t,r){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,r){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,r,n){"use strict";(function(r){function n(t){if(!(this instanceof n))return new n(t);this._=t}function e(t,r){var n=0;for(n;n<t;n++)r(n)}function i(t,r){e(r.length,function(n){t(r[n],n,r)})}function o(t,r,n){return i(function(n,e,i){r=t(r,n,e,i)},n),r}function u(t,r){return o(function(r,n,e,i){return r.concat([t(n,e,i)])},[],r)}function f(t){var n=o(function(t,n,e,i){return t.concat(e===i.length-1?r.from([n,0]).readUInt16BE(0):i.readUInt16BE(e))},[],t);return r.from(u(function(t){return(t<<1&65535)>>8},n))}function a(t,r){var n={v:0,buf:r};return e(t,function(){n={v:n.v<<1|s(n.buf),buf:f(n.buf)}}),n}function s(t){return t[0]>>7}function h(t){return o(function(t,r){return t+r},0,t)}function c(t,r){return o(function(r,n){return r||(t(n)?n:r)},null,r)}function l(){return void 0!==r}function p(){if(!l())throw new Error("Buffer global does not exist; please consider using https://github.com/feross/buffer if you are running Parsimmon in a browser.")}function g(t){p();var r=h(t);if(r%8!=0)throw new Error("The bits ["+t.join(", ")+"] add up to "+r+" which is not an even number of bytes; the total should be divisible by 8");var e=r/8,i=c(function(t){return t>48},t);if(i)throw new Error(i+" bit range requested exceeds 48 bit (6 byte) Number max.");return new n(function(r,n){var i=e+n;return i>r.length?E(n,e.toString()+" bytes"):m(i,o(function(t,r){var n=a(r,t.buf);return{coll:t.coll.concat(n.v),buf:n.buf}},{coll:[],buf:r.slice(n,i)},t).coll)})}function y(t){p();var r={},n=0,e=u(function(t){if(w(t)){var e=t;if(2!==e.length)throw new Error("["+e.join(", ")+"] should be length 2, got length "+e.length);if(O(e[0]),T(e[1]),Object.prototype.hasOwnProperty.call(r,e[0]))throw new Error("duplicate key in bitSeqObj: "+e[0]);return r[e[0]]=!0,n++,e}return T(t),[null,t]},t);if(n<1)throw new Error("bitSeqObj expects at least one named pair, got ["+t.join(", ")+"]");var i=u(function(t){return t[0]},e);return g(u(function(t){return t[1]},e)).map(function(t){var r=u(function(r,n){return[r,t[n]]},i);return o(function(t,r){return null!==r[0]&&(t[r[0]]=r[1]),t},{},r)})}function d(t){return Array.prototype.slice.call(t)}function v(t){return t instanceof n}function w(t){return"[object Array]"==={}.toString.call(t)}function b(t){return l()&&r.isBuffer(t)}function m(t,r){return{status:!0,index:t,value:r,furthest:-1,expected:[]}}function E(t,r){return{status:!1,index:-1,value:null,furthest:t,expected:[r]}}function A(t,r){if(!r)return t;if(t.furthest>r.furthest)return t;var n=t.furthest===r.furthest?R(t.expected,r.expected):r.expected;return{status:t.status,index:t.index,value:t.value,furthest:r.furthest,expected:n}}function _(t,r){if(b(t))return{offset:r,line:-1,column:-1};var n=t.slice(0,r).split("\n");return{offset:r,line:n.length,column:n[n.length-1].length+1}}function R(t,r){var n=t.length,e=r.length;if(0===n)return r;if(0===e)return t;for(var i={},o=0;o<n;o++)i[t[o]]=!0;for(var u=0;u<e;u++)i[r[u]]=!0;var f=[];for(var a in i)i.hasOwnProperty(a)&&f.push(a);return f.sort(),f}function P(t){if(!v(t))throw new Error("not a parser: "+t)}function x(t,r){return"string"==typeof t?t.charAt(r):t[r]}function B(t){if(!w(t))throw new Error("not an array: "+t)}function T(t){if("number"!=typeof t)throw new Error("not a number: "+t)}function S(t){if(!(t instanceof RegExp))throw new Error("not a regexp: "+t);for(var r=C(t),n=0;n<r.length;n++){var e=r.charAt(n);if("i"!==e&&"m"!==e&&"u"!==e)throw new Error('unsupported regexp flag "'+e+'": '+t)}}function U(t){if("function"!=typeof t)throw new Error("not a function: "+t)}function O(t){if("string"!=typeof t)throw new Error("not a string: "+t)}function Y(t){return 1===t.length?t[0]:"one of "+t.join(", ")}function I(t,r){var n=r.index,e=n.offset;if(e===t.length)return", got the end of the input";if(b(t))return" at byte "+n.offset;var i=e>0?"'...":"'",o=t.length-e>12?"...'":"'";return" at line "+n.line+" column "+n.column+", got "+i+t.slice(e,e+12)+o}function M(t,r){return"expected "+Y(r.expected)+I(t,r)}function C(t){var r=""+t;return r.slice(r.lastIndexOf("/")+1)}function L(t){return RegExp("^(?:"+t.source+")",C(t))}function k(){for(var t=[].slice.call(arguments),r=t.length,e=0;e<r;e+=1)P(t[e]);return n(function(n,e){for(var i,o=new Array(r),u=0;u<r;u+=1){if(i=A(t[u]._(n,e),i),!i.status)return i;o[u]=i.value,e=i.index}return A(m(e,o),i)})}function j(){for(var t={},r=0,e=d(arguments),i=e.length,o=0;o<i;o+=1){var u=e[o];if(!v(u)){if(w(u)){if(2===u.length&&"string"==typeof u[0]&&v(u[1])){var f=u[0];if(Object.prototype.hasOwnProperty.call(t,f))throw new Error("seqObj: duplicate key "+f);t[f]=!0,r++;continue}}throw new Error("seqObj arguments must be parsers or [string, parser] array pairs.")}}if(0===r)throw new Error("seqObj expects at least one named parser, found zero");return n(function(t,r){for(var n,o={},u=0;u<i;u+=1){var f,a;if(w(e[u])?(f=e[u][0],a=e[u][1]):(f=null,a=e[u]),n=A(a._(t,r),n),!n.status)return n;f&&(o[f]=n.value),r=n.index}return A(m(r,o),n)})}function D(){var t=[].slice.call(arguments);if(0===t.length)throw new Error("seqMap needs at least one argument");var r=t.pop();return U(r),k.apply(null,t).map(function(t){return r.apply(null,t)})}function N(t){var r={};for(var n in t)({}).hasOwnProperty.call(t,n)&&function(n){var e=function(){return t[n](r)};r[n]=et(e)}(n);return r}function z(){var t=[].slice.call(arguments),r=t.length;if(0===r)return Z("zero alternates");for(var e=0;e<r;e+=1)P(t[e]);return n(function(r,n){for(var e,i=0;i<t.length;i+=1)if(e=A(t[i]._(r,n),e),e.status)return e;return e})}function q(t,r){return F(t,r).or(J([]))}function F(t,r){return P(t),P(r),D(t,r.then(t).many(),function(t,r){return[t].concat(r)})}function V(t){O(t);var r="'"+t+"'";return n(function(n,e){var i=e+t.length,o=n.slice(e,i);return o===t?m(i,o):E(e,r)})}function W(t){if(p(),T(t),t>255)throw new Error("Value specified to byte constructor ("+t+"=0x"+t.toString(16)+") is larger in value than a single byte.");var r=(t>15?"0x":"0x0")+t.toString(16);return n(function(n,e){var i=x(n,e);return i===t?m(e+1,i):E(e,r)})}function X(t,r){S(t),arguments.length>=2?T(r):r=0;var e=L(t),i=""+t;return n(function(t,n){var o=e.exec(t.slice(n));if(o){if(0<=r&&r<=o.length){var u=o[0],f=o[r];return m(n+u.length,f)}return E(n,"valid match group (0 to "+o.length+") in "+i)}return E(n,i)})}function J(t){return n(function(r,n){return m(n,t)})}function Z(t){return n(function(r,n){return E(n,t)})}function G(t){if(v(t))return n(function(r,n){var e=t._(r,n);return e.index=n,e.value="",e});if("string"==typeof t)return G(V(t));if(t instanceof RegExp)return G(X(t));throw new Error("not a string, regexp, or parser: "+t)}function H(t){return P(t),n(function(r,n){var e=t._(r,n),i=r.slice(n,e.index);return e.status?E(n,'not "'+i+'"'):m(n,null)})}function K(t){return U(t),n(function(r,n){var e=x(r,n);return n<r.length&&t(e)?m(n+1,e):E(n,"a character/byte matching "+t)})}function Q(t){return K(function(r){return t.indexOf(r)>=0})}function $(t){return K(function(r){return t.indexOf(r)<0})}function tt(t){return n(t(m,E))}function rt(t,r){return K(function(n){return t<=n&&n<=r}).desc(t+"-"+r)}function nt(t){return U(t),n(function(r,n){for(var e=n;e<r.length&&t(x(r,e));)e++;return m(e,r.slice(n,e))})}function et(t,r){arguments.length<2&&(r=t,t=void 0);var e=n(function(t,n){return e._=r()._,e._(t,n)});return t?e.desc(t):e}function it(){return Z("fantasy-land/empty")}var ot=n.prototype;ot.parse=function(t){if("string"!=typeof t&&!b(t))throw new Error(".parse must be called with a string or Buffer as its argument");var r=this.skip(st)._(t,0);return r.status?{status:!0,value:r.value}:{status:!1,index:_(t,r.furthest),expected:r.expected}},ot.tryParse=function(t){var r=this.parse(t);if(r.status)return r.value;var n=M(t,r),e=new Error(n);throw e.type="ParsimmonError",e.result=r,e},ot.or=function(t){return z(this,t)},ot.trim=function(t){return this.wrap(t,t)},ot.wrap=function(t,r){return D(t,this,r,function(t,r){return r})},ot.thru=function(t){return t(this)},ot.then=function(t){return P(t),k(this,t).map(function(t){return t[1]})},ot.many=function(){var t=this;return n(function(r,n){for(var e=[],i=void 0;;){if(i=A(t._(r,n),i),!i.status)return A(m(n,e),i);if(n===i.index)throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");n=i.index,e.push(i.value)}})},ot.tie=function(){return this.map(function(t){B(t);for(var r="",n=0;n<t.length;n++)O(t[n]),r+=t[n];return r})},ot.times=function(t,r){var e=this;return arguments.length<2&&(r=t),T(t),T(r),n(function(n,i){for(var o=[],u=void 0,f=void 0,a=0;a<t;a+=1){if(u=e._(n,i),f=A(u,f),!u.status)return f;i=u.index,o.push(u.value)}for(;a<r&&(u=e._(n,i),f=A(u,f),u.status);a+=1)i=u.index,o.push(u.value);return A(m(i,o),f)})},ot.result=function(t){return this.map(function(){return t})},ot.atMost=function(t){return this.times(0,t)},ot.atLeast=function(t){return D(this.times(t),this.many(),function(t,r){return t.concat(r)})},ot.map=function(t){U(t);var r=this;return n(function(n,e){var i=r._(n,e);return i.status?A(m(i.index,t(i.value)),i):i})},ot.skip=function(t){return k(this,t).map(function(t){return t[0]})},ot.mark=function(){return D(ut,this,ut,function(t,r,n){return{start:t,value:r,end:n}})},ot.node=function(t){return D(ut,this,ut,function(r,n,e){return{name:t,value:n,start:r,end:e}})},ot.sepBy=function(t){return q(this,t)},ot.sepBy1=function(t){return F(this,t)},ot.lookahead=function(t){return this.skip(G(t))},ot.notFollowedBy=function(t){return this.skip(H(t))},ot.desc=function(t){var r=this;return n(function(n,e){var i=r._(n,e);return i.status||(i.expected=[t]),i})},ot.fallback=function(t){return this.or(J(t))},ot.ap=function(t){return D(t,this,function(t,r){return t(r)})},ot.chain=function(t){var r=this;return n(function(n,e){var i=r._(n,e);return i.status?A(t(i.value)._(n,i.index),i):i})},ot.concat=ot.or,ot.empty=it,ot.of=J,ot["fantasy-land/ap"]=ot.ap,ot["fantasy-land/chain"]=ot.chain,ot["fantasy-land/concat"]=ot.concat,ot["fantasy-land/empty"]=ot.empty,ot["fantasy-land/of"]=ot.of,ot["fantasy-land/map"]=ot.map;var ut=n(function(t,r){return m(r,_(t,r))}),ft=n(function(t,r){return r>=t.length?E(r,"any character/byte"):m(r+1,x(t,r))}),at=n(function(t,r){return m(t.length,t.slice(r))}),st=n(function(t,r){return r<t.length?E(r,"EOF"):m(r,null)}),ht=X(/[0-9]/).desc("a digit"),ct=X(/[0-9]*/).desc("optional digits"),lt=X(/[a-z]/i).desc("a letter"),pt=X(/[a-z]*/i).desc("optional letters"),gt=X(/\s*/).desc("optional whitespace"),yt=X(/\s+/).desc("whitespace");n.all=at,n.alt=z,n.any=ft,n.createLanguage=N,n.custom=tt,n.digit=ht,n.digits=ct,n.empty=it,n.eof=st,n.fail=Z,n.formatError=M,n.index=ut,n.isParser=v,n.lazy=et,n.letter=lt,n.letters=pt,n.lookahead=G,n.makeFailure=E,n.makeSuccess=m,n.noneOf=$,n.notFollowedBy=H,n.of=J,n.oneOf=Q,n.optWhitespace=gt,n.Parser=n,n.range=rt,n.regex=X,n.regexp=X,n.sepBy=q,n.sepBy1=F,n.seq=k,n.seqMap=D,n.seqObj=j,n.string=V,n.succeed=J,n.takeWhile=nt,n.test=K,n.whitespace=yt,n["fantasy-land/empty"]=it,n["fantasy-land/of"]=J,n.Binary={bitSeq:g,bitSeqObj:y,byte:W},t.exports=n}).call(r,n(0).Buffer)}])});
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Parsimmon=t():n.Parsimmon=t()}("undefined"!=typeof self?self:this,function(){return function(n){var t={};function r(e){if(t[e])return t[e].exports;var u=t[e]={i:e,l:!1,exports:{}};return n[e].call(u.exports,u,u.exports,r),u.l=!0,u.exports}return r.m=n,r.c=t,r.d=function(n,t,e){r.o(n,t)||Object.defineProperty(n,t,{configurable:!1,enumerable:!0,get:e})},r.r=function(n){Object.defineProperty(n,"__esModule",{value:!0})},r.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(t,"a",t),t},r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.p="",r(r.s=0)}([function(n,t,r){"use strict";function e(n){if(!(this instanceof e))return new e(n);this._=n}var u=e.prototype;function o(n,t){for(var r=0;r<n;r++)t(r)}function i(n,t,r){return function(n,t){o(t.length,function(r){n(t[r],r,t)})}(function(r,e,u){t=n(t,r,e,u)},r),t}function a(n,t){return i(function(t,r,e,u){return t.concat([n(r,e,u)])},[],t)}function f(n,t){var r={v:0,buf:t};return o(n,function(){var n;r={v:r.v<<1|(n=r.buf,n[0]>>7),buf:function(n){var t=i(function(n,t,r,e){return n.concat(r===e.length-1?Buffer.from([t,0]).readUInt16BE(0):e.readUInt16BE(r))},[],n);return Buffer.from(a(function(n){return(n<<1&65535)>>8},t))}(r.buf)}}),r}function c(){return"undefined"!=typeof Buffer}function s(){if(!c())throw new Error("Buffer global does not exist; please consider using https://github.com/feross/buffer if you are running Parsimmon in a browser.")}function l(n){s();var t=i(function(n,t){return n+t},0,n);if(t%8!=0)throw new Error("The bits ["+n.join(", ")+"] add up to "+t+" which is not an even number of bytes; the total should be divisible by 8");var r,u=t/8,o=(r=function(n){return n>48},i(function(n,t){return n||(r(t)?t:n)},null,n));if(o)throw new Error(o+" bit range requested exceeds 48 bit (6 byte) Number max.");return new e(function(t,r){var e=u+r;return e>t.length?g(r,u.toString()+" bytes"):v(e,i(function(n,t){var r=f(t,n.buf);return{coll:n.coll.concat(r.v),buf:r.buf}},{coll:[],buf:t.slice(r,e)},n).coll)})}function h(n){return n instanceof e}function p(n){return"[object Array]"==={}.toString.call(n)}function d(n){return c()&&Buffer.isBuffer(n)}function v(n,t){return{status:!0,index:n,value:t,furthest:-1,expected:[]}}function g(n,t){return{status:!1,index:-1,value:null,furthest:n,expected:[t]}}function y(n,t){if(!t)return n;if(n.furthest>t.furthest)return n;var r=n.furthest===t.furthest?function(n,t){var r=n.length,e=t.length;if(0===r)return t;if(0===e)return n;for(var u={},o=0;o<r;o++)u[n[o]]=!0;for(var i=0;i<e;i++)u[t[i]]=!0;var a=[];for(var f in u)u.hasOwnProperty(f)&&a.push(f);return a.sort(),a}(n.expected,t.expected):t.expected;return{status:n.status,index:n.index,value:n.value,furthest:t.furthest,expected:r}}function m(n,t){if(d(n))return{offset:t,line:-1,column:-1};var r=n.slice(0,t).split("\n");return{offset:t,line:r.length,column:r[r.length-1].length+1}}function w(n){if(!h(n))throw new Error("not a parser: "+n)}function x(n,t){return"string"==typeof n?n.charAt(t):n[t]}function b(n){if("number"!=typeof n)throw new Error("not a number: "+n)}function E(n){if("function"!=typeof n)throw new Error("not a function: "+n)}function O(n){if("string"!=typeof n)throw new Error("not a string: "+n)}function _(n,t){return"expected "+(1===(r=t.expected).length?r[0]:"one of "+r.join(", "))+function(n,t){var r=t.index,e=r.offset;if(e===n.length)return", got the end of the input";if(d(n))return" at byte "+r.offset;var u=e>0?"'...":"'",o=n.length-e>12?"...'":"'";return" at line "+r.line+" column "+r.column+", got "+u+n.slice(e,e+12)+o}(n,t);var r}function j(n){var t=""+n;return t.slice(t.lastIndexOf("/")+1)}function B(){for(var n=[].slice.call(arguments),t=n.length,r=0;r<t;r+=1)w(n[r]);return e(function(r,e){for(var u,o=new Array(t),i=0;i<t;i+=1){if(!(u=y(n[i]._(r,e),u)).status)return u;o[i]=u.value,e=u.index}return y(v(e,o),u)})}function P(){var n=[].slice.call(arguments);if(0===n.length)throw new Error("seqMap needs at least one argument");var t=n.pop();return E(t),B.apply(null,n).map(function(n){return t.apply(null,n)})}function k(){var n=[].slice.call(arguments),t=n.length;if(0===t)return F("zero alternates");for(var r=0;r<t;r+=1)w(n[r]);return e(function(t,r){for(var e,u=0;u<n.length;u+=1)if((e=y(n[u]._(t,r),e)).status)return e;return e})}function q(n,t){return S(n,t).or(M([]))}function S(n,t){return w(n),w(t),P(n,t.then(n).many(),function(n,t){return[n].concat(t)})}function z(n){O(n);var t="'"+n+"'";return e(function(r,e){var u=e+n.length,o=r.slice(e,u);return o===n?v(u,o):g(e,t)})}function A(n,t){!function(n){if(!(n instanceof RegExp))throw new Error("not a regexp: "+n);for(var t=j(n),r=0;r<t.length;r++){var e=t.charAt(r);if("i"!==e&&"m"!==e&&"u"!==e)throw new Error('unsupported regexp flag "'+e+'": '+n)}}(n),arguments.length>=2?b(t):t=0;var r=function(n){return RegExp("^(?:"+n.source+")",j(n))}(n),u=""+n;return e(function(n,e){var o=r.exec(n.slice(e));if(o){if(0<=t&&t<=o.length){var i=o[0],a=o[t];return v(e+i.length,a)}return g(e,"valid match group (0 to "+o.length+") in "+u)}return g(e,u)})}function M(n){return e(function(t,r){return v(r,n)})}function F(n){return e(function(t,r){return g(r,n)})}function I(n){if(h(n))return e(function(t,r){var e=n._(t,r);return e.index=r,e.value="",e});if("string"==typeof n)return I(z(n));if(n instanceof RegExp)return I(A(n));throw new Error("not a string, regexp, or parser: "+n)}function R(n){return w(n),e(function(t,r){var e=n._(t,r),u=t.slice(r,e.index);return e.status?g(r,'not "'+u+'"'):v(r,null)})}function L(n){return E(n),e(function(t,r){var e=x(t,r);return r<t.length&&n(e)?v(r+1,e):g(r,"a character/byte matching "+n)})}function U(n,t){arguments.length<2&&(t=n,n=void 0);var r=e(function(n,e){return r._=t()._,r._(n,e)});return n?r.desc(n):r}function W(){return F("fantasy-land/empty")}u.parse=function(n){if("string"!=typeof n&&!d(n))throw new Error(".parse must be called with a string or Buffer as its argument");var t=this.skip(C)._(n,0);return t.status?{status:!0,value:t.value}:{status:!1,index:m(n,t.furthest),expected:t.expected}},u.tryParse=function(n){var t=this.parse(n);if(t.status)return t.value;var r=_(n,t),e=new Error(r);throw e.type="ParsimmonError",e.result=t,e},u.or=function(n){return k(this,n)},u.trim=function(n){return this.wrap(n,n)},u.wrap=function(n,t){return P(n,this,t,function(n,t){return t})},u.thru=function(n){return n(this)},u.then=function(n){return w(n),B(this,n).map(function(n){return n[1]})},u.many=function(){var n=this;return e(function(t,r){for(var e=[],u=void 0;;){if(!(u=y(n._(t,r),u)).status)return y(v(r,e),u);if(r===u.index)throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");r=u.index,e.push(u.value)}})},u.tie=function(){return this.map(function(n){!function(n){if(!p(n))throw new Error("not an array: "+n)}(n);for(var t="",r=0;r<n.length;r++)O(n[r]),t+=n[r];return t})},u.times=function(n,t){var r=this;return arguments.length<2&&(t=n),b(n),b(t),e(function(e,u){for(var o=[],i=void 0,a=void 0,f=0;f<n;f+=1){if(a=y(i=r._(e,u),a),!i.status)return a;u=i.index,o.push(i.value)}for(;f<t&&(a=y(i=r._(e,u),a),i.status);f+=1)u=i.index,o.push(i.value);return y(v(u,o),a)})},u.result=function(n){return this.map(function(){return n})},u.atMost=function(n){return this.times(0,n)},u.atLeast=function(n){return P(this.times(n),this.many(),function(n,t){return n.concat(t)})},u.map=function(n){E(n);var t=this;return e(function(r,e){var u=t._(r,e);return u.status?y(v(u.index,n(u.value)),u):u})},u.skip=function(n){return B(this,n).map(function(n){return n[0]})},u.mark=function(){return P(N,this,N,function(n,t,r){return{start:n,value:t,end:r}})},u.node=function(n){return P(N,this,N,function(t,r,e){return{name:n,value:r,start:t,end:e}})},u.sepBy=function(n){return q(this,n)},u.sepBy1=function(n){return S(this,n)},u.lookahead=function(n){return this.skip(I(n))},u.notFollowedBy=function(n){return this.skip(R(n))},u.desc=function(n){var t=this;return e(function(r,e){var u=t._(r,e);return u.status||(u.expected=[n]),u})},u.fallback=function(n){return this.or(M(n))},u.ap=function(n){return P(n,this,function(n,t){return n(t)})},u.chain=function(n){var t=this;return e(function(r,e){var u=t._(r,e);return u.status?y(n(u.value)._(r,u.index),u):u})},u.concat=u.or,u.empty=W,u.of=M,u["fantasy-land/ap"]=u.ap,u["fantasy-land/chain"]=u.chain,u["fantasy-land/concat"]=u.concat,u["fantasy-land/empty"]=u.empty,u["fantasy-land/of"]=u.of,u["fantasy-land/map"]=u.map;var N=e(function(n,t){return v(t,m(n,t))}),T=e(function(n,t){return t>=n.length?g(t,"any character/byte"):v(t+1,x(n,t))}),V=e(function(n,t){return v(n.length,n.slice(t))}),C=e(function(n,t){return t<n.length?g(t,"EOF"):v(t,null)}),D=A(/[0-9]/).desc("a digit"),G=A(/[0-9]*/).desc("optional digits"),H=A(/[a-z]/i).desc("a letter"),J=A(/[a-z]*/i).desc("optional letters"),K=A(/\s*/).desc("optional whitespace"),Q=A(/\s+/).desc("whitespace");e.all=V,e.alt=k,e.any=T,e.createLanguage=function(n){var t={};for(var r in n)({}).hasOwnProperty.call(n,r)&&function(r){t[r]=U(function(){return n[r](t)})}(r);return t},e.custom=function(n){return e(n(v,g))},e.digit=D,e.digits=G,e.empty=W,e.eof=C,e.fail=F,e.formatError=_,e.index=N,e.isParser=h,e.lazy=U,e.letter=H,e.letters=J,e.lookahead=I,e.makeFailure=g,e.makeSuccess=v,e.noneOf=function(n){return L(function(t){return n.indexOf(t)<0})},e.notFollowedBy=R,e.of=M,e.oneOf=function(n){return L(function(t){return n.indexOf(t)>=0})},e.optWhitespace=K,e.Parser=e,e.range=function(n,t){return L(function(r){return n<=r&&r<=t}).desc(n+"-"+t)},e.regex=A,e.regexp=A,e.sepBy=q,e.sepBy1=S,e.seq=B,e.seqMap=P,e.seqObj=function(){for(var n,t={},r=0,u=(n=arguments,Array.prototype.slice.call(n)),o=u.length,i=0;i<o;i+=1){var a=u[i];if(!h(a)){if(p(a)&&2===a.length&&"string"==typeof a[0]&&h(a[1])){var f=a[0];if(Object.prototype.hasOwnProperty.call(t,f))throw new Error("seqObj: duplicate key "+f);t[f]=!0,r++;continue}throw new Error("seqObj arguments must be parsers or [string, parser] array pairs.")}}if(0===r)throw new Error("seqObj expects at least one named parser, found zero");return e(function(n,t){for(var r,e={},i=0;i<o;i+=1){var a,f;if(p(u[i])?(a=u[i][0],f=u[i][1]):(a=null,f=u[i]),!(r=y(f._(n,t),r)).status)return r;a&&(e[a]=r.value),t=r.index}return y(v(t,e),r)})},e.string=z,e.succeed=M,e.takeWhile=function(n){return E(n),e(function(t,r){for(var e=r;e<t.length&&n(x(t,e));)e++;return v(e,t.slice(r,e))})},e.test=L,e.whitespace=Q,e["fantasy-land/empty"]=W,e["fantasy-land/of"]=M,e.Binary={bitSeq:l,bitSeqObj:function(n){s();var t={},r=0,e=a(function(n){if(p(n)){var e=n;if(2!==e.length)throw new Error("["+e.join(", ")+"] should be length 2, got length "+e.length);if(O(e[0]),b(e[1]),Object.prototype.hasOwnProperty.call(t,e[0]))throw new Error("duplicate key in bitSeqObj: "+e[0]);return t[e[0]]=!0,r++,e}return b(n),[null,n]},n);if(r<1)throw new Error("bitSeqObj expects at least one named pair, got ["+n.join(", ")+"]");var u=a(function(n){return n[0]},e);return l(a(function(n){return n[1]},e)).map(function(n){return i(function(n,t){return null!==t[0]&&(n[t[0]]=t[1]),n},{},a(function(t,r){return[t,n[r]]},u))})},byte:function(n){if(s(),b(n),n>255)throw new Error("Value specified to byte constructor ("+n+"=0x"+n.toString(16)+") is larger in value than a single byte.");var t=(n>15?"0x":"0x0")+n.toString(16);return e(function(r,e){var u=x(r,e);return u===n?v(e+1,u):g(e,t)})}},n.exports=e}])});

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## version 1.7.3 (2018-04-22)
* Shrinks UMD build from ~33 kb to ~11 kb
## version 1.7.2 (2018-04-05)

@@ -2,0 +6,0 @@

{
"name": "parsimmon",
"version": "1.7.2",
"version": "1.7.3",
"description": "A monadic LL(infinity) parser combinator library",

@@ -30,6 +30,9 @@ "keywords": [

"rimraf": "^2.5.4",
"webpack": "^2.6.1"
"webpack": "^4.6.0",
"webpack-cli": "^2.0.15"
},
"license": "MIT",
"scripts": {
"preversion": "npm test",
"postversion": "git push && git push --tags",
"prebuild": "rimraf build && mkdirp build",

@@ -36,0 +39,0 @@ "build": "webpack -p",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc