Huge News!Announcing our $40M Series B led by Abstract Ventures.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.2.9 to 0.2.10

272

dist/gram-parse.cjs.development.js

@@ -137,16 +137,4 @@ 'use strict';

ParserRules: [{
name: 'PathSequence$ebnf$1$subexpression$1$ebnf$1',
symbols: [{
literal: ','
}],
postprocess: id
}, {
name: 'PathSequence$ebnf$1$subexpression$1$ebnf$1',
symbols: [],
postprocess: function postprocess() {
return null;
}
}, {
name: 'PathSequence$ebnf$1$subexpression$1',
symbols: ['Path', 'PathSequence$ebnf$1$subexpression$1$ebnf$1', '_'],
name: 'GramSeq$ebnf$1$subexpression$1',
symbols: ['Path', '_'],
postprocess: function postprocess(_ref2) {

@@ -157,19 +145,7 @@ var pp = _ref2[0];

}, {
name: 'PathSequence$ebnf$1',
symbols: ['PathSequence$ebnf$1$subexpression$1']
name: 'GramSeq$ebnf$1',
symbols: ['GramSeq$ebnf$1$subexpression$1']
}, {
name: 'PathSequence$ebnf$1$subexpression$2$ebnf$1',
symbols: [{
literal: ','
}],
postprocess: id
}, {
name: 'PathSequence$ebnf$1$subexpression$2$ebnf$1',
symbols: [],
postprocess: function postprocess() {
return null;
}
}, {
name: 'PathSequence$ebnf$1$subexpression$2',
symbols: ['Path', 'PathSequence$ebnf$1$subexpression$2$ebnf$1', '_'],
name: 'GramSeq$ebnf$1$subexpression$2',
symbols: ['Path', '_'],
postprocess: function postprocess(_ref3) {

@@ -180,4 +156,4 @@ var pp = _ref3[0];

}, {
name: 'PathSequence$ebnf$1',
symbols: ['PathSequence$ebnf$1', 'PathSequence$ebnf$1$subexpression$2'],
name: 'GramSeq$ebnf$1',
symbols: ['GramSeq$ebnf$1', 'GramSeq$ebnf$1$subexpression$2'],
postprocess: function postprocess(d) {

@@ -187,7 +163,7 @@ return d[0].concat([d[1]]);

}, {
name: 'PathSequence$ebnf$2',
name: 'GramSeq$ebnf$2',
symbols: ['EOL'],
postprocess: id
}, {
name: 'PathSequence$ebnf$2',
name: 'GramSeq$ebnf$2',
symbols: [],

@@ -198,4 +174,4 @@ postprocess: function postprocess() {

}, {
name: 'PathSequence',
symbols: ['PathSequence$ebnf$1', 'PathSequence$ebnf$2'],
name: 'GramSeq',
symbols: ['GramSeq$ebnf$1', 'GramSeq$ebnf$2'],
postprocess: function postprocess(_ref4) {

@@ -215,13 +191,13 @@ var pp = _ref4[0];

name: 'Path',
symbols: ['Comment'],
symbols: ['PathPair'],
postprocess: id
}, {
name: 'NodePattern',
symbols: ['Node', 'Edge', 'NodePattern'],
symbols: ['Node', '_', 'Edge', '_', 'NodePattern'],
postprocess: function postprocess(_ref5) {
var np = _ref5[0],
es = _ref5[1],
ep = _ref5[2];
es = _ref5[2],
ep = _ref5[4];
return gramBuilder.builder.cons([np, ep], {
relation: es.relation,
kind: es.kind,
id: es.id,

@@ -244,4 +220,4 @@ labels: es.labels,

postprocess: function postprocess(_ref6) {
var content = _ref6[2];
return gramBuilder.builder.node(content.id, content.labels, content.record);
var attrs = _ref6[2];
return gramBuilder.builder.node(attrs.id, attrs.labels, attrs.record);
}

@@ -256,6 +232,6 @@ }, {

postprocess: function postprocess(_ref7) {
var content = _ref7[2];
var attrs = _ref7[2];
return _extends({
relation: 'right'
}, content);
kind: 'right'
}, attrs);
}

@@ -270,6 +246,6 @@ }, {

postprocess: function postprocess(_ref8) {
var content = _ref8[2];
var attrs = _ref8[2];
return _extends({
relation: 'either'
}, content);
kind: 'either'
}, attrs);
}

@@ -284,6 +260,6 @@ }, {

postprocess: function postprocess(_ref9) {
var content = _ref9[2];
var attrs = _ref9[2];
return _extends({
relation: 'left'
}, content);
kind: 'left'
}, attrs);
}

@@ -297,3 +273,3 @@ }, {

return {
relation: 'right'
kind: 'right'
};

@@ -308,3 +284,3 @@ }

return {
relation: 'either'
kind: 'either'
};

@@ -319,3 +295,3 @@ }

return {
relation: 'left'
kind: 'left'
};

@@ -330,3 +306,3 @@ }

return {
relation: 'right'
kind: 'right'
};

@@ -341,3 +317,3 @@ }

return {
relation: 'either'
kind: 'either'
};

@@ -352,3 +328,3 @@ }

return {
relation: 'left'
kind: 'left'
};

@@ -358,26 +334,52 @@ }

name: 'PathComposition',
symbols: ['PathPoint'],
postprocess: id
}, {
name: 'PathComposition',
symbols: ['PathAnnotation'],
postprocess: id
}, {
name: 'PathComposition',
symbols: ['PathExpression'],
postprocess: id
}, {
name: 'PathPoint',
symbols: [{
literal: '['
}, '_', {
}, '_', 'Attributes', '_', {
literal: ']'
}],
postprocess: function postprocess() {
return gramBuilder.builder.empty();
postprocess: function postprocess(_ref10) {
var attr = _ref10[2];
if ((attr.id || attr.labels || attr.record) && attr.id !== 'ø') {
// console.log(attr);
return gramBuilder.builder.node(attr.id, attr.labels, attr.record);
} else {
return gramBuilder.builder.empty();
}
}
}, {
name: 'PathComposition$ebnf$1',
symbols: ['Relation'],
postprocess: id
}, {
name: 'PathComposition$ebnf$1',
symbols: [],
postprocess: function postprocess() {
return null;
name: 'PathAnnotation',
symbols: [{
literal: '['
}, '_', 'Attributes', '_', 'Path', {
literal: ']'
}],
postprocess: function postprocess(_ref11) {
var attr = _ref11[2],
lhs = _ref11[4];
// console.log('annotate()', lhs)
return gramBuilder.builder.cons([lhs], {
id: attr.id,
labels: attr.labels,
record: attr.record
});
}
}, {
name: 'PathComposition$ebnf$2',
symbols: ['Path'],
name: 'PathExpression$ebnf$1',
symbols: ['Kind'],
postprocess: id
}, {
name: 'PathComposition$ebnf$2',
name: 'PathExpression$ebnf$1',
symbols: [],

@@ -388,32 +390,38 @@ postprocess: function postprocess() {

}, {
name: 'PathComposition$ebnf$3',
symbols: ['Path'],
postprocess: id
}, {
name: 'PathComposition$ebnf$3',
symbols: [],
postprocess: function postprocess() {
return null;
}
}, {
name: 'PathComposition',
name: 'PathExpression',
symbols: [{
literal: '['
}, '_', 'Attributes', '_', 'PathComposition$ebnf$1', '_', 'PathComposition$ebnf$2', '_', 'PathComposition$ebnf$3', '_', {
}, '_', 'Attributes', '_', 'PathExpression$ebnf$1', '_', 'Path', '_', 'Path', '_', {
literal: ']'
}],
postprocess: function postprocess(_ref10) {
var attr = _ref10[2],
relation = _ref10[4],
lhs = _ref10[6],
rhs = _ref10[8];
return gramBuilder.builder.cons(rhs ? lhs ? [lhs, rhs] : [rhs] : [], {
relation: relation,
id: attr.id,
labels: attr.labels,
record: attr.record
postprocess: function postprocess(_ref12) {
var attrs = _ref12[2],
kind = _ref12[4],
lhs = _ref12[6],
rhs = _ref12[8];
return gramBuilder.builder.cons([lhs, rhs], {
kind: kind,
id: attrs.id,
labels: attrs.labels,
record: attrs.record
});
}
}, {
name: 'Relation',
name: 'PathPair$subexpression$1',
symbols: ['NodePattern']
}, {
name: 'PathPair$subexpression$1',
symbols: ['PathComposition']
}, {
name: 'PathPair',
symbols: ['PathPair$subexpression$1', '_', {
literal: ','
}, '_', 'Path'],
postprocess: function postprocess(_ref13) {
var lp = _ref13[0],
rp = _ref13[4];
return gramBuilder.builder.pair([lp[0], rp]);
}
}, {
name: 'Kind',
symbols: [{

@@ -426,3 +434,3 @@ literal: ','

}, {
name: 'Relation',
name: 'Kind',
symbols: [{

@@ -435,3 +443,3 @@ literal: '-->'

}, {
name: 'Relation',
name: 'Kind',
symbols: [{

@@ -444,3 +452,3 @@ literal: '--'

}, {
name: 'Relation',
name: 'Kind',
symbols: [{

@@ -463,4 +471,11 @@ literal: '<--'

}, {
name: 'Attributes$ebnf$2$subexpression$1',
symbols: ['_', 'LabelList'],
postprocess: function postprocess(_ref14) {
var ll = _ref14[1];
return ll;
}
}, {
name: 'Attributes$ebnf$2',
symbols: ['LabelList'],
symbols: ['Attributes$ebnf$2$subexpression$1'],
postprocess: id

@@ -474,4 +489,11 @@ }, {

}, {
name: 'Attributes$ebnf$3$subexpression$1',
symbols: ['_', 'Record'],
postprocess: function postprocess(_ref15) {
var r = _ref15[1];
return r;
}
}, {
name: 'Attributes$ebnf$3',
symbols: ['Record'],
symbols: ['Attributes$ebnf$3$subexpression$1'],
postprocess: id

@@ -486,7 +508,7 @@ }, {

name: 'Attributes',
symbols: ['Attributes$ebnf$1', '_', 'Attributes$ebnf$2', '_', 'Attributes$ebnf$3'],
postprocess: function postprocess(_ref11) {
var id = _ref11[0],
labels = _ref11[2],
record = _ref11[4];
symbols: ['Attributes$ebnf$1', 'Attributes$ebnf$2', 'Attributes$ebnf$3'],
postprocess: function postprocess(_ref16) {
var id = _ref16[0],
labels = _ref16[2],
record = _ref16[4];
return {

@@ -510,4 +532,4 @@ id: id,

symbols: ['LabelList$ebnf$1'],
postprocess: function postprocess(_ref12) {
var labels = _ref12[0];
postprocess: function postprocess(_ref17) {
var labels = _ref17[0];
return labels;

@@ -520,4 +542,4 @@ }

}, 'Symbol'],
postprocess: function postprocess(_ref13) {
var label = _ref13[1];
postprocess: function postprocess(_ref18) {
var label = _ref18[1];
return label;

@@ -572,4 +594,4 @@ }

} : tickedString],
postprocess: function postprocess(_ref14) {
var t = _ref14[0];
postprocess: function postprocess(_ref19) {
var t = _ref19[0];
return t.text.slice(1, -1);

@@ -588,4 +610,4 @@ }

} : tickedString],
postprocess: function postprocess(_ref15) {
var t = _ref15[0];
postprocess: function postprocess(_ref20) {
var t = _ref20[0];
return t.text.slice(1, -1);

@@ -622,5 +644,5 @@ }

}],
postprocess: function postprocess(_ref16) {
var p = _ref16[2],
ps = _ref16[3];
postprocess: function postprocess(_ref21) {
var p = _ref21[2],
ps = _ref21[3];
return [p].concat(extractPairs(ps));

@@ -633,5 +655,5 @@ }

}, '_', 'Value'],
postprocess: function postprocess(_ref17) {
var k = _ref17[0],
v = _ref17[4];
postprocess: function postprocess(_ref22) {
var k = _ref22[0],
v = _ref22[4];
return gramBuilder.builder.property(k, v);

@@ -676,5 +698,5 @@ }

}],
postprocess: function postprocess(_ref18) {
var v = _ref18[2],
vs = _ref18[3];
postprocess: function postprocess(_ref23) {
var v = _ref23[2],
vs = _ref23[3];
return [v].concat(extractArray(vs));

@@ -778,3 +800,3 @@ }

}],
ParserStart: 'PathSequence'
ParserStart: 'GramSeq'
};

@@ -816,2 +838,6 @@

if (parsed.results.length > 1) {
file.info('[WARN] parsing is ambiguous');
}
return parsed.results[0] || {

@@ -818,0 +844,0 @@ type: 'error'

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

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("unified")),s=e(require("nearley")),n=e(require("moo")),r=require("@gram-data/gram-builder"),o=require("@gram-data/gram-ast");function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e}).apply(this,arguments)}function l(e){return e[0]}var i=n.compile({whitespace:{match:/\s+/,lineBreaks:!0},lineComment:{match:/\/\/.*?\n?$/},hexadecimal:o.tokens.hexadecimal,octal:o.tokens.octal,measurement:o.tokens.measurement,decimal:o.tokens.decimal,integer:o.tokens.integer,taggedString:{match:o.tokens.taggedString},boolean:["true","TRUE","True","false","FALSE","False"],symbol:o.tokens.symbol,identifier:o.tokens.identifier,doubleQuotedString:{match:o.tokens.doubleQuotedString,value:function(e){return e.slice(1,-1)}},singleQuotedString:{match:o.tokens.singleQuotedString,value:function(e){return e.slice(1,-1)}},tickedString:{match:o.tokens.tickedString,value:function(e){return e.slice(1,-1)}},"--\x3e":"--\x3e","--":"--","<--":"<--","-[]->":"-[]->","-[]-":"-[]-","<-[]-":"<-[]-","<-[":"<-[","]->":"]->","-[":"-[","]-":"]-","{":"{","}":"}","[":"[","]":"]","(":"(",")":")",",":",",":":":","`":"`","'":"'","ø":"ø"}),u=function(){return null},m=function(e){return e[0].text},c={Lexer:i,ParserRules:[{name:"PathSequence$ebnf$1$subexpression$1$ebnf$1",symbols:[{literal:","}],postprocess:l},{name:"PathSequence$ebnf$1$subexpression$1$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathSequence$ebnf$1$subexpression$1",symbols:["Path","PathSequence$ebnf$1$subexpression$1$ebnf$1","_"],postprocess:function(e){return e[0]}},{name:"PathSequence$ebnf$1",symbols:["PathSequence$ebnf$1$subexpression$1"]},{name:"PathSequence$ebnf$1$subexpression$2$ebnf$1",symbols:[{literal:","}],postprocess:l},{name:"PathSequence$ebnf$1$subexpression$2$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathSequence$ebnf$1$subexpression$2",symbols:["Path","PathSequence$ebnf$1$subexpression$2$ebnf$1","_"],postprocess:function(e){return e[0]}},{name:"PathSequence$ebnf$1",symbols:["PathSequence$ebnf$1","PathSequence$ebnf$1$subexpression$2"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"PathSequence$ebnf$2",symbols:["EOL"],postprocess:l},{name:"PathSequence$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"PathSequence",symbols:["PathSequence$ebnf$1","PathSequence$ebnf$2"],postprocess:function(e){return r.builder.seq(r.builder.flatten(e[0]))}},{name:"Path",symbols:["NodePattern"],postprocess:l},{name:"Path",symbols:["PathComposition"],postprocess:l},{name:"Path",symbols:["Comment"],postprocess:l},{name:"NodePattern",symbols:["Node","Edge","NodePattern"],postprocess:function(e){var t=e[1];return r.builder.cons([e[0],e[2]],{relation:t.relation,id:t.id,labels:t.labels,record:t.record})}},{name:"NodePattern",symbols:["Node"],postprocess:l},{name:"Node",symbols:[{literal:"("},"_","Attributes","_",{literal:")"}],postprocess:function(e){var t=e[2];return r.builder.node(t.id,t.labels,t.record)}},{name:"Edge",symbols:[{literal:"-["},"_","Attributes",{literal:"]->"}],postprocess:function(e){return a({relation:"right"},e[2])}},{name:"Edge",symbols:[{literal:"-["},"_","Attributes",{literal:"]-"}],postprocess:function(e){return a({relation:"either"},e[2])}},{name:"Edge",symbols:[{literal:"<-["},"_","Attributes",{literal:"]-"}],postprocess:function(e){return a({relation:"left"},e[2])}},{name:"Edge",symbols:[{literal:"-[]->"}],postprocess:function(){return{relation:"right"}}},{name:"Edge",symbols:[{literal:"-[]-"}],postprocess:function(){return{relation:"either"}}},{name:"Edge",symbols:[{literal:"<-[]-"}],postprocess:function(){return{relation:"left"}}},{name:"Edge",symbols:[{literal:"--\x3e"}],postprocess:function(){return{relation:"right"}}},{name:"Edge",symbols:[{literal:"--"}],postprocess:function(){return{relation:"either"}}},{name:"Edge",symbols:[{literal:"<--"}],postprocess:function(){return{relation:"left"}}},{name:"PathComposition",symbols:[{literal:"["},"_",{literal:"]"}],postprocess:function(){return r.builder.empty()}},{name:"PathComposition$ebnf$1",symbols:["Relation"],postprocess:l},{name:"PathComposition$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathComposition$ebnf$2",symbols:["Path"],postprocess:l},{name:"PathComposition$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"PathComposition$ebnf$3",symbols:["Path"],postprocess:l},{name:"PathComposition$ebnf$3",symbols:[],postprocess:function(){return null}},{name:"PathComposition",symbols:[{literal:"["},"_","Attributes","_","PathComposition$ebnf$1","_","PathComposition$ebnf$2","_","PathComposition$ebnf$3","_",{literal:"]"}],postprocess:function(e){var t=e[2],s=e[6],n=e[8];return r.builder.cons(n?s?[s,n]:[n]:[],{relation:e[4],id:t.id,labels:t.labels,record:t.record})}},{name:"Relation",symbols:[{literal:","}],postprocess:function(){return"pair"}},{name:"Relation",symbols:[{literal:"--\x3e"}],postprocess:function(){return"right"}},{name:"Relation",symbols:[{literal:"--"}],postprocess:function(){return"either"}},{name:"Relation",symbols:[{literal:"<--"}],postprocess:function(){return"left"}},{name:"Attributes$ebnf$1",symbols:["Identity"],postprocess:l},{name:"Attributes$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"Attributes$ebnf$2",symbols:["LabelList"],postprocess:l},{name:"Attributes$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"Attributes$ebnf$3",symbols:["Record"],postprocess:l},{name:"Attributes$ebnf$3",symbols:[],postprocess:function(){return null}},{name:"Attributes",symbols:["Attributes$ebnf$1","_","Attributes$ebnf$2","_","Attributes$ebnf$3"],postprocess:function(e){return{id:e[0],labels:e[2],record:e[4]}}},{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:[i.has("identifier")?{type:"identifier"}:identifier],postprocess:m},{name:"Identity",symbols:[{literal:"ø"}],postprocess:m},{name:"Identity",symbols:[i.has("symbol")?{type:"symbol"}:symbol],postprocess:m},{name:"Identity",symbols:[i.has("integer")?{type:"integer"}:integer],postprocess:m},{name:"Identity",symbols:[i.has("octal")?{type:"octal"}:octal],postprocess:m},{name:"Identity",symbols:[i.has("hexadecimal")?{type:"hexadecimal"}:hexadecimal],postprocess:m},{name:"Identity",symbols:[i.has("measurement")?{type:"measurement"}:measurement],postprocess:m},{name:"Identity",symbols:[i.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(e){return e[0].text.slice(1,-1)}},{name:"Symbol",symbols:[i.has("symbol")?{type:"symbol"}:symbol],postprocess:m},{name:"Symbol",symbols:[i.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(e){return e[0].text.slice(1,-1)}},{name:"Record",symbols:[{literal:"{"},"_",{literal:"}"}],postprocess:u},{name:"Record$ebnf$1",symbols:[]},{name:"Record$ebnf$1$subexpression$1",symbols:["_",{literal:","},"_","Property"]},{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].map((function(e){return e[3]})))}},{name:"Property",symbols:["Symbol","_",{literal:":"},"_","Value"],postprocess:function(e){return r.builder.property(e[0],e[4])}},{name:"Value",symbols:["StringLiteral"],postprocess:l},{name:"Value",symbols:["NumericLiteral"],postprocess:l},{name:"Value",symbols:[i.has("boolean")?{type:"boolean"}:boolean],postprocess:function(e){return r.builder.boolean(JSON.parse(e[0].value.toLowerCase()))}},{name:"Value$ebnf$1",symbols:[]},{name:"Value$ebnf$1$subexpression$1",symbols:["_",{literal:","},"_","Value"]},{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].map((function(e){return e[3]})))}},{name:"StringLiteral",symbols:[i.has("singleQuotedString")?{type:"singleQuotedString"}:singleQuotedString],postprocess:function(e){return r.builder.string(e[0].value)}},{name:"StringLiteral",symbols:[i.has("doubleQuotedString")?{type:"doubleQuotedString"}:doubleQuotedString],postprocess:function(e){return r.builder.string(e[0].value)}},{name:"StringLiteral",symbols:[i.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(e){return r.builder.string(e[0].value)}},{name:"StringLiteral",symbols:[i.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 r.builder.tagged(t.tag,t.value)}},{name:"NumericLiteral",symbols:[i.has("integer")?{type:"integer"}:integer],postprocess:function(e){return r.builder.integer(e[0].value)}},{name:"NumericLiteral",symbols:[i.has("decimal")?{type:"decimal"}:decimal],postprocess:function(e){return r.builder.decimal(e[0].value)}},{name:"NumericLiteral",symbols:[i.has("hexadecimal")?{type:"hexadecimal"}:hexadecimal],postprocess:function(e){return r.builder.hexadecimal(e[0].value)}},{name:"NumericLiteral",symbols:[i.has("octal")?{type:"octal"}:octal],postprocess:function(e){return r.builder.octal(e[0].value)}},{name:"NumericLiteral",symbols:[i.has("measurement")?{type:"measurement"}:measurement],postprocess:function(e){var t=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 r.builder.measurement(t.unit,t.value)}},{name:"_",symbols:[]},{name:"_",symbols:[i.has("whitespace")?{type:"whitespace"}:whitespace],postprocess:u},{name:"Comment",symbols:[i.has("lineComment")?{type:"lineComment"}:lineComment],postprocess:u},{name:"EOL",symbols:[{literal:"\n"}],postprocess:u}],ParserStart:"PathSequence"},p=function(e,t){var n,r,o=new s.Parser(s.Grammar.fromCompiled(c));try{var a=o.feed(e);if(void 0===a.results[0]&&a.lexerState){var l={line:(r=a.lexerState).line,column:r.col};t.fail("Incomplete parse.",l)}return a.results[0]||{type:"error"}}catch(e){var i=e.token?{line:(n=e.token).line,column:n.col}:{line:0,column:0};t.fail(e.message,i)}},b=function(){this.Parser=p};exports.errors={__proto__:null,INCOMPLETE_PARSE:"Incomplete parse.",SYNTAX_ERROR:"Syntax error at"},exports.gramParserPlugin=b,exports.toAST=function(e){return t().use(b).freeze().parse(e)};
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("unified")),s=e(require("nearley")),r=e(require("moo")),n=require("@gram-data/gram-builder"),o=require("@gram-data/gram-ast");function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r])}return e}).apply(this,arguments)}function i(e){return e[0]}var l=r.compile({whitespace:{match:/\s+/,lineBreaks:!0},lineComment:{match:/\/\/.*?\n?$/},hexadecimal:o.tokens.hexadecimal,octal:o.tokens.octal,measurement:o.tokens.measurement,decimal:o.tokens.decimal,integer:o.tokens.integer,taggedString:{match:o.tokens.taggedString},boolean:["true","TRUE","True","false","FALSE","False"],symbol:o.tokens.symbol,identifier:o.tokens.identifier,doubleQuotedString:{match:o.tokens.doubleQuotedString,value:function(e){return e.slice(1,-1)}},singleQuotedString:{match:o.tokens.singleQuotedString,value:function(e){return e.slice(1,-1)}},tickedString:{match:o.tokens.tickedString,value:function(e){return e.slice(1,-1)}},"--\x3e":"--\x3e","--":"--","<--":"<--","-[]->":"-[]->","-[]-":"-[]-","<-[]-":"<-[]-","<-[":"<-[","]->":"]->","-[":"-[","]-":"]-","{":"{","}":"}","[":"[","]":"]","(":"(",")":")",",":",",":":":","`":"`","'":"'","ø":"ø"}),u=function(){return null},m=function(e){return e[0].text},c={Lexer:l,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$ebnf$2",symbols:["EOL"],postprocess:i},{name:"GramSeq$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"GramSeq",symbols:["GramSeq$ebnf$1","GramSeq$ebnf$2"],postprocess:function(e){return n.builder.seq(n.builder.flatten(e[0]))}},{name:"Path",symbols:["NodePattern"],postprocess:i},{name:"Path",symbols:["PathComposition"],postprocess:i},{name:"Path",symbols:["PathPair"],postprocess:i},{name:"NodePattern",symbols:["Node","_","Edge","_","NodePattern"],postprocess:function(e){var t=e[2];return n.builder.cons([e[0],e[4]],{kind:t.kind,id:t.id,labels:t.labels,record:t.record})}},{name:"NodePattern",symbols:["Node"],postprocess:i},{name:"Node",symbols:[{literal:"("},"_","Attributes","_",{literal:")"}],postprocess:function(e){var t=e[2];return n.builder.node(t.id,t.labels,t.record)}},{name:"Edge",symbols:[{literal:"-["},"_","Attributes",{literal:"]->"}],postprocess:function(e){return a({kind:"right"},e[2])}},{name:"Edge",symbols:[{literal:"-["},"_","Attributes",{literal:"]-"}],postprocess:function(e){return a({kind:"either"},e[2])}},{name:"Edge",symbols:[{literal:"<-["},"_","Attributes",{literal:"]-"}],postprocess:function(e){return a({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:i},{name:"PathComposition",symbols:["PathAnnotation"],postprocess:i},{name:"PathComposition",symbols:["PathExpression"],postprocess:i},{name:"PathPoint",symbols:[{literal:"["},"_","Attributes","_",{literal:"]"}],postprocess:function(e){var t=e[2];return(t.id||t.labels||t.record)&&"ø"!==t.id?n.builder.node(t.id,t.labels,t.record):n.builder.empty()}},{name:"PathAnnotation",symbols:[{literal:"["},"_","Attributes","_","Path",{literal:"]"}],postprocess:function(e){var t=e[2];return n.builder.cons([e[4]],{id:t.id,labels:t.labels,record:t.record})}},{name:"PathExpression$ebnf$1",symbols:["Kind"],postprocess:i},{name:"PathExpression$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathExpression",symbols:[{literal:"["},"_","Attributes","_","PathExpression$ebnf$1","_","Path","_","Path","_",{literal:"]"}],postprocess:function(e){var t=e[2];return n.builder.cons([e[6],e[8]],{kind:e[4],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 n.builder.pair([e[0][0],e[4]])}},{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:i},{name:"Attributes$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"Attributes$ebnf$2$subexpression$1",symbols:["_","LabelList"],postprocess:function(e){return e[1]}},{name:"Attributes$ebnf$2",symbols:["Attributes$ebnf$2$subexpression$1"],postprocess:i},{name:"Attributes$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"Attributes$ebnf$3$subexpression$1",symbols:["_","Record"],postprocess:function(e){return e[1]}},{name:"Attributes$ebnf$3",symbols:["Attributes$ebnf$3$subexpression$1"],postprocess:i},{name:"Attributes$ebnf$3",symbols:[],postprocess:function(){return null}},{name:"Attributes",symbols:["Attributes$ebnf$1","Attributes$ebnf$2","Attributes$ebnf$3"],postprocess:function(e){return{id:e[0],labels:e[2],record:e[4]}}},{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:[l.has("identifier")?{type:"identifier"}:identifier],postprocess:m},{name:"Identity",symbols:[{literal:"ø"}],postprocess:m},{name:"Identity",symbols:[l.has("symbol")?{type:"symbol"}:symbol],postprocess:m},{name:"Identity",symbols:[l.has("integer")?{type:"integer"}:integer],postprocess:m},{name:"Identity",symbols:[l.has("octal")?{type:"octal"}:octal],postprocess:m},{name:"Identity",symbols:[l.has("hexadecimal")?{type:"hexadecimal"}:hexadecimal],postprocess:m},{name:"Identity",symbols:[l.has("measurement")?{type:"measurement"}:measurement],postprocess:m},{name:"Identity",symbols:[l.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(e){return e[0].text.slice(1,-1)}},{name:"Symbol",symbols:[l.has("symbol")?{type:"symbol"}:symbol],postprocess:m},{name:"Symbol",symbols:[l.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(e){return e[0].text.slice(1,-1)}},{name:"Record",symbols:[{literal:"{"},"_",{literal:"}"}],postprocess:u},{name:"Record$ebnf$1",symbols:[]},{name:"Record$ebnf$1$subexpression$1",symbols:["_",{literal:","},"_","Property"]},{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].map((function(e){return e[3]})))}},{name:"Property",symbols:["Symbol","_",{literal:":"},"_","Value"],postprocess:function(e){return n.builder.property(e[0],e[4])}},{name:"Value",symbols:["StringLiteral"],postprocess:i},{name:"Value",symbols:["NumericLiteral"],postprocess:i},{name:"Value",symbols:[l.has("boolean")?{type:"boolean"}:boolean],postprocess:function(e){return n.builder.boolean(JSON.parse(e[0].value.toLowerCase()))}},{name:"Value$ebnf$1",symbols:[]},{name:"Value$ebnf$1$subexpression$1",symbols:["_",{literal:","},"_","Value"]},{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].map((function(e){return e[3]})))}},{name:"StringLiteral",symbols:[l.has("singleQuotedString")?{type:"singleQuotedString"}:singleQuotedString],postprocess:function(e){return n.builder.string(e[0].value)}},{name:"StringLiteral",symbols:[l.has("doubleQuotedString")?{type:"doubleQuotedString"}:doubleQuotedString],postprocess:function(e){return n.builder.string(e[0].value)}},{name:"StringLiteral",symbols:[l.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(e){return n.builder.string(e[0].value)}},{name:"StringLiteral",symbols:[l.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 n.builder.tagged(t.tag,t.value)}},{name:"NumericLiteral",symbols:[l.has("integer")?{type:"integer"}:integer],postprocess:function(e){return n.builder.integer(e[0].value)}},{name:"NumericLiteral",symbols:[l.has("decimal")?{type:"decimal"}:decimal],postprocess:function(e){return n.builder.decimal(e[0].value)}},{name:"NumericLiteral",symbols:[l.has("hexadecimal")?{type:"hexadecimal"}:hexadecimal],postprocess:function(e){return n.builder.hexadecimal(e[0].value)}},{name:"NumericLiteral",symbols:[l.has("octal")?{type:"octal"}:octal],postprocess:function(e){return n.builder.octal(e[0].value)}},{name:"NumericLiteral",symbols:[l.has("measurement")?{type:"measurement"}:measurement],postprocess:function(e){var t=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 n.builder.measurement(t.unit,t.value)}},{name:"_",symbols:[]},{name:"_",symbols:[l.has("whitespace")?{type:"whitespace"}:whitespace],postprocess:u},{name:"Comment",symbols:[l.has("lineComment")?{type:"lineComment"}:lineComment],postprocess:u},{name:"EOL",symbols:[{literal:"\n"}],postprocess:u}],ParserStart:"GramSeq"},p=function(e,t){var r,n,o=new s.Parser(s.Grammar.fromCompiled(c));try{var a=o.feed(e);if(void 0===a.results[0]&&a.lexerState){var i={line:(n=a.lexerState).line,column:n.col};t.fail("Incomplete parse.",i)}return a.results.length>1&&t.info("[WARN] parsing is ambiguous"),a.results[0]||{type:"error"}}catch(e){var l=e.token?{line:(r=e.token).line,column:r.col}:{line:0,column:0};t.fail(e.message,l)}},b=function(){this.Parser=p};exports.errors={__proto__:null,INCOMPLETE_PARSE:"Incomplete parse.",SYNTAX_ERROR:"Syntax error at"},exports.gramParserPlugin=b,exports.toAST=function(e){return t().use(b).freeze().parse(e)};
//# sourceMappingURL=gram-parse.cjs.production.min.js.map

@@ -131,16 +131,4 @@ import unified from 'unified';

ParserRules: [{
name: 'PathSequence$ebnf$1$subexpression$1$ebnf$1',
symbols: [{
literal: ','
}],
postprocess: id
}, {
name: 'PathSequence$ebnf$1$subexpression$1$ebnf$1',
symbols: [],
postprocess: function postprocess() {
return null;
}
}, {
name: 'PathSequence$ebnf$1$subexpression$1',
symbols: ['Path', 'PathSequence$ebnf$1$subexpression$1$ebnf$1', '_'],
name: 'GramSeq$ebnf$1$subexpression$1',
symbols: ['Path', '_'],
postprocess: function postprocess(_ref2) {

@@ -151,19 +139,7 @@ var pp = _ref2[0];

}, {
name: 'PathSequence$ebnf$1',
symbols: ['PathSequence$ebnf$1$subexpression$1']
name: 'GramSeq$ebnf$1',
symbols: ['GramSeq$ebnf$1$subexpression$1']
}, {
name: 'PathSequence$ebnf$1$subexpression$2$ebnf$1',
symbols: [{
literal: ','
}],
postprocess: id
}, {
name: 'PathSequence$ebnf$1$subexpression$2$ebnf$1',
symbols: [],
postprocess: function postprocess() {
return null;
}
}, {
name: 'PathSequence$ebnf$1$subexpression$2',
symbols: ['Path', 'PathSequence$ebnf$1$subexpression$2$ebnf$1', '_'],
name: 'GramSeq$ebnf$1$subexpression$2',
symbols: ['Path', '_'],
postprocess: function postprocess(_ref3) {

@@ -174,4 +150,4 @@ var pp = _ref3[0];

}, {
name: 'PathSequence$ebnf$1',
symbols: ['PathSequence$ebnf$1', 'PathSequence$ebnf$1$subexpression$2'],
name: 'GramSeq$ebnf$1',
symbols: ['GramSeq$ebnf$1', 'GramSeq$ebnf$1$subexpression$2'],
postprocess: function postprocess(d) {

@@ -181,7 +157,7 @@ return d[0].concat([d[1]]);

}, {
name: 'PathSequence$ebnf$2',
name: 'GramSeq$ebnf$2',
symbols: ['EOL'],
postprocess: id
}, {
name: 'PathSequence$ebnf$2',
name: 'GramSeq$ebnf$2',
symbols: [],

@@ -192,4 +168,4 @@ postprocess: function postprocess() {

}, {
name: 'PathSequence',
symbols: ['PathSequence$ebnf$1', 'PathSequence$ebnf$2'],
name: 'GramSeq',
symbols: ['GramSeq$ebnf$1', 'GramSeq$ebnf$2'],
postprocess: function postprocess(_ref4) {

@@ -209,13 +185,13 @@ var pp = _ref4[0];

name: 'Path',
symbols: ['Comment'],
symbols: ['PathPair'],
postprocess: id
}, {
name: 'NodePattern',
symbols: ['Node', 'Edge', 'NodePattern'],
symbols: ['Node', '_', 'Edge', '_', 'NodePattern'],
postprocess: function postprocess(_ref5) {
var np = _ref5[0],
es = _ref5[1],
ep = _ref5[2];
es = _ref5[2],
ep = _ref5[4];
return builder.cons([np, ep], {
relation: es.relation,
kind: es.kind,
id: es.id,

@@ -238,4 +214,4 @@ labels: es.labels,

postprocess: function postprocess(_ref6) {
var content = _ref6[2];
return builder.node(content.id, content.labels, content.record);
var attrs = _ref6[2];
return builder.node(attrs.id, attrs.labels, attrs.record);
}

@@ -250,6 +226,6 @@ }, {

postprocess: function postprocess(_ref7) {
var content = _ref7[2];
var attrs = _ref7[2];
return _extends({
relation: 'right'
}, content);
kind: 'right'
}, attrs);
}

@@ -264,6 +240,6 @@ }, {

postprocess: function postprocess(_ref8) {
var content = _ref8[2];
var attrs = _ref8[2];
return _extends({
relation: 'either'
}, content);
kind: 'either'
}, attrs);
}

@@ -278,6 +254,6 @@ }, {

postprocess: function postprocess(_ref9) {
var content = _ref9[2];
var attrs = _ref9[2];
return _extends({
relation: 'left'
}, content);
kind: 'left'
}, attrs);
}

@@ -291,3 +267,3 @@ }, {

return {
relation: 'right'
kind: 'right'
};

@@ -302,3 +278,3 @@ }

return {
relation: 'either'
kind: 'either'
};

@@ -313,3 +289,3 @@ }

return {
relation: 'left'
kind: 'left'
};

@@ -324,3 +300,3 @@ }

return {
relation: 'right'
kind: 'right'
};

@@ -335,3 +311,3 @@ }

return {
relation: 'either'
kind: 'either'
};

@@ -346,3 +322,3 @@ }

return {
relation: 'left'
kind: 'left'
};

@@ -352,26 +328,52 @@ }

name: 'PathComposition',
symbols: ['PathPoint'],
postprocess: id
}, {
name: 'PathComposition',
symbols: ['PathAnnotation'],
postprocess: id
}, {
name: 'PathComposition',
symbols: ['PathExpression'],
postprocess: id
}, {
name: 'PathPoint',
symbols: [{
literal: '['
}, '_', {
}, '_', 'Attributes', '_', {
literal: ']'
}],
postprocess: function postprocess() {
return builder.empty();
postprocess: function postprocess(_ref10) {
var attr = _ref10[2];
if ((attr.id || attr.labels || attr.record) && attr.id !== 'ø') {
// console.log(attr);
return builder.node(attr.id, attr.labels, attr.record);
} else {
return builder.empty();
}
}
}, {
name: 'PathComposition$ebnf$1',
symbols: ['Relation'],
postprocess: id
}, {
name: 'PathComposition$ebnf$1',
symbols: [],
postprocess: function postprocess() {
return null;
name: 'PathAnnotation',
symbols: [{
literal: '['
}, '_', 'Attributes', '_', 'Path', {
literal: ']'
}],
postprocess: function postprocess(_ref11) {
var attr = _ref11[2],
lhs = _ref11[4];
// console.log('annotate()', lhs)
return builder.cons([lhs], {
id: attr.id,
labels: attr.labels,
record: attr.record
});
}
}, {
name: 'PathComposition$ebnf$2',
symbols: ['Path'],
name: 'PathExpression$ebnf$1',
symbols: ['Kind'],
postprocess: id
}, {
name: 'PathComposition$ebnf$2',
name: 'PathExpression$ebnf$1',
symbols: [],

@@ -382,32 +384,38 @@ postprocess: function postprocess() {

}, {
name: 'PathComposition$ebnf$3',
symbols: ['Path'],
postprocess: id
}, {
name: 'PathComposition$ebnf$3',
symbols: [],
postprocess: function postprocess() {
return null;
}
}, {
name: 'PathComposition',
name: 'PathExpression',
symbols: [{
literal: '['
}, '_', 'Attributes', '_', 'PathComposition$ebnf$1', '_', 'PathComposition$ebnf$2', '_', 'PathComposition$ebnf$3', '_', {
}, '_', 'Attributes', '_', 'PathExpression$ebnf$1', '_', 'Path', '_', 'Path', '_', {
literal: ']'
}],
postprocess: function postprocess(_ref10) {
var attr = _ref10[2],
relation = _ref10[4],
lhs = _ref10[6],
rhs = _ref10[8];
return builder.cons(rhs ? lhs ? [lhs, rhs] : [rhs] : [], {
relation: relation,
id: attr.id,
labels: attr.labels,
record: attr.record
postprocess: function postprocess(_ref12) {
var attrs = _ref12[2],
kind = _ref12[4],
lhs = _ref12[6],
rhs = _ref12[8];
return builder.cons([lhs, rhs], {
kind: kind,
id: attrs.id,
labels: attrs.labels,
record: attrs.record
});
}
}, {
name: 'Relation',
name: 'PathPair$subexpression$1',
symbols: ['NodePattern']
}, {
name: 'PathPair$subexpression$1',
symbols: ['PathComposition']
}, {
name: 'PathPair',
symbols: ['PathPair$subexpression$1', '_', {
literal: ','
}, '_', 'Path'],
postprocess: function postprocess(_ref13) {
var lp = _ref13[0],
rp = _ref13[4];
return builder.pair([lp[0], rp]);
}
}, {
name: 'Kind',
symbols: [{

@@ -420,3 +428,3 @@ literal: ','

}, {
name: 'Relation',
name: 'Kind',
symbols: [{

@@ -429,3 +437,3 @@ literal: '-->'

}, {
name: 'Relation',
name: 'Kind',
symbols: [{

@@ -438,3 +446,3 @@ literal: '--'

}, {
name: 'Relation',
name: 'Kind',
symbols: [{

@@ -457,4 +465,11 @@ literal: '<--'

}, {
name: 'Attributes$ebnf$2$subexpression$1',
symbols: ['_', 'LabelList'],
postprocess: function postprocess(_ref14) {
var ll = _ref14[1];
return ll;
}
}, {
name: 'Attributes$ebnf$2',
symbols: ['LabelList'],
symbols: ['Attributes$ebnf$2$subexpression$1'],
postprocess: id

@@ -468,4 +483,11 @@ }, {

}, {
name: 'Attributes$ebnf$3$subexpression$1',
symbols: ['_', 'Record'],
postprocess: function postprocess(_ref15) {
var r = _ref15[1];
return r;
}
}, {
name: 'Attributes$ebnf$3',
symbols: ['Record'],
symbols: ['Attributes$ebnf$3$subexpression$1'],
postprocess: id

@@ -480,7 +502,7 @@ }, {

name: 'Attributes',
symbols: ['Attributes$ebnf$1', '_', 'Attributes$ebnf$2', '_', 'Attributes$ebnf$3'],
postprocess: function postprocess(_ref11) {
var id = _ref11[0],
labels = _ref11[2],
record = _ref11[4];
symbols: ['Attributes$ebnf$1', 'Attributes$ebnf$2', 'Attributes$ebnf$3'],
postprocess: function postprocess(_ref16) {
var id = _ref16[0],
labels = _ref16[2],
record = _ref16[4];
return {

@@ -504,4 +526,4 @@ id: id,

symbols: ['LabelList$ebnf$1'],
postprocess: function postprocess(_ref12) {
var labels = _ref12[0];
postprocess: function postprocess(_ref17) {
var labels = _ref17[0];
return labels;

@@ -514,4 +536,4 @@ }

}, 'Symbol'],
postprocess: function postprocess(_ref13) {
var label = _ref13[1];
postprocess: function postprocess(_ref18) {
var label = _ref18[1];
return label;

@@ -566,4 +588,4 @@ }

} : tickedString],
postprocess: function postprocess(_ref14) {
var t = _ref14[0];
postprocess: function postprocess(_ref19) {
var t = _ref19[0];
return t.text.slice(1, -1);

@@ -582,4 +604,4 @@ }

} : tickedString],
postprocess: function postprocess(_ref15) {
var t = _ref15[0];
postprocess: function postprocess(_ref20) {
var t = _ref20[0];
return t.text.slice(1, -1);

@@ -616,5 +638,5 @@ }

}],
postprocess: function postprocess(_ref16) {
var p = _ref16[2],
ps = _ref16[3];
postprocess: function postprocess(_ref21) {
var p = _ref21[2],
ps = _ref21[3];
return [p].concat(extractPairs(ps));

@@ -627,5 +649,5 @@ }

}, '_', 'Value'],
postprocess: function postprocess(_ref17) {
var k = _ref17[0],
v = _ref17[4];
postprocess: function postprocess(_ref22) {
var k = _ref22[0],
v = _ref22[4];
return builder.property(k, v);

@@ -670,5 +692,5 @@ }

}],
postprocess: function postprocess(_ref18) {
var v = _ref18[2],
vs = _ref18[3];
postprocess: function postprocess(_ref23) {
var v = _ref23[2],
vs = _ref23[3];
return [v].concat(extractArray(vs));

@@ -772,3 +794,3 @@ }

}],
ParserStart: 'PathSequence'
ParserStart: 'GramSeq'
};

@@ -810,2 +832,6 @@

if (parsed.results.length > 1) {
file.info('[WARN] parsing is ambiguous');
}
return parsed.results[0] || {

@@ -812,0 +838,0 @@ type: 'error'

@@ -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,i=Object.defineProperty,s=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"),i=e.constructor&&e.constructor.prototype&&r.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!i)return!1;for(t in e);return void 0===t||r.call(e,t)},u=function(e,t){i&&"__proto__"===t.name?i(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(s)return s(e,t).value}return e[t]},f=function e(){var t,n,r,o,i,s,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)||(i=a(o)))?(i?(i=!1,s=r&&a(r)?r:[]):s=r&&l(r)?r:{},u(f,{name:n,newValue:e(m,s,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,i=h.call(arguments,0),s=e.length>i.length;s&&i.push(r);try{t=e.apply(null,i)}catch(e){if(s&&n)throw e;return r(e)}s||(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(i){var s=e[++t],a=d.call(arguments,0),l=a.slice(1),u=n.length,c=-1;if(i)r(i);else{for(;++c<u;)null==l[c]&&(l[c]=n[c]);n=l,s?m(s,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={}),S(e.line)+":"+S(e.column)}function x(e){return e&&"object"==typeof e||(e={}),w(e.start)+"-"+w(e.end)}function S(e){return e&&"number"==typeof e?e:1}var $=P;function E(){}E.prototype=Error.prototype;var k=P.prototype=new E;function P(e,t,n){var r,o,i;"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",i={start:{line:null,column:null},end:{line:null,column:null}},t&&t.position&&(t=t.position),t&&(t.start?(i=t,t=t.start):i.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=i,this.source=r[0],this.ruleId=r[1]}k.file="",k.name="",k.reason="",k.message="",k.stack="",k.fatal=null,k.column=null,k.line=null;var O="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function j(e,t){for(var n=0,r=e.length-1;r>=0;r--){var o=e[r];"."===o?e.splice(r,1):".."===o?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}"function"==typeof O.setTimeout&&setTimeout,"function"==typeof O.clearTimeout&&clearTimeout,new Date;var _=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,A=function(e){return _.exec(e).slice(1)};function T(){for(var e="",t=!1,n=arguments.length-1;n>=-1&&!t;n--){var r=n>=0?arguments[n]:"/";if("string"!=typeof r)throw new TypeError("Arguments to path.resolve must be strings");r&&(e=r+"/"+e,t="/"===r.charAt(0))}return(t?"/":"")+(e=j(V(e.split("/"),(function(e){return!!e})),!t).join("/"))||"."}function C(e){var t=R(e),n="/"===z(e,-1);return(e=j(V(e.split("/"),(function(e){return!!e})),!t).join("/"))||t||(e="."),e&&n&&(e+="/"),(t?"/":"")+e}function R(e){return"/"===e.charAt(0)}function L(){var e=Array.prototype.slice.call(arguments,0);return C(V(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))}function q(e,t){function n(e){for(var t=0;t<e.length&&""===e[t];t++);for(var n=e.length-1;n>=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=T(e).substr(1),t=T(t).substr(1);for(var r=n(e.split("/")),o=n(t.split("/")),i=Math.min(r.length,o.length),s=i,a=0;a<i;a++)if(r[a]!==o[a]){s=a;break}var l=[];for(a=s;a<r.length;a++)l.push("..");return(l=l.concat(o.slice(s))).join("/")}function N(e){var t=A(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."}function I(e,t){var n=A(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n}function B(e){return A(e)[3]}var M={extname:B,basename:I,dirname:N,sep:"/",delimiter:":",relative:q,join:L,isAbsolute:R,normalize:C,resolve:T};function V(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}var z="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)},F="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function U(e,t){return e(t={exports:{}},t.exports),t.exports}var Q,D=(Q={__proto__:null,resolve:T,normalize:C,isAbsolute:R,join:L,relative:q,sep:"/",delimiter:":",dirname:N,basename:I,extname:B,default:M})&&Q.default||Q,H=Y,G={}.hasOwnProperty,J=Y.prototype,Z=["history","path","basename","stem","extname","dirname"];function Y(e){var t,r,o;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 Y))return new Y(e);for(this.data={},this.messages=[],this.history=[],this.cwd="/",r=-1,o=Z.length;++r<o;)G.call(e,t=Z[r])&&(this[t]=e[t]);for(t in e)-1===Z.indexOf(t)&&(this[t]=e[t])}function X(e,t){if(-1!==e.indexOf(D.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+D.sep+"`")}function K(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function W(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}J.toString=function(e){var t=this.contents||"";return n(t)?t.toString(e):String(t)},Object.defineProperty(J,"path",{get:function(){return this.history[this.history.length-1]},set:function(e){K(e,"path"),e!==this.path&&this.history.push(e)}}),Object.defineProperty(J,"dirname",{get:function(){return"string"==typeof this.path?D.dirname(this.path):void 0},set:function(e){W(this.path,"dirname"),this.path=D.join(e||"",this.basename)}}),Object.defineProperty(J,"basename",{get:function(){return"string"==typeof this.path?D.basename(this.path):void 0},set:function(e){K(e,"basename"),X(e,"basename"),this.path=D.join(this.dirname||"",e)}}),Object.defineProperty(J,"extname",{get:function(){return"string"==typeof this.path?D.extname(this.path):void 0},set:function(e){var t=e||"";if(X(t,"extname"),W(this.path,"extname"),t){if("."!==t.charAt(0))throw new Error("`extname` must start with `.`");if(-1!==t.indexOf(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=function(e,t){if("string"!=typeof e)return e;if(0===e.length)return e;var n=D.basename(e,D.extname(e))+t;return D.join(D.dirname(e),n)}(this.path,t)}}),Object.defineProperty(J,"stem",{get:function(){return"string"==typeof this.path?D.basename(this.path,this.extname):void 0},set:function(e){K(e,"stem"),X(e,"stem"),this.path=D.join(this.dirname||"",e+(this.extname||""))}});var ee=H,te=H.prototype;te.message=function(e,t,n){var r=this.path,o=new $(e,t,n);return r&&(o.name=r+":"+o.name,o.file=r),o.fatal=!1,this.messages.push(o),o},te.info=function(){var e=this.message.apply(this,arguments);return e.fatal=null,e},te.fail=function(){var e=this.message.apply(this,arguments);throw e.fatal=!0,e};var ne=function e(){var n=[],r=y(),o={},i=!1,s=-1;return a.data=function(e,t){return"string"==typeof e?2===arguments.length?(ue("data",i),o[e]=t,a):oe.call(o,e)&&o[e]||null:e?(ue("data",i),o=e,a):o},a.freeze=l,a.attachers=n,a.use=function(e){var t;if(ue("use",i),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 s(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;)s(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(re.call(arguments))}},a.parse=function(e){var t,n=ee(e);return l(),ae("parse",t=a.Parser),se(t,"parse")?new t(String(n),n).parse():t(String(n),n)},a.stringify=function(e,t){var n,r=ee(t);return l(),le("stringify",n=a.Compiler),ce(e),se(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})),fe("runSync","run",o),r},a.process=h,a.processSync=function(e){var n,r=!1;return l(),ae("processSync",a.Parser),le("processSync",a.Compiler),h(n=ee(e),(function(e){r=!0,t(e)})),fe("processSync","process",r),n},a;function a(){for(var t=e(),r=n.length,i=-1;++i<r;)t.use.apply(null,n[i]);return t.data(f(!0,{},o)),t}function l(){var e,t,o,l;if(i)return a;for(;++s<n.length;)t=(e=n[s])[0],!1!==(o=e[1])&&(!0===o&&(e[1]=void 0),"function"==typeof(l=t.apply(a,e.slice(1)))&&r.use(l));return i=!0,s=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(ce(e),l(),n||"function"!=typeof t||(n=t,t=null),!n)return new Promise(o);function o(o,i){r.run(e,ee(t),(function(t,r,s){r=r||e,t?i(t):o?o(r):n(null,r,s)}))}o(null,n)}function h(e,t){if(l(),ae("process",a.Parser),le("process",a.Compiler),!t)return new Promise(n);function n(n,r){var o=ee(e);ie.run(a,{file:o},(function(e){e?r(e):n?n(o):t(null,o)}))}n(null,t)}}().freeze(),re=[].slice,oe={}.hasOwnProperty,ie=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 se(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 ae(e,t){if("function"!=typeof t)throw new Error("Cannot `"+e+"` without `Parser`")}function le(e,t){if("function"!=typeof t)throw new Error("Cannot `"+e+"` without `Compiler`")}function ue(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 ce(e){if(!e||"string"!=typeof e.type)throw new Error("Expected node, got `"+e+"`")}function fe(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}var pe=U((function(e){var t,n;t=F,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 i(e,t,i){if(e instanceof r){var s=e;i=t}else s=r.fromCompiled(e,t);for(var a in this.grammar=s,this.options={keepHistory:!1,lexer:s.lexer||new o},i||{})this.options[a]=i[a];this.lexer=this.options.lexer,this.lexerState=void 0;var l=new n(s,0);this.table=[l],l.wants[s.start]=[],l.predict(s.start),l.process(),this.current=0}function s(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(s).join(" "):this.symbols.slice(0,e).map(s).join(" ")+" ● "+this.symbols.slice(e).map(s).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,i.fail))},n.prototype.process=function(e){for(var t=this.states,n=this.wants,r=this.completed,o=0;o<t.length;o++){var s=t[o];if(s.isComplete){if(s.finish(),s.data!==i.fail){for(var a=s.wantedBy,l=a.length;l--;)this.complete(a[l],s);s.reference===this.index&&(this.completed[u=s.rule.name]=this.completed[u]||[]).push(s)}}else{var u;if("string"!=typeof(u=s.rule.symbols[s.dot])){this.scannable.push(s);continue}if(n[u]){if(n[u].push(s),r.hasOwnProperty(u)){var c=r[u];for(l=0;l<c.length;l++)this.complete(s,c[l])}}else n[u]=[s],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 i=new r(t=t.map((function(t){return new e(t.name,t.symbols,t.postprocess)})),n);return i.lexer=o,i},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 i=this.index-this.lastLineBreak,s=String(this.line).length;return t+=" at line "+this.line+" col "+i+":\n\n",(t+=r.map((function(e,t){return a(this.line-r.length+t+1,s)+" "+e}),this).join("\n"))+"\n"+a("",s+i)+"^\n"}return t+" at index "+(this.index-1);function a(e,t){var n=String(e);return Array(t-n.length+1).join(" ")+n}},i.fail={},i.prototype.feed=function(e){var t,r=this.lexer;for(r.reset(e,this.lexerState);;){try{if(!(t=r.next()))break}catch(e){var i=new n(this.grammar,this.current+1);throw this.table.push(i),(l=new Error(this.reportLexerError(e))).offset=this.current,l.token=e.token,l}var s=this.table[this.current];this.options.keepHistory||delete this.table[this.current-1];var a=this.current+1;i=new n(this.grammar,a),this.table.push(i);for(var l,u=void 0!==t.text?t.text:t.value,c=r.constructor===o?t.value:t,f=s.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});i.states.push(y)}}if(i.process(),0===i.states.length)throw(l=new Error(this.reportError(t))).offset=this.current,l.token=t,l;this.options.keepHistory&&(s.lexerState=r.save()),this.current++}return s&&(this.lexerState=r.save()),this.results=this.finish(),this},i.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)},i.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)},i.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")},i.prototype.displayStateStack=function(e,t){for(var n,r=0,o=0;o<e.length;o++){var i=e[o],s=i.rule.toString(i.dot);s===n?r++:(r>0&&t.push(" ^ "+r+" more lines identical to this"),r=0,t.push(" "+s)),n=s}},i.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)},i.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)},i.prototype.save=function(){var e=this.table[this.current];return e.lexerState=this.lexerState,e},i.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()},i.prototype.rewind=function(e){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[e])},i.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!==i.fail&&e.push(n)})),e.map((function(e){return e.data}))},{Parser:i,Grammar:r,Rule:e}},e.exports?e.exports=n():t.nearley=n()}));function he(){return(he=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 me=U((function(e){var t,n;t=F,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 i(e){return e.length?"(?:"+e.map((function(e){return"(?:"+e+")"})).join("|")+")":"(?!)"}function s(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 i={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 s in n)e.call(n,s)&&(i[s]=n[s]);if("string"==typeof i.type&&t!==i.type)throw new Error("Type transform cannot be a string (type '"+i.type+"' for token '"+t+"')");var a=i.match;return i.match=Array.isArray(a)?a:a?[a]:[],i.match.sort((function(e,t){return r(e)&&r(t)?0:r(t)?-1:r(e)?1:t.length-e.length})),i}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),i=0;i<o.length;i++)t.push({include:o[i]});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 i=t[r],s=[].concat(e[i]);if("include"!==i){var l=[];s.forEach((function(e){o(e)?(l.length&&n.push(a(i,l)),n.push(a(i,e)),l=[]):l.push(e)})),l.length&&n.push(a(i,l))}else for(var u=0;u<s.length;u++)n.push({include:s[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=i(y.map(s)),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",S=n||w?"":"|";return!0===c&&(x+="u"),{regexp:new RegExp(i(p)+S,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(s=this.fast[n.charCodeAt(e)])return this._token(s,n.charAt(e),e);var r=this.re;r.lastIndex=e;var o=h(r,n),i=this.error;if(null==o)return this._token(i,n.slice(e,n.length),e);var s=this._getGroup(o),a=o[0];return i.fallback&&o.index!==e?(this.queuedGroup=s,this.queuedText=a,this._token(i,n.slice(e,o.index),e)):this._token(s,a,e)}},p.prototype._token=function(e,t,n){var r=0;if(e.lineBreaks){var o=/\n/g,i=1;if("\n"===t)r=1;else for(;o.exec(t);)r++,i=o.lastIndex}var s={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-i+1:this.col+=a,e.shouldThrow)throw new Error(this.formatError(s,"invalid syntax"));return e.pop?this.popState():e.push?this.pushState(e.push):e.next&&this.setState(e.next),s},"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,i=this.buffer.substring(r,e.offset+o);return t+=" at line "+e.line+" col "+e.col+":\n\n",(t+=" "+i+"\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),i=0;i<r.length;i++)o[v=r[i]]=l(e[v]).concat(n);for(i=0;i<r.length;i++)for(var s=o[v=r[i]],a=Object.create(null),u=0;u<s.length;u++){var h=s[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===s.indexOf(b)&&m.push(b)}}s.splice.apply(s,m),u--}}var g=Object.create(null);for(i=0;i<r.length;i++){var v;g[v=r[i]]=c(o[v],!0)}for(i=0;i<r.length;i++){var w=r[i],x=g[w],S=x.groups;for(u=0;u<S.length;u++)f(S[u],w,g);var $=Object.getOwnPropertyNames(x.fast);for(u=0;u<$.length;u++)f(x.fast[$[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 i=r[o],s=e[i];(Array.isArray(s)?s:[s]).forEach((function(e){if((n[e.length]=n[e.length]||[]).push(e),"string"!=typeof e)throw new Error("keyword must be string (in keyword '"+i+"')");t[e]=i}))}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()})),ye=/[0-9a-zA-Z_@]+\b@*/,de=new RegExp("^"+ye.source+"$"),be={__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:ye,isValidIdentifier:function(e){return e&&de.test(e)}},ge=function(e){return!!e.type&&"path"===e.type},ve=function(e){return ge(e)&&void 0===e.children&&"ø"===e.id},we=function(e){return ge(e)&&e.children&&0===e.children.length&&"ø"!==e.id};function xe(){return(xe=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 Se(e){return Array.isArray(e)?e:e instanceof Function?Se(e()):void 0===e?[]:[e]}var $e=function(e,t,n,r){return xe({type:"seq",id:t},n&&{labels:n},r&&{record:r},{children:Se(e)})},Ee=function(e,t){void 0===t&&(t={});var n=xe({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,ke);if(0===e.length)return"ø"===n.id?ke:(n.children=[],n);if(1===e.length){var r=e[0];return ve(r)?(n.children=[],n):(n.children=[r],n)}if(2===e.length){if(t.relation&&"pair"!==t.relation&&we(e[0])&&we(e[1]))return n.relation=t.relation,n.children=[e[0],e[1]],n;if(ve(e[0])&&ve(e[1]))return n.relation=t.relation,n.children=[],n;n.children=[e[0],e[1]]}return n.relation=t.relation||"pair",n},ke={type:"path",id:"ø",labels:void 0,record:void 0,children:void 0},Pe=function(){return ke},Oe=function(e,t,n){return xe({type:"path"},e&&{id:e},t&&{labels:t},n&&{record:n},{children:[]})},je=function(e,t,n,r,o){return xe({type:"path",id:n},r&&{labels:r},o&&{record:o},{relation:t,children:e})},_e=function(e,t,n,r){return xe({type:"path",id:t},n&&{labels:n},r&&{record:r},{children:e})},Ae=function(e){return e.reduce((function(e,t){return e[t.name]=t.value,e}),{})},Te=function(e){return Object.entries(e).reduce((function(e,t){return e.push(Ce(t[0],t[1])),e}),[])},Ce=function(e,t){return{type:"property",name:e,value:t}},Re=function(e){return{type:"boolean",value:e?"true":"false"}},Le=function(e){return{type:"string",value:e}},qe=function(e,t){return{type:"tagged",value:t,tag:e}},Ne=function(e){return{type:"integer",value:String(e)}},Ie=function(e){return{type:"decimal",value:String(e)}},Be=function(e){return{type:"hexadecimal",value:"number"==typeof e?e.toString(16):e}},Me=function(e){return{type:"octal",value:"number"==typeof e?e.toString(8):e}},Ve=function(e,t){return{type:"measurement",value:String(t),unit:e}},ze=function(e){return qe("date",e instanceof Date?e.toISOString().slice(0,10):e)},Fe=function(e){return qe("time",e instanceof Date?e.toTimeString():e)},Ue=function(e){return qe("duration",e instanceof Date?"P"+(e.getUTCFullYear()-1970)+"Y"+e.getUTCMonth()+"M"+e.getUTCDate()+"DT"+e.getUTCHours()+"H"+e.getUTCMinutes()+"M"+e.getUTCMilliseconds()/1e3+"S":e)},Qe=function(e,t){return void 0===t&&(t=1),e.flat(t).filter((function(e){return null!==e}))},De={__proto__:null,seq:$e,reduce:function(e,t,n){return void 0===e&&(e="pair"),t.length>1?t.reduceRight((function(t,r){return Ee([r,t],{relation:e,id:n?""+n+0:void 0})}),ke):t[0]},cons:Ee,EMPTY_PATH:ke,empty:Pe,node:Oe,edge:je,path:_e,recordToMap:Ae,mapToRecord:Te,pluck:function(e,t){return e.reduce((function(e,n){return n.name===t?n:e}))},property:Ce,boolean:Re,string:Le,tagged:qe,integer:Ne,decimal:Ie,hexadecimal:Be,octal:Me,measurement:Ve,year:function(e){return qe("date",e instanceof Date?e.getFullYear().toString():e)},date:ze,dayOfMonth:function(e){return qe("date",e instanceof Date?"--"+e.toISOString().slice(5,10):e)},time:Fe,duration:Ue,flatten:Qe,default:{seq:$e,empty:Pe,cons:Ee,path:_e,node:Oe,edge:je,property:Ce,boolean:Re,string:Le,tagged:qe,integer:Ne,decimal:Ie,hexadecimal:Be,octal:Me,measurement:Ve,date:ze,time:Fe,duration:Ue,flatten:Qe,recordToMap:Ae,mapToRecord:Te}};function He(e){return e[0]}var Ge=me.compile({whitespace:{match:/\s+/,lineBreaks:!0},lineComment:{match:/\/\/.*?\n?$/},hexadecimal:be.hexadecimal,octal:be.octal,measurement:be.measurement,decimal:be.decimal,integer:be.integer,taggedString:{match:be.taggedString},boolean:["true","TRUE","True","false","FALSE","False"],symbol:be.symbol,identifier:be.identifier,doubleQuotedString:{match:be.doubleQuotedString,value:function(e){return e.slice(1,-1)}},singleQuotedString:{match:be.singleQuotedString,value:function(e){return e.slice(1,-1)}},tickedString:{match:be.tickedString,value:function(e){return e.slice(1,-1)}},"--\x3e":"--\x3e","--":"--","<--":"<--","-[]->":"-[]->","-[]-":"-[]-","<-[]-":"<-[]-","<-[":"<-[","]->":"]->","-[":"-[","]-":"]-","{":"{","}":"}","[":"[","]":"]","(":"(",")":")",",":",",":":":","`":"`","'":"'","ø":"ø"}),Je=function(){return null},Ze=function(e){return e[0].text},Ye={Lexer:Ge,ParserRules:[{name:"PathSequence$ebnf$1$subexpression$1$ebnf$1",symbols:[{literal:","}],postprocess:He},{name:"PathSequence$ebnf$1$subexpression$1$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathSequence$ebnf$1$subexpression$1",symbols:["Path","PathSequence$ebnf$1$subexpression$1$ebnf$1","_"],postprocess:function(e){return e[0]}},{name:"PathSequence$ebnf$1",symbols:["PathSequence$ebnf$1$subexpression$1"]},{name:"PathSequence$ebnf$1$subexpression$2$ebnf$1",symbols:[{literal:","}],postprocess:He},{name:"PathSequence$ebnf$1$subexpression$2$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathSequence$ebnf$1$subexpression$2",symbols:["Path","PathSequence$ebnf$1$subexpression$2$ebnf$1","_"],postprocess:function(e){return e[0]}},{name:"PathSequence$ebnf$1",symbols:["PathSequence$ebnf$1","PathSequence$ebnf$1$subexpression$2"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"PathSequence$ebnf$2",symbols:["EOL"],postprocess:He},{name:"PathSequence$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"PathSequence",symbols:["PathSequence$ebnf$1","PathSequence$ebnf$2"],postprocess:function(e){return De.seq(De.flatten(e[0]))}},{name:"Path",symbols:["NodePattern"],postprocess:He},{name:"Path",symbols:["PathComposition"],postprocess:He},{name:"Path",symbols:["Comment"],postprocess:He},{name:"NodePattern",symbols:["Node","Edge","NodePattern"],postprocess:function(e){var t=e[1];return De.cons([e[0],e[2]],{relation:t.relation,id:t.id,labels:t.labels,record:t.record})}},{name:"NodePattern",symbols:["Node"],postprocess:He},{name:"Node",symbols:[{literal:"("},"_","Attributes","_",{literal:")"}],postprocess:function(e){var t=e[2];return De.node(t.id,t.labels,t.record)}},{name:"Edge",symbols:[{literal:"-["},"_","Attributes",{literal:"]->"}],postprocess:function(e){return he({relation:"right"},e[2])}},{name:"Edge",symbols:[{literal:"-["},"_","Attributes",{literal:"]-"}],postprocess:function(e){return he({relation:"either"},e[2])}},{name:"Edge",symbols:[{literal:"<-["},"_","Attributes",{literal:"]-"}],postprocess:function(e){return he({relation:"left"},e[2])}},{name:"Edge",symbols:[{literal:"-[]->"}],postprocess:function(){return{relation:"right"}}},{name:"Edge",symbols:[{literal:"-[]-"}],postprocess:function(){return{relation:"either"}}},{name:"Edge",symbols:[{literal:"<-[]-"}],postprocess:function(){return{relation:"left"}}},{name:"Edge",symbols:[{literal:"--\x3e"}],postprocess:function(){return{relation:"right"}}},{name:"Edge",symbols:[{literal:"--"}],postprocess:function(){return{relation:"either"}}},{name:"Edge",symbols:[{literal:"<--"}],postprocess:function(){return{relation:"left"}}},{name:"PathComposition",symbols:[{literal:"["},"_",{literal:"]"}],postprocess:function(){return De.empty()}},{name:"PathComposition$ebnf$1",symbols:["Relation"],postprocess:He},{name:"PathComposition$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathComposition$ebnf$2",symbols:["Path"],postprocess:He},{name:"PathComposition$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"PathComposition$ebnf$3",symbols:["Path"],postprocess:He},{name:"PathComposition$ebnf$3",symbols:[],postprocess:function(){return null}},{name:"PathComposition",symbols:[{literal:"["},"_","Attributes","_","PathComposition$ebnf$1","_","PathComposition$ebnf$2","_","PathComposition$ebnf$3","_",{literal:"]"}],postprocess:function(e){var t=e[2],n=e[6],r=e[8];return De.cons(r?n?[n,r]:[r]:[],{relation:e[4],id:t.id,labels:t.labels,record:t.record})}},{name:"Relation",symbols:[{literal:","}],postprocess:function(){return"pair"}},{name:"Relation",symbols:[{literal:"--\x3e"}],postprocess:function(){return"right"}},{name:"Relation",symbols:[{literal:"--"}],postprocess:function(){return"either"}},{name:"Relation",symbols:[{literal:"<--"}],postprocess:function(){return"left"}},{name:"Attributes$ebnf$1",symbols:["Identity"],postprocess:He},{name:"Attributes$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"Attributes$ebnf$2",symbols:["LabelList"],postprocess:He},{name:"Attributes$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"Attributes$ebnf$3",symbols:["Record"],postprocess:He},{name:"Attributes$ebnf$3",symbols:[],postprocess:function(){return null}},{name:"Attributes",symbols:["Attributes$ebnf$1","_","Attributes$ebnf$2","_","Attributes$ebnf$3"],postprocess:function(e){return{id:e[0],labels:e[2],record:e[4]}}},{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:[Ge.has("identifier")?{type:"identifier"}:identifier],postprocess:Ze},{name:"Identity",symbols:[{literal:"ø"}],postprocess:Ze},{name:"Identity",symbols:[Ge.has("symbol")?{type:"symbol"}:symbol],postprocess:Ze},{name:"Identity",symbols:[Ge.has("integer")?{type:"integer"}:integer],postprocess:Ze},{name:"Identity",symbols:[Ge.has("octal")?{type:"octal"}:octal],postprocess:Ze},{name:"Identity",symbols:[Ge.has("hexadecimal")?{type:"hexadecimal"}:hexadecimal],postprocess:Ze},{name:"Identity",symbols:[Ge.has("measurement")?{type:"measurement"}:measurement],postprocess:Ze},{name:"Identity",symbols:[Ge.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(e){return e[0].text.slice(1,-1)}},{name:"Symbol",symbols:[Ge.has("symbol")?{type:"symbol"}:symbol],postprocess:Ze},{name:"Symbol",symbols:[Ge.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(e){return e[0].text.slice(1,-1)}},{name:"Record",symbols:[{literal:"{"},"_",{literal:"}"}],postprocess:Je},{name:"Record$ebnf$1",symbols:[]},{name:"Record$ebnf$1$subexpression$1",symbols:["_",{literal:","},"_","Property"]},{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].map((function(e){return e[3]})))}},{name:"Property",symbols:["Symbol","_",{literal:":"},"_","Value"],postprocess:function(e){return De.property(e[0],e[4])}},{name:"Value",symbols:["StringLiteral"],postprocess:He},{name:"Value",symbols:["NumericLiteral"],postprocess:He},{name:"Value",symbols:[Ge.has("boolean")?{type:"boolean"}:boolean],postprocess:function(e){return De.boolean(JSON.parse(e[0].value.toLowerCase()))}},{name:"Value$ebnf$1",symbols:[]},{name:"Value$ebnf$1$subexpression$1",symbols:["_",{literal:","},"_","Value"]},{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].map((function(e){return e[3]})))}},{name:"StringLiteral",symbols:[Ge.has("singleQuotedString")?{type:"singleQuotedString"}:singleQuotedString],postprocess:function(e){return De.string(e[0].value)}},{name:"StringLiteral",symbols:[Ge.has("doubleQuotedString")?{type:"doubleQuotedString"}:doubleQuotedString],postprocess:function(e){return De.string(e[0].value)}},{name:"StringLiteral",symbols:[Ge.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(e){return De.string(e[0].value)}},{name:"StringLiteral",symbols:[Ge.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 De.tagged(t.tag,t.value)}},{name:"NumericLiteral",symbols:[Ge.has("integer")?{type:"integer"}:integer],postprocess:function(e){return De.integer(e[0].value)}},{name:"NumericLiteral",symbols:[Ge.has("decimal")?{type:"decimal"}:decimal],postprocess:function(e){return De.decimal(e[0].value)}},{name:"NumericLiteral",symbols:[Ge.has("hexadecimal")?{type:"hexadecimal"}:hexadecimal],postprocess:function(e){return De.hexadecimal(e[0].value)}},{name:"NumericLiteral",symbols:[Ge.has("octal")?{type:"octal"}:octal],postprocess:function(e){return De.octal(e[0].value)}},{name:"NumericLiteral",symbols:[Ge.has("measurement")?{type:"measurement"}:measurement],postprocess:function(e){var t=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 De.measurement(t.unit,t.value)}},{name:"_",symbols:[]},{name:"_",symbols:[Ge.has("whitespace")?{type:"whitespace"}:whitespace],postprocess:Je},{name:"Comment",symbols:[Ge.has("lineComment")?{type:"lineComment"}:lineComment],postprocess:Je},{name:"EOL",symbols:[{literal:"\n"}],postprocess:Je}],ParserStart:"PathSequence"},Xe=function(e,t){var n,r,o=new pe.Parser(pe.Grammar.fromCompiled(Ye));try{var i=o.feed(e);if(void 0===i.results[0]&&i.lexerState){var s={line:(r=i.lexerState).line,column:r.col};t.fail("Incomplete parse.",s)}return i.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)}},Ke=function(){this.Parser=Xe};e.errors={__proto__:null,INCOMPLETE_PARSE:"Incomplete parse.",SYNTAX_ERROR:"Syntax error at"},e.gramParserPlugin=Ke,e.toAST=function(e){return ne().use(Ke).freeze().parse(e)},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(((t=t||self).gram=t.gram||{},t.gram.parse={}))}(this,(function(t){"use strict";var e=function(t){if(t)throw t},n=function(t){return null!=t&&null!=t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},r=Object.prototype.hasOwnProperty,o=Object.prototype.toString,i=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===o.call(t)},l=function(t){if(!t||"[object Object]"!==o.call(t))return!1;var e,n=r.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&r.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!i)return!1;for(e in t);return void 0===e||r.call(t,e)},u=function(t,e){i&&"__proto__"===e.name?i(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},c=function(t,e){if("__proto__"===e){if(!r.call(t,e))return;if(s)return s(t,e).value}return t[e]},f=function t(){var e,n,r,o,i,s,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!=(e=arguments[p]))for(n in e)r=c(f,n),f!==(o=c(e,n))&&(m&&o&&(l(o)||(i=a(o)))?(i?(i=!1,s=r&&a(r)?r:[]):s=r&&l(r)?r:{},u(f,{name:n,newValue:t(m,s,o)})):void 0!==o&&u(f,{name:n,newValue:o}));return f},p=t=>{if("[object Object]"!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype},h=[].slice,m=function(t,e){var n;return function(){var e,i=h.call(arguments,0),s=t.length>i.length;s&&i.push(r);try{e=t.apply(null,i)}catch(t){if(s&&n)throw t;return r(t)}s||(e&&"function"==typeof e.then?e.then(o,r):e instanceof Error?r(e):o(e))};function r(){n||(n=!0,e.apply(null,arguments))}function o(t){r(null,t)}},d=b;b.wrap=m;var y=[].slice;function b(){var t=[],e={run:function(){var e=-1,n=y.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(i){var s=t[++e],a=y.call(arguments,0),l=a.slice(1),u=n.length,c=-1;if(i)r(i);else{for(;++c<u;)null==l[c]&&(l[c]=n[c]);n=l,s?m(s,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 t.push(n),e}};return e}var g={}.hasOwnProperty,v=function(t){return t&&"object"==typeof t?g.call(t,"position")||g.call(t,"type")?x(t.position):g.call(t,"start")||g.call(t,"end")?x(t):g.call(t,"line")||g.call(t,"column")?w(t):"":""};function w(t){return t&&"object"==typeof t||(t={}),S(t.line)+":"+S(t.column)}function x(t){return t&&"object"==typeof t||(t={}),w(t.start)+"-"+w(t.end)}function S(t){return t&&"number"==typeof t?t:1}var k=P;function $(){}$.prototype=Error.prototype;var E=P.prototype=new $;function P(t,e,n){var r,o,i;"string"==typeof e&&(n=e,e=null),r=function(t){var e,n=[null,null];return"string"==typeof t&&(-1===(e=t.indexOf(":"))?n[1]=t:(n[0]=t.slice(0,e),n[1]=t.slice(e+1))),n}(n),o=v(e)||"1:1",i={start:{line:null,column:null},end:{line:null,column:null}},e&&e.position&&(e=e.position),e&&(e.start?(i=e,e=e.start):i.start=e),t.stack&&(this.stack=t.stack,t=t.message),this.message=t,this.name=o,this.reason=t,this.line=e?e.line:null,this.column=e?e.column:null,this.location=i,this.source=r[0],this.ruleId=r[1]}E.file="",E.name="",E.reason="",E.message="",E.stack="",E.fatal=null,E.column=null,E.line=null;var _="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function O(t,e){for(var n=0,r=t.length-1;r>=0;r--){var o=t[r];"."===o?t.splice(r,1):".."===o?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}"function"==typeof _.setTimeout&&setTimeout,"function"==typeof _.clearTimeout&&clearTimeout,new Date;var A=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,j=function(t){return A.exec(t).slice(1)};function T(){for(var t="",e=!1,n=arguments.length-1;n>=-1&&!e;n--){var r=n>=0?arguments[n]:"/";if("string"!=typeof r)throw new TypeError("Arguments to path.resolve must be strings");r&&(t=r+"/"+t,e="/"===r.charAt(0))}return(e?"/":"")+(t=O(M(t.split("/"),(function(t){return!!t})),!e).join("/"))||"."}function C(t){var e=L(t),n="/"===V(t,-1);return(t=O(M(t.split("/"),(function(t){return!!t})),!e).join("/"))||e||(t="."),t&&n&&(t+="/"),(e?"/":"")+t}function L(t){return"/"===t.charAt(0)}function R(){var t=Array.prototype.slice.call(arguments,0);return C(M(t,(function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))}function q(t,e){function n(t){for(var e=0;e<t.length&&""===t[e];e++);for(var n=t.length-1;n>=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=T(t).substr(1),e=T(e).substr(1);for(var r=n(t.split("/")),o=n(e.split("/")),i=Math.min(r.length,o.length),s=i,a=0;a<i;a++)if(r[a]!==o[a]){s=a;break}var l=[];for(a=s;a<r.length;a++)l.push("..");return(l=l.concat(o.slice(s))).join("/")}function N(t){var e=j(t),n=e[0],r=e[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."}function I(t,e){var n=j(t)[2];return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n}function G(t){return j(t)[3]}var B={extname:G,basename:I,dirname:N,sep:"/",delimiter:":",relative:q,join:R,isAbsolute:L,normalize:C,resolve:T};function M(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r<t.length;r++)e(t[r],r,t)&&n.push(t[r]);return n}var V="b"==="ab".substr(-1)?function(t,e,n){return t.substr(e,n)}:function(t,e,n){return e<0&&(e=t.length+e),t.substr(e,n)},z="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function F(t,e){return t(e={exports:{}},e.exports),e.exports}var U,Q=(U={__proto__:null,resolve:T,normalize:C,isAbsolute:L,join:R,relative:q,sep:"/",delimiter:":",dirname:N,basename:I,extname:G,default:B})&&U.default||U,D=K,H={}.hasOwnProperty,J=K.prototype,Z=["history","path","basename","stem","extname","dirname"];function K(t){var e,r,o;if(t){if("string"==typeof t||n(t))t={contents:t};else if("message"in t&&"messages"in t)return t}else t={};if(!(this instanceof K))return new K(t);for(this.data={},this.messages=[],this.history=[],this.cwd="/",r=-1,o=Z.length;++r<o;)H.call(t,e=Z[r])&&(this[e]=t[e]);for(e in t)-1===Z.indexOf(e)&&(this[e]=t[e])}function Y(t,e){if(-1!==t.indexOf(Q.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Q.sep+"`")}function W(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function X(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}J.toString=function(t){var e=this.contents||"";return n(e)?e.toString(t):String(e)},Object.defineProperty(J,"path",{get:function(){return this.history[this.history.length-1]},set:function(t){W(t,"path"),t!==this.path&&this.history.push(t)}}),Object.defineProperty(J,"dirname",{get:function(){return"string"==typeof this.path?Q.dirname(this.path):void 0},set:function(t){X(this.path,"dirname"),this.path=Q.join(t||"",this.basename)}}),Object.defineProperty(J,"basename",{get:function(){return"string"==typeof this.path?Q.basename(this.path):void 0},set:function(t){W(t,"basename"),Y(t,"basename"),this.path=Q.join(this.dirname||"",t)}}),Object.defineProperty(J,"extname",{get:function(){return"string"==typeof this.path?Q.extname(this.path):void 0},set:function(t){var e=t||"";if(Y(e,"extname"),X(this.path,"extname"),e){if("."!==e.charAt(0))throw new Error("`extname` must start with `.`");if(-1!==e.indexOf(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=function(t,e){if("string"!=typeof t)return t;if(0===t.length)return t;var n=Q.basename(t,Q.extname(t))+e;return Q.join(Q.dirname(t),n)}(this.path,e)}}),Object.defineProperty(J,"stem",{get:function(){return"string"==typeof this.path?Q.basename(this.path,this.extname):void 0},set:function(t){W(t,"stem"),Y(t,"stem"),this.path=Q.join(this.dirname||"",t+(this.extname||""))}});var tt=D,et=D.prototype;et.message=function(t,e,n){var r=this.path,o=new k(t,e,n);return r&&(o.name=r+":"+o.name,o.file=r),o.fatal=!1,this.messages.push(o),o},et.info=function(){var t=this.message.apply(this,arguments);return t.fatal=null,t},et.fail=function(){var t=this.message.apply(this,arguments);throw t.fatal=!0,t};var nt=function t(){var n=[],r=d(),o={},i=!1,s=-1;return a.data=function(t,e){return"string"==typeof t?2===arguments.length?(ut("data",i),o[t]=e,a):ot.call(o,t)&&o[t]||null:t?(ut("data",i),o=t,a):o},a.freeze=l,a.attachers=n,a.use=function(t){var e;if(ut("use",i),null==t);else if("function"==typeof t)c.apply(null,arguments);else{if("object"!=typeof t)throw new Error("Expected usable value, not `"+t+"`");"length"in t?l(t):r(t)}return e&&(o.settings=f(o.settings||{},e)),a;function r(t){l(t.plugins),t.settings&&(e=f(e||{},t.settings))}function s(t){if("function"==typeof t)c(t);else{if("object"!=typeof t)throw new Error("Expected usable value, not `"+t+"`");"length"in t?c.apply(null,t):r(t)}}function l(t){var e,n;if(null==t);else{if("object"!=typeof t||!("length"in t))throw new Error("Expected a list of plugins, not `"+t+"`");for(e=t.length,n=-1;++n<e;)s(t[n])}}function c(t,e){var r=u(t);r?(p(r[1])&&p(e)&&(e=f(r[1],e)),r[1]=e):n.push(rt.call(arguments))}},a.parse=function(t){var e,n=tt(t);return l(),at("parse",e=a.Parser),st(e,"parse")?new e(String(n),n).parse():e(String(n),n)},a.stringify=function(t,e){var n,r=tt(e);return l(),lt("stringify",n=a.Compiler),ct(t),st(n,"compile")?new n(t,r).compile():n(t,r)},a.run=c,a.runSync=function(t,n){var r,o=!1;return c(t,n,(function(t,n){o=!0,e(t),r=n})),ft("runSync","run",o),r},a.process=h,a.processSync=function(t){var n,r=!1;return l(),at("processSync",a.Parser),lt("processSync",a.Compiler),h(n=tt(t),(function(t){r=!0,e(t)})),ft("processSync","process",r),n},a;function a(){for(var e=t(),r=n.length,i=-1;++i<r;)e.use.apply(null,n[i]);return e.data(f(!0,{},o)),e}function l(){var t,e,o,l;if(i)return a;for(;++s<n.length;)e=(t=n[s])[0],!1!==(o=t[1])&&(!0===o&&(t[1]=void 0),"function"==typeof(l=e.apply(a,t.slice(1)))&&r.use(l));return i=!0,s=Infinity,a}function u(t){for(var e,r=n.length,o=-1;++o<r;)if((e=n[o])[0]===t)return e}function c(t,e,n){if(ct(t),l(),n||"function"!=typeof e||(n=e,e=null),!n)return new Promise(o);function o(o,i){r.run(t,tt(e),(function(e,r,s){r=r||t,e?i(e):o?o(r):n(null,r,s)}))}o(null,n)}function h(t,e){if(l(),at("process",a.Parser),lt("process",a.Compiler),!e)return new Promise(n);function n(n,r){var o=tt(t);it.run(a,{file:o},(function(t){t?r(t):n?n(o):e(null,o)}))}n(null,e)}}().freeze(),rt=[].slice,ot={}.hasOwnProperty,it=d().use((function(t,e){e.tree=t.parse(e.file)})).use((function(t,e,n){t.run(e.tree,e.file,(function(t,r,o){t?n(t):(e.tree=r,e.file=o,n())}))})).use((function(t,e){var r=t.stringify(e.tree,e.file),o=e.file;null==r||("string"==typeof r||n(r)?o.contents=r:o.result=r)}));function st(t,e){return"function"==typeof t&&t.prototype&&(function(t){var e;for(e in t)return!0;return!1}(t.prototype)||e in t.prototype)}function at(t,e){if("function"!=typeof e)throw new Error("Cannot `"+t+"` without `Parser`")}function lt(t,e){if("function"!=typeof e)throw new Error("Cannot `"+t+"` without `Compiler`")}function ut(t,e){if(e)throw new Error("Cannot invoke `"+t+"` on a frozen processor.\nCreate a new processor first, by invoking it: use `processor()` instead of `processor`.")}function ct(t){if(!t||"string"!=typeof t.type)throw new Error("Expected node, got `"+t+"`")}function ft(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}var pt=F((function(t){var e,n;e=z,n=function(){function t(e,n,r){return this.id=++t.highestId,this.name=e,this.symbols=n,this.postprocess=r,this}function e(t,e,n,r){this.rule=t,this.dot=e,this.reference=n,this.data=[],this.wantedBy=r,this.isComplete=this.dot===t.symbols.length}function n(t,e){this.grammar=t,this.index=e,this.states=[],this.wants={},this.scannable=[],this.completed={}}function r(t,e){this.rules=t,this.start=e||this.rules[0].name;var n=this.byName={};this.rules.forEach((function(t){n.hasOwnProperty(t.name)||(n[t.name]=[]),n[t.name].push(t)}))}function o(){this.reset("")}function i(t,e,i){if(t instanceof r){var s=t;i=e}else s=r.fromCompiled(t,e);for(var a in this.grammar=s,this.options={keepHistory:!1,lexer:s.lexer||new o},i||{})this.options[a]=i[a];this.lexer=this.options.lexer,this.lexerState=void 0;var l=new n(s,0);this.table=[l],l.wants[s.start]=[],l.predict(s.start),l.process(),this.current=0}function s(t){var e=typeof t;if("string"===e)return t;if("object"===e){if(t.literal)return JSON.stringify(t.literal);if(t instanceof RegExp)return t.toString();if(t.type)return"%"+t.type;if(t.test)return"<"+String(t.test)+">";throw new Error("Unknown symbol type: "+t)}}return t.highestId=0,t.prototype.toString=function(t){var e=void 0===t?this.symbols.map(s).join(" "):this.symbols.slice(0,t).map(s).join(" ")+" ● "+this.symbols.slice(t).map(s).join(" ");return this.name+" → "+e},e.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},e.prototype.nextState=function(t){var n=new e(this.rule,this.dot+1,this.reference,this.wantedBy);return n.left=this,n.right=t,n.isComplete&&(n.data=n.build(),n.right=void 0),n},e.prototype.build=function(){var t=[],e=this;do{t.push(e.right.data),e=e.left}while(e.left);return t.reverse(),t},e.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,i.fail))},n.prototype.process=function(t){for(var e=this.states,n=this.wants,r=this.completed,o=0;o<e.length;o++){var s=e[o];if(s.isComplete){if(s.finish(),s.data!==i.fail){for(var a=s.wantedBy,l=a.length;l--;)this.complete(a[l],s);s.reference===this.index&&(this.completed[u=s.rule.name]=this.completed[u]||[]).push(s)}}else{var u;if("string"!=typeof(u=s.rule.symbols[s.dot])){this.scannable.push(s);continue}if(n[u]){if(n[u].push(s),r.hasOwnProperty(u)){var c=r[u];for(l=0;l<c.length;l++)this.complete(s,c[l])}}else n[u]=[s],this.predict(u)}}},n.prototype.predict=function(t){for(var n=this.grammar.byName[t]||[],r=0;r<n.length;r++){var o=new e(n[r],0,this.index,this.wants[t]);this.states.push(o)}},n.prototype.complete=function(t,e){var n=t.nextState(e);this.states.push(n)},r.fromCompiled=function(e,n){var o=e.Lexer;e.ParserStart&&(n=e.ParserStart,e=e.ParserRules);var i=new r(e=e.map((function(e){return new t(e.name,e.symbols,e.postprocess)})),n);return i.lexer=o,i},o.prototype.reset=function(t,e){this.buffer=t,this.index=0,this.line=e?e.line:1,this.lastLineBreak=e?-e.col:0},o.prototype.next=function(){if(this.index<this.buffer.length){var t=this.buffer[this.index++];return"\n"===t&&(this.line+=1,this.lastLineBreak=this.index),{value:t}}},o.prototype.save=function(){return{line:this.line,col:this.index-this.lastLineBreak}},o.prototype.formatError=function(t,e){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 i=this.index-this.lastLineBreak,s=String(this.line).length;return e+=" at line "+this.line+" col "+i+":\n\n",(e+=r.map((function(t,e){return a(this.line-r.length+e+1,s)+" "+t}),this).join("\n"))+"\n"+a("",s+i)+"^\n"}return e+" at index "+(this.index-1);function a(t,e){var n=String(t);return Array(e-n.length+1).join(" ")+n}},i.fail={},i.prototype.feed=function(t){var e,r=this.lexer;for(r.reset(t,this.lexerState);;){try{if(!(e=r.next()))break}catch(t){var i=new n(this.grammar,this.current+1);throw this.table.push(i),(l=new Error(this.reportLexerError(t))).offset=this.current,l.token=t.token,l}var s=this.table[this.current];this.options.keepHistory||delete this.table[this.current-1];var a=this.current+1;i=new n(this.grammar,a),this.table.push(i);for(var l,u=void 0!==e.text?e.text:e.value,c=r.constructor===o?e.value:e,f=s.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===e.type:m.literal===u){var d=h.nextState({data:c,token:e,isToken:!0,reference:a-1});i.states.push(d)}}if(i.process(),0===i.states.length)throw(l=new Error(this.reportError(e))).offset=this.current,l.token=e,l;this.options.keepHistory&&(s.lexerState=r.save()),this.current++}return s&&(this.lexerState=r.save()),this.results=this.finish(),this},i.prototype.reportLexerError=function(t){var e,n,r=t.token;return r?(e="input "+JSON.stringify(r.text[0])+" (lexer error)",n=this.lexer.formatError(r,"Syntax error")):(e="input (lexer error)",n=t.message),this.reportErrorCommon(n,e)},i.prototype.reportError=function(t){var e=(t.type?t.type+" token: ":"")+JSON.stringify(void 0!==t.value?t.value:t),n=this.lexer.formatError(t,"Syntax error");return this.reportErrorCommon(n,e)},i.prototype.reportErrorCommon=function(t,e){var n=[];n.push(t);var r=this.table[this.table.length-2],o=r.states.filter((function(t){var e=t.rule.symbols[t.dot];return e&&"string"!=typeof e}));return 0===o.length?(n.push("Unexpected "+e+". I did not expect any more input. Here is the state of my parse table:\n"),this.displayStateStack(r.states,n)):(n.push("Unexpected "+e+". Instead, I was expecting to see one of the following:\n"),o.map((function(t){return this.buildFirstStateStack(t,[])||[t]}),this).forEach((function(t){var e=t[0],r=this.getSymbolDisplay(e.rule.symbols[e.dot]);n.push("A "+r+" based on:"),this.displayStateStack(t,n)}),this)),n.push(""),n.join("\n")},i.prototype.displayStateStack=function(t,e){for(var n,r=0,o=0;o<t.length;o++){var i=t[o],s=i.rule.toString(i.dot);s===n?r++:(r>0&&e.push(" ^ "+r+" more lines identical to this"),r=0,e.push(" "+s)),n=s}},i.prototype.getSymbolDisplay=function(t){return function(t){var e=typeof t;if("string"===e)return t;if("object"===e){if(t.literal)return JSON.stringify(t.literal);if(t instanceof RegExp)return"character matching "+t;if(t.type)return t.type+" token";if(t.test)return"token matching "+String(t.test);throw new Error("Unknown symbol type: "+t)}}(t)},i.prototype.buildFirstStateStack=function(t,e){if(-1!==e.indexOf(t))return null;if(0===t.wantedBy.length)return[t];var n=t.wantedBy[0],r=[t].concat(e),o=this.buildFirstStateStack(n,r);return null===o?null:[t].concat(o)},i.prototype.save=function(){var t=this.table[this.current];return t.lexerState=this.lexerState,t},i.prototype.restore=function(t){var e=t.index;this.current=e,this.table[e]=t,this.table.splice(e+1),this.lexerState=t.lexerState,this.results=this.finish()},i.prototype.rewind=function(t){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[t])},i.prototype.finish=function(){var t=[],e=this.grammar.start;return this.table[this.table.length-1].states.forEach((function(n){n.rule.name===e&&n.dot===n.rule.symbols.length&&0===n.reference&&n.data!==i.fail&&t.push(n)})),t.map((function(t){return t.data}))},{Parser:i,Grammar:r,Rule:t}},t.exports?t.exports=n():e.nearley=n()}));function ht(){return(ht=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}var mt=F((function(t){var e,n;e=z,n=function(){var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n="boolean"==typeof(new RegExp).sticky;function r(t){return t&&"[object RegExp]"===e.call(t)}function o(t){return t&&"object"==typeof t&&!r(t)&&!Array.isArray(t)}function i(t){return t.length?"(?:"+t.map((function(t){return"(?:"+t+")"})).join("|")+")":"(?!)"}function s(t){if("string"==typeof t)return"(?:"+t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+")";if(r(t)){if(t.ignoreCase)throw new Error("RegExp /i flag not allowed");if(t.global)throw new Error("RegExp /g flag is implied");if(t.sticky)throw new Error("RegExp /y flag is implied");if(t.multiline)throw new Error("RegExp /m flag is implied");return t.source}throw new Error("Not a pattern: "+t)}function a(e,n){if(o(n)||(n={match:n}),n.include)throw new Error("Matching rules cannot also include states");var i={defaultType:e,lineBreaks:!!n.error||!!n.fallback,pop:!1,next:null,push:null,error:!1,fallback:!1,value:null,type:null,shouldThrow:!1};for(var s in n)t.call(n,s)&&(i[s]=n[s]);if("string"==typeof i.type&&e!==i.type)throw new Error("Type transform cannot be a string (type '"+i.type+"' for token '"+e+"')");var a=i.match;return i.match=Array.isArray(a)?a:a?[a]:[],i.match.sort((function(t,e){return r(t)&&r(e)?0:r(e)?-1:r(t)?1:e.length-t.length})),i}function l(t){return Array.isArray(t)?function(t){for(var e=[],n=0;n<t.length;n++){var r=t[n];if(r.include)for(var o=[].concat(r.include),i=0;i<o.length;i++)e.push({include:o[i]});else{if(!r.type)throw new Error("Rule has no type: "+JSON.stringify(r));e.push(a(r.type,r))}}return e}(t):function(t){for(var e=Object.getOwnPropertyNames(t),n=[],r=0;r<e.length;r++){var i=e[r],s=[].concat(t[i]);if("include"!==i){var l=[];s.forEach((function(t){o(t)?(l.length&&n.push(a(i,l)),n.push(a(i,t)),l=[]):l.push(t)})),l.length&&n.push(a(i,l))}else for(var u=0;u<s.length;u++)n.push({include:s[u]})}return n}(t)}var u=a("error",{lineBreaks:!0,shouldThrow:!0});function c(t,e){for(var o=null,a=Object.create(null),l=!0,c=null,f=[],p=[],h=0;h<t.length;h++)t[h].fallback&&(l=!1);for(h=0;h<t.length;h++){var m=t[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 d=m.match.slice();if(l)for(;d.length&&"string"==typeof d[0]&&1===d[0].length;)a[d.shift().charCodeAt(0)]=m;if(m.pop||m.push||m.next){if(!e)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!==d.length){l=!1,f.push(m);for(var y=0;y<d.length;y++){var b=d[y];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=i(d.map(s)),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",S=n||w?"":"|";return!0===c&&(x+="u"),{regexp:new RegExp(i(p)+S,x),groups:f,fast:a,error:o||u}}function f(t,e,n){var r=t&&(t.push||t.next);if(r&&!n[r])throw new Error("Missing state '"+r+"' (in token '"+t.defaultType+"' of state '"+e+"')");if(t&&t.pop&&1!=+t.pop)throw new Error("pop must be 1 (in token '"+t.defaultType+"' of state '"+e+"')")}var p=function(t,e){this.startState=e,this.states=t,this.buffer="",this.stack=[],this.reset()};p.prototype.reset=function(t,e){return this.buffer=t||"",this.index=0,this.line=e?e.line:1,this.col=e?e.col:1,this.queuedToken=e?e.queuedToken:null,this.queuedThrow=e?e.queuedThrow:null,this.setState(e?e.state:this.startState),this.stack=e&&e.stack?e.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(t){if(t&&this.state!==t){this.state=t;var e=this.states[t];this.groups=e.groups,this.error=e.error,this.re=e.regexp,this.fast=e.fast}},p.prototype.popState=function(){this.setState(this.stack.pop())},p.prototype.pushState=function(t){this.stack.push(this.state),this.setState(t)};var h=n?function(t,e){return t.exec(e)}:function(t,e){var n=t.exec(e);return 0===n[0].length?null:n};function m(){return this.value}if(p.prototype._getGroup=function(t){for(var e=this.groups.length,n=0;n<e;n++)if(void 0!==t[n+1])return this.groups[n];throw new Error("Cannot find token type for matched text")},p.prototype.next=function(){var t=this.index;if(this.queuedGroup){var e=this._token(this.queuedGroup,this.queuedText,t);return this.queuedGroup=null,this.queuedText="",e}var n=this.buffer;if(t!==n.length){if(s=this.fast[n.charCodeAt(t)])return this._token(s,n.charAt(t),t);var r=this.re;r.lastIndex=t;var o=h(r,n),i=this.error;if(null==o)return this._token(i,n.slice(t,n.length),t);var s=this._getGroup(o),a=o[0];return i.fallback&&o.index!==t?(this.queuedGroup=s,this.queuedText=a,this._token(i,n.slice(t,o.index),t)):this._token(s,a,t)}},p.prototype._token=function(t,e,n){var r=0;if(t.lineBreaks){var o=/\n/g,i=1;if("\n"===e)r=1;else for(;o.exec(e);)r++,i=o.lastIndex}var s={type:"function"==typeof t.type&&t.type(e)||t.defaultType,value:"function"==typeof t.value?t.value(e):e,text:e,toString:m,offset:n,lineBreaks:r,line:this.line,col:this.col},a=e.length;if(this.index+=a,this.line+=r,0!==r?this.col=a-i+1:this.col+=a,t.shouldThrow)throw new Error(this.formatError(s,"invalid syntax"));return t.pop?this.popState():t.push?this.pushState(t.push):t.next&&this.setState(t.next),s},"undefined"!=typeof Symbol&&Symbol.iterator){var d=function(t){this.lexer=t};d.prototype.next=function(){var t=this.lexer.next();return{value:t,done:!t}},d.prototype[Symbol.iterator]=function(){return this},p.prototype[Symbol.iterator]=function(){return new d(this)}}return p.prototype.formatError=function(t,e){if(null==t){var n=this.buffer.slice(this.index);t={text:n,offset:this.index,lineBreaks:-1===n.indexOf("\n")?0:1,line:this.line,col:this.col}}var r=Math.max(0,t.offset-t.col+1),o=t.lineBreaks?t.text.indexOf("\n"):t.text.length,i=this.buffer.substring(r,t.offset+o);return e+=" at line "+t.line+" col "+t.col+":\n\n",(e+=" "+i+"\n")+" "+Array(t.col).join(" ")+"^"},p.prototype.clone=function(){return new p(this.states,this.state)},p.prototype.has=function(t){return!0},{compile:function(t){var e=c(l(t));return new p({start:e},"start")},states:function(t,e){var n=t.$all?l(t.$all):[];delete t.$all;var r=Object.getOwnPropertyNames(t);e||(e=r[0]);for(var o=Object.create(null),i=0;i<r.length;i++)o[v=r[i]]=l(t[v]).concat(n);for(i=0;i<r.length;i++)for(var s=o[v=r[i]],a=Object.create(null),u=0;u<s.length;u++){var h=s[u];if(h.include){var m=[u,1];if(h.include!==v&&!a[h.include]){a[h.include]=!0;var d=o[h.include];if(!d)throw new Error("Cannot include nonexistent state '"+h.include+"' (in state '"+v+"')");for(var y=0;y<d.length;y++){var b=d[y];-1===s.indexOf(b)&&m.push(b)}}s.splice.apply(s,m),u--}}var g=Object.create(null);for(i=0;i<r.length;i++){var v;g[v=r[i]]=c(o[v],!0)}for(i=0;i<r.length;i++){var w=r[i],x=g[w],S=x.groups;for(u=0;u<S.length;u++)f(S[u],w,g);var k=Object.getOwnPropertyNames(x.fast);for(u=0;u<k.length;u++)f(x.fast[k[u]],w,g)}return new p(g,e)},error:Object.freeze({error:!0}),fallback:Object.freeze({fallback:!0}),keywords:function(t){for(var e=Object.create(null),n=Object.create(null),r=Object.getOwnPropertyNames(t),o=0;o<r.length;o++){var i=r[o],s=t[i];(Array.isArray(s)?s:[s]).forEach((function(t){if((n[t.length]=n[t.length]||[]).push(t),"string"!=typeof t)throw new Error("keyword must be string (in keyword '"+i+"')");e[t]=i}))}function a(t){return JSON.stringify(t)}var l="";for(var u in l+="switch (value.length) {\n",n)l+="case "+u+":\n",l+="switch (value) {\n",n[u].forEach((function(t){var n=e[t];l+="case "+a(t)+": return "+a(n)+"\n"})),l+="}\n";return l+="}\n",Function("value",l)}}},t.exports?t.exports=n():e.moo=n()})),dt=/[0-9a-zA-Z_@]+\b@*/,yt=new RegExp("^"+dt.source+"$"),bt={__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:dt,isValidIdentifier:function(t){return t&&yt.test(t)}},gt=function(t){return!!t.type&&"path"===t.type},vt=function(t){return gt(t)&&"ø"===t.id},wt=function(t){return gt(t)&&t.children&&0===t.children.length&&"ø"!==t.id};function xt(){return(xt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function St(t){return Array.isArray(t)?t:t instanceof Function?St(t()):void 0===t?[]:[t]}var kt=function(t,e,n,r){return xt({type:"seq",id:e},n&&{labels:n},r&&{record:r},{children:St(t)})},$t=function(t,e){return void 0===t&&(t="pair"),e.length>1?e.slice(0,e.length-1).reduceRight((function(e,n){return Et([n,e],{kind:t})}),e[e.length-1]):e[0]},Et=function(t,e){void 0===e&&(e={});var n=xt({type:"path"},e.id&&{id:e.id},e.labels&&{labels:e.labels},e.record&&{record:e.record});if(void 0===t)return n.id&&"ø"!==n.id?(n.children=[],n):(n.children=void 0,Pt);if(0===t.length)return"ø"===n.id?Pt:(n.children=[],n);if(1===t.length){var r=t[0];return vt(r)?(n.children=[],n):(n.children=[r],n)}if(2===t.length){if(e.kind&&"pair"!==e.kind&&wt(t[0])&&wt(t[1]))return n.kind=e.kind,n.children=[t[0],t[1]],n;if(vt(t[0])&&vt(t[1]))return n.kind=e.kind,n.children=[],n;n.children=[t[0],t[1]]}return n.kind=e.kind||"pair",n},Pt={type:"path",id:"ø",labels:void 0,record:void 0,children:[]},_t=function(){return Pt},Ot=function(t,e,n){return xt({type:"path"},t&&{id:t},e&&{labels:e},n&&{record:n},{children:[]})},At=function(t,e,n,r,o){return xt({type:"path",id:n},r&&{labels:r},o&&{record:o},{kind:e,children:t})},jt=function(t,e,n,r){return xt({type:"path",kind:"pair",id:e},n&&{labels:n},r&&{record:r},{children:t})},Tt=function(t){return t.reduce((function(t,e){return t[e.name]=e.value,t}),{})},Ct=function(t){return Object.entries(t).reduce((function(t,e){return t.push(Lt(e[0],e[1])),t}),[])},Lt=function(t,e){return{type:"property",name:t,value:e}},Rt=function(t){return{type:"boolean",value:t?"true":"false"}},qt=function(t){return{type:"string",value:t}},Nt=function(t,e){return{type:"tagged",value:e,tag:t}},It=function(t){return{type:"integer",value:String(t)}},Gt=function(t){return{type:"decimal",value:String(t)}},Bt=function(t){return{type:"hexadecimal",value:"number"==typeof t?t.toString(16):t}},Mt=function(t){return{type:"octal",value:"number"==typeof t?t.toString(8):t}},Vt=function(t,e){return{type:"measurement",value:String(e),unit:t}},zt=function(t){return Nt("date",t instanceof Date?t.toISOString().slice(0,10):t)},Ft=function(t){return Nt("time",t instanceof Date?t.toTimeString():t)},Ut=function(t){return Nt("duration",t instanceof Date?"P"+(t.getUTCFullYear()-1970)+"Y"+t.getUTCMonth()+"M"+t.getUTCDate()+"DT"+t.getUTCHours()+"H"+t.getUTCMinutes()+"M"+t.getUTCMilliseconds()/1e3+"S":t)},Qt=function(t,e){return void 0===e&&(e=1),t.flat(e).filter((function(t){return null!==t}))},Dt={__proto__:null,seq:kt,listToPath:$t,cons:Et,empty:_t,node:Ot,edge:At,pair:jt,recordToMap:Tt,mapToRecord:Ct,pluck:function(t,e){return t.reduce((function(t,n){return n.name===e?n:t}))},property:Lt,boolean:Rt,string:qt,tagged:Nt,integer:It,decimal:Gt,hexadecimal:Bt,octal:Mt,measurement:Vt,year:function(t){return Nt("date",t instanceof Date?t.getFullYear().toString():t)},date:zt,dayOfMonth:function(t){return Nt("date",t instanceof Date?"--"+t.toISOString().slice(5,10):t)},time:Ft,duration:Ut,flatten:Qt,default:{seq:kt,empty:_t,cons:Et,pair:jt,listToPath:$t,node:Ot,edge:At,property:Lt,boolean:Rt,string:qt,tagged:Nt,integer:It,decimal:Gt,hexadecimal:Bt,octal:Mt,measurement:Vt,date:zt,time:Ft,duration:Ut,flatten:Qt,recordToMap:Tt,mapToRecord:Ct}};function Ht(t){return t[0]}var Jt=mt.compile({whitespace:{match:/\s+/,lineBreaks:!0},lineComment:{match:/\/\/.*?\n?$/},hexadecimal:bt.hexadecimal,octal:bt.octal,measurement:bt.measurement,decimal:bt.decimal,integer:bt.integer,taggedString:{match:bt.taggedString},boolean:["true","TRUE","True","false","FALSE","False"],symbol:bt.symbol,identifier:bt.identifier,doubleQuotedString:{match:bt.doubleQuotedString,value:function(t){return t.slice(1,-1)}},singleQuotedString:{match:bt.singleQuotedString,value:function(t){return t.slice(1,-1)}},tickedString:{match:bt.tickedString,value:function(t){return t.slice(1,-1)}},"--\x3e":"--\x3e","--":"--","<--":"<--","-[]->":"-[]->","-[]-":"-[]-","<-[]-":"<-[]-","<-[":"<-[","]->":"]->","-[":"-[","]-":"]-","{":"{","}":"}","[":"[","]":"]","(":"(",")":")",",":",",":":":","`":"`","'":"'","ø":"ø"}),Zt=function(){return null},Kt=function(t){return t[0].text},Yt={Lexer:Jt,ParserRules:[{name:"GramSeq$ebnf$1$subexpression$1",symbols:["Path","_"],postprocess:function(t){return t[0]}},{name:"GramSeq$ebnf$1",symbols:["GramSeq$ebnf$1$subexpression$1"]},{name:"GramSeq$ebnf$1$subexpression$2",symbols:["Path","_"],postprocess:function(t){return t[0]}},{name:"GramSeq$ebnf$1",symbols:["GramSeq$ebnf$1","GramSeq$ebnf$1$subexpression$2"],postprocess:function(t){return t[0].concat([t[1]])}},{name:"GramSeq$ebnf$2",symbols:["EOL"],postprocess:Ht},{name:"GramSeq$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"GramSeq",symbols:["GramSeq$ebnf$1","GramSeq$ebnf$2"],postprocess:function(t){return Dt.seq(Dt.flatten(t[0]))}},{name:"Path",symbols:["NodePattern"],postprocess:Ht},{name:"Path",symbols:["PathComposition"],postprocess:Ht},{name:"Path",symbols:["PathPair"],postprocess:Ht},{name:"NodePattern",symbols:["Node","_","Edge","_","NodePattern"],postprocess:function(t){var e=t[2];return Dt.cons([t[0],t[4]],{kind:e.kind,id:e.id,labels:e.labels,record:e.record})}},{name:"NodePattern",symbols:["Node"],postprocess:Ht},{name:"Node",symbols:[{literal:"("},"_","Attributes","_",{literal:")"}],postprocess:function(t){var e=t[2];return Dt.node(e.id,e.labels,e.record)}},{name:"Edge",symbols:[{literal:"-["},"_","Attributes",{literal:"]->"}],postprocess:function(t){return ht({kind:"right"},t[2])}},{name:"Edge",symbols:[{literal:"-["},"_","Attributes",{literal:"]-"}],postprocess:function(t){return ht({kind:"either"},t[2])}},{name:"Edge",symbols:[{literal:"<-["},"_","Attributes",{literal:"]-"}],postprocess:function(t){return ht({kind:"left"},t[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:Ht},{name:"PathComposition",symbols:["PathAnnotation"],postprocess:Ht},{name:"PathComposition",symbols:["PathExpression"],postprocess:Ht},{name:"PathPoint",symbols:[{literal:"["},"_","Attributes","_",{literal:"]"}],postprocess:function(t){var e=t[2];return(e.id||e.labels||e.record)&&"ø"!==e.id?Dt.node(e.id,e.labels,e.record):Dt.empty()}},{name:"PathAnnotation",symbols:[{literal:"["},"_","Attributes","_","Path",{literal:"]"}],postprocess:function(t){var e=t[2];return Dt.cons([t[4]],{id:e.id,labels:e.labels,record:e.record})}},{name:"PathExpression$ebnf$1",symbols:["Kind"],postprocess:Ht},{name:"PathExpression$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathExpression",symbols:[{literal:"["},"_","Attributes","_","PathExpression$ebnf$1","_","Path","_","Path","_",{literal:"]"}],postprocess:function(t){var e=t[2];return Dt.cons([t[6],t[8]],{kind:t[4],id:e.id,labels:e.labels,record:e.record})}},{name:"PathPair$subexpression$1",symbols:["NodePattern"]},{name:"PathPair$subexpression$1",symbols:["PathComposition"]},{name:"PathPair",symbols:["PathPair$subexpression$1","_",{literal:","},"_","Path"],postprocess:function(t){return Dt.pair([t[0][0],t[4]])}},{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:Ht},{name:"Attributes$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"Attributes$ebnf$2$subexpression$1",symbols:["_","LabelList"],postprocess:function(t){return t[1]}},{name:"Attributes$ebnf$2",symbols:["Attributes$ebnf$2$subexpression$1"],postprocess:Ht},{name:"Attributes$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"Attributes$ebnf$3$subexpression$1",symbols:["_","Record"],postprocess:function(t){return t[1]}},{name:"Attributes$ebnf$3",symbols:["Attributes$ebnf$3$subexpression$1"],postprocess:Ht},{name:"Attributes$ebnf$3",symbols:[],postprocess:function(){return null}},{name:"Attributes",symbols:["Attributes$ebnf$1","Attributes$ebnf$2","Attributes$ebnf$3"],postprocess:function(t){return{id:t[0],labels:t[2],record:t[4]}}},{name:"LabelList$ebnf$1",symbols:["Label"]},{name:"LabelList$ebnf$1",symbols:["LabelList$ebnf$1","Label"],postprocess:function(t){return t[0].concat([t[1]])}},{name:"LabelList",symbols:["LabelList$ebnf$1"],postprocess:function(t){return t[0]}},{name:"Label",symbols:[{literal:":"},"Symbol"],postprocess:function(t){return t[1]}},{name:"Identity",symbols:[Jt.has("identifier")?{type:"identifier"}:identifier],postprocess:Kt},{name:"Identity",symbols:[{literal:"ø"}],postprocess:Kt},{name:"Identity",symbols:[Jt.has("symbol")?{type:"symbol"}:symbol],postprocess:Kt},{name:"Identity",symbols:[Jt.has("integer")?{type:"integer"}:integer],postprocess:Kt},{name:"Identity",symbols:[Jt.has("octal")?{type:"octal"}:octal],postprocess:Kt},{name:"Identity",symbols:[Jt.has("hexadecimal")?{type:"hexadecimal"}:hexadecimal],postprocess:Kt},{name:"Identity",symbols:[Jt.has("measurement")?{type:"measurement"}:measurement],postprocess:Kt},{name:"Identity",symbols:[Jt.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(t){return t[0].text.slice(1,-1)}},{name:"Symbol",symbols:[Jt.has("symbol")?{type:"symbol"}:symbol],postprocess:Kt},{name:"Symbol",symbols:[Jt.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(t){return t[0].text.slice(1,-1)}},{name:"Record",symbols:[{literal:"{"},"_",{literal:"}"}],postprocess:Zt},{name:"Record$ebnf$1",symbols:[]},{name:"Record$ebnf$1$subexpression$1",symbols:["_",{literal:","},"_","Property"]},{name:"Record$ebnf$1",symbols:["Record$ebnf$1","Record$ebnf$1$subexpression$1"],postprocess:function(t){return t[0].concat([t[1]])}},{name:"Record",symbols:[{literal:"{"},"_","Property","Record$ebnf$1","_",{literal:"}"}],postprocess:function(t){return[t[2]].concat(t[3].map((function(t){return t[3]})))}},{name:"Property",symbols:["Symbol","_",{literal:":"},"_","Value"],postprocess:function(t){return Dt.property(t[0],t[4])}},{name:"Value",symbols:["StringLiteral"],postprocess:Ht},{name:"Value",symbols:["NumericLiteral"],postprocess:Ht},{name:"Value",symbols:[Jt.has("boolean")?{type:"boolean"}:boolean],postprocess:function(t){return Dt.boolean(JSON.parse(t[0].value.toLowerCase()))}},{name:"Value$ebnf$1",symbols:[]},{name:"Value$ebnf$1$subexpression$1",symbols:["_",{literal:","},"_","Value"]},{name:"Value$ebnf$1",symbols:["Value$ebnf$1","Value$ebnf$1$subexpression$1"],postprocess:function(t){return t[0].concat([t[1]])}},{name:"Value",symbols:[{literal:"["},"_","Value","Value$ebnf$1",{literal:"]"}],postprocess:function(t){return[t[2]].concat(t[3].map((function(t){return t[3]})))}},{name:"StringLiteral",symbols:[Jt.has("singleQuotedString")?{type:"singleQuotedString"}:singleQuotedString],postprocess:function(t){return Dt.string(t[0].value)}},{name:"StringLiteral",symbols:[Jt.has("doubleQuotedString")?{type:"doubleQuotedString"}:doubleQuotedString],postprocess:function(t){return Dt.string(t[0].value)}},{name:"StringLiteral",symbols:[Jt.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(t){return Dt.string(t[0].value)}},{name:"StringLiteral",symbols:[Jt.has("taggedString")?{type:"taggedString"}:taggedString],postprocess:function(t){var e=function(t){var e=t.match(/([^`]+)`(.+)`$/);if(null==e)throw Error("Malformed tagged string: "+t);return{tag:e[1],value:e[2]}}(t[0].value);return Dt.tagged(e.tag,e.value)}},{name:"NumericLiteral",symbols:[Jt.has("integer")?{type:"integer"}:integer],postprocess:function(t){return Dt.integer(t[0].value)}},{name:"NumericLiteral",symbols:[Jt.has("decimal")?{type:"decimal"}:decimal],postprocess:function(t){return Dt.decimal(t[0].value)}},{name:"NumericLiteral",symbols:[Jt.has("hexadecimal")?{type:"hexadecimal"}:hexadecimal],postprocess:function(t){return Dt.hexadecimal(t[0].value)}},{name:"NumericLiteral",symbols:[Jt.has("octal")?{type:"octal"}:octal],postprocess:function(t){return Dt.octal(t[0].value)}},{name:"NumericLiteral",symbols:[Jt.has("measurement")?{type:"measurement"}:measurement],postprocess:function(t){var e=function(t){var e=t.match(/(-?[0-9.]+)([a-zA-Z]+)/);if(null==e)throw Error("Malformed measurement : "+t);return{value:e[1],unit:e[2]}}(t[0].value);return Dt.measurement(e.unit,e.value)}},{name:"_",symbols:[]},{name:"_",symbols:[Jt.has("whitespace")?{type:"whitespace"}:whitespace],postprocess:Zt},{name:"Comment",symbols:[Jt.has("lineComment")?{type:"lineComment"}:lineComment],postprocess:Zt},{name:"EOL",symbols:[{literal:"\n"}],postprocess:Zt}],ParserStart:"GramSeq"},Wt=function(t,e){var n,r,o=new pt.Parser(pt.Grammar.fromCompiled(Yt));try{var i=o.feed(t);if(void 0===i.results[0]&&i.lexerState){var s={line:(r=i.lexerState).line,column:r.col};e.fail("Incomplete parse.",s)}return i.results.length>1&&e.info("[WARN] parsing is ambiguous"),i.results[0]||{type:"error"}}catch(t){var a=t.token?{line:(n=t.token).line,column:n.col}:{line:0,column:0};e.fail(t.message,a)}},Xt=function(){this.Parser=Wt};t.errors={__proto__:null,INCOMPLETE_PARSE:"Incomplete parse.",SYNTAX_ERROR:"Syntax error at"},t.gramParserPlugin=Xt,t.toAST=function(t){return nt().use(Xt).freeze().parse(t)},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=gram-parse.umd.production.min.js.map
import gramParserPlugin from './gram-parser-plugin';
import * as gramTypes from '@gram-data/gram-ast';
import * as errors from './gram-errors';
declare const toAST: (src: string) => gramTypes.GramPathSeq;
declare const toAST: (src: string) => gramTypes.GramSeq;
export { toAST, gramParserPlugin, errors };

@@ -8,3 +8,3 @@ {

],
"version": "0.2.9",
"version": "0.2.10",
"license": "MIT",

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

"build:demo": "shx cp dist/gram-parse.umd.development.* ./public",
"demo": "serve ./public/",
"demo": "parcel ./public/index.html --open",
"prepare": "npm run build",

@@ -65,5 +65,5 @@ "update": "ncu -u",

"npm-run-all": "^4.1.5",
"parcel-bundler": "^1.12.4",
"rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-globals": "^1.4.0",
"serve": "^11.3.2",
"shx": "^0.3.3",

@@ -77,4 +77,4 @@ "tsdx": "^0.14.1",

"dependencies": {
"@gram-data/gram-ast": "^0.2.9",
"@gram-data/gram-builder": "^0.2.9",
"@gram-data/gram-ast": "^0.2.10",
"@gram-data/gram-builder": "^0.2.10",
"moo": "^0.5.1",

@@ -85,3 +85,3 @@ "nearley": "^2.19.7",

},
"gitHead": "1ff6bdb1c799a29a95540314bdb5b2a881971774",
"gitHead": "5ab0f6f900db922abaf69906f62d6cf23e12215e",
"publishConfig": {

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

@@ -142,45 +142,22 @@ // Generated automatically by nearley, version 2.19.7

{
name: 'PathSequence$ebnf$1$subexpression$1$ebnf$1',
symbols: [{ literal: ',' }],
postprocess: id,
},
{
name: 'PathSequence$ebnf$1$subexpression$1$ebnf$1',
symbols: [],
postprocess: () => null,
},
{
name: 'PathSequence$ebnf$1$subexpression$1',
symbols: ['Path', 'PathSequence$ebnf$1$subexpression$1$ebnf$1', '_'],
name: 'GramSeq$ebnf$1$subexpression$1',
symbols: ['Path', '_'],
postprocess: ([pp]) => pp,
},
{ name: 'GramSeq$ebnf$1', symbols: ['GramSeq$ebnf$1$subexpression$1'] },
{
name: 'PathSequence$ebnf$1',
symbols: ['PathSequence$ebnf$1$subexpression$1'],
},
{
name: 'PathSequence$ebnf$1$subexpression$2$ebnf$1',
symbols: [{ literal: ',' }],
postprocess: id,
},
{
name: 'PathSequence$ebnf$1$subexpression$2$ebnf$1',
symbols: [],
postprocess: () => null,
},
{
name: 'PathSequence$ebnf$1$subexpression$2',
symbols: ['Path', 'PathSequence$ebnf$1$subexpression$2$ebnf$1', '_'],
name: 'GramSeq$ebnf$1$subexpression$2',
symbols: ['Path', '_'],
postprocess: ([pp]) => pp,
},
{
name: 'PathSequence$ebnf$1',
symbols: ['PathSequence$ebnf$1', 'PathSequence$ebnf$1$subexpression$2'],
name: 'GramSeq$ebnf$1',
symbols: ['GramSeq$ebnf$1', 'GramSeq$ebnf$1$subexpression$2'],
postprocess: d => d[0].concat([d[1]]),
},
{ name: 'PathSequence$ebnf$2', symbols: ['EOL'], postprocess: id },
{ name: 'PathSequence$ebnf$2', symbols: [], postprocess: () => null },
{ name: 'GramSeq$ebnf$2', symbols: ['EOL'], postprocess: id },
{ name: 'GramSeq$ebnf$2', symbols: [], postprocess: () => null },
{
name: 'PathSequence',
symbols: ['PathSequence$ebnf$1', 'PathSequence$ebnf$2'],
name: 'GramSeq',
symbols: ['GramSeq$ebnf$1', 'GramSeq$ebnf$2'],
postprocess: ([pp]) => g.seq(g.flatten(pp)),

@@ -190,9 +167,9 @@ },

{ name: 'Path', symbols: ['PathComposition'], postprocess: id },
{ name: 'Path', symbols: ['Comment'], postprocess: id },
{ name: 'Path', symbols: ['PathPair'], postprocess: id },
{
name: 'NodePattern',
symbols: ['Node', 'Edge', 'NodePattern'],
postprocess: ([np, es, ep]) =>
symbols: ['Node', '_', 'Edge', '_', 'NodePattern'],
postprocess: ([np, , es, , ep]) =>
g.cons([np, ep], {
relation: es.relation,
kind: es.kind,
id: es.id,

@@ -207,4 +184,4 @@ labels: es.labels,

symbols: [{ literal: '(' }, '_', 'Attributes', '_', { literal: ')' }],
postprocess: ([, , content]) =>
g.node(content.id, content.labels, content.record),
postprocess: ([, , attrs]) =>
g.node(attrs.id, attrs.labels, attrs.record),
},

@@ -214,3 +191,3 @@ {

symbols: [{ literal: '-[' }, '_', 'Attributes', { literal: ']->' }],
postprocess: ([, , content]) => ({ relation: 'right', ...content }),
postprocess: ([, , attrs]) => ({ kind: 'right', ...attrs }),
},

@@ -220,3 +197,3 @@ {

symbols: [{ literal: '-[' }, '_', 'Attributes', { literal: ']-' }],
postprocess: ([, , content]) => ({ relation: 'either', ...content }),
postprocess: ([, , attrs]) => ({ kind: 'either', ...attrs }),
},

@@ -226,3 +203,3 @@ {

symbols: [{ literal: '<-[' }, '_', 'Attributes', { literal: ']-' }],
postprocess: ([, , content]) => ({ relation: 'left', ...content }),
postprocess: ([, , attrs]) => ({ kind: 'left', ...attrs }),
},

@@ -232,3 +209,3 @@ {

symbols: [{ literal: '-[]->' }],
postprocess: () => ({ relation: 'right' }),
postprocess: () => ({ kind: 'right' }),
},

@@ -238,3 +215,3 @@ {

symbols: [{ literal: '-[]-' }],
postprocess: () => ({ relation: 'either' }),
postprocess: () => ({ kind: 'either' }),
},

@@ -244,3 +221,3 @@ {

symbols: [{ literal: '<-[]-' }],
postprocess: () => ({ relation: 'left' }),
postprocess: () => ({ kind: 'left' }),
},

@@ -250,3 +227,3 @@ {

symbols: [{ literal: '-->' }],
postprocess: () => ({ relation: 'right' }),
postprocess: () => ({ kind: 'right' }),
},

@@ -256,3 +233,3 @@ {

symbols: [{ literal: '--' }],
postprocess: () => ({ relation: 'either' }),
postprocess: () => ({ kind: 'either' }),
},

@@ -262,17 +239,21 @@ {

symbols: [{ literal: '<--' }],
postprocess: () => ({ relation: 'left' }),
postprocess: () => ({ kind: 'left' }),
},
{ name: 'PathComposition', symbols: ['PathPoint'], postprocess: id },
{ name: 'PathComposition', symbols: ['PathAnnotation'], postprocess: id },
{ name: 'PathComposition', symbols: ['PathExpression'], postprocess: id },
{
name: 'PathComposition',
symbols: [{ literal: '[' }, '_', { literal: ']' }],
postprocess: () => g.empty(),
name: 'PathPoint',
symbols: [{ literal: '[' }, '_', 'Attributes', '_', { literal: ']' }],
postprocess: ([, , attr]) => {
if ((attr.id || attr.labels || attr.record) && attr.id !== 'ø') {
// console.log(attr);
return g.node(attr.id, attr.labels, attr.record);
} else {
return g.empty();
}
},
},
{ name: 'PathComposition$ebnf$1', symbols: ['Relation'], postprocess: id },
{ name: 'PathComposition$ebnf$1', symbols: [], postprocess: () => null },
{ name: 'PathComposition$ebnf$2', symbols: ['Path'], postprocess: id },
{ name: 'PathComposition$ebnf$2', symbols: [], postprocess: () => null },
{ name: 'PathComposition$ebnf$3', symbols: ['Path'], postprocess: id },
{ name: 'PathComposition$ebnf$3', symbols: [], postprocess: () => null },
{
name: 'PathComposition',
name: 'PathAnnotation',
symbols: [

@@ -283,53 +264,78 @@ { literal: '[' },

'_',
'PathComposition$ebnf$1',
'_',
'PathComposition$ebnf$2',
'_',
'PathComposition$ebnf$3',
'_',
'Path',
{ literal: ']' },
],
postprocess: ([, , attr, , relation, , lhs, , rhs]) =>
g.cons(rhs ? (lhs ? [lhs, rhs] : [rhs]) : [], {
relation,
postprocess: ([, , attr, , lhs]) => {
// console.log('annotate()', lhs)
return g.cons([lhs], {
id: attr.id,
labels: attr.labels,
record: attr.record,
}),
});
},
},
{ name: 'PathExpression$ebnf$1', symbols: ['Kind'], postprocess: id },
{ name: 'PathExpression$ebnf$1', symbols: [], postprocess: () => null },
{
name: 'Relation',
symbols: [{ literal: ',' }],
postprocess: () => 'pair',
name: 'PathExpression',
symbols: [
{ literal: '[' },
'_',
'Attributes',
'_',
'PathExpression$ebnf$1',
'_',
'Path',
'_',
'Path',
'_',
{ literal: ']' },
],
postprocess: ([, , attrs, , kind, , lhs, , rhs]) => {
return g.cons([lhs, rhs], {
kind,
id: attrs.id,
labels: attrs.labels,
record: attrs.record,
});
},
},
{ name: 'PathPair$subexpression$1', symbols: ['NodePattern'] },
{ name: 'PathPair$subexpression$1', symbols: ['PathComposition'] },
{
name: 'Relation',
symbols: [{ literal: '-->' }],
postprocess: () => 'right',
name: 'PathPair',
symbols: ['PathPair$subexpression$1', '_', { literal: ',' }, '_', 'Path'],
postprocess: ([lp, , , , rp]) => g.pair([lp[0], rp]),
},
{ name: 'Kind', symbols: [{ literal: ',' }], postprocess: () => 'pair' },
{ name: 'Kind', symbols: [{ literal: '-->' }], postprocess: () => 'right' },
{ name: 'Kind', symbols: [{ literal: '--' }], postprocess: () => 'either' },
{ name: 'Kind', symbols: [{ literal: '<--' }], postprocess: () => 'left' },
{ name: 'Attributes$ebnf$1', symbols: ['Identity'], postprocess: id },
{ name: 'Attributes$ebnf$1', symbols: [], postprocess: () => null },
{
name: 'Relation',
symbols: [{ literal: '--' }],
postprocess: () => 'either',
name: 'Attributes$ebnf$2$subexpression$1',
symbols: ['_', 'LabelList'],
postprocess: ([, ll]) => ll,
},
{
name: 'Relation',
symbols: [{ literal: '<--' }],
postprocess: () => 'left',
name: 'Attributes$ebnf$2',
symbols: ['Attributes$ebnf$2$subexpression$1'],
postprocess: id,
},
{ name: 'Attributes$ebnf$1', symbols: ['Identity'], postprocess: id },
{ name: 'Attributes$ebnf$1', symbols: [], postprocess: () => null },
{ name: 'Attributes$ebnf$2', symbols: ['LabelList'], postprocess: id },
{ name: 'Attributes$ebnf$2', symbols: [], postprocess: () => null },
{ name: 'Attributes$ebnf$3', symbols: ['Record'], postprocess: id },
{
name: 'Attributes$ebnf$3$subexpression$1',
symbols: ['_', 'Record'],
postprocess: ([, r]) => r,
},
{
name: 'Attributes$ebnf$3',
symbols: ['Attributes$ebnf$3$subexpression$1'],
postprocess: id,
},
{ name: 'Attributes$ebnf$3', symbols: [], postprocess: () => null },
{
name: 'Attributes',
symbols: [
'Attributes$ebnf$1',
'_',
'Attributes$ebnf$2',
'_',
'Attributes$ebnf$3',
],
symbols: ['Attributes$ebnf$1', 'Attributes$ebnf$2', 'Attributes$ebnf$3'],
postprocess: ([id, , labels, , record]) => ({ id, labels, record }),

@@ -549,5 +555,5 @@ },

],
ParserStart: 'PathSequence',
ParserStart: 'GramSeq',
};
export default grammar;

@@ -37,2 +37,5 @@ import { ParserFunction, Plugin } from 'unified';

}
if (parsed.results.length > 1) {
file.info('[WARN] parsing is ambiguous');
}
return parsed.results[0] || { type: 'error' };

@@ -39,0 +42,0 @@ } catch (e) {

@@ -11,4 +11,4 @@ import unified from 'unified';

.freeze();
return processor.parse(src) as gramTypes.GramPathSeq;
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

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