New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@gram-data/gram-parse

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gram-data/gram-parse - npm Package Compare versions

Comparing version 0.3.9-alpha.2 to 0.3.9

2

dist/gram-parse.umd.production.min.js

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e=e||self).gram=e.gram||{},e.gram.parse={}))}(this,(function(e){"use strict";var t=function(e){if(e)throw e},n=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},r=Object.prototype.hasOwnProperty,o=Object.prototype.toString,s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===o.call(e)},l=function(e){if(!e||"[object Object]"!==o.call(e))return!1;var t,n=r.call(e,"constructor"),s=e.constructor&&e.constructor.prototype&&r.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!s)return!1;for(t in e);return void 0===t||r.call(e,t)},u=function(e,t){s&&"__proto__"===t.name?s(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},c=function(e,t){if("__proto__"===t){if(!r.call(e,t))return;if(i)return i(e,t).value}return e[t]},f=function e(){var t,n,r,o,s,i,f=arguments[0],p=1,h=arguments.length,m=!1;for("boolean"==typeof f&&(m=f,f=arguments[1]||{},p=2),(null==f||"object"!=typeof f&&"function"!=typeof f)&&(f={});p<h;++p)if(null!=(t=arguments[p]))for(n in t)r=c(f,n),f!==(o=c(t,n))&&(m&&o&&(l(o)||(s=a(o)))?(s?(s=!1,i=r&&a(r)?r:[]):i=r&&l(r)?r:{},u(f,{name:n,newValue:e(m,i,o)})):void 0!==o&&u(f,{name:n,newValue:o}));return f},p=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},h=[].slice,m=function(e,t){var n;return function(){var t,s=h.call(arguments,0),i=e.length>s.length;i&&s.push(r);try{t=e.apply(null,s)}catch(e){if(i&&n)throw e;return r(e)}i||(t&&"function"==typeof t.then?t.then(o,r):t instanceof Error?r(t):o(t))};function r(){n||(n=!0,t.apply(null,arguments))}function o(e){r(null,e)}},y=b;b.wrap=m;var d=[].slice;function b(){var e=[],t={run:function(){var t=-1,n=d.call(arguments,0,-1),r=arguments[arguments.length-1];if("function"!=typeof r)throw new Error("Expected function as last argument, not "+r);function o(s){var i=e[++t],a=d.call(arguments,0),l=a.slice(1),u=n.length,c=-1;if(s)r(s);else{for(;++c<u;)null==l[c]&&(l[c]=n[c]);n=l,i?m(i,o).apply(null,n):r.apply(null,[null].concat(n))}}o.apply(null,[null].concat(n))},use:function(n){if("function"!=typeof n)throw new Error("Expected `fn` to be a function, not "+n);return e.push(n),t}};return t}var g={}.hasOwnProperty,v=function(e){return e&&"object"==typeof e?g.call(e,"position")||g.call(e,"type")?x(e.position):g.call(e,"start")||g.call(e,"end")?x(e):g.call(e,"line")||g.call(e,"column")?w(e):"":""};function w(e){return e&&"object"==typeof e||(e={}),$(e.line)+":"+$(e.column)}function x(e){return e&&"object"==typeof e||(e={}),w(e.start)+"-"+w(e.end)}function $(e){return e&&"number"==typeof e?e:1}var S=P;function k(){}k.prototype=Error.prototype;var E=P.prototype=new k;function P(e,t,n){var r,o,s;"string"==typeof t&&(n=t,t=null),r=function(e){var t,n=[null,null];return"string"==typeof e&&(-1===(t=e.indexOf(":"))?n[1]=e:(n[0]=e.slice(0,t),n[1]=e.slice(t+1))),n}(n),o=v(t)||"1:1",s={start:{line:null,column:null},end:{line:null,column:null}},t&&t.position&&(t=t.position),t&&(t.start?(s=t,t=t.start):s.start=t),e.stack&&(this.stack=e.stack,e=e.message),this.message=e,this.name=o,this.reason=e,this.line=t?t.line:null,this.column=t?t.column:null,this.location=s,this.source=r[0],this.ruleId=r[1]}function _(e){var t,n;return A(e),t=47===e.charCodeAt(0),(n=function(e,t){for(var n,r,o="",s=0,i=-1,a=0,l=-1;++l<=e.length;){if(l<e.length)n=e.charCodeAt(l);else{if(47===n)break;n=47}if(47===n){if(i===l-1||1===a);else if(i!==l-1&&2===a){if(o.length<2||2!==s||46!==o.charCodeAt(o.length-1)||46!==o.charCodeAt(o.length-2))if(o.length>2){if((r=o.lastIndexOf("/"))!==o.length-1){r<0?(o="",s=0):s=(o=o.slice(0,r)).length-1-o.lastIndexOf("/"),i=l,a=0;continue}}else if(o.length){o="",s=0,i=l,a=0;continue}t&&(o=o.length?o+"/..":"..",s=2)}else o.length?o+="/"+e.slice(i+1,l):o=e.slice(i+1,l),s=l-i-1;i=l,a=0}else 46===n&&a>-1?a++:a=-1}return o}(e,!t)).length||t||(n="."),n.length&&47===e.charCodeAt(e.length-1)&&(n+="/"),t?"/"+n:n}function A(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}E.file="",E.name="",E.reason="",E.message="",E.stack="",E.fatal=null,E.column=null,E.line=null;var O=function(e,t){var n,r,o,s,i=0,a=-1;if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');if(A(e),n=e.length,void 0===t||!t.length||t.length>e.length){for(;n--;)if(47===e.charCodeAt(n)){if(o){i=n+1;break}}else a<0&&(o=!0,a=n+1);return a<0?"":e.slice(i,a)}if(t===e)return"";for(r=-1,s=t.length-1;n--;)if(47===e.charCodeAt(n)){if(o){i=n+1;break}}else r<0&&(o=!0,r=n+1),s>-1&&(e.charCodeAt(n)===t.charCodeAt(s--)?s<0&&(a=n):(s=-1,a=r));return i===a?a=r:a<0&&(a=e.length),e.slice(i,a)},j=function(){for(var e,t=-1;++t<arguments.length;)A(arguments[t]),arguments[t]&&(e=void 0===e?arguments[t]:e+"/"+arguments[t]);return void 0===e?".":_(e)},C=N,L={}.hasOwnProperty,R=["history","path","basename","stem","extname","dirname"];function N(e){var t,r;if(e){if("string"==typeof e||n(e))e={contents:e};else if("message"in e&&"messages"in e)return e}else e={};if(!(this instanceof N))return new N(e);for(this.data={},this.messages=[],this.history=[],this.cwd="/",r=-1;++r<R.length;)L.call(e,t=R[r])&&(this[t]=e[t]);for(t in e)R.indexOf(t)<0&&(this[t]=e[t])}function T(e,t){if(e&&e.indexOf("/")>-1)throw new Error("`"+t+"` cannot be a path: did not expect `/`")}function q(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function I(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}N.prototype.toString=function(e){return(this.contents||"").toString(e)},Object.defineProperty(N.prototype,"path",{get:function(){return this.history[this.history.length-1]},set:function(e){q(e,"path"),this.path!==e&&this.history.push(e)}}),Object.defineProperty(N.prototype,"dirname",{get:function(){return"string"==typeof this.path?function(e){var t,n,r;if(A(e),!e.length)return".";for(t=-1,r=e.length;--r;)if(47===e.charCodeAt(r)){if(n){t=r;break}}else n||(n=!0);return t<0?47===e.charCodeAt(0)?"/":".":1===t&&47===e.charCodeAt(0)?"//":e.slice(0,t)}(this.path):void 0},set:function(e){I(this.path,"dirname"),this.path=j(e||"",this.basename)}}),Object.defineProperty(N.prototype,"basename",{get:function(){return"string"==typeof this.path?O(this.path):void 0},set:function(e){q(e,"basename"),T(e,"basename"),this.path=j(this.dirname||"",e)}}),Object.defineProperty(N.prototype,"extname",{get:function(){return"string"==typeof this.path?function(e){var t,n,r,o=-1,s=0,i=-1,a=0;for(A(e),r=e.length;r--;)if(47!==(n=e.charCodeAt(r)))i<0&&(t=!0,i=r+1),46===n?o<0?o=r:1!==a&&(a=1):o>-1&&(a=-1);else if(t){s=r+1;break}return o<0||i<0||0===a||1===a&&o===i-1&&o===s+1?"":e.slice(o,i)}(this.path):void 0},set:function(e){if(T(e,"extname"),I(this.path,"extname"),e){if(46!==e.charCodeAt(0))throw new Error("`extname` must start with `.`");if(e.indexOf(".",1)>-1)throw new Error("`extname` cannot contain multiple dots")}this.path=j(this.dirname,this.stem+(e||""))}}),Object.defineProperty(N.prototype,"stem",{get:function(){return"string"==typeof this.path?O(this.path,this.extname):void 0},set:function(e){q(e,"stem"),T(e,"stem"),this.path=j(this.dirname||"",e+(this.extname||""))}});var B=C;C.prototype.message=function(e,t,n){var r=new S(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r},C.prototype.info=function(){var e=this.message.apply(this,arguments);return e.fatal=null,e},C.prototype.fail=function(){var e=this.message.apply(this,arguments);throw e.fatal=!0,e};var G=B,V=function e(){var n=[],r=y(),o={},s=!1,i=-1;return a.data=function(e,t){return"string"==typeof e?2===arguments.length?(Z("data",s),o[e]=t,a):F.call(o,e)&&o[e]||null:e?(Z("data",s),o=e,a):o},a.freeze=l,a.attachers=n,a.use=function(e){var t;if(Z("use",s),null==e);else if("function"==typeof e)c.apply(null,arguments);else{if("object"!=typeof e)throw new Error("Expected usable value, not `"+e+"`");"length"in e?l(e):r(e)}return t&&(o.settings=f(o.settings||{},t)),a;function r(e){l(e.plugins),e.settings&&(t=f(t||{},e.settings))}function i(e){if("function"==typeof e)c(e);else{if("object"!=typeof e)throw new Error("Expected usable value, not `"+e+"`");"length"in e?c.apply(null,e):r(e)}}function l(e){var t,n;if(null==e);else{if("object"!=typeof e||!("length"in e))throw new Error("Expected a list of plugins, not `"+e+"`");for(t=e.length,n=-1;++n<t;)i(e[n])}}function c(e,t){var r=u(e);r?(p(r[1])&&p(t)&&(t=f(r[1],t)),r[1]=t):n.push(z.call(arguments))}},a.parse=function(e){var t,n=G(e);return l(),U("parse",t=a.Parser),M(t,"parse")?new t(String(n),n).parse():t(String(n),n)},a.stringify=function(e,t){var n,r=G(t);return l(),J("stringify",n=a.Compiler),H(e),M(n,"compile")?new n(e,r).compile():n(e,r)},a.run=c,a.runSync=function(e,n){var r,o=!1;return c(e,n,(function(e,n){o=!0,t(e),r=n})),D("runSync","run",o),r},a.process=h,a.processSync=function(e){var n,r=!1;return l(),U("processSync",a.Parser),J("processSync",a.Compiler),h(n=G(e),(function(e){r=!0,t(e)})),D("processSync","process",r),n},a;function a(){for(var t=e(),r=n.length,s=-1;++s<r;)t.use.apply(null,n[s]);return t.data(f(!0,{},o)),t}function l(){var e,t,o,l;if(s)return a;for(;++i<n.length;)t=(e=n[i])[0],!1!==(o=e[1])&&(!0===o&&(e[1]=void 0),"function"==typeof(l=t.apply(a,e.slice(1)))&&r.use(l));return s=!0,i=Infinity,a}function u(e){for(var t,r=n.length,o=-1;++o<r;)if((t=n[o])[0]===e)return t}function c(e,t,n){if(H(e),l(),n||"function"!=typeof t||(n=t,t=null),!n)return new Promise(o);function o(o,s){r.run(e,G(t),(function(t,r,i){r=r||e,t?s(t):o?o(r):n(null,r,i)}))}o(null,n)}function h(e,t){if(l(),U("process",a.Parser),J("process",a.Compiler),!t)return new Promise(n);function n(n,r){var o=G(e);Q.run(a,{file:o},(function(e){e?r(e):n?n(o):t(null,o)}))}n(null,t)}}().freeze(),z=[].slice,F={}.hasOwnProperty,Q=y().use((function(e,t){t.tree=e.parse(t.file)})).use((function(e,t,n){e.run(t.tree,t.file,(function(e,r,o){e?n(e):(t.tree=r,t.file=o,n())}))})).use((function(e,t){var r=e.stringify(t.tree,t.file),o=t.file;null==r||("string"==typeof r||n(r)?o.contents=r:o.result=r)}));function M(e,t){return"function"==typeof e&&e.prototype&&(function(e){var t;for(t in e)return!0;return!1}(e.prototype)||t in e.prototype)}function U(e,t){if("function"!=typeof t)throw new Error("Cannot `"+e+"` without `Parser`")}function J(e,t){if("function"!=typeof t)throw new Error("Cannot `"+e+"` without `Compiler`")}function Z(e,t){if(t)throw new Error("Cannot invoke `"+e+"` on a frozen processor.\nCreate a new processor first, by invoking it: use `processor()` instead of `processor`.")}function H(e){if(!e||"string"!=typeof e.type)throw new Error("Expected node, got `"+e+"`")}function D(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}var K="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function W(e,t){return e(t={exports:{}},t.exports),t.exports}var X=W((function(e){var t,n;t=K,n=function(){function e(t,n,r){return this.id=++e.highestId,this.name=t,this.symbols=n,this.postprocess=r,this}function t(e,t,n,r){this.rule=e,this.dot=t,this.reference=n,this.data=[],this.wantedBy=r,this.isComplete=this.dot===e.symbols.length}function n(e,t){this.grammar=e,this.index=t,this.states=[],this.wants={},this.scannable=[],this.completed={}}function r(e,t){this.rules=e,this.start=t||this.rules[0].name;var n=this.byName={};this.rules.forEach((function(e){n.hasOwnProperty(e.name)||(n[e.name]=[]),n[e.name].push(e)}))}function o(){this.reset("")}function s(e,t,s){if(e instanceof r){var i=e;s=t}else i=r.fromCompiled(e,t);for(var a in this.grammar=i,this.options={keepHistory:!1,lexer:i.lexer||new o},s||{})this.options[a]=s[a];this.lexer=this.options.lexer,this.lexerState=void 0;var l=new n(i,0);this.table=[l],l.wants[i.start]=[],l.predict(i.start),l.process(),this.current=0}function i(e){var t=typeof e;if("string"===t)return e;if("object"===t){if(e.literal)return JSON.stringify(e.literal);if(e instanceof RegExp)return e.toString();if(e.type)return"%"+e.type;if(e.test)return"<"+String(e.test)+">";throw new Error("Unknown symbol type: "+e)}}return e.highestId=0,e.prototype.toString=function(e){var t=void 0===e?this.symbols.map(i).join(" "):this.symbols.slice(0,e).map(i).join(" ")+" ● "+this.symbols.slice(e).map(i).join(" ");return this.name+" → "+t},t.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},t.prototype.nextState=function(e){var n=new t(this.rule,this.dot+1,this.reference,this.wantedBy);return n.left=this,n.right=e,n.isComplete&&(n.data=n.build(),n.right=void 0),n},t.prototype.build=function(){var e=[],t=this;do{e.push(t.right.data),t=t.left}while(t.left);return e.reverse(),e},t.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,s.fail))},n.prototype.process=function(e){for(var t=this.states,n=this.wants,r=this.completed,o=0;o<t.length;o++){var i=t[o];if(i.isComplete){if(i.finish(),i.data!==s.fail){for(var a=i.wantedBy,l=a.length;l--;)this.complete(a[l],i);i.reference===this.index&&(this.completed[u=i.rule.name]=this.completed[u]||[]).push(i)}}else{var u;if("string"!=typeof(u=i.rule.symbols[i.dot])){this.scannable.push(i);continue}if(n[u]){if(n[u].push(i),r.hasOwnProperty(u)){var c=r[u];for(l=0;l<c.length;l++)this.complete(i,c[l])}}else n[u]=[i],this.predict(u)}}},n.prototype.predict=function(e){for(var n=this.grammar.byName[e]||[],r=0;r<n.length;r++){var o=new t(n[r],0,this.index,this.wants[e]);this.states.push(o)}},n.prototype.complete=function(e,t){var n=e.nextState(t);this.states.push(n)},r.fromCompiled=function(t,n){var o=t.Lexer;t.ParserStart&&(n=t.ParserStart,t=t.ParserRules);var s=new r(t=t.map((function(t){return new e(t.name,t.symbols,t.postprocess)})),n);return s.lexer=o,s},o.prototype.reset=function(e,t){this.buffer=e,this.index=0,this.line=t?t.line:1,this.lastLineBreak=t?-t.col:0},o.prototype.next=function(){if(this.index<this.buffer.length){var e=this.buffer[this.index++];return"\n"===e&&(this.line+=1,this.lastLineBreak=this.index),{value:e}}},o.prototype.save=function(){return{line:this.line,col:this.index-this.lastLineBreak}},o.prototype.formatError=function(e,t){var n=this.buffer;if("string"==typeof n){var r=n.split("\n").slice(Math.max(0,this.line-5),this.line),o=n.indexOf("\n",this.index);-1===o&&(o=n.length);var s=this.index-this.lastLineBreak,i=String(this.line).length;return t+=" at line "+this.line+" col "+s+":\n\n",(t+=r.map((function(e,t){return a(this.line-r.length+t+1,i)+" "+e}),this).join("\n"))+"\n"+a("",i+s)+"^\n"}return t+" at index "+(this.index-1);function a(e,t){var n=String(e);return Array(t-n.length+1).join(" ")+n}},s.fail={},s.prototype.feed=function(e){var t,r=this.lexer;for(r.reset(e,this.lexerState);;){try{if(!(t=r.next()))break}catch(e){var s=new n(this.grammar,this.current+1);throw this.table.push(s),(l=new Error(this.reportLexerError(e))).offset=this.current,l.token=e.token,l}var i=this.table[this.current];this.options.keepHistory||delete this.table[this.current-1];var a=this.current+1;s=new n(this.grammar,a),this.table.push(s);for(var l,u=void 0!==t.text?t.text:t.value,c=r.constructor===o?t.value:t,f=i.scannable,p=f.length;p--;){var h=f[p],m=h.rule.symbols[h.dot];if(m.test?m.test(c):m.type?m.type===t.type:m.literal===u){var y=h.nextState({data:c,token:t,isToken:!0,reference:a-1});s.states.push(y)}}if(s.process(),0===s.states.length)throw(l=new Error(this.reportError(t))).offset=this.current,l.token=t,l;this.options.keepHistory&&(i.lexerState=r.save()),this.current++}return i&&(this.lexerState=r.save()),this.results=this.finish(),this},s.prototype.reportLexerError=function(e){var t,n,r=e.token;return r?(t="input "+JSON.stringify(r.text[0])+" (lexer error)",n=this.lexer.formatError(r,"Syntax error")):(t="input (lexer error)",n=e.message),this.reportErrorCommon(n,t)},s.prototype.reportError=function(e){var t=(e.type?e.type+" token: ":"")+JSON.stringify(void 0!==e.value?e.value:e),n=this.lexer.formatError(e,"Syntax error");return this.reportErrorCommon(n,t)},s.prototype.reportErrorCommon=function(e,t){var n=[];n.push(e);var r=this.table[this.table.length-2],o=r.states.filter((function(e){var t=e.rule.symbols[e.dot];return t&&"string"!=typeof t}));return 0===o.length?(n.push("Unexpected "+t+". I did not expect any more input. Here is the state of my parse table:\n"),this.displayStateStack(r.states,n)):(n.push("Unexpected "+t+". Instead, I was expecting to see one of the following:\n"),o.map((function(e){return this.buildFirstStateStack(e,[])||[e]}),this).forEach((function(e){var t=e[0],r=this.getSymbolDisplay(t.rule.symbols[t.dot]);n.push("A "+r+" based on:"),this.displayStateStack(e,n)}),this)),n.push(""),n.join("\n")},s.prototype.displayStateStack=function(e,t){for(var n,r=0,o=0;o<e.length;o++){var s=e[o],i=s.rule.toString(s.dot);i===n?r++:(r>0&&t.push(" ^ "+r+" more lines identical to this"),r=0,t.push(" "+i)),n=i}},s.prototype.getSymbolDisplay=function(e){return function(e){var t=typeof e;if("string"===t)return e;if("object"===t){if(e.literal)return JSON.stringify(e.literal);if(e instanceof RegExp)return"character matching "+e;if(e.type)return e.type+" token";if(e.test)return"token matching "+String(e.test);throw new Error("Unknown symbol type: "+e)}}(e)},s.prototype.buildFirstStateStack=function(e,t){if(-1!==t.indexOf(e))return null;if(0===e.wantedBy.length)return[e];var n=e.wantedBy[0],r=[e].concat(t),o=this.buildFirstStateStack(n,r);return null===o?null:[e].concat(o)},s.prototype.save=function(){var e=this.table[this.current];return e.lexerState=this.lexerState,e},s.prototype.restore=function(e){var t=e.index;this.current=t,this.table[t]=e,this.table.splice(t+1),this.lexerState=e.lexerState,this.results=this.finish()},s.prototype.rewind=function(e){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[e])},s.prototype.finish=function(){var e=[],t=this.grammar.start;return this.table[this.table.length-1].states.forEach((function(n){n.rule.name===t&&n.dot===n.rule.symbols.length&&0===n.reference&&n.data!==s.fail&&e.push(n)})),e.map((function(e){return e.data}))},{Parser:s,Grammar:r,Rule:e}},e.exports?e.exports=n():t.nearley=n()}));function Y(){return(Y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var ee=W((function(e){var t,n;t=K,n=function(){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n="boolean"==typeof(new RegExp).sticky;function r(e){return e&&"[object RegExp]"===t.call(e)}function o(e){return e&&"object"==typeof e&&!r(e)&&!Array.isArray(e)}function s(e){return e.length?"(?:"+e.map((function(e){return"(?:"+e+")"})).join("|")+")":"(?!)"}function i(e){if("string"==typeof e)return"(?:"+e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+")";if(r(e)){if(e.ignoreCase)throw new Error("RegExp /i flag not allowed");if(e.global)throw new Error("RegExp /g flag is implied");if(e.sticky)throw new Error("RegExp /y flag is implied");if(e.multiline)throw new Error("RegExp /m flag is implied");return e.source}throw new Error("Not a pattern: "+e)}function a(t,n){if(o(n)||(n={match:n}),n.include)throw new Error("Matching rules cannot also include states");var s={defaultType:t,lineBreaks:!!n.error||!!n.fallback,pop:!1,next:null,push:null,error:!1,fallback:!1,value:null,type:null,shouldThrow:!1};for(var i in n)e.call(n,i)&&(s[i]=n[i]);if("string"==typeof s.type&&t!==s.type)throw new Error("Type transform cannot be a string (type '"+s.type+"' for token '"+t+"')");var a=s.match;return s.match=Array.isArray(a)?a:a?[a]:[],s.match.sort((function(e,t){return r(e)&&r(t)?0:r(t)?-1:r(e)?1:t.length-e.length})),s}function l(e){return Array.isArray(e)?function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];if(r.include)for(var o=[].concat(r.include),s=0;s<o.length;s++)t.push({include:o[s]});else{if(!r.type)throw new Error("Rule has no type: "+JSON.stringify(r));t.push(a(r.type,r))}}return t}(e):function(e){for(var t=Object.getOwnPropertyNames(e),n=[],r=0;r<t.length;r++){var s=t[r],i=[].concat(e[s]);if("include"!==s){var l=[];i.forEach((function(e){o(e)?(l.length&&n.push(a(s,l)),n.push(a(s,e)),l=[]):l.push(e)})),l.length&&n.push(a(s,l))}else for(var u=0;u<i.length;u++)n.push({include:i[u]})}return n}(e)}var u=a("error",{lineBreaks:!0,shouldThrow:!0});function c(e,t){for(var o=null,a=Object.create(null),l=!0,c=null,f=[],p=[],h=0;h<e.length;h++)e[h].fallback&&(l=!1);for(h=0;h<e.length;h++){var m=e[h];if(m.include)throw new Error("Inheritance is not allowed in stateless lexers");if(m.error||m.fallback){if(o)throw!m.fallback==!o.fallback?new Error("Multiple "+(m.fallback?"fallback":"error")+" rules not allowed (for token '"+m.defaultType+"')"):new Error("fallback and error are mutually exclusive (for token '"+m.defaultType+"')");o=m}var y=m.match.slice();if(l)for(;y.length&&"string"==typeof y[0]&&1===y[0].length;)a[y.shift().charCodeAt(0)]=m;if(m.pop||m.push||m.next){if(!t)throw new Error("State-switching options are not allowed in stateless lexers (for token '"+m.defaultType+"')");if(m.fallback)throw new Error("State-switching options are not allowed on fallback tokens (for token '"+m.defaultType+"')")}if(0!==y.length){l=!1,f.push(m);for(var d=0;d<y.length;d++){var b=y[d];if(r(b))if(null===c)c=b.unicode;else if(c!==b.unicode&&!1===m.fallback)throw new Error("If one rule is /u then all must be")}var g=s(y.map(i)),v=new RegExp(g);if(v.test(""))throw new Error("RegExp matches empty string: "+v);if(new RegExp("|"+g).exec("").length-1>0)throw new Error("RegExp has capture groups: "+v+"\nUse (?: … ) instead");if(!m.lineBreaks&&v.test("\n"))throw new Error("Rule should declare lineBreaks: "+v);p.push("("+g+")")}}var w=o&&o.fallback,x=n&&!w?"ym":"gm",$=n||w?"":"|";return!0===c&&(x+="u"),{regexp:new RegExp(s(p)+$,x),groups:f,fast:a,error:o||u}}function f(e,t,n){var r=e&&(e.push||e.next);if(r&&!n[r])throw new Error("Missing state '"+r+"' (in token '"+e.defaultType+"' of state '"+t+"')");if(e&&e.pop&&1!=+e.pop)throw new Error("pop must be 1 (in token '"+e.defaultType+"' of state '"+t+"')")}var p=function(e,t){this.startState=t,this.states=e,this.buffer="",this.stack=[],this.reset()};p.prototype.reset=function(e,t){return this.buffer=e||"",this.index=0,this.line=t?t.line:1,this.col=t?t.col:1,this.queuedToken=t?t.queuedToken:null,this.queuedThrow=t?t.queuedThrow:null,this.setState(t?t.state:this.startState),this.stack=t&&t.stack?t.stack.slice():[],this},p.prototype.save=function(){return{line:this.line,col:this.col,state:this.state,stack:this.stack.slice(),queuedToken:this.queuedToken,queuedThrow:this.queuedThrow}},p.prototype.setState=function(e){if(e&&this.state!==e){this.state=e;var t=this.states[e];this.groups=t.groups,this.error=t.error,this.re=t.regexp,this.fast=t.fast}},p.prototype.popState=function(){this.setState(this.stack.pop())},p.prototype.pushState=function(e){this.stack.push(this.state),this.setState(e)};var h=n?function(e,t){return e.exec(t)}:function(e,t){var n=e.exec(t);return 0===n[0].length?null:n};function m(){return this.value}if(p.prototype._getGroup=function(e){for(var t=this.groups.length,n=0;n<t;n++)if(void 0!==e[n+1])return this.groups[n];throw new Error("Cannot find token type for matched text")},p.prototype.next=function(){var e=this.index;if(this.queuedGroup){var t=this._token(this.queuedGroup,this.queuedText,e);return this.queuedGroup=null,this.queuedText="",t}var n=this.buffer;if(e!==n.length){if(i=this.fast[n.charCodeAt(e)])return this._token(i,n.charAt(e),e);var r=this.re;r.lastIndex=e;var o=h(r,n),s=this.error;if(null==o)return this._token(s,n.slice(e,n.length),e);var i=this._getGroup(o),a=o[0];return s.fallback&&o.index!==e?(this.queuedGroup=i,this.queuedText=a,this._token(s,n.slice(e,o.index),e)):this._token(i,a,e)}},p.prototype._token=function(e,t,n){var r=0;if(e.lineBreaks){var o=/\n/g,s=1;if("\n"===t)r=1;else for(;o.exec(t);)r++,s=o.lastIndex}var i={type:"function"==typeof e.type&&e.type(t)||e.defaultType,value:"function"==typeof e.value?e.value(t):t,text:t,toString:m,offset:n,lineBreaks:r,line:this.line,col:this.col},a=t.length;if(this.index+=a,this.line+=r,0!==r?this.col=a-s+1:this.col+=a,e.shouldThrow)throw new Error(this.formatError(i,"invalid syntax"));return e.pop?this.popState():e.push?this.pushState(e.push):e.next&&this.setState(e.next),i},"undefined"!=typeof Symbol&&Symbol.iterator){var y=function(e){this.lexer=e};y.prototype.next=function(){var e=this.lexer.next();return{value:e,done:!e}},y.prototype[Symbol.iterator]=function(){return this},p.prototype[Symbol.iterator]=function(){return new y(this)}}return p.prototype.formatError=function(e,t){if(null==e){var n=this.buffer.slice(this.index);e={text:n,offset:this.index,lineBreaks:-1===n.indexOf("\n")?0:1,line:this.line,col:this.col}}var r=Math.max(0,e.offset-e.col+1),o=e.lineBreaks?e.text.indexOf("\n"):e.text.length,s=this.buffer.substring(r,e.offset+o);return t+=" at line "+e.line+" col "+e.col+":\n\n",(t+=" "+s+"\n")+" "+Array(e.col).join(" ")+"^"},p.prototype.clone=function(){return new p(this.states,this.state)},p.prototype.has=function(e){return!0},{compile:function(e){var t=c(l(e));return new p({start:t},"start")},states:function(e,t){var n=e.$all?l(e.$all):[];delete e.$all;var r=Object.getOwnPropertyNames(e);t||(t=r[0]);for(var o=Object.create(null),s=0;s<r.length;s++)o[v=r[s]]=l(e[v]).concat(n);for(s=0;s<r.length;s++)for(var i=o[v=r[s]],a=Object.create(null),u=0;u<i.length;u++){var h=i[u];if(h.include){var m=[u,1];if(h.include!==v&&!a[h.include]){a[h.include]=!0;var y=o[h.include];if(!y)throw new Error("Cannot include nonexistent state '"+h.include+"' (in state '"+v+"')");for(var d=0;d<y.length;d++){var b=y[d];-1===i.indexOf(b)&&m.push(b)}}i.splice.apply(i,m),u--}}var g=Object.create(null);for(s=0;s<r.length;s++){var v;g[v=r[s]]=c(o[v],!0)}for(s=0;s<r.length;s++){var w=r[s],x=g[w],$=x.groups;for(u=0;u<$.length;u++)f($[u],w,g);var S=Object.getOwnPropertyNames(x.fast);for(u=0;u<S.length;u++)f(x.fast[S[u]],w,g)}return new p(g,t)},error:Object.freeze({error:!0}),fallback:Object.freeze({fallback:!0}),keywords:function(e){for(var t=Object.create(null),n=Object.create(null),r=Object.getOwnPropertyNames(e),o=0;o<r.length;o++){var s=r[o],i=e[s];(Array.isArray(i)?i:[i]).forEach((function(e){if((n[e.length]=n[e.length]||[]).push(e),"string"!=typeof e)throw new Error("keyword must be string (in keyword '"+s+"')");t[e]=s}))}function a(e){return JSON.stringify(e)}var l="";for(var u in l+="switch (value.length) {\n",n)l+="case "+u+":\n",l+="switch (value) {\n",n[u].forEach((function(e){var n=t[e];l+="case "+a(e)+": return "+a(n)+"\n"})),l+="}\n";return l+="}\n",Function("value",l)}}},e.exports?e.exports=n():t.moo=n()})),te=/[0-9a-zA-Z_@]+\b@*/,ne=new RegExp("^"+te.source+"$"),re={__proto__:null,boolean:/true|false|TRUE|FALSE\b(?!@)/,hexadecimal:/-?0x(?:[0-9a-fA-F]+)\b(?!@)/,octal:/-?0(?:[0-7]+)\b(?!@)/,measurement:/-?(?:[0-9]|[1-9][0-9]+)(?:\.[0-9]+)?[a-zA-Z]+\b(?!@)/,decimal:/-?(?:[0-9]|[1-9][0-9]+)\.[0-9]+(?:[eE][-+]?[0-9]+)?\b(?!@)/,integer:/-?(?:[0-9]|[1-9][0-9]+)(?:[eE][-+]?[0-9]+)?\b(?!@)/,taggedString:/[a-zA-Z][0-9a-zA-Z_@]*`(?:\\[`bfnrt/\\]|\\u[a-fA-F0-9]{4}|[^`\\])*`/,doubleQuotedString:/"(?:\\["bfnrt/\\]|\\u[a-fA-F0-9]{4}|[^"\\])*"/,singleQuotedString:/'(?:\\['bfnrt/\\]|\\u[a-fA-F0-9]{4}|[^'\\])*'/,tickedString:/`(?:\\[`bfnrt/\\]|\\u[a-fA-F0-9]{4}|[^`\\])*`/,symbol:/[a-zA-Z_][0-9a-zA-Z_]*\b(?!@)/,identifier:te,isValidIdentifier:function(e){return e&&ne.test(e)}},oe=function(e){return!!e.type&&"path"===e.type},se=function(e){return oe(e)&&"ø"===e.id},ie=function(e){return oe(e)&&e.children&&0===e.children.length&&"ø"!==e.id},ae=function(e){return!!e.type&&!!e.value&&"property"!==e.type};function le(){return(le=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function ue(e){return Array.isArray(e)?e:e instanceof Function?ue(e()):void 0===e?[]:[e]}var ce=function(e,t){void 0===t&&(t={});var n=le({type:"path"},t.id&&{id:t.id},t.labels&&{labels:t.labels},t.record&&{record:t.record});if(void 0===e)return n.id&&"ø"!==n.id?(n.children=[],n):(n.children=void 0,fe);if(0===e.length)return"ø"===n.id?fe:(n.children=[],n);if(1===e.length){var r=e[0];return se(r)?(n.children=[],n):(n.children=[r],n)}if(2===e.length){if(t.kind&&"pair"!==t.kind&&ie(e[0])&&ie(e[1]))return n.kind=t.kind,n.children=[e[0],e[1]],n;if(se(e[0])&&se(e[1]))return n.kind=t.kind,n.children=[],n;n.children=[e[0],e[1]]}return n.kind=t.kind||"pair",n},fe={type:"path",id:"ø",labels:void 0,record:void 0,children:[]},pe=function(e,t,n){return le({type:"path"},e&&{id:e},t&&{labels:t},n&&{record:n},{children:[]})},he=function(){return new Map},me=function(e){return Object.entries(e).reduce((function(e,t){return e.set(t[0],ye(t[1])),e}),he())},ye=function e(t){if(Array.isArray(t))return t.map((function(t){return e(t)}));if("object"==typeof t)return t instanceof Date?we(t):ae(t)?t:me(t);switch(typeof t){case"string":return be(t);case"bigint":return ve(t.toString());case"boolean":return de(t);case"number":return ve(t.toString());case"symbol":return be(t.toString());default:throw new Error("Unsupported value: "+t)}},de=function(e){return{type:"boolean",value:e?"true":"false"}},be=function(e){return{type:"string",value:e}},ge=function(e,t){return{type:"tagged",value:t,tag:e}},ve=function(e){return{type:"decimal",value:String(e)}},we=function(e){return ge("date",e instanceof Date?e.toISOString().slice(0,10):e)};function xe(e){return e[0]}var $e=ee.compile({whitespace:{match:/\s+/,lineBreaks:!0},lineComment:{match:/\/\/.*?\n?$/},hexadecimal:re.hexadecimal,octal:re.octal,measurement:re.measurement,decimal:re.decimal,integer:re.integer,taggedString:{match:re.taggedString},boolean:["true","TRUE","True","false","FALSE","False"],symbol:re.symbol,identifier:re.identifier,doubleQuotedString:{match:re.doubleQuotedString,value:function(e){return e.slice(1,-1)}},singleQuotedString:{match:re.singleQuotedString,value:function(e){return e.slice(1,-1)}},tickedString:{match:re.tickedString,value:function(e){return e.slice(1,-1)}},"--\x3e":"--\x3e","--":"--","<--":"<--","-[]->":"-[]->","-[]-":"-[]-","<-[]-":"<-[]-","<-[":"<-[","]->":"]->","-[":"-[","]-":"]-","{":"{","}":"}","[":"[","]":"]","(":"(",")":")",",":",",":":":","`":"`","'":"'","ø":"ø"}),Se=function(){return null},ke=function(e){return e[0].text},Ee={Lexer:$e,ParserRules:[{name:"GramSeq$ebnf$1$subexpression$1",symbols:["Path"],postprocess:function(e){return e[0]}},{name:"GramSeq$ebnf$1",symbols:["GramSeq$ebnf$1$subexpression$1"]},{name:"GramSeq$ebnf$1$subexpression$2",symbols:["Path"],postprocess:function(e){return e[0]}},{name:"GramSeq$ebnf$1",symbols:["GramSeq$ebnf$1","GramSeq$ebnf$1$subexpression$2"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"GramSeq",symbols:["_","GramSeq$ebnf$1"],postprocess:function(e){var t;return void 0===t&&(t=1),le({type:"seq",id:void 0},void 0,void 0,{children:ue(e[1].flat(t).filter((function(e){return null!==e})))})}},{name:"Path",symbols:["NodePattern"],postprocess:xe},{name:"Path",symbols:["PathComposition"],postprocess:xe},{name:"Path",symbols:["PathPair"],postprocess:xe},{name:"NodePattern",symbols:["Node","_","Edge","_","NodePattern"],postprocess:function(e){var t=e[2];return ce([e[0],e[4]],{kind:t.kind,id:t.id,labels:t.labels,record:t.record})}},{name:"NodePattern",symbols:["Node"],postprocess:xe},{name:"Node$ebnf$1",symbols:["Attributes"],postprocess:xe},{name:"Node$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"Node",symbols:[{literal:"("},"_","Node$ebnf$1",{literal:")"},"_"],postprocess:function(e){var t=e[2];return t?pe(t.id,t.labels,t.record):pe()}},{name:"Edge$ebnf$1",symbols:["Attributes"],postprocess:xe},{name:"Edge$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"Edge",symbols:[{literal:"-["},"_","Edge$ebnf$1",{literal:"]->"},"_"],postprocess:function(e){return Y({kind:"right"},e[2])}},{name:"Edge$ebnf$2",symbols:["Attributes"],postprocess:xe},{name:"Edge$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"Edge",symbols:[{literal:"-["},"_","Edge$ebnf$2",{literal:"]-"},"_"],postprocess:function(e){return Y({kind:"either"},e[2])}},{name:"Edge$ebnf$3",symbols:["Attributes"],postprocess:xe},{name:"Edge$ebnf$3",symbols:[],postprocess:function(){return null}},{name:"Edge",symbols:[{literal:"<-["},"_","Edge$ebnf$3",{literal:"]-"},"_"],postprocess:function(e){return Y({kind:"left"},e[2])}},{name:"Edge",symbols:[{literal:"-[]->"},"_"],postprocess:function(){return{kind:"right"}}},{name:"Edge",symbols:[{literal:"-[]-"},"_"],postprocess:function(){return{kind:"either"}}},{name:"Edge",symbols:[{literal:"<-[]-"},"_"],postprocess:function(){return{kind:"left"}}},{name:"Edge",symbols:[{literal:"--\x3e"},"_"],postprocess:function(){return{kind:"right"}}},{name:"Edge",symbols:[{literal:"--"},"_"],postprocess:function(){return{kind:"either"}}},{name:"Edge",symbols:[{literal:"<--"},"_"],postprocess:function(){return{kind:"left"}}},{name:"PathComposition",symbols:["PathPoint"],postprocess:xe},{name:"PathComposition",symbols:["PathAnnotation"],postprocess:xe},{name:"PathComposition",symbols:["PathExpression"],postprocess:xe},{name:"PathPoint$ebnf$1",symbols:["Attributes"],postprocess:xe},{name:"PathPoint$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathPoint",symbols:[{literal:"["},"_","PathPoint$ebnf$1",{literal:"]"},"_"],postprocess:function(e){var t=e[2];return t&&(t.id||t.labels||t.record)&&"ø"!==t.id?pe(t.id,t.labels,t.record):fe}},{name:"PathAnnotation$ebnf$1",symbols:["Attributes"],postprocess:xe},{name:"PathAnnotation$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathAnnotation",symbols:[{literal:"["},"_","PathAnnotation$ebnf$1","Path",{literal:"]"},"_"],postprocess:function(e){var t=e[2];return ce([e[3]],t?{id:t.id,labels:t.labels,record:t.record}:{})}},{name:"PathExpression$ebnf$1",symbols:["Attributes"],postprocess:xe},{name:"PathExpression$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathExpression$ebnf$2",symbols:["Kind"],postprocess:xe},{name:"PathExpression$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"PathExpression",symbols:[{literal:"["},"_","PathExpression$ebnf$1","PathExpression$ebnf$2","Path","Path",{literal:"]"},"_"],postprocess:function(e){var t=e[2];return ce([e[4],e[5]],{kind:e[3],id:t.id,labels:t.labels,record:t.record})}},{name:"PathPair$subexpression$1",symbols:["NodePattern"]},{name:"PathPair$subexpression$1",symbols:["PathComposition"]},{name:"PathPair",symbols:["PathPair$subexpression$1",{literal:","},"_","Path"],postprocess:function(e){return function(e,t,n,r,o){return le({type:"path",kind:"pair",id:void 0},void 0,void 0,{children:t})}(0,[e[0][0],e[3]])}},{name:"Kind",symbols:[{literal:","},"_"],postprocess:function(){return"pair"}},{name:"Kind",symbols:[{literal:"--\x3e"},"_"],postprocess:function(){return"right"}},{name:"Kind",symbols:[{literal:"--"},"_"],postprocess:function(){return"either"}},{name:"Kind",symbols:[{literal:"<--"},"_"],postprocess:function(){return"left"}},{name:"Attributes$ebnf$1",symbols:["Identity"],postprocess:xe},{name:"Attributes$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"Attributes$ebnf$2",symbols:["LabelList"],postprocess:xe},{name:"Attributes$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"Attributes$ebnf$3",symbols:["Record"],postprocess:xe},{name:"Attributes$ebnf$3",symbols:[],postprocess:function(){return null}},{name:"Attributes",symbols:["Attributes$ebnf$1","Attributes$ebnf$2","Attributes$ebnf$3"],postprocess:function(e,t,n){var r=e[0],o=e[1],s=e[2];return r||o||s?{id:r,labels:o,record:s}:n}},{name:"LabelList$ebnf$1",symbols:["Label"]},{name:"LabelList$ebnf$1",symbols:["LabelList$ebnf$1","Label"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"LabelList",symbols:["LabelList$ebnf$1"],postprocess:function(e){return e[0]}},{name:"Label",symbols:[{literal:":"},"Symbol"],postprocess:function(e){return e[1]}},{name:"Identity",symbols:[$e.has("identifier")?{type:"identifier"}:identifier,"_"],postprocess:ke},{name:"Identity",symbols:[{literal:"ø"},"_"],postprocess:ke},{name:"Identity",symbols:[$e.has("symbol")?{type:"symbol"}:symbol,"_"],postprocess:ke},{name:"Identity",symbols:[$e.has("integer")?{type:"integer"}:integer,"_"],postprocess:ke},{name:"Identity",symbols:[$e.has("octal")?{type:"octal"}:octal,"_"],postprocess:ke},{name:"Identity",symbols:[$e.has("hexadecimal")?{type:"hexadecimal"}:hexadecimal,"_"],postprocess:ke},{name:"Identity",symbols:[$e.has("measurement")?{type:"measurement"}:measurement,"_"],postprocess:ke},{name:"Identity",symbols:[$e.has("tickedString")?{type:"tickedString"}:tickedString,"_"],postprocess:function(e){return e[0].text.slice(1,-1)}},{name:"Symbol",symbols:[$e.has("symbol")?{type:"symbol"}:symbol,"_"],postprocess:ke},{name:"Symbol",symbols:[$e.has("tickedString")?{type:"tickedString"}:tickedString,"_"],postprocess:function(e){return e[0].text.slice(1,-1)}},{name:"Record",symbols:[{literal:"{"},"_",{literal:"}"},"_"],postprocess:Se},{name:"Record$ebnf$1",symbols:[]},{name:"Record$ebnf$1$subexpression$1",symbols:[{literal:","},"_","Property"],postprocess:function(e){return e[2]}},{name:"Record$ebnf$1",symbols:["Record$ebnf$1","Record$ebnf$1$subexpression$1"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"Record",symbols:[{literal:"{"},"_","Property","Record$ebnf$1",{literal:"}"},"_"],postprocess:function(e){return[e[2]].concat(e[3]).reduce((function(e,t){return e.set(t.name,t.value),e}),he())}},{name:"Property",symbols:["Symbol",{literal:":"},"_","Value"],postprocess:function(e){var t;return{type:"property",name:e[0],value:ae(t=e[3])?t:ye(t)}}},{name:"Value",symbols:["StringLiteral","_"],postprocess:xe},{name:"Value",symbols:["NumericLiteral","_"],postprocess:xe},{name:"Value",symbols:[$e.has("boolean")?{type:"boolean"}:boolean,"_"],postprocess:function(e){return de(JSON.parse(e[0].value.toLowerCase()))}},{name:"Value$ebnf$1",symbols:[]},{name:"Value$ebnf$1$subexpression$1",symbols:[{literal:","},"_","Value"],postprocess:function(e){return e[2]}},{name:"Value$ebnf$1",symbols:["Value$ebnf$1","Value$ebnf$1$subexpression$1"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"Value",symbols:[{literal:"["},"_","Value","Value$ebnf$1",{literal:"]"},"_"],postprocess:function(e){return[e[2]].concat(e[3])}},{name:"StringLiteral",symbols:[$e.has("singleQuotedString")?{type:"singleQuotedString"}:singleQuotedString],postprocess:function(e){return be(e[0].value)}},{name:"StringLiteral",symbols:[$e.has("doubleQuotedString")?{type:"doubleQuotedString"}:doubleQuotedString],postprocess:function(e){return be(e[0].value)}},{name:"StringLiteral",symbols:[$e.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(e){return be(e[0].value)}},{name:"StringLiteral",symbols:[$e.has("taggedString")?{type:"taggedString"}:taggedString],postprocess:function(e){var t=function(e){var t=e.match(/([^`]+)`(.+)`$/);if(null==t)throw Error("Malformed tagged string: "+e);return{tag:t[1],value:t[2]}}(e[0].value);return ge(t.tag,t.value)}},{name:"NumericLiteral",symbols:[$e.has("integer")?{type:"integer"}:integer],postprocess:function(e){return{type:"integer",value:String(e[0].value)}}},{name:"NumericLiteral",symbols:[$e.has("decimal")?{type:"decimal"}:decimal],postprocess:function(e){return ve(e[0].value)}},{name:"NumericLiteral",symbols:[$e.has("hexadecimal")?{type:"hexadecimal"}:hexadecimal],postprocess:function(e){return{type:"hexadecimal",value:"number"==typeof(t=e[0].value)?t.toString(16):t};var t}},{name:"NumericLiteral",symbols:[$e.has("octal")?{type:"octal"}:octal],postprocess:function(e){return{type:"octal",value:"number"==typeof(t=e[0].value)?t.toString(8):t};var t}},{name:"NumericLiteral",symbols:[$e.has("measurement")?{type:"measurement"}:measurement],postprocess:function(e){var t,n=function(e){var t=e.match(/(-?[0-9.]+)([a-zA-Z]+)/);if(null==t)throw Error("Malformed measurement : "+e);return{value:t[1],unit:t[2]}}(e[0].value);return t=n.unit,{type:"measurement",value:String(n.value),unit:t}}},{name:"_$ebnf$1",symbols:[$e.has("whitespace")?{type:"whitespace"}:whitespace],postprocess:xe},{name:"_$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"_",symbols:["_$ebnf$1"],postprocess:Se},{name:"Comment",symbols:[$e.has("lineComment")?{type:"lineComment"}:lineComment],postprocess:Se},{name:"EOL",symbols:[{literal:"\n"}],postprocess:Se}],ParserStart:"GramSeq"},Pe=function(e,t){var n,r,o=new X.Parser(X.Grammar.fromCompiled(Ee));try{var s=o.feed(e);if(void 0===s.results[0]&&s.lexerState){var i={line:(r=s.lexerState).line,column:r.col};t.fail("Incomplete parse.",i)}return s.results.length>1&&t.info("[WARN] parsing is ambiguous"),s.results[0]||{type:"error"}}catch(e){var a=e.token?{line:(n=e.token).line,column:n.col}:{line:0,column:0};t.fail(e.message,a)}},_e=function(){this.Parser=Pe};e.errors={__proto__:null,INCOMPLETE_PARSE:"Incomplete parse.",SYNTAX_ERROR:"Syntax error at"},e.gramParserPlugin=_e,e.toAST=function(e){return V().use(_e).freeze().parse(e)},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e=e||self).gram=e.gram||{},e.gram.parse={}))}(this,(function(e){"use strict";var t=function(e){if(e)throw e},r=Object.prototype.hasOwnProperty,n=Object.prototype.toString,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,i=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===n.call(e)},a=function(e){if(!e||"[object Object]"!==n.call(e))return!1;var t,o=r.call(e,"constructor"),s=e.constructor&&e.constructor.prototype&&r.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!o&&!s)return!1;for(t in e);return void 0===t||r.call(e,t)},l=function(e,t){o&&"__proto__"===t.name?o(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},u=function(e,t){if("__proto__"===t){if(!r.call(e,t))return;if(s)return s(e,t).value}return e[t]},c=function e(){var t,r,n,o,s,c,f=arguments[0],p=1,h=arguments.length,m=!1;for("boolean"==typeof f&&(m=f,f=arguments[1]||{},p=2),(null==f||"object"!=typeof f&&"function"!=typeof f)&&(f={});p<h;++p)if(null!=(t=arguments[p]))for(r in t)n=u(f,r),f!==(o=u(t,r))&&(m&&o&&(a(o)||(s=i(o)))?(s?(s=!1,c=n&&i(n)?n:[]):c=n&&a(n)?n:{},l(f,{name:r,newValue:e(m,c,o)})):void 0!==o&&l(f,{name:r,newValue:o}));return f},f=function(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},p=[].slice,h=function(e,t){var r;return function(){var t,s=p.call(arguments,0),i=e.length>s.length;i&&s.push(n);try{t=e.apply(null,s)}catch(e){if(i&&r)throw e;return n(e)}i||(t&&"function"==typeof t.then?t.then(o,n):t instanceof Error?n(t):o(t))};function n(){r||(r=!0,t.apply(null,arguments))}function o(e){n(null,e)}},m=d;d.wrap=h;var y=[].slice;function d(){var e=[],t={run:function(){var t=-1,r=y.call(arguments,0,-1),n=arguments[arguments.length-1];if("function"!=typeof n)throw new Error("Expected function as last argument, not "+n);function o(s){var i=e[++t],a=y.call(arguments,0),l=a.slice(1),u=r.length,c=-1;if(s)n(s);else{for(;++c<u;)null==l[c]&&(l[c]=r[c]);r=l,i?h(i,o).apply(null,r):n.apply(null,[null].concat(r))}}o.apply(null,[null].concat(r))},use:function(r){if("function"!=typeof r)throw new Error("Expected `fn` to be a function, not "+r);return e.push(r),t}};return t}var b={}.hasOwnProperty,g=function(e){return e&&"object"==typeof e?b.call(e,"position")||b.call(e,"type")?w(e.position):b.call(e,"start")||b.call(e,"end")?w(e):b.call(e,"line")||b.call(e,"column")?v(e):"":""};function v(e){return e&&"object"==typeof e||(e={}),x(e.line)+":"+x(e.column)}function w(e){return e&&"object"==typeof e||(e={}),v(e.start)+"-"+v(e.end)}function x(e){return e&&"number"==typeof e?e:1}var $=E;function S(){}S.prototype=Error.prototype;var k=E.prototype=new S;function E(e,t,r){var n,o,s;"string"==typeof t&&(r=t,t=null),n=function(e){var t,r=[null,null];return"string"==typeof e&&(-1===(t=e.indexOf(":"))?r[1]=e:(r[0]=e.slice(0,t),r[1]=e.slice(t+1))),r}(r),o=g(t)||"1:1",s={start:{line:null,column:null},end:{line:null,column:null}},t&&t.position&&(t=t.position),t&&(t.start?(s=t,t=t.start):s.start=t),e.stack&&(this.stack=e.stack,e=e.message),this.message=e,this.name=o,this.reason=e,this.line=t?t.line:null,this.column=t?t.column:null,this.location=s,this.source=n[0],this.ruleId=n[1]}function P(e){var t,r;return _(e),t=47===e.charCodeAt(0),(r=function(e,t){for(var r,n,o="",s=0,i=-1,a=0,l=-1;++l<=e.length;){if(l<e.length)r=e.charCodeAt(l);else{if(47===r)break;r=47}if(47===r){if(i===l-1||1===a);else if(i!==l-1&&2===a){if(o.length<2||2!==s||46!==o.charCodeAt(o.length-1)||46!==o.charCodeAt(o.length-2))if(o.length>2){if((n=o.lastIndexOf("/"))!==o.length-1){n<0?(o="",s=0):s=(o=o.slice(0,n)).length-1-o.lastIndexOf("/"),i=l,a=0;continue}}else if(o.length){o="",s=0,i=l,a=0;continue}t&&(o=o.length?o+"/..":"..",s=2)}else o.length?o+="/"+e.slice(i+1,l):o=e.slice(i+1,l),s=l-i-1;i=l,a=0}else 46===r&&a>-1?a++:a=-1}return o}(e,!t)).length||t||(r="."),r.length&&47===e.charCodeAt(e.length-1)&&(r+="/"),t?"/"+r:r}function _(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}k.file="",k.name="",k.reason="",k.message="",k.stack="",k.fatal=null,k.column=null,k.line=null;var A=function(e,t){var r,n,o,s,i=0,a=-1;if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');if(_(e),r=e.length,void 0===t||!t.length||t.length>e.length){for(;r--;)if(47===e.charCodeAt(r)){if(o){i=r+1;break}}else a<0&&(o=!0,a=r+1);return a<0?"":e.slice(i,a)}if(t===e)return"";for(n=-1,s=t.length-1;r--;)if(47===e.charCodeAt(r)){if(o){i=r+1;break}}else n<0&&(o=!0,n=r+1),s>-1&&(e.charCodeAt(r)===t.charCodeAt(s--)?s<0&&(a=r):(s=-1,a=n));return i===a?a=n:a<0&&(a=e.length),e.slice(i,a)},O=function(){for(var e,t=-1;++t<arguments.length;)_(arguments[t]),arguments[t]&&(e=void 0===e?arguments[t]:e+"/"+arguments[t]);return void 0===e?".":P(e)},j=R,C={}.hasOwnProperty,L=["history","path","basename","stem","extname","dirname"];function R(e){var t,r,n;if(e){if("string"==typeof e||null!=(n=e)&&null!=n.constructor&&"function"==typeof n.constructor.isBuffer&&n.constructor.isBuffer(n))e={contents:e};else if("message"in e&&"messages"in e)return e}else e={};if(!(this instanceof R))return new R(e);for(this.data={},this.messages=[],this.history=[],this.cwd="/",r=-1;++r<L.length;)C.call(e,t=L[r])&&(this[t]=e[t]);for(t in e)L.indexOf(t)<0&&(this[t]=e[t])}function N(e,t){if(e&&e.indexOf("/")>-1)throw new Error("`"+t+"` cannot be a path: did not expect `/`")}function T(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function q(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}R.prototype.toString=function(e){return(this.contents||"").toString(e)},Object.defineProperty(R.prototype,"path",{get:function(){return this.history[this.history.length-1]},set:function(e){T(e,"path"),this.path!==e&&this.history.push(e)}}),Object.defineProperty(R.prototype,"dirname",{get:function(){return"string"==typeof this.path?function(e){var t,r,n;if(_(e),!e.length)return".";for(t=-1,n=e.length;--n;)if(47===e.charCodeAt(n)){if(r){t=n;break}}else r||(r=!0);return t<0?47===e.charCodeAt(0)?"/":".":1===t&&47===e.charCodeAt(0)?"//":e.slice(0,t)}(this.path):void 0},set:function(e){q(this.path,"dirname"),this.path=O(e||"",this.basename)}}),Object.defineProperty(R.prototype,"basename",{get:function(){return"string"==typeof this.path?A(this.path):void 0},set:function(e){T(e,"basename"),N(e,"basename"),this.path=O(this.dirname||"",e)}}),Object.defineProperty(R.prototype,"extname",{get:function(){return"string"==typeof this.path?function(e){var t,r,n,o=-1,s=0,i=-1,a=0;for(_(e),n=e.length;n--;)if(47!==(r=e.charCodeAt(n)))i<0&&(t=!0,i=n+1),46===r?o<0?o=n:1!==a&&(a=1):o>-1&&(a=-1);else if(t){s=n+1;break}return o<0||i<0||0===a||1===a&&o===i-1&&o===s+1?"":e.slice(o,i)}(this.path):void 0},set:function(e){if(N(e,"extname"),q(this.path,"extname"),e){if(46!==e.charCodeAt(0))throw new Error("`extname` must start with `.`");if(e.indexOf(".",1)>-1)throw new Error("`extname` cannot contain multiple dots")}this.path=O(this.dirname,this.stem+(e||""))}}),Object.defineProperty(R.prototype,"stem",{get:function(){return"string"==typeof this.path?A(this.path,this.extname):void 0},set:function(e){T(e,"stem"),N(e,"stem"),this.path=O(this.dirname||"",e+(this.extname||""))}});var I=j;j.prototype.message=function(e,t,r){var n=new $(e,t,r);return this.path&&(n.name=this.path+":"+n.name,n.file=this.path),n.fatal=!1,this.messages.push(n),n},j.prototype.info=function(){var e=this.message.apply(this,arguments);return e.fatal=null,e},j.prototype.fail=function(){var e=this.message.apply(this,arguments);throw e.fatal=!0,e};var B=I,G=J().freeze(),V=[].slice,z={}.hasOwnProperty,F=m().use(Q).use(M).use(U);function Q(e,t){t.tree=e.parse(t.file)}function M(e,t,r){e.run(t.tree,t.file,(function(e,n,o){e?r(e):(t.tree=n,t.file=o,r())}))}function U(e,t){var r,n=e.stringify(t.tree,t.file),o=t.file;null==n||("string"==typeof n||null!=(r=n)&&null!=r.constructor&&"function"==typeof r.constructor.isBuffer&&r.constructor.isBuffer(r)?o.contents=n:o.result=n)}function J(){var e=[],r=m(),n={},o=!1,s=-1;return i.data=function(e,t){return"string"==typeof e?2===arguments.length?(K("data",o),n[e]=t,i):z.call(n,e)&&n[e]||null:e?(K("data",o),n=e,i):n},i.freeze=a,i.attachers=e,i.use=function(t){var r;if(K("use",o),null==t);else if("function"==typeof t)p.apply(null,arguments);else{if("object"!=typeof t)throw new Error("Expected usable value, not `"+t+"`");"length"in t?u(t):s(t)}return r&&(n.settings=c(n.settings||{},r)),i;function s(e){u(e.plugins),e.settings&&(r=c(r||{},e.settings))}function a(e){if("function"==typeof e)p(e);else{if("object"!=typeof e)throw new Error("Expected usable value, not `"+e+"`");"length"in e?p.apply(null,e):s(e)}}function u(e){var t,r;if(null==e);else{if("object"!=typeof e||!("length"in e))throw new Error("Expected a list of plugins, not `"+e+"`");for(t=e.length,r=-1;++r<t;)a(e[r])}}function p(t,r){var n=l(t);n?(f(n[1])&&f(r)&&(r=c(n[1],r)),n[1]=r):e.push(V.call(arguments))}},i.parse=function(e){var t,r=B(e);return a(),H("parse",t=i.Parser),Z(t,"parse")?new t(String(r),r).parse():t(String(r),r)},i.stringify=function(e,t){var r,n=B(t);return a(),D("stringify",r=i.Compiler),W(e),Z(r,"compile")?new r(e,n).compile():r(e,n)},i.run=u,i.runSync=function(e,r){var n,o=!1;return u(e,r,(function(e,r){o=!0,t(e),n=r})),X("runSync","run",o),n},i.process=p,i.processSync=function(e){var r,n=!1;return a(),H("processSync",i.Parser),D("processSync",i.Compiler),p(r=B(e),(function(e){n=!0,t(e)})),X("processSync","process",n),r},i;function i(){for(var t=J(),r=e.length,o=-1;++o<r;)t.use.apply(null,e[o]);return t.data(c(!0,{},n)),t}function a(){var t,n,a,l;if(o)return i;for(;++s<e.length;)n=(t=e[s])[0],!1!==(a=t[1])&&(!0===a&&(t[1]=void 0),"function"==typeof(l=n.apply(i,t.slice(1)))&&r.use(l));return o=!0,s=Infinity,i}function l(t){for(var r,n=e.length,o=-1;++o<n;)if((r=e[o])[0]===t)return r}function u(e,t,n){if(W(e),a(),n||"function"!=typeof t||(n=t,t=null),!n)return new Promise(o);function o(o,s){r.run(e,B(t),(function(t,r,i){r=r||e,t?s(t):o?o(r):n(null,r,i)}))}o(null,n)}function p(e,t){if(a(),H("process",i.Parser),D("process",i.Compiler),!t)return new Promise(r);function r(r,n){var o=B(e);F.run(i,{file:o},(function(e){e?n(e):r?r(o):t(null,o)}))}r(null,t)}}function Z(e,t){return"function"==typeof e&&e.prototype&&(function(e){var t;for(t in e)return!0;return!1}(e.prototype)||t in e.prototype)}function H(e,t){if("function"!=typeof t)throw new Error("Cannot `"+e+"` without `Parser`")}function D(e,t){if("function"!=typeof t)throw new Error("Cannot `"+e+"` without `Compiler`")}function K(e,t){if(t)throw new Error("Cannot invoke `"+e+"` on a frozen processor.\nCreate a new processor first, by invoking it: use `processor()` instead of `processor`.")}function W(e){if(!e||"string"!=typeof e.type)throw new Error("Expected node, got `"+e+"`")}function X(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}var Y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ee(e,t){return e(t={exports:{}},t.exports),t.exports}var te=ee((function(e){var t,r;t=Y,r=function(){function e(t,r,n){return this.id=++e.highestId,this.name=t,this.symbols=r,this.postprocess=n,this}function t(e,t,r,n){this.rule=e,this.dot=t,this.reference=r,this.data=[],this.wantedBy=n,this.isComplete=this.dot===e.symbols.length}function r(e,t){this.grammar=e,this.index=t,this.states=[],this.wants={},this.scannable=[],this.completed={}}function n(e,t){this.rules=e,this.start=t||this.rules[0].name;var r=this.byName={};this.rules.forEach((function(e){r.hasOwnProperty(e.name)||(r[e.name]=[]),r[e.name].push(e)}))}function o(){this.reset("")}function s(e,t,s){if(e instanceof n){var i=e;s=t}else i=n.fromCompiled(e,t);for(var a in this.grammar=i,this.options={keepHistory:!1,lexer:i.lexer||new o},s||{})this.options[a]=s[a];this.lexer=this.options.lexer,this.lexerState=void 0;var l=new r(i,0);this.table=[l],l.wants[i.start]=[],l.predict(i.start),l.process(),this.current=0}function i(e){var t=typeof e;if("string"===t)return e;if("object"===t){if(e.literal)return JSON.stringify(e.literal);if(e instanceof RegExp)return e.toString();if(e.type)return"%"+e.type;if(e.test)return"<"+String(e.test)+">";throw new Error("Unknown symbol type: "+e)}}return e.highestId=0,e.prototype.toString=function(e){var t=void 0===e?this.symbols.map(i).join(" "):this.symbols.slice(0,e).map(i).join(" ")+" ● "+this.symbols.slice(e).map(i).join(" ");return this.name+" → "+t},t.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},t.prototype.nextState=function(e){var r=new t(this.rule,this.dot+1,this.reference,this.wantedBy);return r.left=this,r.right=e,r.isComplete&&(r.data=r.build(),r.right=void 0),r},t.prototype.build=function(){var e=[],t=this;do{e.push(t.right.data),t=t.left}while(t.left);return e.reverse(),e},t.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,s.fail))},r.prototype.process=function(e){for(var t=this.states,r=this.wants,n=this.completed,o=0;o<t.length;o++){var i=t[o];if(i.isComplete){if(i.finish(),i.data!==s.fail){for(var a=i.wantedBy,l=a.length;l--;)this.complete(a[l],i);i.reference===this.index&&(this.completed[u=i.rule.name]=this.completed[u]||[]).push(i)}}else{var u;if("string"!=typeof(u=i.rule.symbols[i.dot])){this.scannable.push(i);continue}if(r[u]){if(r[u].push(i),n.hasOwnProperty(u)){var c=n[u];for(l=0;l<c.length;l++)this.complete(i,c[l])}}else r[u]=[i],this.predict(u)}}},r.prototype.predict=function(e){for(var r=this.grammar.byName[e]||[],n=0;n<r.length;n++){var o=new t(r[n],0,this.index,this.wants[e]);this.states.push(o)}},r.prototype.complete=function(e,t){var r=e.nextState(t);this.states.push(r)},n.fromCompiled=function(t,r){var o=t.Lexer;t.ParserStart&&(r=t.ParserStart,t=t.ParserRules);var s=new n(t=t.map((function(t){return new e(t.name,t.symbols,t.postprocess)})),r);return s.lexer=o,s},o.prototype.reset=function(e,t){this.buffer=e,this.index=0,this.line=t?t.line:1,this.lastLineBreak=t?-t.col:0},o.prototype.next=function(){if(this.index<this.buffer.length){var e=this.buffer[this.index++];return"\n"===e&&(this.line+=1,this.lastLineBreak=this.index),{value:e}}},o.prototype.save=function(){return{line:this.line,col:this.index-this.lastLineBreak}},o.prototype.formatError=function(e,t){var r=this.buffer;if("string"==typeof r){var n=r.split("\n").slice(Math.max(0,this.line-5),this.line),o=r.indexOf("\n",this.index);-1===o&&(o=r.length);var s=this.index-this.lastLineBreak,i=String(this.line).length;return t+=" at line "+this.line+" col "+s+":\n\n",(t+=n.map((function(e,t){return a(this.line-n.length+t+1,i)+" "+e}),this).join("\n"))+"\n"+a("",i+s)+"^\n"}return t+" at index "+(this.index-1);function a(e,t){var r=String(e);return Array(t-r.length+1).join(" ")+r}},s.fail={},s.prototype.feed=function(e){var t,n=this.lexer;for(n.reset(e,this.lexerState);;){try{if(!(t=n.next()))break}catch(e){var s=new r(this.grammar,this.current+1);throw this.table.push(s),(l=new Error(this.reportLexerError(e))).offset=this.current,l.token=e.token,l}var i=this.table[this.current];this.options.keepHistory||delete this.table[this.current-1];var a=this.current+1;s=new r(this.grammar,a),this.table.push(s);for(var l,u=void 0!==t.text?t.text:t.value,c=n.constructor===o?t.value:t,f=i.scannable,p=f.length;p--;){var h=f[p],m=h.rule.symbols[h.dot];if(m.test?m.test(c):m.type?m.type===t.type:m.literal===u){var y=h.nextState({data:c,token:t,isToken:!0,reference:a-1});s.states.push(y)}}if(s.process(),0===s.states.length)throw(l=new Error(this.reportError(t))).offset=this.current,l.token=t,l;this.options.keepHistory&&(i.lexerState=n.save()),this.current++}return i&&(this.lexerState=n.save()),this.results=this.finish(),this},s.prototype.reportLexerError=function(e){var t,r,n=e.token;return n?(t="input "+JSON.stringify(n.text[0])+" (lexer error)",r=this.lexer.formatError(n,"Syntax error")):(t="input (lexer error)",r=e.message),this.reportErrorCommon(r,t)},s.prototype.reportError=function(e){var t=(e.type?e.type+" token: ":"")+JSON.stringify(void 0!==e.value?e.value:e),r=this.lexer.formatError(e,"Syntax error");return this.reportErrorCommon(r,t)},s.prototype.reportErrorCommon=function(e,t){var r=[];r.push(e);var n=this.table[this.table.length-2],o=n.states.filter((function(e){var t=e.rule.symbols[e.dot];return t&&"string"!=typeof t}));return 0===o.length?(r.push("Unexpected "+t+". I did not expect any more input. Here is the state of my parse table:\n"),this.displayStateStack(n.states,r)):(r.push("Unexpected "+t+". Instead, I was expecting to see one of the following:\n"),o.map((function(e){return this.buildFirstStateStack(e,[])||[e]}),this).forEach((function(e){var t=e[0],n=this.getSymbolDisplay(t.rule.symbols[t.dot]);r.push("A "+n+" based on:"),this.displayStateStack(e,r)}),this)),r.push(""),r.join("\n")},s.prototype.displayStateStack=function(e,t){for(var r,n=0,o=0;o<e.length;o++){var s=e[o],i=s.rule.toString(s.dot);i===r?n++:(n>0&&t.push(" ^ "+n+" more lines identical to this"),n=0,t.push(" "+i)),r=i}},s.prototype.getSymbolDisplay=function(e){return function(e){var t=typeof e;if("string"===t)return e;if("object"===t){if(e.literal)return JSON.stringify(e.literal);if(e instanceof RegExp)return"character matching "+e;if(e.type)return e.type+" token";if(e.test)return"token matching "+String(e.test);throw new Error("Unknown symbol type: "+e)}}(e)},s.prototype.buildFirstStateStack=function(e,t){if(-1!==t.indexOf(e))return null;if(0===e.wantedBy.length)return[e];var r=e.wantedBy[0],n=[e].concat(t),o=this.buildFirstStateStack(r,n);return null===o?null:[e].concat(o)},s.prototype.save=function(){var e=this.table[this.current];return e.lexerState=this.lexerState,e},s.prototype.restore=function(e){var t=e.index;this.current=t,this.table[t]=e,this.table.splice(t+1),this.lexerState=e.lexerState,this.results=this.finish()},s.prototype.rewind=function(e){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[e])},s.prototype.finish=function(){var e=[],t=this.grammar.start;return this.table[this.table.length-1].states.forEach((function(r){r.rule.name===t&&r.dot===r.rule.symbols.length&&0===r.reference&&r.data!==s.fail&&e.push(r)})),e.map((function(e){return e.data}))},{Parser:s,Grammar:n,Rule:e}},e.exports?e.exports=r():t.nearley=r()}));function re(){return(re=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var ne=ee((function(e){var t,r;t=Y,r=function(){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r="boolean"==typeof(new RegExp).sticky;function n(e){return e&&"[object RegExp]"===t.call(e)}function o(e){return e&&"object"==typeof e&&!n(e)&&!Array.isArray(e)}function s(e){return e.length?"(?:"+e.map((function(e){return"(?:"+e+")"})).join("|")+")":"(?!)"}function i(e){if("string"==typeof e)return"(?:"+e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+")";if(n(e)){if(e.ignoreCase)throw new Error("RegExp /i flag not allowed");if(e.global)throw new Error("RegExp /g flag is implied");if(e.sticky)throw new Error("RegExp /y flag is implied");if(e.multiline)throw new Error("RegExp /m flag is implied");return e.source}throw new Error("Not a pattern: "+e)}function a(t,r){if(o(r)||(r={match:r}),r.include)throw new Error("Matching rules cannot also include states");var s={defaultType:t,lineBreaks:!!r.error||!!r.fallback,pop:!1,next:null,push:null,error:!1,fallback:!1,value:null,type:null,shouldThrow:!1};for(var i in r)e.call(r,i)&&(s[i]=r[i]);if("string"==typeof s.type&&t!==s.type)throw new Error("Type transform cannot be a string (type '"+s.type+"' for token '"+t+"')");var a=s.match;return s.match=Array.isArray(a)?a:a?[a]:[],s.match.sort((function(e,t){return n(e)&&n(t)?0:n(t)?-1:n(e)?1:t.length-e.length})),s}function l(e){return Array.isArray(e)?function(e){for(var t=[],r=0;r<e.length;r++){var n=e[r];if(n.include)for(var o=[].concat(n.include),s=0;s<o.length;s++)t.push({include:o[s]});else{if(!n.type)throw new Error("Rule has no type: "+JSON.stringify(n));t.push(a(n.type,n))}}return t}(e):function(e){for(var t=Object.getOwnPropertyNames(e),r=[],n=0;n<t.length;n++){var s=t[n],i=[].concat(e[s]);if("include"!==s){var l=[];i.forEach((function(e){o(e)?(l.length&&r.push(a(s,l)),r.push(a(s,e)),l=[]):l.push(e)})),l.length&&r.push(a(s,l))}else for(var u=0;u<i.length;u++)r.push({include:i[u]})}return r}(e)}var u=a("error",{lineBreaks:!0,shouldThrow:!0});function c(e,t){for(var o=null,a=Object.create(null),l=!0,c=null,f=[],p=[],h=0;h<e.length;h++)e[h].fallback&&(l=!1);for(h=0;h<e.length;h++){var m=e[h];if(m.include)throw new Error("Inheritance is not allowed in stateless lexers");if(m.error||m.fallback){if(o)throw!m.fallback==!o.fallback?new Error("Multiple "+(m.fallback?"fallback":"error")+" rules not allowed (for token '"+m.defaultType+"')"):new Error("fallback and error are mutually exclusive (for token '"+m.defaultType+"')");o=m}var y=m.match.slice();if(l)for(;y.length&&"string"==typeof y[0]&&1===y[0].length;)a[y.shift().charCodeAt(0)]=m;if(m.pop||m.push||m.next){if(!t)throw new Error("State-switching options are not allowed in stateless lexers (for token '"+m.defaultType+"')");if(m.fallback)throw new Error("State-switching options are not allowed on fallback tokens (for token '"+m.defaultType+"')")}if(0!==y.length){l=!1,f.push(m);for(var d=0;d<y.length;d++){var b=y[d];if(n(b))if(null===c)c=b.unicode;else if(c!==b.unicode&&!1===m.fallback)throw new Error("If one rule is /u then all must be")}var g=s(y.map(i)),v=new RegExp(g);if(v.test(""))throw new Error("RegExp matches empty string: "+v);if(new RegExp("|"+g).exec("").length-1>0)throw new Error("RegExp has capture groups: "+v+"\nUse (?: … ) instead");if(!m.lineBreaks&&v.test("\n"))throw new Error("Rule should declare lineBreaks: "+v);p.push("("+g+")")}}var w=o&&o.fallback,x=r&&!w?"ym":"gm",$=r||w?"":"|";return!0===c&&(x+="u"),{regexp:new RegExp(s(p)+$,x),groups:f,fast:a,error:o||u}}function f(e,t,r){var n=e&&(e.push||e.next);if(n&&!r[n])throw new Error("Missing state '"+n+"' (in token '"+e.defaultType+"' of state '"+t+"')");if(e&&e.pop&&1!=+e.pop)throw new Error("pop must be 1 (in token '"+e.defaultType+"' of state '"+t+"')")}var p=function(e,t){this.startState=t,this.states=e,this.buffer="",this.stack=[],this.reset()};p.prototype.reset=function(e,t){return this.buffer=e||"",this.index=0,this.line=t?t.line:1,this.col=t?t.col:1,this.queuedToken=t?t.queuedToken:null,this.queuedThrow=t?t.queuedThrow:null,this.setState(t?t.state:this.startState),this.stack=t&&t.stack?t.stack.slice():[],this},p.prototype.save=function(){return{line:this.line,col:this.col,state:this.state,stack:this.stack.slice(),queuedToken:this.queuedToken,queuedThrow:this.queuedThrow}},p.prototype.setState=function(e){if(e&&this.state!==e){this.state=e;var t=this.states[e];this.groups=t.groups,this.error=t.error,this.re=t.regexp,this.fast=t.fast}},p.prototype.popState=function(){this.setState(this.stack.pop())},p.prototype.pushState=function(e){this.stack.push(this.state),this.setState(e)};var h=r?function(e,t){return e.exec(t)}:function(e,t){var r=e.exec(t);return 0===r[0].length?null:r};function m(){return this.value}if(p.prototype._getGroup=function(e){for(var t=this.groups.length,r=0;r<t;r++)if(void 0!==e[r+1])return this.groups[r];throw new Error("Cannot find token type for matched text")},p.prototype.next=function(){var e=this.index;if(this.queuedGroup){var t=this._token(this.queuedGroup,this.queuedText,e);return this.queuedGroup=null,this.queuedText="",t}var r=this.buffer;if(e!==r.length){if(i=this.fast[r.charCodeAt(e)])return this._token(i,r.charAt(e),e);var n=this.re;n.lastIndex=e;var o=h(n,r),s=this.error;if(null==o)return this._token(s,r.slice(e,r.length),e);var i=this._getGroup(o),a=o[0];return s.fallback&&o.index!==e?(this.queuedGroup=i,this.queuedText=a,this._token(s,r.slice(e,o.index),e)):this._token(i,a,e)}},p.prototype._token=function(e,t,r){var n=0;if(e.lineBreaks){var o=/\n/g,s=1;if("\n"===t)n=1;else for(;o.exec(t);)n++,s=o.lastIndex}var i={type:"function"==typeof e.type&&e.type(t)||e.defaultType,value:"function"==typeof e.value?e.value(t):t,text:t,toString:m,offset:r,lineBreaks:n,line:this.line,col:this.col},a=t.length;if(this.index+=a,this.line+=n,0!==n?this.col=a-s+1:this.col+=a,e.shouldThrow)throw new Error(this.formatError(i,"invalid syntax"));return e.pop?this.popState():e.push?this.pushState(e.push):e.next&&this.setState(e.next),i},"undefined"!=typeof Symbol&&Symbol.iterator){var y=function(e){this.lexer=e};y.prototype.next=function(){var e=this.lexer.next();return{value:e,done:!e}},y.prototype[Symbol.iterator]=function(){return this},p.prototype[Symbol.iterator]=function(){return new y(this)}}return p.prototype.formatError=function(e,t){if(null==e){var r=this.buffer.slice(this.index);e={text:r,offset:this.index,lineBreaks:-1===r.indexOf("\n")?0:1,line:this.line,col:this.col}}var n=Math.max(0,e.offset-e.col+1),o=e.lineBreaks?e.text.indexOf("\n"):e.text.length,s=this.buffer.substring(n,e.offset+o);return t+=" at line "+e.line+" col "+e.col+":\n\n",(t+=" "+s+"\n")+" "+Array(e.col).join(" ")+"^"},p.prototype.clone=function(){return new p(this.states,this.state)},p.prototype.has=function(e){return!0},{compile:function(e){var t=c(l(e));return new p({start:t},"start")},states:function(e,t){var r=e.$all?l(e.$all):[];delete e.$all;var n=Object.getOwnPropertyNames(e);t||(t=n[0]);for(var o=Object.create(null),s=0;s<n.length;s++)o[v=n[s]]=l(e[v]).concat(r);for(s=0;s<n.length;s++)for(var i=o[v=n[s]],a=Object.create(null),u=0;u<i.length;u++){var h=i[u];if(h.include){var m=[u,1];if(h.include!==v&&!a[h.include]){a[h.include]=!0;var y=o[h.include];if(!y)throw new Error("Cannot include nonexistent state '"+h.include+"' (in state '"+v+"')");for(var d=0;d<y.length;d++){var b=y[d];-1===i.indexOf(b)&&m.push(b)}}i.splice.apply(i,m),u--}}var g=Object.create(null);for(s=0;s<n.length;s++){var v;g[v=n[s]]=c(o[v],!0)}for(s=0;s<n.length;s++){var w=n[s],x=g[w],$=x.groups;for(u=0;u<$.length;u++)f($[u],w,g);var S=Object.getOwnPropertyNames(x.fast);for(u=0;u<S.length;u++)f(x.fast[S[u]],w,g)}return new p(g,t)},error:Object.freeze({error:!0}),fallback:Object.freeze({fallback:!0}),keywords:function(e){for(var t=Object.create(null),r=Object.create(null),n=Object.getOwnPropertyNames(e),o=0;o<n.length;o++){var s=n[o],i=e[s];(Array.isArray(i)?i:[i]).forEach((function(e){if((r[e.length]=r[e.length]||[]).push(e),"string"!=typeof e)throw new Error("keyword must be string (in keyword '"+s+"')");t[e]=s}))}function a(e){return JSON.stringify(e)}var l="";for(var u in l+="switch (value.length) {\n",r)l+="case "+u+":\n",l+="switch (value) {\n",r[u].forEach((function(e){var r=t[e];l+="case "+a(e)+": return "+a(r)+"\n"})),l+="}\n";return l+="}\n",Function("value",l)}}},e.exports?e.exports=r():t.moo=r()})),oe=/[0-9a-zA-Z_@]+\b@*/,se=new RegExp("^"+oe.source+"$"),ie={__proto__:null,boolean:/true|false|TRUE|FALSE\b(?!@)/,hexadecimal:/-?0x(?:[0-9a-fA-F]+)\b(?!@)/,octal:/-?0(?:[0-7]+)\b(?!@)/,measurement:/-?(?:[0-9]|[1-9][0-9]+)(?:\.[0-9]+)?[a-zA-Z]+\b(?!@)/,decimal:/-?(?:[0-9]|[1-9][0-9]+)\.[0-9]+(?:[eE][-+]?[0-9]+)?\b(?!@)/,integer:/-?(?:[0-9]|[1-9][0-9]+)(?:[eE][-+]?[0-9]+)?\b(?!@)/,taggedString:/[a-zA-Z][0-9a-zA-Z_@]*`(?:\\[`bfnrt/\\]|\\u[a-fA-F0-9]{4}|[^`\\])*`/,doubleQuotedString:/"(?:\\["bfnrt/\\]|\\u[a-fA-F0-9]{4}|[^"\\])*"/,singleQuotedString:/'(?:\\['bfnrt/\\]|\\u[a-fA-F0-9]{4}|[^'\\])*'/,tickedString:/`(?:\\[`bfnrt/\\]|\\u[a-fA-F0-9]{4}|[^`\\])*`/,symbol:/[a-zA-Z_][0-9a-zA-Z_]*\b(?!@)/,identifier:oe,isValidIdentifier:function(e){return e&&se.test(e)}},ae=function(e){return!!e.type&&"path"===e.type},le=function(e){return ae(e)&&"ø"===e.id},ue=function(e){return ae(e)&&e.children&&0===e.children.length&&"ø"!==e.id},ce=function(e){return!!e.type&&!!e.value&&"property"!==e.type};function fe(){return(fe=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function pe(e){return Array.isArray(e)?e:e instanceof Function?pe(e()):void 0===e?[]:[e]}var he=function(e,t){void 0===t&&(t={});var r=fe({type:"path"},t.id&&{id:t.id},t.labels&&{labels:t.labels},t.record&&{record:t.record});if(void 0===e)return r.id&&"ø"!==r.id?(r.children=[],r):(r.children=void 0,me);if(0===e.length)return"ø"===r.id?me:(r.children=[],r);if(1===e.length){var n=e[0];return le(n)?(r.children=[],r):(r.children=[n],r)}if(2===e.length){if(t.kind&&"pair"!==t.kind&&ue(e[0])&&ue(e[1]))return r.kind=t.kind,r.children=[e[0],e[1]],r;if(le(e[0])&&le(e[1]))return r.kind=t.kind,r.children=[],r;r.children=[e[0],e[1]]}return r.kind=t.kind||"pair",r},me={type:"path",id:"ø",labels:void 0,record:void 0,children:[]},ye=function(e,t,r){return fe({type:"path"},e&&{id:e},t&&{labels:t},r&&{record:r},{children:[]})},de=function(){return new Map},be=function(e){return Object.entries(e).reduce((function(e,t){return e.set(t[0],ge(t[1])),e}),de())},ge=function e(t){if(Array.isArray(t))return t.map((function(t){return e(t)}));if("object"==typeof t)return t instanceof Date?Se(t):ce(t)?t:be(t);switch(typeof t){case"string":return we(t);case"bigint":return $e(t.toString());case"boolean":return ve(t);case"number":return $e(t.toString());case"symbol":return we(t.toString());default:throw new Error("Unsupported value: "+t)}},ve=function(e){return{type:"boolean",value:e?"true":"false"}},we=function(e){return{type:"string",value:e}},xe=function(e,t){return{type:"tagged",value:t,tag:e}},$e=function(e){return{type:"decimal",value:String(e)}},Se=function(e){return xe("date",e instanceof Date?e.toISOString().slice(0,10):e)};function ke(e){return e[0]}var Ee=ne.compile({whitespace:{match:/\s+/,lineBreaks:!0},lineComment:{match:/\/\/.*?\n?$/},hexadecimal:ie.hexadecimal,octal:ie.octal,measurement:ie.measurement,decimal:ie.decimal,integer:ie.integer,taggedString:{match:ie.taggedString},boolean:["true","TRUE","True","false","FALSE","False"],symbol:ie.symbol,identifier:ie.identifier,doubleQuotedString:{match:ie.doubleQuotedString,value:function(e){return e.slice(1,-1)}},singleQuotedString:{match:ie.singleQuotedString,value:function(e){return e.slice(1,-1)}},tickedString:{match:ie.tickedString,value:function(e){return e.slice(1,-1)}},"--\x3e":"--\x3e","--":"--","<--":"<--","-[]->":"-[]->","-[]-":"-[]-","<-[]-":"<-[]-","<-[":"<-[","]->":"]->","-[":"-[","]-":"]-","{":"{","}":"}","[":"[","]":"]","(":"(",")":")",",":",",":":":","`":"`","'":"'","ø":"ø"}),Pe=function(){return null},_e=function(e){return e[0].text},Ae={Lexer:Ee,ParserRules:[{name:"GramSeq$ebnf$1$subexpression$1",symbols:["Path"],postprocess:function(e){return e[0]}},{name:"GramSeq$ebnf$1",symbols:["GramSeq$ebnf$1$subexpression$1"]},{name:"GramSeq$ebnf$1$subexpression$2",symbols:["Path"],postprocess:function(e){return e[0]}},{name:"GramSeq$ebnf$1",symbols:["GramSeq$ebnf$1","GramSeq$ebnf$1$subexpression$2"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"GramSeq",symbols:["_","GramSeq$ebnf$1"],postprocess:function(e){var t;return void 0===t&&(t=1),fe({type:"seq",id:void 0},void 0,void 0,{children:pe(e[1].flat(t).filter((function(e){return null!==e})))})}},{name:"Path",symbols:["NodePattern"],postprocess:ke},{name:"Path",symbols:["PathComposition"],postprocess:ke},{name:"Path",symbols:["PathPair"],postprocess:ke},{name:"NodePattern",symbols:["Node","_","Edge","_","NodePattern"],postprocess:function(e){var t=e[2];return he([e[0],e[4]],{kind:t.kind,id:t.id,labels:t.labels,record:t.record})}},{name:"NodePattern",symbols:["Node"],postprocess:ke},{name:"Node$ebnf$1",symbols:["Attributes"],postprocess:ke},{name:"Node$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"Node",symbols:[{literal:"("},"_","Node$ebnf$1",{literal:")"},"_"],postprocess:function(e){var t=e[2];return t?ye(t.id,t.labels,t.record):ye()}},{name:"Edge$ebnf$1",symbols:["Attributes"],postprocess:ke},{name:"Edge$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"Edge",symbols:[{literal:"-["},"_","Edge$ebnf$1",{literal:"]->"},"_"],postprocess:function(e){return re({kind:"right"},e[2])}},{name:"Edge$ebnf$2",symbols:["Attributes"],postprocess:ke},{name:"Edge$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"Edge",symbols:[{literal:"-["},"_","Edge$ebnf$2",{literal:"]-"},"_"],postprocess:function(e){return re({kind:"either"},e[2])}},{name:"Edge$ebnf$3",symbols:["Attributes"],postprocess:ke},{name:"Edge$ebnf$3",symbols:[],postprocess:function(){return null}},{name:"Edge",symbols:[{literal:"<-["},"_","Edge$ebnf$3",{literal:"]-"},"_"],postprocess:function(e){return re({kind:"left"},e[2])}},{name:"Edge",symbols:[{literal:"-[]->"},"_"],postprocess:function(){return{kind:"right"}}},{name:"Edge",symbols:[{literal:"-[]-"},"_"],postprocess:function(){return{kind:"either"}}},{name:"Edge",symbols:[{literal:"<-[]-"},"_"],postprocess:function(){return{kind:"left"}}},{name:"Edge",symbols:[{literal:"--\x3e"},"_"],postprocess:function(){return{kind:"right"}}},{name:"Edge",symbols:[{literal:"--"},"_"],postprocess:function(){return{kind:"either"}}},{name:"Edge",symbols:[{literal:"<--"},"_"],postprocess:function(){return{kind:"left"}}},{name:"PathComposition",symbols:["PathPoint"],postprocess:ke},{name:"PathComposition",symbols:["PathAnnotation"],postprocess:ke},{name:"PathComposition",symbols:["PathExpression"],postprocess:ke},{name:"PathPoint$ebnf$1",symbols:["Attributes"],postprocess:ke},{name:"PathPoint$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathPoint",symbols:[{literal:"["},"_","PathPoint$ebnf$1",{literal:"]"},"_"],postprocess:function(e){var t=e[2];return t&&(t.id||t.labels||t.record)&&"ø"!==t.id?ye(t.id,t.labels,t.record):me}},{name:"PathAnnotation$ebnf$1",symbols:["Attributes"],postprocess:ke},{name:"PathAnnotation$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathAnnotation",symbols:[{literal:"["},"_","PathAnnotation$ebnf$1","Path",{literal:"]"},"_"],postprocess:function(e){var t=e[2];return he([e[3]],t?{id:t.id,labels:t.labels,record:t.record}:{})}},{name:"PathExpression$ebnf$1",symbols:["Attributes"],postprocess:ke},{name:"PathExpression$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathExpression$ebnf$2",symbols:["Kind"],postprocess:ke},{name:"PathExpression$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"PathExpression",symbols:[{literal:"["},"_","PathExpression$ebnf$1","PathExpression$ebnf$2","Path","Path",{literal:"]"},"_"],postprocess:function(e){var t=e[2];return he([e[4],e[5]],{kind:e[3],id:t.id,labels:t.labels,record:t.record})}},{name:"PathPair$subexpression$1",symbols:["NodePattern"]},{name:"PathPair$subexpression$1",symbols:["PathComposition"]},{name:"PathPair",symbols:["PathPair$subexpression$1",{literal:","},"_","Path"],postprocess:function(e){return function(e,t,r,n,o){return fe({type:"path",kind:"pair",id:void 0},void 0,void 0,{children:t})}(0,[e[0][0],e[3]])}},{name:"Kind",symbols:[{literal:","},"_"],postprocess:function(){return"pair"}},{name:"Kind",symbols:[{literal:"--\x3e"},"_"],postprocess:function(){return"right"}},{name:"Kind",symbols:[{literal:"--"},"_"],postprocess:function(){return"either"}},{name:"Kind",symbols:[{literal:"<--"},"_"],postprocess:function(){return"left"}},{name:"Attributes$ebnf$1",symbols:["Identity"],postprocess:ke},{name:"Attributes$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"Attributes$ebnf$2",symbols:["LabelList"],postprocess:ke},{name:"Attributes$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"Attributes$ebnf$3",symbols:["Record"],postprocess:ke},{name:"Attributes$ebnf$3",symbols:[],postprocess:function(){return null}},{name:"Attributes",symbols:["Attributes$ebnf$1","Attributes$ebnf$2","Attributes$ebnf$3"],postprocess:function(e,t,r){var n=e[0],o=e[1],s=e[2];return n||o||s?{id:n,labels:o,record:s}:r}},{name:"LabelList$ebnf$1",symbols:["Label"]},{name:"LabelList$ebnf$1",symbols:["LabelList$ebnf$1","Label"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"LabelList",symbols:["LabelList$ebnf$1"],postprocess:function(e){return e[0]}},{name:"Label",symbols:[{literal:":"},"Symbol"],postprocess:function(e){return e[1]}},{name:"Identity",symbols:[Ee.has("identifier")?{type:"identifier"}:identifier,"_"],postprocess:_e},{name:"Identity",symbols:[{literal:"ø"},"_"],postprocess:_e},{name:"Identity",symbols:[Ee.has("symbol")?{type:"symbol"}:symbol,"_"],postprocess:_e},{name:"Identity",symbols:[Ee.has("integer")?{type:"integer"}:integer,"_"],postprocess:_e},{name:"Identity",symbols:[Ee.has("octal")?{type:"octal"}:octal,"_"],postprocess:_e},{name:"Identity",symbols:[Ee.has("hexadecimal")?{type:"hexadecimal"}:hexadecimal,"_"],postprocess:_e},{name:"Identity",symbols:[Ee.has("measurement")?{type:"measurement"}:measurement,"_"],postprocess:_e},{name:"Identity",symbols:[Ee.has("tickedString")?{type:"tickedString"}:tickedString,"_"],postprocess:function(e){return e[0].text.slice(1,-1)}},{name:"Symbol",symbols:[Ee.has("symbol")?{type:"symbol"}:symbol,"_"],postprocess:_e},{name:"Symbol",symbols:[Ee.has("tickedString")?{type:"tickedString"}:tickedString,"_"],postprocess:function(e){return e[0].text.slice(1,-1)}},{name:"Record",symbols:[{literal:"{"},"_",{literal:"}"},"_"],postprocess:Pe},{name:"Record$ebnf$1",symbols:[]},{name:"Record$ebnf$1$subexpression$1",symbols:[{literal:","},"_","Property"],postprocess:function(e){return e[2]}},{name:"Record$ebnf$1",symbols:["Record$ebnf$1","Record$ebnf$1$subexpression$1"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"Record",symbols:[{literal:"{"},"_","Property","Record$ebnf$1",{literal:"}"},"_"],postprocess:function(e){return[e[2]].concat(e[3]).reduce((function(e,t){return e.set(t.name,t.value),e}),de())}},{name:"Property",symbols:["Symbol",{literal:":"},"_","Value"],postprocess:function(e){var t;return{type:"property",name:e[0],value:ce(t=e[3])?t:ge(t)}}},{name:"Value",symbols:["StringLiteral","_"],postprocess:ke},{name:"Value",symbols:["NumericLiteral","_"],postprocess:ke},{name:"Value",symbols:[Ee.has("boolean")?{type:"boolean"}:boolean,"_"],postprocess:function(e){return ve(JSON.parse(e[0].value.toLowerCase()))}},{name:"Value$ebnf$1",symbols:[]},{name:"Value$ebnf$1$subexpression$1",symbols:[{literal:","},"_","Value"],postprocess:function(e){return e[2]}},{name:"Value$ebnf$1",symbols:["Value$ebnf$1","Value$ebnf$1$subexpression$1"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"Value",symbols:[{literal:"["},"_","Value","Value$ebnf$1",{literal:"]"},"_"],postprocess:function(e){return[e[2]].concat(e[3])}},{name:"StringLiteral",symbols:[Ee.has("singleQuotedString")?{type:"singleQuotedString"}:singleQuotedString],postprocess:function(e){return we(e[0].value)}},{name:"StringLiteral",symbols:[Ee.has("doubleQuotedString")?{type:"doubleQuotedString"}:doubleQuotedString],postprocess:function(e){return we(e[0].value)}},{name:"StringLiteral",symbols:[Ee.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(e){return we(e[0].value)}},{name:"StringLiteral",symbols:[Ee.has("taggedString")?{type:"taggedString"}:taggedString],postprocess:function(e){var t=function(e){var t=e.match(/([^`]+)`(.+)`$/);if(null==t)throw Error("Malformed tagged string: "+e);return{tag:t[1],value:t[2]}}(e[0].value);return xe(t.tag,t.value)}},{name:"NumericLiteral",symbols:[Ee.has("integer")?{type:"integer"}:integer],postprocess:function(e){return{type:"integer",value:String(e[0].value)}}},{name:"NumericLiteral",symbols:[Ee.has("decimal")?{type:"decimal"}:decimal],postprocess:function(e){return $e(e[0].value)}},{name:"NumericLiteral",symbols:[Ee.has("hexadecimal")?{type:"hexadecimal"}:hexadecimal],postprocess:function(e){return{type:"hexadecimal",value:"number"==typeof(t=e[0].value)?t.toString(16):t};var t}},{name:"NumericLiteral",symbols:[Ee.has("octal")?{type:"octal"}:octal],postprocess:function(e){return{type:"octal",value:"number"==typeof(t=e[0].value)?t.toString(8):t};var t}},{name:"NumericLiteral",symbols:[Ee.has("measurement")?{type:"measurement"}:measurement],postprocess:function(e){var t,r=function(e){var t=e.match(/(-?[0-9.]+)([a-zA-Z]+)/);if(null==t)throw Error("Malformed measurement : "+e);return{value:t[1],unit:t[2]}}(e[0].value);return t=r.unit,{type:"measurement",value:String(r.value),unit:t}}},{name:"_$ebnf$1",symbols:[Ee.has("whitespace")?{type:"whitespace"}:whitespace],postprocess:ke},{name:"_$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"_",symbols:["_$ebnf$1"],postprocess:Pe},{name:"Comment",symbols:[Ee.has("lineComment")?{type:"lineComment"}:lineComment],postprocess:Pe},{name:"EOL",symbols:[{literal:"\n"}],postprocess:Pe}],ParserStart:"GramSeq"},Oe=function(e,t){var r,n,o=new te.Parser(te.Grammar.fromCompiled(Ae));try{var s=o.feed(e);if(void 0===s.results[0]&&s.lexerState){var i={line:(n=s.lexerState).line,column:n.col};t.fail("Incomplete parse.",i)}return s.results.length>1&&t.info("[WARN] parsing is ambiguous"),s.results[0]||{type:"error"}}catch(e){var a=e.token?{line:(r=e.token).line,column:r.col}:{line:0,column:0};t.fail(e.message,a)}},je=function(){this.Parser=Oe};e.errors={__proto__:null,INCOMPLETE_PARSE:"Incomplete parse.",SYNTAX_ERROR:"Syntax error at"},e.gramParserPlugin=je,e.toAST=function(e){return G().use(je).freeze().parse(e)},Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=gram-parse.umd.production.min.js.map

@@ -10,3 +10,3 @@ {

],
"version": "0.3.9-alpha.2",
"version": "0.3.9",
"license": "MIT",

@@ -59,3 +59,3 @@ "author": "Andreas Kollegger",

"devDependencies": {
"@gram-data/gram-stringify": "^0.3.9-alpha.2",
"@gram-data/gram-stringify": "^0.3.9",
"@types/jest": "^26.0.19",

@@ -80,4 +80,4 @@ "@types/moo": "^0.5.3",

"dependencies": {
"@gram-data/gram-ast": "^0.3.9-alpha.2",
"@gram-data/gram-builder": "^0.3.9-alpha.2",
"@gram-data/gram-ast": "^0.3.9",
"@gram-data/gram-builder": "^0.3.9",
"moo": "^0.5.1",

@@ -88,3 +88,3 @@ "nearley": "^2.20.1",

},
"gitHead": "32528b415789ea165d93b2432a50322c977642eb",
"gitHead": "f77b8ca02cfafdf66e58eb67632ba8ad9857d3f2",
"publishConfig": {

@@ -91,0 +91,0 @@ "access": "public"

@@ -157,3 +157,3 @@ // Generated automatically by nearley, version 2.20.1

symbols: ['GramSeq$ebnf$1', 'GramSeq$ebnf$1$subexpression$2'],
postprocess: d => d[0].concat([d[1]]),
postprocess: (d) => d[0].concat([d[1]]),
},

@@ -347,3 +347,3 @@ {

symbols: ['Attributes$ebnf$1', 'Attributes$ebnf$2', 'Attributes$ebnf$3'],
postprocess: function(d, _, reject) {
postprocess: function (d, _, reject) {
const [id, labels, record] = d;

@@ -359,3 +359,3 @@ if (id || labels || record) {

symbols: ['LabelList$ebnf$1', 'Label'],
postprocess: d => d[0].concat([d[1]]),
postprocess: (d) => d[0].concat([d[1]]),
},

@@ -447,3 +447,3 @@ {

symbols: ['Record$ebnf$1', 'Record$ebnf$1$subexpression$1'],
postprocess: d => d[0].concat([d[1]]),
postprocess: (d) => d[0].concat([d[1]]),
},

@@ -472,3 +472,3 @@ {

symbols: [lexer.has('boolean') ? { type: 'boolean' } : boolean, '_'],
postprocess: d => g.boolean(JSON.parse(d[0].value.toLowerCase())),
postprocess: (d) => g.boolean(JSON.parse(d[0].value.toLowerCase())),
},

@@ -484,3 +484,3 @@ { name: 'Value$ebnf$1', symbols: [] },

symbols: ['Value$ebnf$1', 'Value$ebnf$1$subexpression$1'],
postprocess: d => d[0].concat([d[1]]),
postprocess: (d) => d[0].concat([d[1]]),
},

@@ -506,3 +506,3 @@ {

],
postprocess: d => g.string(d[0].value),
postprocess: (d) => g.string(d[0].value),
},

@@ -516,3 +516,3 @@ {

],
postprocess: d => g.string(d[0].value),
postprocess: (d) => g.string(d[0].value),
},

@@ -524,3 +524,3 @@ {

],
postprocess: d => g.string(d[0].value),
postprocess: (d) => g.string(d[0].value),
},

@@ -532,3 +532,3 @@ {

],
postprocess: d => {
postprocess: (d) => {
const parts = separateTagFromString(d[0].value);

@@ -541,3 +541,3 @@ return g.tagged(parts.tag, parts.value);

symbols: [lexer.has('integer') ? { type: 'integer' } : integer],
postprocess: d => g.integer(d[0].value),
postprocess: (d) => g.integer(d[0].value),
},

@@ -547,3 +547,3 @@ {

symbols: [lexer.has('decimal') ? { type: 'decimal' } : decimal],
postprocess: d => g.decimal(d[0].value),
postprocess: (d) => g.decimal(d[0].value),
},

@@ -555,3 +555,3 @@ {

],
postprocess: d => g.hexadecimal(d[0].value),
postprocess: (d) => g.hexadecimal(d[0].value),
},

@@ -561,3 +561,3 @@ {

symbols: [lexer.has('octal') ? { type: 'octal' } : octal],
postprocess: d => g.octal(d[0].value),
postprocess: (d) => g.octal(d[0].value),
},

@@ -569,3 +569,3 @@ {

],
postprocess: d => {
postprocess: (d) => {
const parts = separateNumberFromUnits(d[0].value);

@@ -572,0 +572,0 @@ return g.measurement(parts.unit, parts.value);

@@ -50,3 +50,3 @@ import { ParserFunction, Plugin } from 'unified';

const gramParserPlugin: Plugin<GramParserSettings[]> = function() {
const gramParserPlugin: Plugin<GramParserSettings[]> = function () {
this.Parser = parse;

@@ -53,0 +53,0 @@ };

@@ -8,7 +8,5 @@ import unified from 'unified';

const toAST = (src: string) => {
const processor = unified()
.use(gramParserPlugin)
.freeze();
const processor = unified().use(gramParserPlugin).freeze();
return processor.parse(src) as gramTypes.GramSeq;
};
export { toAST, gramParserPlugin, errors };

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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