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.3 to 1.8.0

2

build/parsimmon.umd.min.js

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

!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}])});
!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 W(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 W(z(n));if(n instanceof RegExp)return W(A(n));throw new Error("not a string, regexp, or parser: "+n)}function I(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 R(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 L(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 U(){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.tieWith=function(n){return O(n),this.map(function(t){if(function(n){if(!p(n))throw new Error("not an array: "+n)}(t),t.length){O(t[0]);for(var r=t[0],e=1;e<t.length;e++)O(t[e]),r+=n+t[e];return r}return""})},u.tie=function(){return this.tieWith("")},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(W(n))},u.notFollowedBy=function(n){return this.skip(I(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=U,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"),X=z("\r"),Y=z("\n"),Z=z("\r\n"),$=k(Z,Y,X).desc("newline"),nn=k($,C);e.all=V,e.alt=k,e.any=T,e.cr=X,e.createLanguage=function(n){var t={};for(var r in n)({}).hasOwnProperty.call(n,r)&&function(r){t[r]=L(function(){return n[r](t)})}(r);return t},e.crlf=Z,e.custom=function(n){return e(n(v,g))},e.digit=D,e.digits=G,e.empty=U,e.end=nn,e.eof=C,e.fail=F,e.formatError=_,e.index=N,e.isParser=h,e.lazy=L,e.letter=H,e.letters=J,e.lf=Y,e.lookahead=W,e.makeFailure=g,e.makeSuccess=v,e.newline=$,e.noneOf=function(n){return R(function(t){return n.indexOf(t)<0})},e.notFollowedBy=I,e.of=M,e.oneOf=function(n){return R(function(t){return n.indexOf(t)>=0})},e.optWhitespace=K,e.Parser=e,e.range=function(n,t){return R(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=R,e.whitespace=Q,e["fantasy-land/empty"]=U,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}])});

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

## version 1.8.0 (2018-06-04)
* Adds `parser.tieWith(separator)`, a generalized version of `parser.tie()`
## version 1.7.3 (2018-04-22)

@@ -146,4 +150,4 @@

* **BREAKING:** deprecated use of `.then(function(result) { ... })`. Use `chain` instead.
* **BREAKING:** errors are no longer thrown on invalid parses. Instead, `.parse(str)` returns
* **BREAKING:** deprecated use of `.then(function(result) { ... })`. Use `chain` instead.
* **BREAKING:** errors are no longer thrown on invalid parses. Instead, `.parse(str)` returns
an object with a `status` tag, indicating whether the parse was successful.

@@ -150,0 +154,0 @@

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

@@ -5,0 +5,0 @@ "keywords": [

@@ -649,14 +649,24 @@ "use strict";

_.tie = function() {
_.tieWith = function(separator) {
assertString(separator);
return this.map(function(args) {
assertArray(args);
var s = "";
for (var i = 0; i < args.length; i++) {
assertString(args[i]);
s += args[i];
if (args.length) {
assertString(args[0]);
var s = args[0];
for (var i = 1; i < args.length; i++) {
assertString(args[i]);
s += separator + args[i];
}
return s;
} else {
return "";
}
return s;
});
};
_.tie = function() {
return this.tieWith("");
};
_.times = function(min, max) {

@@ -1015,2 +1025,7 @@ var self = this;

var whitespace = regexp(/\s+/).desc("whitespace");
var cr = string("\r");
var lf = string("\n");
var crlf = string("\r\n");
var newline = alt(crlf, lf, cr).desc("newline");
var end = alt(newline, eof);

@@ -1020,3 +1035,5 @@ Parsimmon.all = all;

Parsimmon.any = any;
Parsimmon.cr = cr;
Parsimmon.createLanguage = createLanguage;
Parsimmon.crlf = crlf;
Parsimmon.custom = custom;

@@ -1026,2 +1043,3 @@ Parsimmon.digit = digit;

Parsimmon.empty = empty;
Parsimmon.end = end;
Parsimmon.eof = eof;

@@ -1035,5 +1053,7 @@ Parsimmon.fail = fail;

Parsimmon.letters = letters;
Parsimmon.lf = lf;
Parsimmon.lookahead = lookahead;
Parsimmon.makeFailure = makeFailure;
Parsimmon.makeSuccess = makeSuccess;
Parsimmon.newline = newline;
Parsimmon.noneOf = noneOf;

@@ -1040,0 +1060,0 @@ Parsimmon.notFollowedBy = notFollowedBy;

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