json-asty 1.2.1 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Gruntfile.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** JSON-ASTy -- Lossless JSON-to-AST Parser and AST-to-JSON Generator
3
- ** Copyright (c) 2018-2024 Dr. Ralf S. Engelschall <rse@engelschall.com>
3
+ ** Copyright (c) 2018-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
4
4
  **
5
5
  ** Permission is hereby granted, free of charge, to any person obtaining
6
6
  ** a copy of this software and associated documentation files (the
package/Makefile CHANGED
@@ -1,6 +1,6 @@
1
1
  ##
2
2
  ## JSON-ASTy -- Lossless JSON-to-AST Parser and AST-to-JSON Generator
3
- ## Copyright (c) 2018-2024 Dr. Ralf S. Engelschall <rse@engelschall.com>
3
+ ## Copyright (c) 2018-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
4
4
  ##
5
5
  ## Permission is hereby granted, free of charge, to any person obtaining
6
6
  ## a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -137,7 +137,7 @@ JSON (new):
137
137
  License
138
138
  -------
139
139
 
140
- Copyright &copy; 2018-2024 Dr. Ralf S. Engelschall (http://engelschall.com/)
140
+ Copyright &copy; 2018-2025 Dr. Ralf S. Engelschall (http://engelschall.com/)
141
141
 
142
142
  Permission is hereby granted, free of charge, to any person obtaining
143
143
  a copy of this software and associated documentation files (the
package/eslint.yaml CHANGED
@@ -1,6 +1,6 @@
1
1
  ##
2
2
  ## JSON-ASTy -- Lossless JSON-to-AST Parser and AST-to-JSON Generator
3
- ## Copyright (c) 2018-2024 Dr. Ralf S. Engelschall <rse@engelschall.com>
3
+ ## Copyright (c) 2018-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
4
4
  ##
5
5
  ## Permission is hereby granted, free of charge, to any person obtaining
6
6
  ## a copy of this software and associated documentation files (the
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** JSON-ASTy -- Lossless JSON-to-AST Parser and AST-to-JSON Generator
3
- ** Copyright (c) 2018-2024 Dr. Ralf S. Engelschall <rse@engelschall.com>
3
+ ** Copyright (c) 2018-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
4
4
  **
5
5
  ** Permission is hereby granted, free of charge, to any person obtaining
6
6
  ** a copy of this software and associated documentation files (the
@@ -44,11 +44,11 @@ const conversions=_dereq_("./conversions");function buildGraph(){const n={},e=Ob
44
44
  "use strict";module.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};
45
45
  },{}],10:[function(_dereq_,module,exports){
46
46
  (function (global){(function (){
47
- !function(e,n,r){"object"==typeof module&&"object"==typeof module.exports?module.exports=r():"function"==typeof define&&void 0!==define.amd?define("PEGUtil",function(){return r()}):e.PEGUtil=r()}("undefined"!=typeof global?global:"undefined"!=typeof window?window:this,0,function(){var e={makeAST:function(e,n){return function(){return n.util.__makeAST.call(null,e().start.line,e().start.column,e().start.offset,arguments)}},makeUnroll:function(e,n){return function(r,t,o){if("object"!=typeof t||!(t instanceof Array))throw new n.util.__SyntaxError("unroll: invalid list argument for unrolling",typeof t,"Array",e());if(void 0!==o){"number"==typeof o&&(o=[o]);var l=[];null!==r&&l.push(r);for(var a=0;a<t.length;a++)for(var i=0;i<o.length;i++)l.push(t[a][o[i]]);return l}return null!==r&&t.unshift(r),t}}},n=function(e,n){var r=e.length,t=n-20;t<0&&(t=0);var o=n+20;o>r&&(o=r);var l=function(e){return e.charCodeAt(0).toString(16).toUpperCase()},a=function(e,n,r){return e.substr(n,r).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(e){return"\\x0"+l(e)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(e){return"\\x"+l(e)}).replace(/[\u0100-\u0FFF]/g,function(e){return"\\u0"+l(e)}).replace(/[\u1000-\uFFFF]/g,function(e){return"\\u"+l(e)})};return{prolog:a(e,t,n-t),token:a(e,n,1),epilog:a(e,n+1,o-(n+1))}};return e.parse=function(r,t,o){if("object"!=typeof r)throw new Error("invalid parser object (not an object)");if("function"!=typeof r.parse)throw new Error('invalid parser object (no "parse" function)');if("string"!=typeof t)throw new Error("invalid input text (not a string)");if(void 0!==o&&"object"!=typeof o)throw new Error("invalid options (not an object)");void 0===o&&(o={});var l={ast:null,error:null};try{var a;a="function"==typeof o.makeAST?o.makeAST:function(e,n){return{line:e().start.line,column:e().start.column,offset:e().start.offset,args:n}},o.util={makeUnroll:e.makeUnroll,makeAST:e.makeAST,__makeAST:a,__SyntaxError:r.SyntaxError},l.ast=r.parse(t,o),l.error=null}catch(e){if(l.ast=null,e instanceof r.SyntaxError){var i=function(e,n){return void 0!==e?e:n};l.error={line:i(e.location.start.line,0),column:i(e.location.start.column,0),message:e.message,found:i(e.found,""),expected:i(e.expected,""),location:n(t,i(e.location.start.offset,0))}}else l.error={line:0,column:0,message:e.message,found:"",expected:"",location:n("",0)}}return l},e.errorMessage=function(e,n){for(var r=e.location,t="line "+e.line+" (column "+e.column+"): ",o="",l=0;l<t.length+r.prolog.length;l++)o+="-";return t+r.prolog+r.token+r.epilog+"\n"+o+"^\n"+e.message+(n?"":"\n")},e});
47
+ !function(e,n,r){"object"==typeof module&&"object"==typeof module.exports?module.exports=r():"function"==typeof define&&void 0!==define.amd?define("PEGUtil",function(){return r()}):e.PEGUtil=r()}("undefined"!=typeof global?global:"undefined"!=typeof window?window:this,0,function(){var e={makeAST:function(e,n){return function(){return n.util.__makeAST.call(null,e().start.line,e().start.column,e().start.offset,arguments)}},makeUnroll:function(e,n){return function(r,t,o){if("object"!=typeof t||!(t instanceof Array))throw new n.util.__SyntaxError("unroll: invalid list argument for unrolling",typeof t,"Array",e());if(void 0!==o){"number"==typeof o&&(o=[o]);var l=[];null!==r&&l.push(r);for(var a=0;a<t.length;a++)for(var i=0;i<o.length;i++)l.push(t[a][o[i]]);return l}return null!==r&&t.unshift(r),t}}},n=function(e,n){var r=e.length,t=n-20;t<0&&(t=0);var o=n+20;o>r&&(o=r);var l=function(e){return e.charCodeAt(0).toString(16).toUpperCase()},a=function(e,n,r){return e.substr(n,r).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(e){return"\\x0"+l(e)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(e){return"\\x"+l(e)}).replace(/[\u0100-\u0FFF]/g,function(e){return"\\u0"+l(e)}).replace(/[\u1000-\uFFFF]/g,function(e){return"\\u"+l(e)})};return{prolog:a(e,t,n-t),token:a(e,n,1),epilog:a(e,n+1,o-(n+1))}};return e.parse=function(r,t,o){if("object"!=typeof r)throw new Error("invalid parser object (not an object)");if("function"!=typeof r.parse)throw new Error('invalid parser object (no "parse" function)');if("string"!=typeof t)throw new Error("invalid input text (not a string)");if(void 0!==o&&"object"!=typeof o)throw new Error("invalid options (not an object)");void 0===o&&(o={});var l={ast:null,error:null};try{var a;a="function"==typeof o.makeAST?o.makeAST:function(e,n,r,t){return{line:e,column:n,offset:r,args:t}},o.util={makeUnroll:e.makeUnroll,makeAST:e.makeAST,__makeAST:a,__SyntaxError:r.SyntaxError},l.ast=r.parse(t,o),l.error=null}catch(e){if(l.ast=null,e instanceof r.SyntaxError){var i=function(e,n){return void 0!==e?e:n};l.error={line:i(e.location.start.line,0),column:i(e.location.start.column,0),message:e.message,found:i(e.found,""),expected:i(e.expected,""),location:n(t,i(e.location.start.offset,0))}}else l.error={line:0,column:0,message:e.message,found:"",expected:"",location:n("",0)}}return l},e.errorMessage=function(e,n){for(var r=e.location,t="line "+e.line+" (column "+e.column+"): ",o="",l=0;l<t.length+r.prolog.length;l++)o+="-";return t+r.prolog+r.token+r.epilog+"\n"+o+"^\n"+e.message+(n?"":"\n")},e});
48
48
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
49
49
  },{}],11:[function(_dereq_,module,exports){
50
50
  "use strict";module.exports={stdout:!1,stderr:!1};
51
51
  },{}],12:[function(_dereq_,module,exports){
52
- "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,_toPropertyKey(n.key),n)}}function _createClass(t,e,r){return e&&_defineProperties(t.prototype,e),r&&_defineProperties(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function _toPropertyKey(t){var e=_toPrimitive(t,"string");return"symbol"==_typeof(e)?e:String(e)}function _toPrimitive(t,e){if("object"!=_typeof(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}var ASTY=_dereq_("asty-astq"),PEGUtil=_dereq_("pegjs-util"),chalk=_dereq_("chalk"),PEGparser=function(){function t(e,r,n,o){var u=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(u,t.prototype),u.expected=r,u.found=n,u.location=o,u.name="SyntaxError",u}function e(t,e,r){return r=r||" ",t.length>e?t:(e-=t.length,t+(r+=r.repeat(e)).slice(0,e))}return function(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}(t,Error),t.prototype.format=function(t){var r="Error: "+this.message;if(this.location){var n,o=null;for(n=0;n<t.length;n++)if(t[n].source===this.location.source){o=t[n].text.split(/\r\n|\n|\r/g);break}var u=this.location.start,l=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(u):u,a=this.location.source+":"+l.line+":"+l.column;if(o){var i=this.location.end,c=e("",l.line.toString().length," "),s=o[u.line-1],f=(u.line===i.line?i.column:s.length+1)-u.column||1;r+="\n --\x3e "+a+"\n"+c+" |\n"+l.line+" | "+s+"\n"+c+" | "+e("",u.column-1," ")+e("",f,"^")}else r+="\n at "+a}return r},t.buildMessage=function(t,e){var r={literal:function(t){return'"'+o(t.text)+'"'},class:function(t){var e=t.parts.map(function(t){return Array.isArray(t)?u(t[0])+"-"+u(t[1]):u(t)});return"["+(t.inverted?"^":"")+e.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(t){return t.description}};function n(t){return t.charCodeAt(0).toString(16).toUpperCase()}function o(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(t){return"\\x0"+n(t)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(t){return"\\x"+n(t)})}function u(t){return t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(t){return"\\x0"+n(t)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(t){return"\\x"+n(t)})}function l(t){return r[t.type](t)}return"Expected "+function(t){var e,r,n=t.map(l);if(n.sort(),n.length>0){for(e=1,r=1;e<n.length;e++)n[e-1]!==n[e]&&(n[r]=n[e],r++);n.length=r}switch(n.length){case 1:return n[0];case 2:return n[0]+" or "+n[1];default:return n.slice(0,-1).join(", ")+", or "+n[n.length-1]}}(t)+" but "+function(t){return t?'"'+o(t)+'"':"end of input"}(e)+" found."},{StartRules:["json"],SyntaxError:t,parse:function(e,r){var n,o={},u=(r=void 0!==r?r:{}).grammarSource,l={json:Vt},a=Vt,i="{",c=",",s="}",f=":",p="[",h="]",g="-",d="0",y=".",v='"',b="\\",A="b",m="f",C="n",x="r",w="t",E="u",S="null",P="false",k="true",j=/^[1-9]/,_=/^[0-9]/,F=/^[eE]/,O=/^[+\-]/,R=/^[^\0-\x1F"\\]/,$=/^["\/\\]/,T=/^[0-9a-f]/i,q=/^[ \t\n\r]/,G=Yt("{",!1),J=Yt(",",!1),N=Yt("}",!1),U=Yt(":",!1),M=Yt("[",!1),I=Yt("]",!1),K=Lt("number literal value"),Y=Yt("-",!1),D=Yt("0",!1),L=Dt([["1","9"]],!1,!1),z=Dt([["0","9"]],!1,!1),B=Yt(".",!1),H=Dt(["e","E"],!1,!1),Q=Dt(["+","-"],!1,!1),V=Lt("quoted string literal value"),W=Yt('"',!1),X=Dt([["\0",""],'"',"\\"],!0,!1),Z=Yt("\\",!1),tt=Dt(['"',"/","\\"],!1,!1),et=Yt("b",!1),rt=Yt("f",!1),nt=Yt("n",!1),ot=Yt("r",!1),ut=Yt("t",!1),lt=Yt("u",!1),at=Dt([["0","9"],["a","f"]],!1,!0),it=Lt("object null literal value"),ct=Yt("null",!1),st=Lt("boolean false literal value"),ft=Yt("false",!1),pt=Lt("boolean true literal value"),ht=Yt("true",!1),gt=Lt("whitespace"),dt=Dt([" ","\t","\n","\r"],!1,!1),yt=Lt("end of file"),vt={type:"any"},bt=function(t,e,r){return t&&e.set("prolog",t+(e.get("prolog")||"")),r&&e.set("epilog",(e.get("epilog")||"")+r),e},At=function(t,e,r){return r.reduce((t,e)=>{const r=t[t.length-1].get("epilog")||"";return t[t.length-1].set({epilog:r+e[0]}),t.concat([e[1]])},[e])},mt=function(t,e,r){return ee("object").set({prolog:t}).set({epilog:r}).add(e)},Ct=function(t,e,r){return ee("member").add(t.set({epilog:e}),r)},xt=function(t,e,r){return r.reduce((t,e)=>{const r=t[t.length-1].get("epilog")||"";return t[t.length-1].set({epilog:r+e[0]}),t.concat([e[1]])},[e])},wt=function(t,e,r){return ee("array").set({prolog:t}).set({epilog:r}).add(e)},Et=function(t,e,r){return ee("number").set({body:Kt(),value:parseFloat(Kt())})},St=function(){return"\b"},Pt=function(){return"\f"},kt=function(){return"\n"},jt=function(){return"\r"},_t=function(){return"\t"},Ft=function(t){return String.fromCharCode(parseInt(t,16))},Ot=function(t){return t},Rt=function(t){return ee("string").set({body:Kt(),value:t.join("")})},$t=function(){return ee("null").set({body:Kt(),value:null})},Tt=function(){return ee("boolean").set({body:Kt(),value:!1})},qt=function(){return ee("boolean").set({body:Kt(),value:!0})},Gt=0|r.peg$currPos,Jt=Gt,Nt=[{line:1,column:1}],Ut=Gt,Mt=r.peg$maxFailExpected||[],It=0|r.peg$silentFails;if(r.startRule){if(!(r.startRule in l))throw new Error("Can't start parsing from rule \""+r.startRule+'".');a=l[r.startRule]}function Kt(){return e.substring(Jt,Gt)}function Yt(t,e){return{type:"literal",text:t,ignoreCase:e}}function Dt(t,e,r){return{type:"class",parts:t,inverted:e,ignoreCase:r}}function Lt(t){return{type:"other",description:t}}function zt(t){var r,n=Nt[t];if(n)return n;if(t>=Nt.length)r=Nt.length-1;else for(r=t;!Nt[--r];);for(n={line:(n=Nt[r]).line,column:n.column};r<t;)10===e.charCodeAt(r)?(n.line++,n.column=1):n.column++,r++;return Nt[t]=n,n}function Bt(t,e,r){var n=zt(t),o=zt(e),l={source:u,start:{offset:t,line:n.line,column:n.column},end:{offset:e,line:o.line,column:o.column}};return r&&u&&"function"==typeof u.offset&&(l.start=u.offset(l.start),l.end=u.offset(l.end)),l}function Ht(t){Gt<Ut||(Gt>Ut&&(Ut=Gt,Mt=[]),Mt.push(t))}function Qt(e,r,n){return new t(t.buildMessage(e,r),e,r,n)}function Vt(){var t,r,n,u;return t=Gt,(r=te())===o&&(r=null),(n=Wt())!==o?((u=te())===o&&(u=null),function(){var t,r;return It++,t=Gt,It++,e.length>Gt?(r=e.charAt(Gt),Gt++):(r=o,0===It&&Ht(vt)),It--,r===o?t=void 0:(Gt=t,t=o),It--,t===o&&(r=o,0===It&&Ht(yt)),t}()!==o?(Jt=t,t=bt(r,n,u)):(Gt=t,t=o)):(Gt=t,t=o),t}function Wt(){var t;return(t=function(){var t,r,n,u,l,a,f,p,h,g,d;if(t=Gt,r=Gt,n=Gt,(u=te())===o&&(u=null),123===e.charCodeAt(Gt)?(l=i,Gt++):(l=o,0===It&&Ht(G)),l!==o?((a=te())===o&&(a=null),n=u=[u,l,a]):(Gt=n,n=o),(r=n!==o?e.substring(r,Gt):n)!==o){if(n=Gt,(u=Xt())!==o){for(l=[],a=Gt,f=Gt,p=Gt,(h=te())===o&&(h=null),44===e.charCodeAt(Gt)?(g=c,Gt++):(g=o,0===It&&Ht(J)),g!==o?((d=te())===o&&(d=null),p=h=[h,g,d]):(Gt=p,p=o),(f=p!==o?e.substring(f,Gt):p)!==o&&(p=Xt())!==o?a=f=[f,p]:(Gt=a,a=o);a!==o;)l.push(a),a=Gt,f=Gt,p=Gt,(h=te())===o&&(h=null),44===e.charCodeAt(Gt)?(g=c,Gt++):(g=o,0===It&&Ht(J)),g!==o?((d=te())===o&&(d=null),p=h=[h,g,d]):(Gt=p,p=o),(f=p!==o?e.substring(f,Gt):p)!==o&&(p=Xt())!==o?a=f=[f,p]:(Gt=a,a=o);Jt=n,n=At(r,u,l)}else Gt=n,n=o;n===o&&(n=null),u=Gt,l=Gt,(a=te())===o&&(a=null),125===e.charCodeAt(Gt)?(f=s,Gt++):(f=o,0===It&&Ht(N)),f!==o?((p=te())===o&&(p=null),l=a=[a,f,p]):(Gt=l,l=o),(u=l!==o?e.substring(u,Gt):l)!==o?(Jt=t,t=mt(r,n,u)):(Gt=t,t=o)}else Gt=t,t=o;return t}())===o&&(t=function(){var t,r,n,u,l,a,i,s,f,g,d;if(t=Gt,r=Gt,n=Gt,(u=te())===o&&(u=null),91===e.charCodeAt(Gt)?(l=p,Gt++):(l=o,0===It&&Ht(M)),l!==o?((a=te())===o&&(a=null),n=u=[u,l,a]):(Gt=n,n=o),(r=n!==o?e.substring(r,Gt):n)!==o){if(n=Gt,(u=Wt())!==o){for(l=[],a=Gt,i=Gt,s=Gt,(f=te())===o&&(f=null),44===e.charCodeAt(Gt)?(g=c,Gt++):(g=o,0===It&&Ht(J)),g!==o?((d=te())===o&&(d=null),s=f=[f,g,d]):(Gt=s,s=o),(i=s!==o?e.substring(i,Gt):s)!==o&&(s=Wt())!==o?a=i=[i,s]:(Gt=a,a=o);a!==o;)l.push(a),a=Gt,i=Gt,s=Gt,(f=te())===o&&(f=null),44===e.charCodeAt(Gt)?(g=c,Gt++):(g=o,0===It&&Ht(J)),g!==o?((d=te())===o&&(d=null),s=f=[f,g,d]):(Gt=s,s=o),(i=s!==o?e.substring(i,Gt):s)!==o&&(s=Wt())!==o?a=i=[i,s]:(Gt=a,a=o);Jt=n,n=xt(r,u,l)}else Gt=n,n=o;n===o&&(n=null),u=Gt,l=Gt,(a=te())===o&&(a=null),93===e.charCodeAt(Gt)?(i=h,Gt++):(i=o,0===It&&Ht(I)),i!==o?((s=te())===o&&(s=null),l=a=[a,i,s]):(Gt=l,l=o),(u=l!==o?e.substring(u,Gt):l)!==o?(Jt=t,t=wt(r,n,u)):(Gt=t,t=o)}else Gt=t,t=o;return t}())===o&&(t=function(){var t,r,n,u,l,a,i,c,s;if(It++,t=Gt,45===e.charCodeAt(Gt)?(r=g,Gt++):(r=o,0===It&&Ht(Y)),r===o&&(r=null),48===e.charCodeAt(Gt)?(n=d,Gt++):(n=o,0===It&&Ht(D)),n===o)if(n=Gt,u=e.charAt(Gt),j.test(u)?Gt++:(u=o,0===It&&Ht(L)),u!==o){for(l=[],a=e.charAt(Gt),_.test(a)?Gt++:(a=o,0===It&&Ht(z));a!==o;)l.push(a),a=e.charAt(Gt),_.test(a)?Gt++:(a=o,0===It&&Ht(z));n=u=[u,l]}else Gt=n,n=o;if(n!==o){if(u=Gt,46===e.charCodeAt(Gt)?(l=y,Gt++):(l=o,0===It&&Ht(B)),l!==o){if(a=[],i=e.charAt(Gt),_.test(i)?Gt++:(i=o,0===It&&Ht(z)),i!==o)for(;i!==o;)a.push(i),i=e.charAt(Gt),_.test(i)?Gt++:(i=o,0===It&&Ht(z));else a=o;a!==o?u=l=[l,a]:(Gt=u,u=o)}else Gt=u,u=o;if(u===o&&(u=null),l=Gt,a=e.charAt(Gt),F.test(a)?Gt++:(a=o,0===It&&Ht(H)),a!==o){if(i=e.charAt(Gt),O.test(i)?Gt++:(i=o,0===It&&Ht(Q)),i===o&&(i=null),c=[],s=e.charAt(Gt),_.test(s)?Gt++:(s=o,0===It&&Ht(z)),s!==o)for(;s!==o;)c.push(s),s=e.charAt(Gt),_.test(s)?Gt++:(s=o,0===It&&Ht(z));else c=o;c!==o?l=a=[a,i,c]:(Gt=l,l=o)}else Gt=l,l=o;l===o&&(l=null),Jt=t,t=Et(n,u,l)}else Gt=t,t=o;return It--,t===o&&(r=o,0===It&&Ht(K)),t}())===o&&(t=Zt())===o&&(t=function(){var t,r;return It++,t=Gt,e.substr(Gt,4)===S?(r=S,Gt+=4):(r=o,0===It&&Ht(ct)),r!==o&&(Jt=t,r=$t()),It--,(t=r)===o&&(r=o,0===It&&Ht(it)),t}())===o&&(t=function(){var t,r;return It++,t=Gt,e.substr(Gt,5)===P?(r=P,Gt+=5):(r=o,0===It&&Ht(ft)),r!==o&&(Jt=t,r=Tt()),It--,(t=r)===o&&(r=o,0===It&&Ht(st)),t}())===o&&(t=function(){var t,r;return It++,t=Gt,e.substr(Gt,4)===k?(r=k,Gt+=4):(r=o,0===It&&Ht(ht)),r!==o&&(Jt=t,r=qt()),It--,(t=r)===o&&(r=o,0===It&&Ht(pt)),t}()),t}function Xt(){var t,r,n,u,l,a,i;return t=Gt,(r=Zt())!==o?(n=Gt,u=Gt,(l=te())===o&&(l=null),58===e.charCodeAt(Gt)?(a=f,Gt++):(a=o,0===It&&Ht(U)),a!==o?((i=te())===o&&(i=null),u=l=[l,a,i]):(Gt=u,u=o),(n=u!==o?e.substring(n,Gt):u)!==o&&(u=Wt())!==o?(Jt=t,t=Ct(r,n,u)):(Gt=t,t=o)):(Gt=t,t=o),t}function Zt(){var t,r,n,u,l,a,i,c,s,f,p,h,g;if(It++,t=Gt,34===e.charCodeAt(Gt)?(r=v,Gt++):(r=o,0===It&&Ht(W)),r!==o){for(n=[],u=e.charAt(Gt),R.test(u)?Gt++:(u=o,0===It&&Ht(X)),u===o&&(u=Gt,92===e.charCodeAt(Gt)?(l=b,Gt++):(l=o,0===It&&Ht(Z)),l!==o?(a=e.charAt(Gt),$.test(a)?Gt++:(a=o,0===It&&Ht(tt)),a===o&&(a=Gt,98===e.charCodeAt(Gt)?(i=A,Gt++):(i=o,0===It&&Ht(et)),i!==o&&(Jt=a,i=St()),(a=i)===o&&(a=Gt,102===e.charCodeAt(Gt)?(i=m,Gt++):(i=o,0===It&&Ht(rt)),i!==o&&(Jt=a,i=Pt()),(a=i)===o&&(a=Gt,110===e.charCodeAt(Gt)?(i=C,Gt++):(i=o,0===It&&Ht(nt)),i!==o&&(Jt=a,i=kt()),(a=i)===o&&(a=Gt,114===e.charCodeAt(Gt)?(i=x,Gt++):(i=o,0===It&&Ht(ot)),i!==o&&(Jt=a,i=jt()),(a=i)===o&&(a=Gt,116===e.charCodeAt(Gt)?(i=w,Gt++):(i=o,0===It&&Ht(ut)),i!==o&&(Jt=a,i=_t()),(a=i)===o&&(a=Gt,117===e.charCodeAt(Gt)?(i=E,Gt++):(i=o,0===It&&Ht(lt)),i!==o?(c=Gt,s=Gt,f=e.charAt(Gt),T.test(f)?Gt++:(f=o,0===It&&Ht(at)),f!==o?(p=e.charAt(Gt),T.test(p)?Gt++:(p=o,0===It&&Ht(at)),p!==o?(h=e.charAt(Gt),T.test(h)?Gt++:(h=o,0===It&&Ht(at)),h!==o?(g=e.charAt(Gt),T.test(g)?Gt++:(g=o,0===It&&Ht(at)),g!==o?s=f=[f,p,h,g]:(Gt=s,s=o)):(Gt=s,s=o)):(Gt=s,s=o)):(Gt=s,s=o),(c=s!==o?e.substring(c,Gt):s)!==o?(Jt=a,a=Ft(c)):(Gt=a,a=o)):(Gt=a,a=o))))))),a!==o?(Jt=u,u=Ot(a)):(Gt=u,u=o)):(Gt=u,u=o));u!==o;)n.push(u),u=e.charAt(Gt),R.test(u)?Gt++:(u=o,0===It&&Ht(X)),u===o&&(u=Gt,92===e.charCodeAt(Gt)?(l=b,Gt++):(l=o,0===It&&Ht(Z)),l!==o?(a=e.charAt(Gt),$.test(a)?Gt++:(a=o,0===It&&Ht(tt)),a===o&&(a=Gt,98===e.charCodeAt(Gt)?(i=A,Gt++):(i=o,0===It&&Ht(et)),i!==o&&(Jt=a,i=St()),(a=i)===o&&(a=Gt,102===e.charCodeAt(Gt)?(i=m,Gt++):(i=o,0===It&&Ht(rt)),i!==o&&(Jt=a,i=Pt()),(a=i)===o&&(a=Gt,110===e.charCodeAt(Gt)?(i=C,Gt++):(i=o,0===It&&Ht(nt)),i!==o&&(Jt=a,i=kt()),(a=i)===o&&(a=Gt,114===e.charCodeAt(Gt)?(i=x,Gt++):(i=o,0===It&&Ht(ot)),i!==o&&(Jt=a,i=jt()),(a=i)===o&&(a=Gt,116===e.charCodeAt(Gt)?(i=w,Gt++):(i=o,0===It&&Ht(ut)),i!==o&&(Jt=a,i=_t()),(a=i)===o&&(a=Gt,117===e.charCodeAt(Gt)?(i=E,Gt++):(i=o,0===It&&Ht(lt)),i!==o?(c=Gt,s=Gt,f=e.charAt(Gt),T.test(f)?Gt++:(f=o,0===It&&Ht(at)),f!==o?(p=e.charAt(Gt),T.test(p)?Gt++:(p=o,0===It&&Ht(at)),p!==o?(h=e.charAt(Gt),T.test(h)?Gt++:(h=o,0===It&&Ht(at)),h!==o?(g=e.charAt(Gt),T.test(g)?Gt++:(g=o,0===It&&Ht(at)),g!==o?s=f=[f,p,h,g]:(Gt=s,s=o)):(Gt=s,s=o)):(Gt=s,s=o)):(Gt=s,s=o),(c=s!==o?e.substring(c,Gt):s)!==o?(Jt=a,a=Ft(c)):(Gt=a,a=o)):(Gt=a,a=o))))))),a!==o?(Jt=u,u=Ot(a)):(Gt=u,u=o)):(Gt=u,u=o));34===e.charCodeAt(Gt)?(u=v,Gt++):(u=o,0===It&&Ht(W)),u!==o?(Jt=t,t=Rt(n)):(Gt=t,t=o)}else Gt=t,t=o;return It--,t===o&&(r=o,0===It&&Ht(V)),t}function te(){var t,r;if(It++,t=[],r=e.charAt(Gt),q.test(r)?Gt++:(r=o,0===It&&Ht(dt)),r!==o)for(;r!==o;)t.push(r),r=e.charAt(Gt),q.test(r)?Gt++:(r=o,0===It&&Ht(dt));else t=o;return It--,t===o&&(r=o,0===It&&Ht(gt)),t}var ee=r.util.makeAST(function(){return Bt(Jt,Gt)},r);if(n=a(),r.peg$library)return{peg$result:n,peg$currPos:Gt,peg$FAILED:o,peg$maxFailExpected:Mt,peg$maxFailPos:Ut};if(n!==o&&Gt===e.length)return n;throw n!==o&&Gt<e.length&&Ht({type:"end"}),Qt(Mt,Ut<e.length?e.charAt(Ut):null,Ut<e.length?Bt(Ut,Ut+1):Bt(Ut,Ut))}}}(),JsonAsty=function(){function t(){_classCallCheck(this,t)}return _createClass(t,null,[{key:"parse",value:function(t){if("string"!=typeof t)throw new Error("invalid JSON argument (expected type string)");var e=new ASTY,r=PEGUtil.parse(PEGparser,t,{startRule:"json",makeAST:function(t,r,n,o){return e.create.apply(e,o).pos(t,r,n)}});if(null!==r.error)throw new Error("parse: JSON parsing failure:\n"+PEGUtil.errorMessage(r.error,!0).replace(/^/gm,"ERROR: ")+"\n");return r.ast}},{key:"dump",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(e=Object.assign({},{colors:!1},e)).colors?t.dump(1/0,function(t,e){switch(t){case"tree":e=chalk.grey(e);break;case"type":e=chalk.blue(e);break;case"value":e=chalk.yellow(e);break;case"position":e=chalk.grey(e)}return e}):t.dump(1/0)}},{key:"unparse",value:function(t){if("object"!==_typeof(t))throw new Error("generate: invalid AST argument (expected type object)");var e="";return t.walk(function(t,r,n,o){if("downward"===o){var u=t.get("prolog");void 0!==u&&(e+=u);var l=t.get("body");if(void 0!==l)e+=l;else{var a=t.get("value");void 0!==a&&(e+=JSON.stringify(a))}}else if("upward"===o){var i=t.get("epilog");void 0!==i&&(e+=i)}},"both"),e}}]),t}();module.exports=JsonAsty;
52
+ "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,_toPropertyKey(n.key),n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==_typeof(t)?t:t+""}function _toPrimitive(e,t){if("object"!=_typeof(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var ASTY=_dereq_("asty-astq"),PEGUtil=_dereq_("pegjs-util"),chalk=_dereq_("chalk"),PEGparser=function(){class e extends SyntaxError{constructor(e,t,r,n){super(e),this.expected=t,this.found=r,this.location=n,this.name="SyntaxError"}format(e){let t="Error: "+this.message;if(this.location){let r=null;const n=e.find(e=>e.source===this.location.source);n&&(r=n.text.split(/\r\n|\n|\r/g));const o=this.location.start,l=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(o):o,a=this.location.source+":"+l.line+":"+l.column;if(r){const e=this.location.end,n="".padEnd(l.line.toString().length," "),u=r[o.line-1],i=(o.line===e.line?e.column:u.length+1)-o.column||1;t+="\n --\x3e "+a+"\n"+n+" |\n"+l.line+" | "+u+"\n"+n+" | "+"".padEnd(o.column-1," ")+"".padEnd(i,"^")}else t+="\n at "+a}return t}static buildMessage(e,t){function r(e){return e.codePointAt(0).toString(16).toUpperCase()}const n=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function o(e){return n?e.replace(n,e=>"\\u{"+r(e)+"}"):e}function l(e){return o(e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,e=>"\\x0"+r(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+r(e)))}function a(e){return o(e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,e=>"\\x0"+r(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+r(e)))}const u={literal:e=>'"'+l(e.text)+'"',class(e){const t=e.parts.map(e=>Array.isArray(e)?a(e[0])+"-"+a(e[1]):a(e));return"["+(e.inverted?"^":"")+t.join("")+"]"+(e.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:e=>e.description};function i(e){return u[e.type](e)}return"Expected "+function(e){const t=e.map(i);if(t.sort(),t.length>0){let e=1;for(let r=1;r<t.length;r++)t[r-1]!==t[r]&&(t[e]=t[r],e++);t.length=e}switch(t.length){case 1:return t[0];case 2:return t[0]+" or "+t[1];default:return t.slice(0,-1).join(", ")+", or "+t[t.length-1]}}(e)+" but "+function(e){return e?'"'+l(e)+'"':"end of input"}(t)+" found."}}return{StartRules:["json"],SyntaxError:e,parse:function(t,r){const n={},o=(r=void 0!==r?r:{}).grammarSource,l={json:Te};let a=Te;const u="{",i=",",s="}",c=":",f="[",p="]",h="-",g="0",d=".",y='"',b="\\",A="b",m="f",v="n",C="r",x="t",w="u",E="null",S="false",P="true",k=/^[1-9]/,j=/^[0-9]/,_=/^[eE]/,F=/^[+\-]/,R=/^[^\0-\x1F"\\]/,$=/^["\/\\]/,O=/^[0-9a-f]/i,T=/^[ \t\n\r]/,q=ke("{",!1),G=ke(",",!1),J=ke("}",!1),M=ke(":",!1),N=ke("[",!1),U=ke("]",!1),I=_e("number literal value"),K=ke("-",!1),Y=ke("0",!1),D=je([["1","9"]],!1,!1,!1),L=je([["0","9"]],!1,!1,!1),z=ke(".",!1),B=je(["e","E"],!1,!1,!1),H=je(["+","-"],!1,!1,!1),Q=_e("quoted string literal value"),V=ke('"',!1),W=je([["\0",""],'"',"\\"],!0,!1,!1),X=ke("\\",!1),Z=je(['"',"/","\\"],!1,!1,!1),ee=ke("b",!1),te=ke("f",!1),re=ke("n",!1),ne=ke("r",!1),oe=ke("t",!1),le=ke("u",!1),ae=je([["0","9"],["a","f"]],!1,!0,!1),ue=_e("object null literal value"),ie=ke("null",!1),se=_e("boolean false literal value"),ce=ke("false",!1),fe=_e("boolean true literal value"),pe=ke("true",!1),he=_e("whitespace"),ge=je([" ","\t","\n","\r"],!1,!1,!1),de=_e("end of file"),ye={type:"any"};function be(e){return String.fromCharCode(parseInt(e,16))}function Ae(e){return e}let me=0|r.peg$currPos,ve=me;const Ce=[{line:1,column:1}];let xe,we=me,Ee=r.peg$maxFailExpected||[],Se=0|r.peg$silentFails;if(r.startRule){if(!(r.startRule in l))throw new Error("Can't start parsing from rule \""+r.startRule+'".');a=l[r.startRule]}function Pe(){return t.substring(ve,me)}function ke(e,t){return{type:"literal",text:e,ignoreCase:t}}function je(e,t,r,n){return{type:"class",parts:e,inverted:t,ignoreCase:r,unicode:n}}function _e(e){return{type:"other",description:e}}function Fe(e){let r,n=Ce[e];if(n)return n;if(e>=Ce.length)r=Ce.length-1;else for(r=e;!Ce[--r];);for(n={line:(n=Ce[r]).line,column:n.column};r<e;)10===t.charCodeAt(r)?(n.line++,n.column=1):n.column++,r++;return Ce[e]=n,n}function Re(e,t,r){const n=Fe(e),l=Fe(t),a={source:o,start:{offset:e,line:n.line,column:n.column},end:{offset:t,line:l.line,column:l.column}};return r&&o&&"function"==typeof o.offset&&(a.start=o.offset(a.start),a.end=o.offset(a.end)),a}function $e(e){me<we||(me>we&&(we=me,Ee=[]),Ee.push(e))}function Oe(t,r,n){return new e(e.buildMessage(t,r),t,r,n)}function Te(){let e,r,o,l,a;var u,i,s;return e=me,(r=Me())===n&&(r=null),(o=qe())!==n?((l=Me())===n&&(l=null),(a=function(){let e,r;return Se++,e=me,Se++,t.length>me?(r=t.charAt(me),me++):(r=n,0===Se&&$e(ye)),Se--,r===n?e=void 0:(me=e,e=n),Se--,e===n&&(r=n,0===Se&&$e(de)),e}())!==n?(ve=e,i=o,s=l,(u=r)&&i.set("prolog",u+(i.get("prolog")||"")),s&&i.set("epilog",(i.get("epilog")||"")+s),e=i):(me=e,e=n)):(me=e,e=n),e}function qe(){let e;return(e=function(){let e,r,o,l,a,c,f,p,h,g,d;if(e=me,r=me,o=me,(l=Me())===n&&(l=null),123===t.charCodeAt(me)?(a=u,me++):(a=n,0===Se&&$e(q)),a!==n?((c=Me())===n&&(c=null),o=l=[l,a,c]):(me=o,o=n),(r=o!==n?t.substring(r,me):o)!==n){if(o=me,(l=Ge())!==n){for(a=[],c=me,f=me,p=me,(h=Me())===n&&(h=null),44===t.charCodeAt(me)?(g=i,me++):(g=n,0===Se&&$e(G)),g!==n?((d=Me())===n&&(d=null),p=h=[h,g,d]):(me=p,p=n),(f=p!==n?t.substring(f,me):p)!==n&&(p=Ge())!==n?c=f=[f,p]:(me=c,c=n);c!==n;)a.push(c),c=me,f=me,p=me,(h=Me())===n&&(h=null),44===t.charCodeAt(me)?(g=i,me++):(g=n,0===Se&&$e(G)),g!==n?((d=Me())===n&&(d=null),p=h=[h,g,d]):(me=p,p=n),(f=p!==n?t.substring(f,me):p)!==n&&(p=Ge())!==n?c=f=[f,p]:(me=c,c=n);ve=o,m=l,o=a.reduce((e,t)=>{const r=e[e.length-1].get("epilog")||"";return e[e.length-1].set({epilog:r+t[0]}),e.concat([t[1]])},[m])}else me=o,o=n;o===n&&(o=null),l=me,a=me,(c=Me())===n&&(c=null),125===t.charCodeAt(me)?(f=s,me++):(f=n,0===Se&&$e(J)),f!==n?((p=Me())===n&&(p=null),a=c=[c,f,p]):(me=a,a=n),(l=a!==n?t.substring(l,me):a)!==n?(ve=e,y=r,b=o,A=l,e=Ne("object").set({prolog:y}).set({epilog:A}).add(b)):(me=e,e=n)}else me=e,e=n;var y,b,A,m;return e}())===n&&(e=function(){let e,r,o,l,a,u,s,c,h,g,d;if(e=me,r=me,o=me,(l=Me())===n&&(l=null),91===t.charCodeAt(me)?(a=f,me++):(a=n,0===Se&&$e(N)),a!==n?((u=Me())===n&&(u=null),o=l=[l,a,u]):(me=o,o=n),(r=o!==n?t.substring(r,me):o)!==n){if(o=me,(l=qe())!==n){for(a=[],u=me,s=me,c=me,(h=Me())===n&&(h=null),44===t.charCodeAt(me)?(g=i,me++):(g=n,0===Se&&$e(G)),g!==n?((d=Me())===n&&(d=null),c=h=[h,g,d]):(me=c,c=n),(s=c!==n?t.substring(s,me):c)!==n&&(c=qe())!==n?u=s=[s,c]:(me=u,u=n);u!==n;)a.push(u),u=me,s=me,c=me,(h=Me())===n&&(h=null),44===t.charCodeAt(me)?(g=i,me++):(g=n,0===Se&&$e(G)),g!==n?((d=Me())===n&&(d=null),c=h=[h,g,d]):(me=c,c=n),(s=c!==n?t.substring(s,me):c)!==n&&(c=qe())!==n?u=s=[s,c]:(me=u,u=n);ve=o,m=l,o=a.reduce((e,t)=>{const r=e[e.length-1].get("epilog")||"";return e[e.length-1].set({epilog:r+t[0]}),e.concat([t[1]])},[m])}else me=o,o=n;o===n&&(o=null),l=me,a=me,(u=Me())===n&&(u=null),93===t.charCodeAt(me)?(s=p,me++):(s=n,0===Se&&$e(U)),s!==n?((c=Me())===n&&(c=null),a=u=[u,s,c]):(me=a,a=n),(l=a!==n?t.substring(l,me):a)!==n?(ve=e,y=r,b=o,A=l,e=Ne("array").set({prolog:y}).set({epilog:A}).add(b)):(me=e,e=n)}else me=e,e=n;var y,b,A,m;return e}())===n&&(e=function(){let e,r,o,l,a,u,i,s,c;if(Se++,e=me,45===t.charCodeAt(me)?(r=h,me++):(r=n,0===Se&&$e(K)),r===n&&(r=null),48===t.charCodeAt(me)?(o=g,me++):(o=n,0===Se&&$e(Y)),o===n)if(o=me,l=t.charAt(me),k.test(l)?me++:(l=n,0===Se&&$e(D)),l!==n){for(a=[],u=t.charAt(me),j.test(u)?me++:(u=n,0===Se&&$e(L));u!==n;)a.push(u),u=t.charAt(me),j.test(u)?me++:(u=n,0===Se&&$e(L));o=l=[l,a]}else me=o,o=n;if(o!==n){if(l=me,46===t.charCodeAt(me)?(a=d,me++):(a=n,0===Se&&$e(z)),a!==n){if(u=[],i=t.charAt(me),j.test(i)?me++:(i=n,0===Se&&$e(L)),i!==n)for(;i!==n;)u.push(i),i=t.charAt(me),j.test(i)?me++:(i=n,0===Se&&$e(L));else u=n;u!==n?l=a=[a,u]:(me=l,l=n)}else me=l,l=n;if(l===n&&(l=null),a=me,u=t.charAt(me),_.test(u)?me++:(u=n,0===Se&&$e(B)),u!==n){if(i=t.charAt(me),F.test(i)?me++:(i=n,0===Se&&$e(H)),i===n&&(i=null),s=[],c=t.charAt(me),j.test(c)?me++:(c=n,0===Se&&$e(L)),c!==n)for(;c!==n;)s.push(c),c=t.charAt(me),j.test(c)?me++:(c=n,0===Se&&$e(L));else s=n;s!==n?a=u=[u,i,s]:(me=a,a=n)}else me=a,a=n;a===n&&(a=null),ve=e,e=Ne("number").set({body:Pe(),value:parseFloat(Pe())})}else me=e,e=n;return Se--,e===n&&(r=n,0===Se&&$e(I)),e}())===n&&(e=Je())===n&&(e=function(){let e,r;return Se++,e=me,t.substr(me,4)===E?(r=E,me+=4):(r=n,0===Se&&$e(ie)),r!==n&&(ve=e,r=Ne("null").set({body:Pe(),value:null})),Se--,(e=r)===n&&(r=n,0===Se&&$e(ue)),e}())===n&&(e=function(){let e,r;return Se++,e=me,t.substr(me,5)===S?(r=S,me+=5):(r=n,0===Se&&$e(ce)),r!==n&&(ve=e,r=Ne("boolean").set({body:Pe(),value:!1})),Se--,(e=r)===n&&(r=n,0===Se&&$e(se)),e}())===n&&(e=function(){let e,r;return Se++,e=me,t.substr(me,4)===P?(r=P,me+=4):(r=n,0===Se&&$e(pe)),r!==n&&(ve=e,r=Ne("boolean").set({body:Pe(),value:!0})),Se--,(e=r)===n&&(r=n,0===Se&&$e(fe)),e}()),e}function Ge(){let e,r,o,l,a,u,i;var s,f,p;return e=me,(r=Je())!==n?(o=me,l=me,(a=Me())===n&&(a=null),58===t.charCodeAt(me)?(u=c,me++):(u=n,0===Se&&$e(M)),u!==n?((i=Me())===n&&(i=null),l=a=[a,u,i]):(me=l,l=n),(o=l!==n?t.substring(o,me):l)!==n&&(l=qe())!==n?(ve=e,s=r,f=o,p=l,e=Ne("member").add(s.set({epilog:f}),p)):(me=e,e=n)):(me=e,e=n),e}function Je(){let e,r,o,l,a,u,i,s,c,f,p,h,g;if(Se++,e=me,34===t.charCodeAt(me)?(r=y,me++):(r=n,0===Se&&$e(V)),r!==n){for(o=[],l=t.charAt(me),R.test(l)?me++:(l=n,0===Se&&$e(W)),l===n&&(l=me,92===t.charCodeAt(me)?(a=b,me++):(a=n,0===Se&&$e(X)),a!==n?(u=t.charAt(me),$.test(u)?me++:(u=n,0===Se&&$e(Z)),u===n&&(u=me,98===t.charCodeAt(me)?(i=A,me++):(i=n,0===Se&&$e(ee)),i!==n&&(ve=u,i="\b"),(u=i)===n&&(u=me,102===t.charCodeAt(me)?(i=m,me++):(i=n,0===Se&&$e(te)),i!==n&&(ve=u,i="\f"),(u=i)===n&&(u=me,110===t.charCodeAt(me)?(i=v,me++):(i=n,0===Se&&$e(re)),i!==n&&(ve=u,i="\n"),(u=i)===n&&(u=me,114===t.charCodeAt(me)?(i=C,me++):(i=n,0===Se&&$e(ne)),i!==n&&(ve=u,i="\r"),(u=i)===n&&(u=me,116===t.charCodeAt(me)?(i=x,me++):(i=n,0===Se&&$e(oe)),i!==n&&(ve=u,i="\t"),(u=i)===n&&(u=me,117===t.charCodeAt(me)?(i=w,me++):(i=n,0===Se&&$e(le)),i!==n?(s=me,c=me,f=t.charAt(me),O.test(f)?me++:(f=n,0===Se&&$e(ae)),f!==n?(p=t.charAt(me),O.test(p)?me++:(p=n,0===Se&&$e(ae)),p!==n?(h=t.charAt(me),O.test(h)?me++:(h=n,0===Se&&$e(ae)),h!==n?(g=t.charAt(me),O.test(g)?me++:(g=n,0===Se&&$e(ae)),g!==n?c=f=[f,p,h,g]:(me=c,c=n)):(me=c,c=n)):(me=c,c=n)):(me=c,c=n),(s=c!==n?t.substring(s,me):c)!==n?(ve=u,u=be(s)):(me=u,u=n)):(me=u,u=n))))))),u!==n?(ve=l,l=Ae(u)):(me=l,l=n)):(me=l,l=n));l!==n;)o.push(l),l=t.charAt(me),R.test(l)?me++:(l=n,0===Se&&$e(W)),l===n&&(l=me,92===t.charCodeAt(me)?(a=b,me++):(a=n,0===Se&&$e(X)),a!==n?(u=t.charAt(me),$.test(u)?me++:(u=n,0===Se&&$e(Z)),u===n&&(u=me,98===t.charCodeAt(me)?(i=A,me++):(i=n,0===Se&&$e(ee)),i!==n&&(ve=u,i="\b"),(u=i)===n&&(u=me,102===t.charCodeAt(me)?(i=m,me++):(i=n,0===Se&&$e(te)),i!==n&&(ve=u,i="\f"),(u=i)===n&&(u=me,110===t.charCodeAt(me)?(i=v,me++):(i=n,0===Se&&$e(re)),i!==n&&(ve=u,i="\n"),(u=i)===n&&(u=me,114===t.charCodeAt(me)?(i=C,me++):(i=n,0===Se&&$e(ne)),i!==n&&(ve=u,i="\r"),(u=i)===n&&(u=me,116===t.charCodeAt(me)?(i=x,me++):(i=n,0===Se&&$e(oe)),i!==n&&(ve=u,i="\t"),(u=i)===n&&(u=me,117===t.charCodeAt(me)?(i=w,me++):(i=n,0===Se&&$e(le)),i!==n?(s=me,c=me,f=t.charAt(me),O.test(f)?me++:(f=n,0===Se&&$e(ae)),f!==n?(p=t.charAt(me),O.test(p)?me++:(p=n,0===Se&&$e(ae)),p!==n?(h=t.charAt(me),O.test(h)?me++:(h=n,0===Se&&$e(ae)),h!==n?(g=t.charAt(me),O.test(g)?me++:(g=n,0===Se&&$e(ae)),g!==n?c=f=[f,p,h,g]:(me=c,c=n)):(me=c,c=n)):(me=c,c=n)):(me=c,c=n),(s=c!==n?t.substring(s,me):c)!==n?(ve=u,u=be(s)):(me=u,u=n)):(me=u,u=n))))))),u!==n?(ve=l,l=Ae(u)):(me=l,l=n)):(me=l,l=n));34===t.charCodeAt(me)?(l=y,me++):(l=n,0===Se&&$e(V)),l!==n?(ve=e,d=o,e=Ne("string").set({body:Pe(),value:d.join("")})):(me=e,e=n)}else me=e,e=n;var d;return Se--,e===n&&(r=n,0===Se&&$e(Q)),e}function Me(){let e,r;if(Se++,e=[],r=t.charAt(me),T.test(r)?me++:(r=n,0===Se&&$e(ge)),r!==n)for(;r!==n;)e.push(r),r=t.charAt(me),T.test(r)?me++:(r=n,0===Se&&$e(ge));else e=n;return Se--,e===n&&(r=n,0===Se&&$e(he)),e}var Ne=r.util.makeAST(function(){return Re(ve,me)},r);const Ue=(xe=a())!==n&&me===t.length;function Ie(){throw xe!==n&&me<t.length&&$e({type:"end"}),Oe(Ee,we<t.length?function(e=me){const r=t.codePointAt(e);return void 0===r?"":String.fromCodePoint(r)}(we):null,we<t.length?Re(we,we+1):Re(we,we))}return r.peg$library?{peg$result:xe,peg$currPos:me,peg$FAILED:n,peg$maxFailExpected:Ee,peg$maxFailPos:we,peg$success:Ue,peg$throw:Ue?void 0:Ie}:Ue?xe:void Ie()}}}(),JsonAsty=function(){return _createClass(function e(){_classCallCheck(this,e)},null,[{key:"parse",value:function(e){if("string"!=typeof e)throw new Error("invalid JSON argument (expected type string)");var t=new ASTY,r=PEGUtil.parse(PEGparser,e,{startRule:"json",makeAST:function(e,r,n,o){return t.create.apply(t,o).pos(e,r,n)}});if(null!==r.error)throw new Error("parse: JSON parsing failure:\n"+PEGUtil.errorMessage(r.error,!0).replace(/^/gm,"ERROR: ")+"\n");return r.ast}},{key:"dump",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(t=Object.assign({},{colors:!1},t)).colors?e.dump(1/0,function(e,t){switch(e){case"tree":t=chalk.grey(t);break;case"type":t=chalk.blue(t);break;case"value":t=chalk.yellow(t);break;case"position":t=chalk.grey(t)}return t}):e.dump(1/0)}},{key:"unparse",value:function(e){if("object"!==_typeof(e))throw new Error("generate: invalid AST argument (expected type object)");var t="";return e.walk(function(e,r,n,o){if("downward"===o){var l=e.get("prolog");void 0!==l&&(t+=l);var a=e.get("body");if(void 0!==a)t+=a;else{var u=e.get("value");void 0!==u&&(t+=JSON.stringify(u))}}else if("upward"===o){var i=e.get("epilog");void 0!==i&&(t+=i)}},"both"),t}}])}();module.exports=JsonAsty;
53
53
  },{"asty-astq":2,"chalk":3,"pegjs-util":10}]},{},[12])(12)
54
54
  });
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** JSON-ASTy -- Lossless JSON-to-AST Parser and AST-to-JSON Generator
3
- ** Copyright (c) 2018-2024 Dr. Ralf S. Engelschall <rse@engelschall.com>
3
+ ** Copyright (c) 2018-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
4
4
  **
5
5
  ** Permission is hereby granted, free of charge, to any person obtaining
6
6
  ** a copy of this software and associated documentation files (the
@@ -41,6 +41,6 @@ const conversions=_dereq_("./conversions");function buildGraph(){const n={},e=Ob
41
41
  },{}],9:[function(_dereq_,module,exports){
42
42
  "use strict";module.exports={stdout:!1,stderr:!1};
43
43
  },{}],10:[function(_dereq_,module,exports){
44
- "use strict";const ASTY=_dereq_("asty-astq"),PEGUtil=_dereq_("pegjs-util"),chalk=_dereq_("chalk"),PEGparser=function(){function t(e,r,n,o){var u=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(u,t.prototype),u.expected=r,u.found=n,u.location=o,u.name="SyntaxError",u}function e(t,e,r){return r=r||" ",t.length>e?t:(e-=t.length,t+(r+=r.repeat(e)).slice(0,e))}return function(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}(t,Error),t.prototype.format=function(t){var r="Error: "+this.message;if(this.location){var n,o=null;for(n=0;n<t.length;n++)if(t[n].source===this.location.source){o=t[n].text.split(/\r\n|\n|\r/g);break}var u=this.location.start,l=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(u):u,a=this.location.source+":"+l.line+":"+l.column;if(o){var c=this.location.end,i=e("",l.line.toString().length," "),s=o[u.line-1],f=(u.line===c.line?c.column:s.length+1)-u.column||1;r+="\n --\x3e "+a+"\n"+i+" |\n"+l.line+" | "+s+"\n"+i+" | "+e("",u.column-1," ")+e("",f,"^")}else r+="\n at "+a}return r},t.buildMessage=function(t,e){var r={literal:function(t){return'"'+o(t.text)+'"'},class:function(t){var e=t.parts.map(function(t){return Array.isArray(t)?u(t[0])+"-"+u(t[1]):u(t)});return"["+(t.inverted?"^":"")+e.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(t){return t.description}};function n(t){return t.charCodeAt(0).toString(16).toUpperCase()}function o(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(t){return"\\x0"+n(t)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(t){return"\\x"+n(t)})}function u(t){return t.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(t){return"\\x0"+n(t)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(t){return"\\x"+n(t)})}function l(t){return r[t.type](t)}return"Expected "+function(t){var e,r,n=t.map(l);if(n.sort(),n.length>0){for(e=1,r=1;e<n.length;e++)n[e-1]!==n[e]&&(n[r]=n[e],r++);n.length=r}switch(n.length){case 1:return n[0];case 2:return n[0]+" or "+n[1];default:return n.slice(0,-1).join(", ")+", or "+n[n.length-1]}}(t)+" but "+function(t){return t?'"'+o(t)+'"':"end of input"}(e)+" found."},{StartRules:["json"],SyntaxError:t,parse:function(e,r){var n,o={},u=(r=void 0!==r?r:{}).grammarSource,l={json:Wt},a=Wt,c="{",i=",",s="}",f=":",p="[",h="]",g="-",d="0",A=".",b='"',v="\\",y="b",m="f",C="n",x="r",E="t",w="u",F="null",S="false",j="true",k=/^[1-9]/,P=/^[0-9]/,O=/^[eE]/,R=/^[+\-]/,$=/^[^\0-\x1F"\\]/,q=/^["\/\\]/,G=/^[0-9a-f]/i,J=/^[ \t\n\r]/,T=Lt("{",!1),U=Lt(",",!1),M=Lt("}",!1),N=Lt(":",!1),I=Lt("[",!1),Y=Lt("]",!1),D=Bt("number literal value"),L=Lt("-",!1),z=Lt("0",!1),B=zt([["1","9"]],!1,!1),H=zt([["0","9"]],!1,!1),K=Lt(".",!1),Q=zt(["e","E"],!1,!1),V=zt(["+","-"],!1,!1),W=Bt("quoted string literal value"),X=Lt('"',!1),Z=zt([["\0",""],'"',"\\"],!0,!1),_=Lt("\\",!1),tt=zt(['"',"/","\\"],!1,!1),et=Lt("b",!1),rt=Lt("f",!1),nt=Lt("n",!1),ot=Lt("r",!1),ut=Lt("t",!1),lt=Lt("u",!1),at=zt([["0","9"],["a","f"]],!1,!0),ct=Bt("object null literal value"),it=Lt("null",!1),st=Bt("boolean false literal value"),ft=Lt("false",!1),pt=Bt("boolean true literal value"),ht=Lt("true",!1),gt=Bt("whitespace"),dt=zt([" ","\t","\n","\r"],!1,!1),At=Bt("end of file"),bt={type:"any"},vt=function(t,e,r){return t&&e.set("prolog",t+(e.get("prolog")||"")),r&&e.set("epilog",(e.get("epilog")||"")+r),e},yt=function(t,e,r){return r.reduce((t,e)=>{const r=t[t.length-1].get("epilog")||"";return t[t.length-1].set({epilog:r+e[0]}),t.concat([e[1]])},[e])},mt=function(t,e,r){return ee("object").set({prolog:t}).set({epilog:r}).add(e)},Ct=function(t,e,r){return ee("member").add(t.set({epilog:e}),r)},xt=function(t,e,r){return r.reduce((t,e)=>{const r=t[t.length-1].get("epilog")||"";return t[t.length-1].set({epilog:r+e[0]}),t.concat([e[1]])},[e])},Et=function(t,e,r){return ee("array").set({prolog:t}).set({epilog:r}).add(e)},wt=function(t,e,r){return ee("number").set({body:Dt(),value:parseFloat(Dt())})},Ft=function(){return"\b"},St=function(){return"\f"},jt=function(){return"\n"},kt=function(){return"\r"},Pt=function(){return"\t"},Ot=function(t){return String.fromCharCode(parseInt(t,16))},Rt=function(t){return t},$t=function(t){return ee("string").set({body:Dt(),value:t.join("")})},qt=function(){return ee("null").set({body:Dt(),value:null})},Gt=function(){return ee("boolean").set({body:Dt(),value:!1})},Jt=function(){return ee("boolean").set({body:Dt(),value:!0})},Tt=0|r.peg$currPos,Ut=Tt,Mt=[{line:1,column:1}],Nt=Tt,It=r.peg$maxFailExpected||[],Yt=0|r.peg$silentFails;if(r.startRule){if(!(r.startRule in l))throw new Error("Can't start parsing from rule \""+r.startRule+'".');a=l[r.startRule]}function Dt(){return e.substring(Ut,Tt)}function Lt(t,e){return{type:"literal",text:t,ignoreCase:e}}function zt(t,e,r){return{type:"class",parts:t,inverted:e,ignoreCase:r}}function Bt(t){return{type:"other",description:t}}function Ht(t){var r,n=Mt[t];if(n)return n;if(t>=Mt.length)r=Mt.length-1;else for(r=t;!Mt[--r];);for(n={line:(n=Mt[r]).line,column:n.column};r<t;)10===e.charCodeAt(r)?(n.line++,n.column=1):n.column++,r++;return Mt[t]=n,n}function Kt(t,e,r){var n=Ht(t),o=Ht(e),l={source:u,start:{offset:t,line:n.line,column:n.column},end:{offset:e,line:o.line,column:o.column}};return r&&u&&"function"==typeof u.offset&&(l.start=u.offset(l.start),l.end=u.offset(l.end)),l}function Qt(t){Tt<Nt||(Tt>Nt&&(Nt=Tt,It=[]),It.push(t))}function Vt(e,r,n){return new t(t.buildMessage(e,r),e,r,n)}function Wt(){var t,r,n,u;return t=Tt,(r=te())===o&&(r=null),(n=Xt())!==o?((u=te())===o&&(u=null),function(){var t,r;return Yt++,t=Tt,Yt++,e.length>Tt?(r=e.charAt(Tt),Tt++):(r=o,0===Yt&&Qt(bt)),Yt--,r===o?t=void 0:(Tt=t,t=o),Yt--,t===o&&(r=o,0===Yt&&Qt(At)),t}()!==o?(Ut=t,t=vt(r,n,u)):(Tt=t,t=o)):(Tt=t,t=o),t}function Xt(){var t;return(t=function(){var t,r,n,u,l,a,f,p,h,g,d;if(t=Tt,r=Tt,n=Tt,(u=te())===o&&(u=null),123===e.charCodeAt(Tt)?(l=c,Tt++):(l=o,0===Yt&&Qt(T)),l!==o?((a=te())===o&&(a=null),n=u=[u,l,a]):(Tt=n,n=o),(r=n!==o?e.substring(r,Tt):n)!==o){if(n=Tt,(u=Zt())!==o){for(l=[],a=Tt,f=Tt,p=Tt,(h=te())===o&&(h=null),44===e.charCodeAt(Tt)?(g=i,Tt++):(g=o,0===Yt&&Qt(U)),g!==o?((d=te())===o&&(d=null),p=h=[h,g,d]):(Tt=p,p=o),(f=p!==o?e.substring(f,Tt):p)!==o&&(p=Zt())!==o?a=f=[f,p]:(Tt=a,a=o);a!==o;)l.push(a),a=Tt,f=Tt,p=Tt,(h=te())===o&&(h=null),44===e.charCodeAt(Tt)?(g=i,Tt++):(g=o,0===Yt&&Qt(U)),g!==o?((d=te())===o&&(d=null),p=h=[h,g,d]):(Tt=p,p=o),(f=p!==o?e.substring(f,Tt):p)!==o&&(p=Zt())!==o?a=f=[f,p]:(Tt=a,a=o);Ut=n,n=yt(r,u,l)}else Tt=n,n=o;n===o&&(n=null),u=Tt,l=Tt,(a=te())===o&&(a=null),125===e.charCodeAt(Tt)?(f=s,Tt++):(f=o,0===Yt&&Qt(M)),f!==o?((p=te())===o&&(p=null),l=a=[a,f,p]):(Tt=l,l=o),(u=l!==o?e.substring(u,Tt):l)!==o?(Ut=t,t=mt(r,n,u)):(Tt=t,t=o)}else Tt=t,t=o;return t}())===o&&(t=function(){var t,r,n,u,l,a,c,s,f,g,d;if(t=Tt,r=Tt,n=Tt,(u=te())===o&&(u=null),91===e.charCodeAt(Tt)?(l=p,Tt++):(l=o,0===Yt&&Qt(I)),l!==o?((a=te())===o&&(a=null),n=u=[u,l,a]):(Tt=n,n=o),(r=n!==o?e.substring(r,Tt):n)!==o){if(n=Tt,(u=Xt())!==o){for(l=[],a=Tt,c=Tt,s=Tt,(f=te())===o&&(f=null),44===e.charCodeAt(Tt)?(g=i,Tt++):(g=o,0===Yt&&Qt(U)),g!==o?((d=te())===o&&(d=null),s=f=[f,g,d]):(Tt=s,s=o),(c=s!==o?e.substring(c,Tt):s)!==o&&(s=Xt())!==o?a=c=[c,s]:(Tt=a,a=o);a!==o;)l.push(a),a=Tt,c=Tt,s=Tt,(f=te())===o&&(f=null),44===e.charCodeAt(Tt)?(g=i,Tt++):(g=o,0===Yt&&Qt(U)),g!==o?((d=te())===o&&(d=null),s=f=[f,g,d]):(Tt=s,s=o),(c=s!==o?e.substring(c,Tt):s)!==o&&(s=Xt())!==o?a=c=[c,s]:(Tt=a,a=o);Ut=n,n=xt(r,u,l)}else Tt=n,n=o;n===o&&(n=null),u=Tt,l=Tt,(a=te())===o&&(a=null),93===e.charCodeAt(Tt)?(c=h,Tt++):(c=o,0===Yt&&Qt(Y)),c!==o?((s=te())===o&&(s=null),l=a=[a,c,s]):(Tt=l,l=o),(u=l!==o?e.substring(u,Tt):l)!==o?(Ut=t,t=Et(r,n,u)):(Tt=t,t=o)}else Tt=t,t=o;return t}())===o&&(t=function(){var t,r,n,u,l,a,c,i,s;if(Yt++,t=Tt,45===e.charCodeAt(Tt)?(r=g,Tt++):(r=o,0===Yt&&Qt(L)),r===o&&(r=null),48===e.charCodeAt(Tt)?(n=d,Tt++):(n=o,0===Yt&&Qt(z)),n===o)if(n=Tt,u=e.charAt(Tt),k.test(u)?Tt++:(u=o,0===Yt&&Qt(B)),u!==o){for(l=[],a=e.charAt(Tt),P.test(a)?Tt++:(a=o,0===Yt&&Qt(H));a!==o;)l.push(a),a=e.charAt(Tt),P.test(a)?Tt++:(a=o,0===Yt&&Qt(H));n=u=[u,l]}else Tt=n,n=o;if(n!==o){if(u=Tt,46===e.charCodeAt(Tt)?(l=A,Tt++):(l=o,0===Yt&&Qt(K)),l!==o){if(a=[],c=e.charAt(Tt),P.test(c)?Tt++:(c=o,0===Yt&&Qt(H)),c!==o)for(;c!==o;)a.push(c),c=e.charAt(Tt),P.test(c)?Tt++:(c=o,0===Yt&&Qt(H));else a=o;a!==o?u=l=[l,a]:(Tt=u,u=o)}else Tt=u,u=o;if(u===o&&(u=null),l=Tt,a=e.charAt(Tt),O.test(a)?Tt++:(a=o,0===Yt&&Qt(Q)),a!==o){if(c=e.charAt(Tt),R.test(c)?Tt++:(c=o,0===Yt&&Qt(V)),c===o&&(c=null),i=[],s=e.charAt(Tt),P.test(s)?Tt++:(s=o,0===Yt&&Qt(H)),s!==o)for(;s!==o;)i.push(s),s=e.charAt(Tt),P.test(s)?Tt++:(s=o,0===Yt&&Qt(H));else i=o;i!==o?l=a=[a,c,i]:(Tt=l,l=o)}else Tt=l,l=o;l===o&&(l=null),Ut=t,t=wt(n,u,l)}else Tt=t,t=o;return Yt--,t===o&&(r=o,0===Yt&&Qt(D)),t}())===o&&(t=_t())===o&&(t=function(){var t,r;return Yt++,t=Tt,e.substr(Tt,4)===F?(r=F,Tt+=4):(r=o,0===Yt&&Qt(it)),r!==o&&(Ut=t,r=qt()),Yt--,(t=r)===o&&(r=o,0===Yt&&Qt(ct)),t}())===o&&(t=function(){var t,r;return Yt++,t=Tt,e.substr(Tt,5)===S?(r=S,Tt+=5):(r=o,0===Yt&&Qt(ft)),r!==o&&(Ut=t,r=Gt()),Yt--,(t=r)===o&&(r=o,0===Yt&&Qt(st)),t}())===o&&(t=function(){var t,r;return Yt++,t=Tt,e.substr(Tt,4)===j?(r=j,Tt+=4):(r=o,0===Yt&&Qt(ht)),r!==o&&(Ut=t,r=Jt()),Yt--,(t=r)===o&&(r=o,0===Yt&&Qt(pt)),t}()),t}function Zt(){var t,r,n,u,l,a,c;return t=Tt,(r=_t())!==o?(n=Tt,u=Tt,(l=te())===o&&(l=null),58===e.charCodeAt(Tt)?(a=f,Tt++):(a=o,0===Yt&&Qt(N)),a!==o?((c=te())===o&&(c=null),u=l=[l,a,c]):(Tt=u,u=o),(n=u!==o?e.substring(n,Tt):u)!==o&&(u=Xt())!==o?(Ut=t,t=Ct(r,n,u)):(Tt=t,t=o)):(Tt=t,t=o),t}function _t(){var t,r,n,u,l,a,c,i,s,f,p,h,g;if(Yt++,t=Tt,34===e.charCodeAt(Tt)?(r=b,Tt++):(r=o,0===Yt&&Qt(X)),r!==o){for(n=[],u=e.charAt(Tt),$.test(u)?Tt++:(u=o,0===Yt&&Qt(Z)),u===o&&(u=Tt,92===e.charCodeAt(Tt)?(l=v,Tt++):(l=o,0===Yt&&Qt(_)),l!==o?(a=e.charAt(Tt),q.test(a)?Tt++:(a=o,0===Yt&&Qt(tt)),a===o&&(a=Tt,98===e.charCodeAt(Tt)?(c=y,Tt++):(c=o,0===Yt&&Qt(et)),c!==o&&(Ut=a,c=Ft()),(a=c)===o&&(a=Tt,102===e.charCodeAt(Tt)?(c=m,Tt++):(c=o,0===Yt&&Qt(rt)),c!==o&&(Ut=a,c=St()),(a=c)===o&&(a=Tt,110===e.charCodeAt(Tt)?(c=C,Tt++):(c=o,0===Yt&&Qt(nt)),c!==o&&(Ut=a,c=jt()),(a=c)===o&&(a=Tt,114===e.charCodeAt(Tt)?(c=x,Tt++):(c=o,0===Yt&&Qt(ot)),c!==o&&(Ut=a,c=kt()),(a=c)===o&&(a=Tt,116===e.charCodeAt(Tt)?(c=E,Tt++):(c=o,0===Yt&&Qt(ut)),c!==o&&(Ut=a,c=Pt()),(a=c)===o&&(a=Tt,117===e.charCodeAt(Tt)?(c=w,Tt++):(c=o,0===Yt&&Qt(lt)),c!==o?(i=Tt,s=Tt,f=e.charAt(Tt),G.test(f)?Tt++:(f=o,0===Yt&&Qt(at)),f!==o?(p=e.charAt(Tt),G.test(p)?Tt++:(p=o,0===Yt&&Qt(at)),p!==o?(h=e.charAt(Tt),G.test(h)?Tt++:(h=o,0===Yt&&Qt(at)),h!==o?(g=e.charAt(Tt),G.test(g)?Tt++:(g=o,0===Yt&&Qt(at)),g!==o?s=f=[f,p,h,g]:(Tt=s,s=o)):(Tt=s,s=o)):(Tt=s,s=o)):(Tt=s,s=o),(i=s!==o?e.substring(i,Tt):s)!==o?(Ut=a,a=Ot(i)):(Tt=a,a=o)):(Tt=a,a=o))))))),a!==o?(Ut=u,u=Rt(a)):(Tt=u,u=o)):(Tt=u,u=o));u!==o;)n.push(u),u=e.charAt(Tt),$.test(u)?Tt++:(u=o,0===Yt&&Qt(Z)),u===o&&(u=Tt,92===e.charCodeAt(Tt)?(l=v,Tt++):(l=o,0===Yt&&Qt(_)),l!==o?(a=e.charAt(Tt),q.test(a)?Tt++:(a=o,0===Yt&&Qt(tt)),a===o&&(a=Tt,98===e.charCodeAt(Tt)?(c=y,Tt++):(c=o,0===Yt&&Qt(et)),c!==o&&(Ut=a,c=Ft()),(a=c)===o&&(a=Tt,102===e.charCodeAt(Tt)?(c=m,Tt++):(c=o,0===Yt&&Qt(rt)),c!==o&&(Ut=a,c=St()),(a=c)===o&&(a=Tt,110===e.charCodeAt(Tt)?(c=C,Tt++):(c=o,0===Yt&&Qt(nt)),c!==o&&(Ut=a,c=jt()),(a=c)===o&&(a=Tt,114===e.charCodeAt(Tt)?(c=x,Tt++):(c=o,0===Yt&&Qt(ot)),c!==o&&(Ut=a,c=kt()),(a=c)===o&&(a=Tt,116===e.charCodeAt(Tt)?(c=E,Tt++):(c=o,0===Yt&&Qt(ut)),c!==o&&(Ut=a,c=Pt()),(a=c)===o&&(a=Tt,117===e.charCodeAt(Tt)?(c=w,Tt++):(c=o,0===Yt&&Qt(lt)),c!==o?(i=Tt,s=Tt,f=e.charAt(Tt),G.test(f)?Tt++:(f=o,0===Yt&&Qt(at)),f!==o?(p=e.charAt(Tt),G.test(p)?Tt++:(p=o,0===Yt&&Qt(at)),p!==o?(h=e.charAt(Tt),G.test(h)?Tt++:(h=o,0===Yt&&Qt(at)),h!==o?(g=e.charAt(Tt),G.test(g)?Tt++:(g=o,0===Yt&&Qt(at)),g!==o?s=f=[f,p,h,g]:(Tt=s,s=o)):(Tt=s,s=o)):(Tt=s,s=o)):(Tt=s,s=o),(i=s!==o?e.substring(i,Tt):s)!==o?(Ut=a,a=Ot(i)):(Tt=a,a=o)):(Tt=a,a=o))))))),a!==o?(Ut=u,u=Rt(a)):(Tt=u,u=o)):(Tt=u,u=o));34===e.charCodeAt(Tt)?(u=b,Tt++):(u=o,0===Yt&&Qt(X)),u!==o?(Ut=t,t=$t(n)):(Tt=t,t=o)}else Tt=t,t=o;return Yt--,t===o&&(r=o,0===Yt&&Qt(W)),t}function te(){var t,r;if(Yt++,t=[],r=e.charAt(Tt),J.test(r)?Tt++:(r=o,0===Yt&&Qt(dt)),r!==o)for(;r!==o;)t.push(r),r=e.charAt(Tt),J.test(r)?Tt++:(r=o,0===Yt&&Qt(dt));else t=o;return Yt--,t===o&&(r=o,0===Yt&&Qt(gt)),t}var ee=r.util.makeAST(function(){return Kt(Ut,Tt)},r);if(n=a(),r.peg$library)return{peg$result:n,peg$currPos:Tt,peg$FAILED:o,peg$maxFailExpected:It,peg$maxFailPos:Nt};if(n!==o&&Tt===e.length)return n;throw n!==o&&Tt<e.length&&Qt({type:"end"}),Vt(It,Nt<e.length?e.charAt(Nt):null,Nt<e.length?Kt(Nt,Nt+1):Kt(Nt,Nt))}}}();class JsonAsty{static parse(t){if("string"!=typeof t)throw new Error("invalid JSON argument (expected type string)");const e=new ASTY,r=PEGUtil.parse(PEGparser,t,{startRule:"json",makeAST:(t,r,n,o)=>e.create.apply(e,o).pos(t,r,n)});if(null!==r.error)throw new Error("parse: JSON parsing failure:\n"+PEGUtil.errorMessage(r.error,!0).replace(/^/gm,"ERROR: ")+"\n");return r.ast}static dump(t,e={}){let r;return r=(e=Object.assign({},{colors:!1},e)).colors?t.dump(1/0,(t,e)=>{switch(t){case"tree":e=chalk.grey(e);break;case"type":e=chalk.blue(e);break;case"value":e=chalk.yellow(e);break;case"position":e=chalk.grey(e)}return e}):t.dump(1/0)}static unparse(t){if("object"!=typeof t)throw new Error("generate: invalid AST argument (expected type object)");let e="";return t.walk((t,r,n,o)=>{if("downward"===o){const r=t.get("prolog");void 0!==r&&(e+=r);const n=t.get("body");if(void 0!==n)e+=n;else{const r=t.get("value");void 0!==r&&(e+=JSON.stringify(r))}}else if("upward"===o){const r=t.get("epilog");void 0!==r&&(e+=r)}},"both"),e}}module.exports=JsonAsty;
44
+ "use strict";const ASTY=_dereq_("asty-astq"),PEGUtil=_dereq_("pegjs-util"),chalk=_dereq_("chalk"),PEGparser=function(){class e extends SyntaxError{constructor(e,t,r,n){super(e),this.expected=t,this.found=r,this.location=n,this.name="SyntaxError"}format(e){let t="Error: "+this.message;if(this.location){let r=null;const n=e.find(e=>e.source===this.location.source);n&&(r=n.text.split(/\r\n|\n|\r/g));const l=this.location.start,o=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(l):l,s=this.location.source+":"+o.line+":"+o.column;if(r){const e=this.location.end,n="".padEnd(o.line.toString().length," "),a=r[l.line-1],u=(l.line===e.line?e.column:a.length+1)-l.column||1;t+="\n --\x3e "+s+"\n"+n+" |\n"+o.line+" | "+a+"\n"+n+" | "+"".padEnd(l.column-1," ")+"".padEnd(u,"^")}else t+="\n at "+s}return t}static buildMessage(e,t){function r(e){return e.codePointAt(0).toString(16).toUpperCase()}const n=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function l(e){return n?e.replace(n,e=>"\\u{"+r(e)+"}"):e}function o(e){return l(e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,e=>"\\x0"+r(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+r(e)))}function s(e){return l(e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,e=>"\\x0"+r(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+r(e)))}const a={literal:e=>'"'+o(e.text)+'"',class(e){const t=e.parts.map(e=>Array.isArray(e)?s(e[0])+"-"+s(e[1]):s(e));return"["+(e.inverted?"^":"")+t.join("")+"]"+(e.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:e=>e.description};function u(e){return a[e.type](e)}return"Expected "+function(e){const t=e.map(u);if(t.sort(),t.length>0){let e=1;for(let r=1;r<t.length;r++)t[r-1]!==t[r]&&(t[e]=t[r],e++);t.length=e}switch(t.length){case 1:return t[0];case 2:return t[0]+" or "+t[1];default:return t.slice(0,-1).join(", ")+", or "+t[t.length-1]}}(e)+" but "+function(e){return e?'"'+o(e)+'"':"end of input"}(t)+" found."}}return{StartRules:["json"],SyntaxError:e,parse:function(t,r){const n={},l=(r=void 0!==r?r:{}).grammarSource,o={json:Ge};let s=Ge;const a="{",u=",",c="}",i=":",p="[",f="]",h="-",g="0",d=".",A='"',b="\\",y="b",m="f",x="n",C="r",v="t",E="u",w="null",S="false",F="true",j=/^[1-9]/,k=/^[0-9]/,P=/^[eE]/,R=/^[+\-]/,$=/^[^\0-\x1F"\\]/,O=/^["\/\\]/,q=/^[0-9a-f]/i,G=/^[ \t\n\r]/,J=je("{",!1),M=je(",",!1),T=je("}",!1),U=je(":",!1),N=je("[",!1),I=je("]",!1),Y=Pe("number literal value"),D=je("-",!1),L=je("0",!1),z=ke([["1","9"]],!1,!1,!1),B=ke([["0","9"]],!1,!1,!1),H=je(".",!1),K=ke(["e","E"],!1,!1,!1),Q=ke(["+","-"],!1,!1,!1),V=Pe("quoted string literal value"),W=je('"',!1),X=ke([["\0",""],'"',"\\"],!0,!1,!1),Z=je("\\",!1),_=ke(['"',"/","\\"],!1,!1,!1),ee=je("b",!1),te=je("f",!1),re=je("n",!1),ne=je("r",!1),le=je("t",!1),oe=je("u",!1),se=ke([["0","9"],["a","f"]],!1,!0,!1),ae=Pe("object null literal value"),ue=je("null",!1),ce=Pe("boolean false literal value"),ie=je("false",!1),pe=Pe("boolean true literal value"),fe=je("true",!1),he=Pe("whitespace"),ge=ke([" ","\t","\n","\r"],!1,!1,!1),de=Pe("end of file"),Ae={type:"any"};function be(e){return String.fromCharCode(parseInt(e,16))}function ye(e){return e}let me=0|r.peg$currPos,xe=me;const Ce=[{line:1,column:1}];let ve,Ee=me,we=r.peg$maxFailExpected||[],Se=0|r.peg$silentFails;if(r.startRule){if(!(r.startRule in o))throw new Error("Can't start parsing from rule \""+r.startRule+'".');s=o[r.startRule]}function Fe(){return t.substring(xe,me)}function je(e,t){return{type:"literal",text:e,ignoreCase:t}}function ke(e,t,r,n){return{type:"class",parts:e,inverted:t,ignoreCase:r,unicode:n}}function Pe(e){return{type:"other",description:e}}function Re(e){let r,n=Ce[e];if(n)return n;if(e>=Ce.length)r=Ce.length-1;else for(r=e;!Ce[--r];);for(n={line:(n=Ce[r]).line,column:n.column};r<e;)10===t.charCodeAt(r)?(n.line++,n.column=1):n.column++,r++;return Ce[e]=n,n}function $e(e,t,r){const n=Re(e),o=Re(t),s={source:l,start:{offset:e,line:n.line,column:n.column},end:{offset:t,line:o.line,column:o.column}};return r&&l&&"function"==typeof l.offset&&(s.start=l.offset(s.start),s.end=l.offset(s.end)),s}function Oe(e){me<Ee||(me>Ee&&(Ee=me,we=[]),we.push(e))}function qe(t,r,n){return new e(e.buildMessage(t,r),t,r,n)}function Ge(){let e,r,l,o,s;var a,u,c;return e=me,(r=Ue())===n&&(r=null),(l=Je())!==n?((o=Ue())===n&&(o=null),(s=function(){let e,r;return Se++,e=me,Se++,t.length>me?(r=t.charAt(me),me++):(r=n,0===Se&&Oe(Ae)),Se--,r===n?e=void 0:(me=e,e=n),Se--,e===n&&(r=n,0===Se&&Oe(de)),e}())!==n?(xe=e,u=l,c=o,(a=r)&&u.set("prolog",a+(u.get("prolog")||"")),c&&u.set("epilog",(u.get("epilog")||"")+c),e=u):(me=e,e=n)):(me=e,e=n),e}function Je(){let e;return(e=function(){let e,r,l,o,s,i,p,f,h,g,d;if(e=me,r=me,l=me,(o=Ue())===n&&(o=null),123===t.charCodeAt(me)?(s=a,me++):(s=n,0===Se&&Oe(J)),s!==n?((i=Ue())===n&&(i=null),l=o=[o,s,i]):(me=l,l=n),(r=l!==n?t.substring(r,me):l)!==n){if(l=me,(o=Me())!==n){for(s=[],i=me,p=me,f=me,(h=Ue())===n&&(h=null),44===t.charCodeAt(me)?(g=u,me++):(g=n,0===Se&&Oe(M)),g!==n?((d=Ue())===n&&(d=null),f=h=[h,g,d]):(me=f,f=n),(p=f!==n?t.substring(p,me):f)!==n&&(f=Me())!==n?i=p=[p,f]:(me=i,i=n);i!==n;)s.push(i),i=me,p=me,f=me,(h=Ue())===n&&(h=null),44===t.charCodeAt(me)?(g=u,me++):(g=n,0===Se&&Oe(M)),g!==n?((d=Ue())===n&&(d=null),f=h=[h,g,d]):(me=f,f=n),(p=f!==n?t.substring(p,me):f)!==n&&(f=Me())!==n?i=p=[p,f]:(me=i,i=n);xe=l,m=o,l=s.reduce((e,t)=>{const r=e[e.length-1].get("epilog")||"";return e[e.length-1].set({epilog:r+t[0]}),e.concat([t[1]])},[m])}else me=l,l=n;l===n&&(l=null),o=me,s=me,(i=Ue())===n&&(i=null),125===t.charCodeAt(me)?(p=c,me++):(p=n,0===Se&&Oe(T)),p!==n?((f=Ue())===n&&(f=null),s=i=[i,p,f]):(me=s,s=n),(o=s!==n?t.substring(o,me):s)!==n?(xe=e,A=r,b=l,y=o,e=Ne("object").set({prolog:A}).set({epilog:y}).add(b)):(me=e,e=n)}else me=e,e=n;var A,b,y,m;return e}())===n&&(e=function(){let e,r,l,o,s,a,c,i,h,g,d;if(e=me,r=me,l=me,(o=Ue())===n&&(o=null),91===t.charCodeAt(me)?(s=p,me++):(s=n,0===Se&&Oe(N)),s!==n?((a=Ue())===n&&(a=null),l=o=[o,s,a]):(me=l,l=n),(r=l!==n?t.substring(r,me):l)!==n){if(l=me,(o=Je())!==n){for(s=[],a=me,c=me,i=me,(h=Ue())===n&&(h=null),44===t.charCodeAt(me)?(g=u,me++):(g=n,0===Se&&Oe(M)),g!==n?((d=Ue())===n&&(d=null),i=h=[h,g,d]):(me=i,i=n),(c=i!==n?t.substring(c,me):i)!==n&&(i=Je())!==n?a=c=[c,i]:(me=a,a=n);a!==n;)s.push(a),a=me,c=me,i=me,(h=Ue())===n&&(h=null),44===t.charCodeAt(me)?(g=u,me++):(g=n,0===Se&&Oe(M)),g!==n?((d=Ue())===n&&(d=null),i=h=[h,g,d]):(me=i,i=n),(c=i!==n?t.substring(c,me):i)!==n&&(i=Je())!==n?a=c=[c,i]:(me=a,a=n);xe=l,m=o,l=s.reduce((e,t)=>{const r=e[e.length-1].get("epilog")||"";return e[e.length-1].set({epilog:r+t[0]}),e.concat([t[1]])},[m])}else me=l,l=n;l===n&&(l=null),o=me,s=me,(a=Ue())===n&&(a=null),93===t.charCodeAt(me)?(c=f,me++):(c=n,0===Se&&Oe(I)),c!==n?((i=Ue())===n&&(i=null),s=a=[a,c,i]):(me=s,s=n),(o=s!==n?t.substring(o,me):s)!==n?(xe=e,A=r,b=l,y=o,e=Ne("array").set({prolog:A}).set({epilog:y}).add(b)):(me=e,e=n)}else me=e,e=n;var A,b,y,m;return e}())===n&&(e=function(){let e,r,l,o,s,a,u,c,i;if(Se++,e=me,45===t.charCodeAt(me)?(r=h,me++):(r=n,0===Se&&Oe(D)),r===n&&(r=null),48===t.charCodeAt(me)?(l=g,me++):(l=n,0===Se&&Oe(L)),l===n)if(l=me,o=t.charAt(me),j.test(o)?me++:(o=n,0===Se&&Oe(z)),o!==n){for(s=[],a=t.charAt(me),k.test(a)?me++:(a=n,0===Se&&Oe(B));a!==n;)s.push(a),a=t.charAt(me),k.test(a)?me++:(a=n,0===Se&&Oe(B));l=o=[o,s]}else me=l,l=n;if(l!==n){if(o=me,46===t.charCodeAt(me)?(s=d,me++):(s=n,0===Se&&Oe(H)),s!==n){if(a=[],u=t.charAt(me),k.test(u)?me++:(u=n,0===Se&&Oe(B)),u!==n)for(;u!==n;)a.push(u),u=t.charAt(me),k.test(u)?me++:(u=n,0===Se&&Oe(B));else a=n;a!==n?o=s=[s,a]:(me=o,o=n)}else me=o,o=n;if(o===n&&(o=null),s=me,a=t.charAt(me),P.test(a)?me++:(a=n,0===Se&&Oe(K)),a!==n){if(u=t.charAt(me),R.test(u)?me++:(u=n,0===Se&&Oe(Q)),u===n&&(u=null),c=[],i=t.charAt(me),k.test(i)?me++:(i=n,0===Se&&Oe(B)),i!==n)for(;i!==n;)c.push(i),i=t.charAt(me),k.test(i)?me++:(i=n,0===Se&&Oe(B));else c=n;c!==n?s=a=[a,u,c]:(me=s,s=n)}else me=s,s=n;s===n&&(s=null),xe=e,e=Ne("number").set({body:Fe(),value:parseFloat(Fe())})}else me=e,e=n;return Se--,e===n&&(r=n,0===Se&&Oe(Y)),e}())===n&&(e=Te())===n&&(e=function(){let e,r;return Se++,e=me,t.substr(me,4)===w?(r=w,me+=4):(r=n,0===Se&&Oe(ue)),r!==n&&(xe=e,r=Ne("null").set({body:Fe(),value:null})),Se--,(e=r)===n&&(r=n,0===Se&&Oe(ae)),e}())===n&&(e=function(){let e,r;return Se++,e=me,t.substr(me,5)===S?(r=S,me+=5):(r=n,0===Se&&Oe(ie)),r!==n&&(xe=e,r=Ne("boolean").set({body:Fe(),value:!1})),Se--,(e=r)===n&&(r=n,0===Se&&Oe(ce)),e}())===n&&(e=function(){let e,r;return Se++,e=me,t.substr(me,4)===F?(r=F,me+=4):(r=n,0===Se&&Oe(fe)),r!==n&&(xe=e,r=Ne("boolean").set({body:Fe(),value:!0})),Se--,(e=r)===n&&(r=n,0===Se&&Oe(pe)),e}()),e}function Me(){let e,r,l,o,s,a,u;var c,p,f;return e=me,(r=Te())!==n?(l=me,o=me,(s=Ue())===n&&(s=null),58===t.charCodeAt(me)?(a=i,me++):(a=n,0===Se&&Oe(U)),a!==n?((u=Ue())===n&&(u=null),o=s=[s,a,u]):(me=o,o=n),(l=o!==n?t.substring(l,me):o)!==n&&(o=Je())!==n?(xe=e,c=r,p=l,f=o,e=Ne("member").add(c.set({epilog:p}),f)):(me=e,e=n)):(me=e,e=n),e}function Te(){let e,r,l,o,s,a,u,c,i,p,f,h,g;if(Se++,e=me,34===t.charCodeAt(me)?(r=A,me++):(r=n,0===Se&&Oe(W)),r!==n){for(l=[],o=t.charAt(me),$.test(o)?me++:(o=n,0===Se&&Oe(X)),o===n&&(o=me,92===t.charCodeAt(me)?(s=b,me++):(s=n,0===Se&&Oe(Z)),s!==n?(a=t.charAt(me),O.test(a)?me++:(a=n,0===Se&&Oe(_)),a===n&&(a=me,98===t.charCodeAt(me)?(u=y,me++):(u=n,0===Se&&Oe(ee)),u!==n&&(xe=a,u="\b"),(a=u)===n&&(a=me,102===t.charCodeAt(me)?(u=m,me++):(u=n,0===Se&&Oe(te)),u!==n&&(xe=a,u="\f"),(a=u)===n&&(a=me,110===t.charCodeAt(me)?(u=x,me++):(u=n,0===Se&&Oe(re)),u!==n&&(xe=a,u="\n"),(a=u)===n&&(a=me,114===t.charCodeAt(me)?(u=C,me++):(u=n,0===Se&&Oe(ne)),u!==n&&(xe=a,u="\r"),(a=u)===n&&(a=me,116===t.charCodeAt(me)?(u=v,me++):(u=n,0===Se&&Oe(le)),u!==n&&(xe=a,u="\t"),(a=u)===n&&(a=me,117===t.charCodeAt(me)?(u=E,me++):(u=n,0===Se&&Oe(oe)),u!==n?(c=me,i=me,p=t.charAt(me),q.test(p)?me++:(p=n,0===Se&&Oe(se)),p!==n?(f=t.charAt(me),q.test(f)?me++:(f=n,0===Se&&Oe(se)),f!==n?(h=t.charAt(me),q.test(h)?me++:(h=n,0===Se&&Oe(se)),h!==n?(g=t.charAt(me),q.test(g)?me++:(g=n,0===Se&&Oe(se)),g!==n?i=p=[p,f,h,g]:(me=i,i=n)):(me=i,i=n)):(me=i,i=n)):(me=i,i=n),(c=i!==n?t.substring(c,me):i)!==n?(xe=a,a=be(c)):(me=a,a=n)):(me=a,a=n))))))),a!==n?(xe=o,o=ye(a)):(me=o,o=n)):(me=o,o=n));o!==n;)l.push(o),o=t.charAt(me),$.test(o)?me++:(o=n,0===Se&&Oe(X)),o===n&&(o=me,92===t.charCodeAt(me)?(s=b,me++):(s=n,0===Se&&Oe(Z)),s!==n?(a=t.charAt(me),O.test(a)?me++:(a=n,0===Se&&Oe(_)),a===n&&(a=me,98===t.charCodeAt(me)?(u=y,me++):(u=n,0===Se&&Oe(ee)),u!==n&&(xe=a,u="\b"),(a=u)===n&&(a=me,102===t.charCodeAt(me)?(u=m,me++):(u=n,0===Se&&Oe(te)),u!==n&&(xe=a,u="\f"),(a=u)===n&&(a=me,110===t.charCodeAt(me)?(u=x,me++):(u=n,0===Se&&Oe(re)),u!==n&&(xe=a,u="\n"),(a=u)===n&&(a=me,114===t.charCodeAt(me)?(u=C,me++):(u=n,0===Se&&Oe(ne)),u!==n&&(xe=a,u="\r"),(a=u)===n&&(a=me,116===t.charCodeAt(me)?(u=v,me++):(u=n,0===Se&&Oe(le)),u!==n&&(xe=a,u="\t"),(a=u)===n&&(a=me,117===t.charCodeAt(me)?(u=E,me++):(u=n,0===Se&&Oe(oe)),u!==n?(c=me,i=me,p=t.charAt(me),q.test(p)?me++:(p=n,0===Se&&Oe(se)),p!==n?(f=t.charAt(me),q.test(f)?me++:(f=n,0===Se&&Oe(se)),f!==n?(h=t.charAt(me),q.test(h)?me++:(h=n,0===Se&&Oe(se)),h!==n?(g=t.charAt(me),q.test(g)?me++:(g=n,0===Se&&Oe(se)),g!==n?i=p=[p,f,h,g]:(me=i,i=n)):(me=i,i=n)):(me=i,i=n)):(me=i,i=n),(c=i!==n?t.substring(c,me):i)!==n?(xe=a,a=be(c)):(me=a,a=n)):(me=a,a=n))))))),a!==n?(xe=o,o=ye(a)):(me=o,o=n)):(me=o,o=n));34===t.charCodeAt(me)?(o=A,me++):(o=n,0===Se&&Oe(W)),o!==n?(xe=e,d=l,e=Ne("string").set({body:Fe(),value:d.join("")})):(me=e,e=n)}else me=e,e=n;var d;return Se--,e===n&&(r=n,0===Se&&Oe(V)),e}function Ue(){let e,r;if(Se++,e=[],r=t.charAt(me),G.test(r)?me++:(r=n,0===Se&&Oe(ge)),r!==n)for(;r!==n;)e.push(r),r=t.charAt(me),G.test(r)?me++:(r=n,0===Se&&Oe(ge));else e=n;return Se--,e===n&&(r=n,0===Se&&Oe(he)),e}var Ne=r.util.makeAST(function(){return $e(xe,me)},r);const Ie=(ve=s())!==n&&me===t.length;function Ye(){throw ve!==n&&me<t.length&&Oe({type:"end"}),qe(we,Ee<t.length?function(e=me){const r=t.codePointAt(e);return void 0===r?"":String.fromCodePoint(r)}(Ee):null,Ee<t.length?$e(Ee,Ee+1):$e(Ee,Ee))}return r.peg$library?{peg$result:ve,peg$currPos:me,peg$FAILED:n,peg$maxFailExpected:we,peg$maxFailPos:Ee,peg$success:Ie,peg$throw:Ie?void 0:Ye}:Ie?ve:void Ye()}}}();class JsonAsty{static parse(e){if("string"!=typeof e)throw new Error("invalid JSON argument (expected type string)");const t=new ASTY,r=PEGUtil.parse(PEGparser,e,{startRule:"json",makeAST:(e,r,n,l)=>t.create.apply(t,l).pos(e,r,n)});if(null!==r.error)throw new Error("parse: JSON parsing failure:\n"+PEGUtil.errorMessage(r.error,!0).replace(/^/gm,"ERROR: ")+"\n");return r.ast}static dump(e,t={}){let r;return r=(t=Object.assign({},{colors:!1},t)).colors?e.dump(1/0,(e,t)=>{switch(e){case"tree":t=chalk.grey(t);break;case"type":t=chalk.blue(t);break;case"value":t=chalk.yellow(t);break;case"position":t=chalk.grey(t)}return t}):e.dump(1/0)}static unparse(e){if("object"!=typeof e)throw new Error("generate: invalid AST argument (expected type object)");let t="";return e.walk((e,r,n,l)=>{if("downward"===l){const r=e.get("prolog");void 0!==r&&(t+=r);const n=e.get("body");if(void 0!==n)t+=n;else{const r=e.get("value");void 0!==r&&(t+=JSON.stringify(r))}}else if("upward"===l){const r=e.get("epilog");void 0!==r&&(t+=r)}},"both"),t}}module.exports=JsonAsty;
45
45
  },{"asty-astq":"asty-astq","chalk":2,"pegjs-util":"pegjs-util"}]},{},[10])(10)
46
46
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-asty",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "Lossless JSON-to-AST Parser and AST-to-JSON Generator",
5
5
  "keywords": [ "json", "ast", "parse", "generate" ],
6
6
  "browser": "lib/json-asty.browser.js",
@@ -21,21 +21,21 @@
21
21
  "bugs": "https://github.com/rse/json-asty/issues",
22
22
  "dependencies": {
23
23
  "asty-astq": "1.14.0",
24
- "pegjs-otf": "2.0.2",
25
- "pegjs-util": "2.0.1",
24
+ "pegjs-otf": "2.0.3",
25
+ "pegjs-util": "2.0.2",
26
26
  "chalk": "4.1.2",
27
27
  "yargs": "17.7.2",
28
- "cli-io": "0.9.11"
28
+ "cli-io": "0.9.13"
29
29
  },
30
30
  "devDependencies": {
31
31
  "grunt": "1.6.1",
32
- "grunt-cli": "1.4.3",
32
+ "grunt-cli": "1.5.0",
33
33
  "grunt-contrib-clean": "2.0.1",
34
34
  "grunt-contrib-watch": "1.1.0",
35
35
  "grunt-eslint": "24.3.0",
36
36
  "grunt-browserify": "6.0.0",
37
37
  "grunt-mocha-test": "0.13.3",
38
- "browserify": "17.0.0",
38
+ "browserify": "17.0.1",
39
39
  "envify": "4.1.0",
40
40
  "babelify": "10.0.0",
41
41
  "uglifyify": "5.0.2",
@@ -43,16 +43,16 @@
43
43
  "browserify-derequire": "1.1.1",
44
44
  "eslint": "8.57.0",
45
45
  "eslint-config-standard": "17.1.0",
46
- "eslint-plugin-promise": "6.1.1",
47
- "eslint-plugin-import": "2.29.1",
46
+ "eslint-plugin-promise": "6.2.0",
47
+ "eslint-plugin-import": "2.31.0",
48
48
  "eslint-plugin-node": "11.1.0",
49
- "@babel/core": "7.24.0",
50
- "@babel/preset-env": "7.24.0",
51
- "@babel/plugin-transform-runtime": "7.24.0",
52
- "mocha": "10.3.0",
53
- "chai": "4.4.1"
49
+ "@babel/core": "7.27.1",
50
+ "@babel/preset-env": "7.27.2",
51
+ "@babel/plugin-transform-runtime": "7.27.1",
52
+ "mocha": "11.2.2",
53
+ "chai": "5.2.0"
54
54
  },
55
- "upd": [ "!chalk" ],
55
+ "upd": [ "!chalk", "!eslint", "!grunt-eslint" ],
56
56
  "scripts": {
57
57
  "prepublishOnly": "grunt default",
58
58
  "build": "grunt default"
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  /*!
3
3
  ** JSON-ASTy -- Lossless JSON-to-AST Parser and AST-to-JSON Generator
4
- ** Copyright (c) 2018-2024 Dr. Ralf S. Engelschall <rse@engelschall.com>
4
+ ** Copyright (c) 2018-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
5
5
  **
6
6
  ** Permission is hereby granted, free of charge, to any person obtaining
7
7
  ** a copy of this software and associated documentation files (the
@@ -67,7 +67,7 @@ const cli = new CLIio({
67
67
  if (argv.version) {
68
68
  process.stderr.write(my.name + " " + my.version + " <" + my.homepage + ">\n")
69
69
  process.stderr.write(my.description + "\n")
70
- process.stderr.write("Copyright (c) 2018-2023 " + my.author.name + " <" + my.author.url + ">\n")
70
+ process.stderr.write("Copyright (c) 2018-2025 " + my.author.name + " <" + my.author.url + ">\n")
71
71
  process.stderr.write("Licensed under " + my.license + " <http://spdx.org/licenses/" + my.license + ".html>\n")
72
72
  process.exit(0)
73
73
  }
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  ** JSON-ASTy -- Lossless JSON-to-AST Parser and AST-to-JSON Generator
3
- ** Copyright (c) 2018-2024 Dr. Ralf S. Engelschall <rse@engelschall.com>
3
+ ** Copyright (c) 2018-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
4
4
  **
5
5
  ** Permission is hereby granted, free of charge, to any person obtaining
6
6
  ** a copy of this software and associated documentation files (the
@@ -23,7 +23,7 @@
23
23
  */
24
24
 
25
25
  declare module "JsonAsty" {
26
- class JsonAsty {
26
+ export default class JsonAsty {
27
27
  /* parse JSON into AST */
28
28
  static parse(json: string): object;
29
29
 
@@ -35,5 +35,3 @@ declare module "JsonAsty" {
35
35
  }
36
36
  }
37
37
 
38
- export = JsonAsty.JsonAsty
39
-
package/src/json-asty.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** JSON-ASTy -- Lossless JSON-to-AST Parser and AST-to-JSON Generator
3
- ** Copyright (c) 2018-2024 Dr. Ralf S. Engelschall <rse@engelschall.com>
3
+ ** Copyright (c) 2018-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
4
4
  **
5
5
  ** Permission is hereby granted, free of charge, to any person obtaining
6
6
  ** a copy of this software and associated documentation files (the
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  ** JSON-ASTy -- Lossless JSON-to-AST Parser and AST-to-JSON Generator
3
- ** Copyright (c) 2018-2024 Dr. Ralf S. Engelschall <rse@engelschall.com>
3
+ ** Copyright (c) 2018-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
4
4
  **
5
5
  ** Permission is hereby granted, free of charge, to any person obtaining
6
6
  ** a copy of this software and associated documentation files (the
package/tst/json-asty.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  ** JSON-ASTy -- Lossless JSON-to-AST Parser and AST-to-JSON Generator
3
- ** Copyright (c) 2018-2024 Dr. Ralf S. Engelschall <rse@engelschall.com>
3
+ ** Copyright (c) 2018-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
4
4
  **
5
5
  ** Permission is hereby granted, free of charge, to any person obtaining
6
6
  ** a copy of this software and associated documentation files (the