@gram-data/gram-parse
Advanced tools
Comparing version
@@ -10,3 +10,3 @@ 'use strict'; | ||
var moo = _interopDefault(require('moo')); | ||
var g = require('@gram-data/gram-builder'); | ||
var gramBuilder = require('@gram-data/gram-builder'); | ||
var gramAst = require('@gram-data/gram-ast'); | ||
@@ -92,3 +92,4 @@ | ||
'`': '`', | ||
"'": "'" | ||
"'": "'", | ||
ø: 'ø' | ||
}); | ||
@@ -138,3 +139,3 @@ | ||
ParserRules: [{ | ||
name: 'Gram$ebnf$1$subexpression$1$ebnf$1', | ||
name: 'PathSequence$ebnf$1$subexpression$1$ebnf$1', | ||
symbols: [{ | ||
@@ -145,3 +146,3 @@ literal: ',' | ||
}, { | ||
name: 'Gram$ebnf$1$subexpression$1$ebnf$1', | ||
name: 'PathSequence$ebnf$1$subexpression$1$ebnf$1', | ||
symbols: [], | ||
@@ -152,4 +153,4 @@ postprocess: function postprocess() { | ||
}, { | ||
name: 'Gram$ebnf$1$subexpression$1', | ||
symbols: ['Pathlike', 'Gram$ebnf$1$subexpression$1$ebnf$1', '_'], | ||
name: 'PathSequence$ebnf$1$subexpression$1', | ||
symbols: ['Path', 'PathSequence$ebnf$1$subexpression$1$ebnf$1', '_'], | ||
postprocess: function postprocess(_ref2) { | ||
@@ -160,6 +161,6 @@ var pp = _ref2[0]; | ||
}, { | ||
name: 'Gram$ebnf$1', | ||
symbols: ['Gram$ebnf$1$subexpression$1'] | ||
name: 'PathSequence$ebnf$1', | ||
symbols: ['PathSequence$ebnf$1$subexpression$1'] | ||
}, { | ||
name: 'Gram$ebnf$1$subexpression$2$ebnf$1', | ||
name: 'PathSequence$ebnf$1$subexpression$2$ebnf$1', | ||
symbols: [{ | ||
@@ -170,3 +171,3 @@ literal: ',' | ||
}, { | ||
name: 'Gram$ebnf$1$subexpression$2$ebnf$1', | ||
name: 'PathSequence$ebnf$1$subexpression$2$ebnf$1', | ||
symbols: [], | ||
@@ -177,4 +178,4 @@ postprocess: function postprocess() { | ||
}, { | ||
name: 'Gram$ebnf$1$subexpression$2', | ||
symbols: ['Pathlike', 'Gram$ebnf$1$subexpression$2$ebnf$1', '_'], | ||
name: 'PathSequence$ebnf$1$subexpression$2', | ||
symbols: ['Path', 'PathSequence$ebnf$1$subexpression$2$ebnf$1', '_'], | ||
postprocess: function postprocess(_ref3) { | ||
@@ -185,4 +186,4 @@ var pp = _ref3[0]; | ||
}, { | ||
name: 'Gram$ebnf$1', | ||
symbols: ['Gram$ebnf$1', 'Gram$ebnf$1$subexpression$2'], | ||
name: 'PathSequence$ebnf$1', | ||
symbols: ['PathSequence$ebnf$1', 'PathSequence$ebnf$1$subexpression$2'], | ||
postprocess: function postprocess(d) { | ||
@@ -192,7 +193,7 @@ return d[0].concat([d[1]]); | ||
}, { | ||
name: 'Gram$ebnf$2', | ||
name: 'PathSequence$ebnf$2', | ||
symbols: ['EOL'], | ||
postprocess: id | ||
}, { | ||
name: 'Gram$ebnf$2', | ||
name: 'PathSequence$ebnf$2', | ||
symbols: [], | ||
@@ -203,23 +204,23 @@ postprocess: function postprocess() { | ||
}, { | ||
name: 'Gram', | ||
symbols: ['Gram$ebnf$1', 'Gram$ebnf$2'], | ||
name: 'PathSequence', | ||
symbols: ['PathSequence$ebnf$1', 'PathSequence$ebnf$2'], | ||
postprocess: function postprocess(_ref4) { | ||
var pp = _ref4[0]; | ||
return g.seq(g.flatten(pp)); | ||
return gramBuilder.builder.seq(gramBuilder.builder.flatten(pp)); | ||
} | ||
}, { | ||
name: 'Pathlike', | ||
symbols: ['EdgeExpression'], | ||
name: 'Path', | ||
symbols: ['NodePattern'], | ||
postprocess: id | ||
}, { | ||
name: 'Pathlike', | ||
name: 'Path', | ||
symbols: ['PathComposition'], | ||
postprocess: id | ||
}, { | ||
name: 'Pathlike', | ||
name: 'Path', | ||
symbols: ['Comment'], | ||
postprocess: id | ||
}, { | ||
name: 'EdgeExpression', | ||
symbols: ['Node', 'Edge', 'EdgeExpression'], | ||
name: 'NodePattern', | ||
symbols: ['Node', 'Edge', 'NodePattern'], | ||
postprocess: function postprocess(_ref5) { | ||
@@ -229,3 +230,3 @@ var np = _ref5[0], | ||
ep = _ref5[2]; | ||
return g.cons([np, ep], { | ||
return gramBuilder.builder.cons([np, ep], { | ||
relation: es.relation, | ||
@@ -238,3 +239,3 @@ id: es.id, | ||
}, { | ||
name: 'EdgeExpression', | ||
name: 'NodePattern', | ||
symbols: ['Node'], | ||
@@ -251,3 +252,3 @@ postprocess: id | ||
var content = _ref6[2]; | ||
return g.node(content.id, content.labels, content.record); | ||
return gramBuilder.builder.node(content.id, content.labels, content.record); | ||
} | ||
@@ -354,50 +355,17 @@ }, { | ||
}, { | ||
name: 'PathComposition$ebnf$1', | ||
symbols: ['Pathlike'], | ||
postprocess: id | ||
}, { | ||
name: 'PathComposition$ebnf$1', | ||
symbols: [], | ||
postprocess: function postprocess() { | ||
return null; | ||
} | ||
}, { | ||
name: 'PathComposition', | ||
symbols: [{ | ||
literal: '[' | ||
}, '_', 'Attributes', '_', 'PathComposition$ebnf$1', '_', { | ||
}, '_', { | ||
literal: ']' | ||
}], | ||
postprocess: function postprocess(_ref10) { | ||
var attr = _ref10[2], | ||
sub = _ref10[4]; | ||
return g.cons(sub ? [sub] : [], attr); | ||
postprocess: function postprocess() { | ||
return gramBuilder.builder.empty(); | ||
} | ||
}, { | ||
name: 'PathComposition', | ||
symbols: [{ | ||
literal: '[' | ||
}, '_', 'Attributes', '_', 'Relation', '_', 'Pathlike', '_', 'Pathlike', '_', { | ||
literal: ']' | ||
}], | ||
postprocess: function postprocess(_ref11) { | ||
var attr = _ref11[2], | ||
relation = _ref11[4], | ||
lhs = _ref11[6], | ||
rhs = _ref11[8]; | ||
return g.cons([lhs, rhs], { | ||
relation: relation, | ||
id: attr.id, | ||
labels: attr.labels, | ||
record: attr.record | ||
}); | ||
} | ||
}, { | ||
name: 'PathComposition$ebnf$2$subexpression$1$ebnf$1', | ||
symbols: [{ | ||
literal: ',' | ||
}], | ||
name: 'PathComposition$ebnf$1', | ||
symbols: ['Relation'], | ||
postprocess: id | ||
}, { | ||
name: 'PathComposition$ebnf$2$subexpression$1$ebnf$1', | ||
name: 'PathComposition$ebnf$1', | ||
symbols: [], | ||
@@ -408,19 +376,7 @@ postprocess: function postprocess() { | ||
}, { | ||
name: 'PathComposition$ebnf$2$subexpression$1', | ||
symbols: ['Pathlike', 'PathComposition$ebnf$2$subexpression$1$ebnf$1', '_'], | ||
postprocess: function postprocess(_ref12) { | ||
var pp = _ref12[0]; | ||
return pp; | ||
} | ||
}, { | ||
name: 'PathComposition$ebnf$2', | ||
symbols: ['PathComposition$ebnf$2$subexpression$1'] | ||
}, { | ||
name: 'PathComposition$ebnf$2$subexpression$2$ebnf$1', | ||
symbols: [{ | ||
literal: ',' | ||
}], | ||
symbols: ['Path'], | ||
postprocess: id | ||
}, { | ||
name: 'PathComposition$ebnf$2$subexpression$2$ebnf$1', | ||
name: 'PathComposition$ebnf$2', | ||
symbols: [], | ||
@@ -431,13 +387,10 @@ postprocess: function postprocess() { | ||
}, { | ||
name: 'PathComposition$ebnf$2$subexpression$2', | ||
symbols: ['Pathlike', 'PathComposition$ebnf$2$subexpression$2$ebnf$1', '_'], | ||
postprocess: function postprocess(_ref13) { | ||
var pp = _ref13[0]; | ||
return pp; | ||
} | ||
name: 'PathComposition$ebnf$3', | ||
symbols: ['Path'], | ||
postprocess: id | ||
}, { | ||
name: 'PathComposition$ebnf$2', | ||
symbols: ['PathComposition$ebnf$2', 'PathComposition$ebnf$2$subexpression$2'], | ||
postprocess: function postprocess(d) { | ||
return d[0].concat([d[1]]); | ||
name: 'PathComposition$ebnf$3', | ||
symbols: [], | ||
postprocess: function postprocess() { | ||
return null; | ||
} | ||
@@ -448,9 +401,16 @@ }, { | ||
literal: '[' | ||
}, '_', 'Attributes', '_', 'PathComposition$ebnf$2', { | ||
}, '_', 'Attributes', '_', 'PathComposition$ebnf$1', '_', 'PathComposition$ebnf$2', '_', 'PathComposition$ebnf$3', '_', { | ||
literal: ']' | ||
}], | ||
postprocess: function postprocess(_ref14) { | ||
var attr = _ref14[2], | ||
pp = _ref14[4]; | ||
return g.cons(g.reduce('pair', g.flatten(pp)), attr); | ||
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 | ||
}); | ||
} | ||
@@ -522,6 +482,6 @@ }, { | ||
symbols: ['Attributes$ebnf$1', '_', 'Attributes$ebnf$2', '_', 'Attributes$ebnf$3'], | ||
postprocess: function postprocess(_ref15) { | ||
var id = _ref15[0], | ||
labels = _ref15[2], | ||
record = _ref15[4]; | ||
postprocess: function postprocess(_ref11) { | ||
var id = _ref11[0], | ||
labels = _ref11[2], | ||
record = _ref11[4]; | ||
return { | ||
@@ -545,4 +505,4 @@ id: id, | ||
symbols: ['LabelList$ebnf$1'], | ||
postprocess: function postprocess(_ref16) { | ||
var labels = _ref16[0]; | ||
postprocess: function postprocess(_ref12) { | ||
var labels = _ref12[0]; | ||
return labels; | ||
@@ -555,4 +515,4 @@ } | ||
}, 'Symbol'], | ||
postprocess: function postprocess(_ref17) { | ||
var label = _ref17[1]; | ||
postprocess: function postprocess(_ref13) { | ||
var label = _ref13[1]; | ||
return label; | ||
@@ -568,2 +528,8 @@ } | ||
name: 'Identity', | ||
symbols: [{ | ||
literal: 'ø' | ||
}], | ||
postprocess: text | ||
}, { | ||
name: 'Identity', | ||
symbols: [/*#__PURE__*/lexer.has('symbol') ? { | ||
@@ -602,4 +568,4 @@ type: 'symbol' | ||
} : tickedString], | ||
postprocess: function postprocess(_ref18) { | ||
var t = _ref18[0]; | ||
postprocess: function postprocess(_ref14) { | ||
var t = _ref14[0]; | ||
return t.text.slice(1, -1); | ||
@@ -618,4 +584,4 @@ } | ||
} : tickedString], | ||
postprocess: function postprocess(_ref19) { | ||
var t = _ref19[0]; | ||
postprocess: function postprocess(_ref15) { | ||
var t = _ref15[0]; | ||
return t.text.slice(1, -1); | ||
@@ -652,6 +618,6 @@ } | ||
}], | ||
postprocess: function postprocess(_ref20) { | ||
var p = _ref20[2], | ||
ps = _ref20[3]; | ||
return g.record([p].concat(extractPairs(ps))); | ||
postprocess: function postprocess(_ref16) { | ||
var p = _ref16[2], | ||
ps = _ref16[3]; | ||
return [p].concat(extractPairs(ps)); | ||
} | ||
@@ -663,6 +629,6 @@ }, { | ||
}, '_', 'Value'], | ||
postprocess: function postprocess(_ref21) { | ||
var k = _ref21[0], | ||
v = _ref21[4]; | ||
return g.property(k, v); | ||
postprocess: function postprocess(_ref17) { | ||
var k = _ref17[0], | ||
v = _ref17[4]; | ||
return gramBuilder.builder.property(k, v); | ||
} | ||
@@ -683,3 +649,3 @@ }, { | ||
postprocess: function postprocess(d) { | ||
return g.boolean(JSON.parse(d[0].value.toLowerCase())); | ||
return gramBuilder.builder["boolean"](JSON.parse(d[0].value.toLowerCase())); | ||
} | ||
@@ -707,5 +673,5 @@ }, { | ||
}], | ||
postprocess: function postprocess(_ref22) { | ||
var v = _ref22[2], | ||
vs = _ref22[3]; | ||
postprocess: function postprocess(_ref18) { | ||
var v = _ref18[2], | ||
vs = _ref18[3]; | ||
return [v].concat(extractArray(vs)); | ||
@@ -719,3 +685,3 @@ } | ||
postprocess: function postprocess(d) { | ||
return g.string(d[0].value); | ||
return gramBuilder.builder.string(d[0].value); | ||
} | ||
@@ -728,3 +694,3 @@ }, { | ||
postprocess: function postprocess(d) { | ||
return g.string(d[0].value); | ||
return gramBuilder.builder.string(d[0].value); | ||
} | ||
@@ -737,3 +703,3 @@ }, { | ||
postprocess: function postprocess(d) { | ||
return g.string(d[0].value); | ||
return gramBuilder.builder.string(d[0].value); | ||
} | ||
@@ -747,3 +713,3 @@ }, { | ||
var parts = separateTagFromString(d[0].value); | ||
return g.tagged(parts.tag, parts.value); | ||
return gramBuilder.builder.tagged(parts.tag, parts.value); | ||
} | ||
@@ -756,3 +722,3 @@ }, { | ||
postprocess: function postprocess(d) { | ||
return g.integer(d[0].value); | ||
return gramBuilder.builder.integer(d[0].value); | ||
} | ||
@@ -765,3 +731,3 @@ }, { | ||
postprocess: function postprocess(d) { | ||
return g.decimal(d[0].value); | ||
return gramBuilder.builder.decimal(d[0].value); | ||
} | ||
@@ -774,3 +740,3 @@ }, { | ||
postprocess: function postprocess(d) { | ||
return g.hexadecimal(d[0].value); | ||
return gramBuilder.builder.hexadecimal(d[0].value); | ||
} | ||
@@ -783,3 +749,3 @@ }, { | ||
postprocess: function postprocess(d) { | ||
return g.octal(d[0].value); | ||
return gramBuilder.builder.octal(d[0].value); | ||
} | ||
@@ -793,3 +759,3 @@ }, { | ||
var parts = separateNumberFromUnits(d[0].value); | ||
return g.measurement(parts.unit, parts.value); | ||
return gramBuilder.builder.measurement(parts.unit, parts.value); | ||
} | ||
@@ -818,3 +784,3 @@ }, { | ||
}], | ||
ParserStart: 'Gram' | ||
ParserStart: 'PathSequence' | ||
}; | ||
@@ -821,0 +787,0 @@ |
@@ -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 s=e(require("unified")),t=e(require("nearley")),n=e(require("moo")),o=require("@gram-data/gram-builder"),r=require("@gram-data/gram-ast");function a(){return(a=Object.assign||function(e){for(var s=1;s<arguments.length;s++){var t=arguments[s];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function i(e){return e[0]}var l=n.compile({whitespace:{match:/\s+/,lineBreaks:!0},lineComment:{match:/\/\/.*?\n?$/},hexadecimal:r.tokens.hexadecimal,octal:r.tokens.octal,measurement:r.tokens.measurement,decimal:r.tokens.decimal,integer:r.tokens.integer,taggedString:{match:r.tokens.taggedString},boolean:["true","TRUE","True","false","FALSE","False"],symbol:r.tokens.symbol,identifier:r.tokens.identifier,doubleQuotedString:{match:r.tokens.doubleQuotedString,value:function(e){return e.slice(1,-1)}},singleQuotedString:{match:r.tokens.singleQuotedString,value:function(e){return e.slice(1,-1)}},tickedString:{match:r.tokens.tickedString,value:function(e){return e.slice(1,-1)}},"--\x3e":"--\x3e","--":"--","<--":"<--","-[]->":"-[]->","-[]-":"-[]-","<-[]-":"<-[]-","<-[":"<-[","]->":"]->","-[":"-[","]-":"]-","{":"{","}":"}","[":"[","]":"]","(":"(",")":")",",":",",":":":","`":"`","'":"'"}),m=function(){return null},u=function(e){return e[0].text},p={Lexer:l,ParserRules:[{name:"Gram$ebnf$1$subexpression$1$ebnf$1",symbols:[{literal:","}],postprocess:i},{name:"Gram$ebnf$1$subexpression$1$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"Gram$ebnf$1$subexpression$1",symbols:["Pathlike","Gram$ebnf$1$subexpression$1$ebnf$1","_"],postprocess:function(e){return e[0]}},{name:"Gram$ebnf$1",symbols:["Gram$ebnf$1$subexpression$1"]},{name:"Gram$ebnf$1$subexpression$2$ebnf$1",symbols:[{literal:","}],postprocess:i},{name:"Gram$ebnf$1$subexpression$2$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"Gram$ebnf$1$subexpression$2",symbols:["Pathlike","Gram$ebnf$1$subexpression$2$ebnf$1","_"],postprocess:function(e){return e[0]}},{name:"Gram$ebnf$1",symbols:["Gram$ebnf$1","Gram$ebnf$1$subexpression$2"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"Gram$ebnf$2",symbols:["EOL"],postprocess:i},{name:"Gram$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"Gram",symbols:["Gram$ebnf$1","Gram$ebnf$2"],postprocess:function(e){return o.seq(o.flatten(e[0]))}},{name:"Pathlike",symbols:["EdgeExpression"],postprocess:i},{name:"Pathlike",symbols:["PathComposition"],postprocess:i},{name:"Pathlike",symbols:["Comment"],postprocess:i},{name:"EdgeExpression",symbols:["Node","Edge","EdgeExpression"],postprocess:function(e){var s=e[1];return o.cons([e[0],e[2]],{relation:s.relation,id:s.id,labels:s.labels,record:s.record})}},{name:"EdgeExpression",symbols:["Node"],postprocess:i},{name:"Node",symbols:[{literal:"("},"_","Attributes",{literal:")"}],postprocess:function(e){var s=e[2];return o.node(s.id,s.labels,s.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$ebnf$1",symbols:["Pathlike"],postprocess:i},{name:"PathComposition$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathComposition",symbols:[{literal:"["},"_","Attributes","_","PathComposition$ebnf$1","_",{literal:"]"}],postprocess:function(e){var s=e[4];return o.cons(s?[s]:[],e[2])}},{name:"PathComposition",symbols:[{literal:"["},"_","Attributes","_","Relation","_","Pathlike","_","Pathlike","_",{literal:"]"}],postprocess:function(e){var s=e[2];return o.cons([e[6],e[8]],{relation:e[4],id:s.id,labels:s.labels,record:s.record})}},{name:"PathComposition$ebnf$2$subexpression$1$ebnf$1",symbols:[{literal:","}],postprocess:i},{name:"PathComposition$ebnf$2$subexpression$1$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathComposition$ebnf$2$subexpression$1",symbols:["Pathlike","PathComposition$ebnf$2$subexpression$1$ebnf$1","_"],postprocess:function(e){return e[0]}},{name:"PathComposition$ebnf$2",symbols:["PathComposition$ebnf$2$subexpression$1"]},{name:"PathComposition$ebnf$2$subexpression$2$ebnf$1",symbols:[{literal:","}],postprocess:i},{name:"PathComposition$ebnf$2$subexpression$2$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathComposition$ebnf$2$subexpression$2",symbols:["Pathlike","PathComposition$ebnf$2$subexpression$2$ebnf$1","_"],postprocess:function(e){return e[0]}},{name:"PathComposition$ebnf$2",symbols:["PathComposition$ebnf$2","PathComposition$ebnf$2$subexpression$2"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"PathComposition",symbols:[{literal:"["},"_","Attributes","_","PathComposition$ebnf$2",{literal:"]"}],postprocess:function(e){var s=e[2];return o.cons(o.reduce("pair",o.flatten(e[4])),s)}},{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:i},{name:"Attributes$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"Attributes$ebnf$2",symbols:["LabelList"],postprocess:i},{name:"Attributes$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"Attributes$ebnf$3",symbols:["Record"],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:u},{name:"Identity",symbols:[l.has("symbol")?{type:"symbol"}:symbol],postprocess:u},{name:"Identity",symbols:[l.has("integer")?{type:"integer"}:integer],postprocess:u},{name:"Identity",symbols:[l.has("octal")?{type:"octal"}:octal],postprocess:u},{name:"Identity",symbols:[l.has("hexadecimal")?{type:"hexadecimal"}:hexadecimal],postprocess:u},{name:"Identity",symbols:[l.has("measurement")?{type:"measurement"}:measurement],postprocess:u},{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:u},{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:m},{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 o.record([e[2]].concat(e[3].map((function(e){return e[3]}))))}},{name:"Property",symbols:["Symbol","_",{literal:":"},"_","Value"],postprocess:function(e){return o.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 o.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 o.string(e[0].value)}},{name:"StringLiteral",symbols:[l.has("doubleQuotedString")?{type:"doubleQuotedString"}:doubleQuotedString],postprocess:function(e){return o.string(e[0].value)}},{name:"StringLiteral",symbols:[l.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(e){return o.string(e[0].value)}},{name:"StringLiteral",symbols:[l.has("taggedString")?{type:"taggedString"}:taggedString],postprocess:function(e){var s=function(e){var s=e.match(/([^`]+)`(.+)`$/);if(null==s)throw Error("Malformed tagged string: "+e);return{tag:s[1],value:s[2]}}(e[0].value);return o.tagged(s.tag,s.value)}},{name:"NumericLiteral",symbols:[l.has("integer")?{type:"integer"}:integer],postprocess:function(e){return o.integer(e[0].value)}},{name:"NumericLiteral",symbols:[l.has("decimal")?{type:"decimal"}:decimal],postprocess:function(e){return o.decimal(e[0].value)}},{name:"NumericLiteral",symbols:[l.has("hexadecimal")?{type:"hexadecimal"}:hexadecimal],postprocess:function(e){return o.hexadecimal(e[0].value)}},{name:"NumericLiteral",symbols:[l.has("octal")?{type:"octal"}:octal],postprocess:function(e){return o.octal(e[0].value)}},{name:"NumericLiteral",symbols:[l.has("measurement")?{type:"measurement"}:measurement],postprocess:function(e){var s=function(e){var s=e.match(/(-?[0-9.]+)([a-zA-Z]+)/);if(null==s)throw Error("Malformed measurement : "+e);return{value:s[1],unit:s[2]}}(e[0].value);return o.measurement(s.unit,s.value)}},{name:"_",symbols:[]},{name:"_",symbols:[l.has("whitespace")?{type:"whitespace"}:whitespace],postprocess:m},{name:"Comment",symbols:[l.has("lineComment")?{type:"lineComment"}:lineComment],postprocess:m},{name:"EOL",symbols:[{literal:"\n"}],postprocess:m}],ParserStart:"Gram"},c=function(e,s){var n,o,r=new t.Parser(t.Grammar.fromCompiled(p));try{var a=r.feed(e);if(void 0===a.results[0]&&a.lexerState){var i={line:(o=a.lexerState).line,column:o.col};s.fail("Incomplete parse.",i)}return a.results[0]||{type:"error"}}catch(e){var l=e.token?{line:(n=e.token).line,column:n.col}:{line:0,column:0};s.fail(e.message,l)}},b=function(){this.Parser=c};exports.errors={__proto__:null,INCOMPLETE_PARSE:"Incomplete parse.",SYNTAX_ERROR:"Syntax error at"},exports.gramParserPlugin=b,exports.toAST=function(e){return s().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")),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)}; | ||
//# sourceMappingURL=gram-parse.cjs.production.min.js.map |
import unified from 'unified'; | ||
import nearley from 'nearley'; | ||
import moo from 'moo'; | ||
import { seq, flatten, cons, node, reduce, record, property, boolean as boolean$1, string, tagged, integer as integer$1, decimal as decimal$1, hexadecimal as hexadecimal$1, octal as octal$1, measurement as measurement$1 } from '@gram-data/gram-builder'; | ||
import { builder } from '@gram-data/gram-builder'; | ||
import { tokens } from '@gram-data/gram-ast'; | ||
@@ -85,3 +85,4 @@ | ||
'`': '`', | ||
"'": "'" | ||
"'": "'", | ||
ø: 'ø' | ||
}); | ||
@@ -131,3 +132,3 @@ | ||
ParserRules: [{ | ||
name: 'Gram$ebnf$1$subexpression$1$ebnf$1', | ||
name: 'PathSequence$ebnf$1$subexpression$1$ebnf$1', | ||
symbols: [{ | ||
@@ -138,3 +139,3 @@ literal: ',' | ||
}, { | ||
name: 'Gram$ebnf$1$subexpression$1$ebnf$1', | ||
name: 'PathSequence$ebnf$1$subexpression$1$ebnf$1', | ||
symbols: [], | ||
@@ -145,4 +146,4 @@ postprocess: function postprocess() { | ||
}, { | ||
name: 'Gram$ebnf$1$subexpression$1', | ||
symbols: ['Pathlike', 'Gram$ebnf$1$subexpression$1$ebnf$1', '_'], | ||
name: 'PathSequence$ebnf$1$subexpression$1', | ||
symbols: ['Path', 'PathSequence$ebnf$1$subexpression$1$ebnf$1', '_'], | ||
postprocess: function postprocess(_ref2) { | ||
@@ -153,6 +154,6 @@ var pp = _ref2[0]; | ||
}, { | ||
name: 'Gram$ebnf$1', | ||
symbols: ['Gram$ebnf$1$subexpression$1'] | ||
name: 'PathSequence$ebnf$1', | ||
symbols: ['PathSequence$ebnf$1$subexpression$1'] | ||
}, { | ||
name: 'Gram$ebnf$1$subexpression$2$ebnf$1', | ||
name: 'PathSequence$ebnf$1$subexpression$2$ebnf$1', | ||
symbols: [{ | ||
@@ -163,3 +164,3 @@ literal: ',' | ||
}, { | ||
name: 'Gram$ebnf$1$subexpression$2$ebnf$1', | ||
name: 'PathSequence$ebnf$1$subexpression$2$ebnf$1', | ||
symbols: [], | ||
@@ -170,4 +171,4 @@ postprocess: function postprocess() { | ||
}, { | ||
name: 'Gram$ebnf$1$subexpression$2', | ||
symbols: ['Pathlike', 'Gram$ebnf$1$subexpression$2$ebnf$1', '_'], | ||
name: 'PathSequence$ebnf$1$subexpression$2', | ||
symbols: ['Path', 'PathSequence$ebnf$1$subexpression$2$ebnf$1', '_'], | ||
postprocess: function postprocess(_ref3) { | ||
@@ -178,4 +179,4 @@ var pp = _ref3[0]; | ||
}, { | ||
name: 'Gram$ebnf$1', | ||
symbols: ['Gram$ebnf$1', 'Gram$ebnf$1$subexpression$2'], | ||
name: 'PathSequence$ebnf$1', | ||
symbols: ['PathSequence$ebnf$1', 'PathSequence$ebnf$1$subexpression$2'], | ||
postprocess: function postprocess(d) { | ||
@@ -185,7 +186,7 @@ return d[0].concat([d[1]]); | ||
}, { | ||
name: 'Gram$ebnf$2', | ||
name: 'PathSequence$ebnf$2', | ||
symbols: ['EOL'], | ||
postprocess: id | ||
}, { | ||
name: 'Gram$ebnf$2', | ||
name: 'PathSequence$ebnf$2', | ||
symbols: [], | ||
@@ -196,23 +197,23 @@ postprocess: function postprocess() { | ||
}, { | ||
name: 'Gram', | ||
symbols: ['Gram$ebnf$1', 'Gram$ebnf$2'], | ||
name: 'PathSequence', | ||
symbols: ['PathSequence$ebnf$1', 'PathSequence$ebnf$2'], | ||
postprocess: function postprocess(_ref4) { | ||
var pp = _ref4[0]; | ||
return seq(flatten(pp)); | ||
return builder.seq(builder.flatten(pp)); | ||
} | ||
}, { | ||
name: 'Pathlike', | ||
symbols: ['EdgeExpression'], | ||
name: 'Path', | ||
symbols: ['NodePattern'], | ||
postprocess: id | ||
}, { | ||
name: 'Pathlike', | ||
name: 'Path', | ||
symbols: ['PathComposition'], | ||
postprocess: id | ||
}, { | ||
name: 'Pathlike', | ||
name: 'Path', | ||
symbols: ['Comment'], | ||
postprocess: id | ||
}, { | ||
name: 'EdgeExpression', | ||
symbols: ['Node', 'Edge', 'EdgeExpression'], | ||
name: 'NodePattern', | ||
symbols: ['Node', 'Edge', 'NodePattern'], | ||
postprocess: function postprocess(_ref5) { | ||
@@ -222,3 +223,3 @@ var np = _ref5[0], | ||
ep = _ref5[2]; | ||
return cons([np, ep], { | ||
return builder.cons([np, ep], { | ||
relation: es.relation, | ||
@@ -231,3 +232,3 @@ id: es.id, | ||
}, { | ||
name: 'EdgeExpression', | ||
name: 'NodePattern', | ||
symbols: ['Node'], | ||
@@ -244,3 +245,3 @@ postprocess: id | ||
var content = _ref6[2]; | ||
return node(content.id, content.labels, content.record); | ||
return builder.node(content.id, content.labels, content.record); | ||
} | ||
@@ -347,50 +348,17 @@ }, { | ||
}, { | ||
name: 'PathComposition$ebnf$1', | ||
symbols: ['Pathlike'], | ||
postprocess: id | ||
}, { | ||
name: 'PathComposition$ebnf$1', | ||
symbols: [], | ||
postprocess: function postprocess() { | ||
return null; | ||
} | ||
}, { | ||
name: 'PathComposition', | ||
symbols: [{ | ||
literal: '[' | ||
}, '_', 'Attributes', '_', 'PathComposition$ebnf$1', '_', { | ||
}, '_', { | ||
literal: ']' | ||
}], | ||
postprocess: function postprocess(_ref10) { | ||
var attr = _ref10[2], | ||
sub = _ref10[4]; | ||
return cons(sub ? [sub] : [], attr); | ||
postprocess: function postprocess() { | ||
return builder.empty(); | ||
} | ||
}, { | ||
name: 'PathComposition', | ||
symbols: [{ | ||
literal: '[' | ||
}, '_', 'Attributes', '_', 'Relation', '_', 'Pathlike', '_', 'Pathlike', '_', { | ||
literal: ']' | ||
}], | ||
postprocess: function postprocess(_ref11) { | ||
var attr = _ref11[2], | ||
relation = _ref11[4], | ||
lhs = _ref11[6], | ||
rhs = _ref11[8]; | ||
return cons([lhs, rhs], { | ||
relation: relation, | ||
id: attr.id, | ||
labels: attr.labels, | ||
record: attr.record | ||
}); | ||
} | ||
}, { | ||
name: 'PathComposition$ebnf$2$subexpression$1$ebnf$1', | ||
symbols: [{ | ||
literal: ',' | ||
}], | ||
name: 'PathComposition$ebnf$1', | ||
symbols: ['Relation'], | ||
postprocess: id | ||
}, { | ||
name: 'PathComposition$ebnf$2$subexpression$1$ebnf$1', | ||
name: 'PathComposition$ebnf$1', | ||
symbols: [], | ||
@@ -401,19 +369,7 @@ postprocess: function postprocess() { | ||
}, { | ||
name: 'PathComposition$ebnf$2$subexpression$1', | ||
symbols: ['Pathlike', 'PathComposition$ebnf$2$subexpression$1$ebnf$1', '_'], | ||
postprocess: function postprocess(_ref12) { | ||
var pp = _ref12[0]; | ||
return pp; | ||
} | ||
}, { | ||
name: 'PathComposition$ebnf$2', | ||
symbols: ['PathComposition$ebnf$2$subexpression$1'] | ||
}, { | ||
name: 'PathComposition$ebnf$2$subexpression$2$ebnf$1', | ||
symbols: [{ | ||
literal: ',' | ||
}], | ||
symbols: ['Path'], | ||
postprocess: id | ||
}, { | ||
name: 'PathComposition$ebnf$2$subexpression$2$ebnf$1', | ||
name: 'PathComposition$ebnf$2', | ||
symbols: [], | ||
@@ -424,13 +380,10 @@ postprocess: function postprocess() { | ||
}, { | ||
name: 'PathComposition$ebnf$2$subexpression$2', | ||
symbols: ['Pathlike', 'PathComposition$ebnf$2$subexpression$2$ebnf$1', '_'], | ||
postprocess: function postprocess(_ref13) { | ||
var pp = _ref13[0]; | ||
return pp; | ||
} | ||
name: 'PathComposition$ebnf$3', | ||
symbols: ['Path'], | ||
postprocess: id | ||
}, { | ||
name: 'PathComposition$ebnf$2', | ||
symbols: ['PathComposition$ebnf$2', 'PathComposition$ebnf$2$subexpression$2'], | ||
postprocess: function postprocess(d) { | ||
return d[0].concat([d[1]]); | ||
name: 'PathComposition$ebnf$3', | ||
symbols: [], | ||
postprocess: function postprocess() { | ||
return null; | ||
} | ||
@@ -441,9 +394,16 @@ }, { | ||
literal: '[' | ||
}, '_', 'Attributes', '_', 'PathComposition$ebnf$2', { | ||
}, '_', 'Attributes', '_', 'PathComposition$ebnf$1', '_', 'PathComposition$ebnf$2', '_', 'PathComposition$ebnf$3', '_', { | ||
literal: ']' | ||
}], | ||
postprocess: function postprocess(_ref14) { | ||
var attr = _ref14[2], | ||
pp = _ref14[4]; | ||
return cons(reduce('pair', flatten(pp)), attr); | ||
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 | ||
}); | ||
} | ||
@@ -515,6 +475,6 @@ }, { | ||
symbols: ['Attributes$ebnf$1', '_', 'Attributes$ebnf$2', '_', 'Attributes$ebnf$3'], | ||
postprocess: function postprocess(_ref15) { | ||
var id = _ref15[0], | ||
labels = _ref15[2], | ||
record = _ref15[4]; | ||
postprocess: function postprocess(_ref11) { | ||
var id = _ref11[0], | ||
labels = _ref11[2], | ||
record = _ref11[4]; | ||
return { | ||
@@ -538,4 +498,4 @@ id: id, | ||
symbols: ['LabelList$ebnf$1'], | ||
postprocess: function postprocess(_ref16) { | ||
var labels = _ref16[0]; | ||
postprocess: function postprocess(_ref12) { | ||
var labels = _ref12[0]; | ||
return labels; | ||
@@ -548,4 +508,4 @@ } | ||
}, 'Symbol'], | ||
postprocess: function postprocess(_ref17) { | ||
var label = _ref17[1]; | ||
postprocess: function postprocess(_ref13) { | ||
var label = _ref13[1]; | ||
return label; | ||
@@ -561,2 +521,8 @@ } | ||
name: 'Identity', | ||
symbols: [{ | ||
literal: 'ø' | ||
}], | ||
postprocess: text | ||
}, { | ||
name: 'Identity', | ||
symbols: [/*#__PURE__*/lexer.has('symbol') ? { | ||
@@ -595,4 +561,4 @@ type: 'symbol' | ||
} : tickedString], | ||
postprocess: function postprocess(_ref18) { | ||
var t = _ref18[0]; | ||
postprocess: function postprocess(_ref14) { | ||
var t = _ref14[0]; | ||
return t.text.slice(1, -1); | ||
@@ -611,4 +577,4 @@ } | ||
} : tickedString], | ||
postprocess: function postprocess(_ref19) { | ||
var t = _ref19[0]; | ||
postprocess: function postprocess(_ref15) { | ||
var t = _ref15[0]; | ||
return t.text.slice(1, -1); | ||
@@ -645,6 +611,6 @@ } | ||
}], | ||
postprocess: function postprocess(_ref20) { | ||
var p = _ref20[2], | ||
ps = _ref20[3]; | ||
return record([p].concat(extractPairs(ps))); | ||
postprocess: function postprocess(_ref16) { | ||
var p = _ref16[2], | ||
ps = _ref16[3]; | ||
return [p].concat(extractPairs(ps)); | ||
} | ||
@@ -656,6 +622,6 @@ }, { | ||
}, '_', 'Value'], | ||
postprocess: function postprocess(_ref21) { | ||
var k = _ref21[0], | ||
v = _ref21[4]; | ||
return property(k, v); | ||
postprocess: function postprocess(_ref17) { | ||
var k = _ref17[0], | ||
v = _ref17[4]; | ||
return builder.property(k, v); | ||
} | ||
@@ -676,3 +642,3 @@ }, { | ||
postprocess: function postprocess(d) { | ||
return boolean$1(JSON.parse(d[0].value.toLowerCase())); | ||
return builder["boolean"](JSON.parse(d[0].value.toLowerCase())); | ||
} | ||
@@ -700,5 +666,5 @@ }, { | ||
}], | ||
postprocess: function postprocess(_ref22) { | ||
var v = _ref22[2], | ||
vs = _ref22[3]; | ||
postprocess: function postprocess(_ref18) { | ||
var v = _ref18[2], | ||
vs = _ref18[3]; | ||
return [v].concat(extractArray(vs)); | ||
@@ -712,3 +678,3 @@ } | ||
postprocess: function postprocess(d) { | ||
return string(d[0].value); | ||
return builder.string(d[0].value); | ||
} | ||
@@ -721,3 +687,3 @@ }, { | ||
postprocess: function postprocess(d) { | ||
return string(d[0].value); | ||
return builder.string(d[0].value); | ||
} | ||
@@ -730,3 +696,3 @@ }, { | ||
postprocess: function postprocess(d) { | ||
return string(d[0].value); | ||
return builder.string(d[0].value); | ||
} | ||
@@ -740,3 +706,3 @@ }, { | ||
var parts = separateTagFromString(d[0].value); | ||
return tagged(parts.tag, parts.value); | ||
return builder.tagged(parts.tag, parts.value); | ||
} | ||
@@ -749,3 +715,3 @@ }, { | ||
postprocess: function postprocess(d) { | ||
return integer$1(d[0].value); | ||
return builder.integer(d[0].value); | ||
} | ||
@@ -758,3 +724,3 @@ }, { | ||
postprocess: function postprocess(d) { | ||
return decimal$1(d[0].value); | ||
return builder.decimal(d[0].value); | ||
} | ||
@@ -767,3 +733,3 @@ }, { | ||
postprocess: function postprocess(d) { | ||
return hexadecimal$1(d[0].value); | ||
return builder.hexadecimal(d[0].value); | ||
} | ||
@@ -776,3 +742,3 @@ }, { | ||
postprocess: function postprocess(d) { | ||
return octal$1(d[0].value); | ||
return builder.octal(d[0].value); | ||
} | ||
@@ -786,3 +752,3 @@ }, { | ||
var parts = separateNumberFromUnits(d[0].value); | ||
return measurement$1(parts.unit, parts.value); | ||
return builder.measurement(parts.unit, parts.value); | ||
} | ||
@@ -811,3 +777,3 @@ }, { | ||
}], | ||
ParserStart: 'Gram' | ||
ParserStart: 'PathSequence' | ||
}; | ||
@@ -814,0 +780,0 @@ |
@@ -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=Object.prototype.hasOwnProperty,r=Object.prototype.toString,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,i=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===r.call(e)},a=function(e){if(!e||"[object Object]"!==r.call(e))return!1;var t,o=n.call(e,"constructor"),s=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!o&&!s)return!1;for(t in e);return void 0===t||n.call(e,t)},l=function(e,t){o&&"__proto__"===t.name?o(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},u=function(e,t){if("__proto__"===t){if(!n.call(e,t))return;if(s)return s(e,t).value}return e[t]},c=function e(){var t,n,r,o,s,c,f=arguments[0],p=1,h=arguments.length,m=!1;for("boolean"==typeof f&&(m=f,f=arguments[1]||{},p=2),(null==f||"object"!=typeof f&&"function"!=typeof f)&&(f={});p<h;++p)if(null!=(t=arguments[p]))for(n in t)r=u(f,n),f!==(o=u(t,n))&&(m&&o&&(a(o)||(s=i(o)))?(s?(s=!1,c=r&&i(r)?r:[]):c=r&&a(r)?r:{},l(f,{name:n,newValue:e(m,c,o)})):void 0!==o&&l(f,{name:n,newValue:o}));return f},f=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},p=[].slice,h=function(e,t){var n;return function(){var t,s=p.call(arguments,0),i=e.length>s.length;i&&s.push(r);try{t=e.apply(null,s)}catch(e){if(i&&n)throw e;return r(e)}i||(t&&"function"==typeof t.then?t.then(o,r):t instanceof Error?r(t):o(t))};function r(){n||(n=!0,t.apply(null,arguments))}function o(e){r(null,e)}},m=b;b.wrap=h;var y=[].slice;function b(){var e=[],t={run:function(){var t=-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(s){var i=e[++t],a=y.call(arguments,0),l=a.slice(1),u=n.length,c=-1;if(s)r(s);else{for(;++c<u;)null==l[c]&&(l[c]=n[c]);n=l,i?h(i,o).apply(null,n):r.apply(null,[null].concat(n))}}o.apply(null,[null].concat(n))},use:function(n){if("function"!=typeof n)throw new Error("Expected `fn` to be a function, not "+n);return e.push(n),t}};return t}var d={}.hasOwnProperty,g=function(e){return e&&"object"==typeof e?d.call(e,"position")||d.call(e,"type")?$(e.position):d.call(e,"start")||d.call(e,"end")?$(e):d.call(e,"line")||d.call(e,"column")?v(e):"":""};function v(e){return e&&"object"==typeof e||(e={}),w(e.line)+":"+w(e.column)}function $(e){return e&&"object"==typeof e||(e={}),v(e.start)+"-"+v(e.end)}function w(e){return e&&"number"==typeof e?e:1}var x=k;function S(){}S.prototype=Error.prototype;var E=k.prototype=new S;function k(e,t,n){var r,o,s;"string"==typeof t&&(n=t,t=null),r=function(e){var t,n=[null,null];return"string"==typeof e&&(-1===(t=e.indexOf(":"))?n[1]=e:(n[0]=e.slice(0,t),n[1]=e.slice(t+1))),n}(n),o=g(t)||"1:1",s={start:{line:null,column:null},end:{line:null,column:null}},t&&t.position&&(t=t.position),t&&(t.start?(s=t,t=t.start):s.start=t),e.stack&&(this.stack=e.stack,e=e.message),this.message=e,this.name=o,this.reason=e,this.line=t?t.line:null,this.column=t?t.column:null,this.location=s,this.source=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 P="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function O(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 P.setTimeout&&setTimeout,"function"==typeof P.clearTimeout&&clearTimeout,new Date;var j=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,_=function(e){return j.exec(e).slice(1)};function A(){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=O(q(e.split("/"),(function(e){return!!e})),!t).join("/"))||"."}function C(e){var t=L(e),n="/"===V(e,-1);return(e=O(q(e.split("/"),(function(e){return!!e})),!t).join("/"))||t||(e="."),e&&n&&(e+="/"),(t?"/":"")+e}function L(e){return"/"===e.charAt(0)}function R(){var e=Array.prototype.slice.call(arguments,0);return C(q(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))}function T(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=A(e).substr(1),t=A(t).substr(1);for(var r=n(e.split("/")),o=n(t.split("/")),s=Math.min(r.length,o.length),i=s,a=0;a<s;a++)if(r[a]!==o[a]){i=a;break}var l=[];for(a=i;a<r.length;a++)l.push("..");return(l=l.concat(o.slice(i))).join("/")}function G(e){var t=_(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."}function N(e,t){var n=_(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n}function B(e){return _(e)[3]}var I={extname:B,basename:N,dirname:G,sep:"/",delimiter:":",relative:T,join:R,isAbsolute:L,normalize:C,resolve:A};function q(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 V="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)},z="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function F(e,t){return e(t={exports:{}},t.exports),t.exports}var Q,M=(Q={__proto__:null,resolve:A,normalize:C,isAbsolute:L,join:R,relative:T,sep:"/",delimiter:":",dirname:G,basename:N,extname:B,default:I})&&Q.default||Q,U=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},J=X,Z={}.hasOwnProperty,H=X.prototype,D=["history","path","basename","stem","extname","dirname"];function X(e){var t,n,r;if(e){if("string"==typeof e||U(e))e={contents:e};else if("message"in e&&"messages"in e)return e}else e={};if(!(this instanceof X))return new X(e);for(this.data={},this.messages=[],this.history=[],this.cwd="/",n=-1,r=D.length;++n<r;)Z.call(e,t=D[n])&&(this[t]=e[t]);for(t in e)-1===D.indexOf(t)&&(this[t]=e[t])}function Y(e,t){if(-1!==e.indexOf(M.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+M.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")}H.toString=function(e){var t=this.contents||"";return U(t)?t.toString(e):String(t)},Object.defineProperty(H,"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(H,"dirname",{get:function(){return"string"==typeof this.path?M.dirname(this.path):void 0},set:function(e){W(this.path,"dirname"),this.path=M.join(e||"",this.basename)}}),Object.defineProperty(H,"basename",{get:function(){return"string"==typeof this.path?M.basename(this.path):void 0},set:function(e){K(e,"basename"),Y(e,"basename"),this.path=M.join(this.dirname||"",e)}}),Object.defineProperty(H,"extname",{get:function(){return"string"==typeof this.path?M.extname(this.path):void 0},set:function(e){var t=e||"";if(Y(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=M.basename(e,M.extname(e))+t;return M.join(M.dirname(e),n)}(this.path,t)}}),Object.defineProperty(H,"stem",{get:function(){return"string"==typeof this.path?M.basename(this.path,this.extname):void 0},set:function(e){K(e,"stem"),Y(e,"stem"),this.path=M.join(this.dirname||"",e+(this.extname||""))}});var ee=J,te=J.prototype;te.message=function(e,t,n){var r=this.path,o=new x(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=m(),o={},s=!1,i=-1;return a.data=function(e,t){return"string"==typeof e?2===arguments.length?(ue("data",s),o[e]=t,a):oe.call(o,e)&&o[e]||null:e?(ue("data",s),o=e,a):o},a.freeze=l,a.attachers=n,a.use=function(e){var t;if(ue("use",s),null==e);else if("function"==typeof e)p.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=c(o.settings||{},t)),a;function r(e){l(e.plugins),e.settings&&(t=c(t||{},e.settings))}function i(e){if("function"==typeof e)p(e);else{if("object"!=typeof e)throw new Error("Expected usable value, not `"+e+"`");"length"in e?p.apply(null,e):r(e)}}function l(e){var t,n;if(null==e);else{if("object"!=typeof e||!("length"in e))throw new Error("Expected a list of plugins, not `"+e+"`");for(t=e.length,n=-1;++n<t;)i(e[n])}}function p(e,t){var r=u(e);r?(f(r[1])&&f(t)&&(t=c(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),ie(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),ie(n,"compile")?new n(e,r).compile():n(e,r)},a.run=p,a.runSync=function(e,n){var r,o=!1;return p(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,s=-1;++s<r;)t.use.apply(null,n[s]);return t.data(c(!0,{},o)),t}function l(){var e,t,o,l;if(s)return a;for(;++i<n.length;)t=(e=n[i])[0],!1!==(o=e[1])&&(!0===o&&(e[1]=void 0),"function"==typeof(l=t.apply(a,e.slice(1)))&&r.use(l));return s=!0,i=Infinity,a}function u(e){for(var t,r=n.length,o=-1;++o<r;)if((t=n[o])[0]===e)return t}function p(e,t,n){if(ce(e),l(),n||"function"!=typeof t||(n=t,t=null),!n)return new Promise(o);function o(o,s){r.run(e,ee(t),(function(t,r,i){r=r||e,t?s(t):o?o(r):n(null,r,i)}))}o(null,n)}function h(e,t){if(l(),ae("process",a.Parser),le("process",a.Compiler),!t)return new Promise(n);function n(n,r){var o=ee(e);se.run(a,{file:o},(function(e){e?r(e):n?n(o):t(null,o)}))}n(null,t)}}().freeze(),re=[].slice,oe={}.hasOwnProperty,se=m().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 n,r=e.stringify(t.tree,t.file),o=t.file;null==r||("string"==typeof r||null!=(n=r)&&null!=n.constructor&&"function"==typeof n.constructor.isBuffer&&n.constructor.isBuffer(n)?o.contents=r:o.result=r)}));function ie(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=F((function(e){var t,n;t=z,n=function(){function e(t,n,r){return this.id=++e.highestId,this.name=t,this.symbols=n,this.postprocess=r,this}function t(e,t,n,r){this.rule=e,this.dot=t,this.reference=n,this.data=[],this.wantedBy=r,this.isComplete=this.dot===e.symbols.length}function n(e,t){this.grammar=e,this.index=t,this.states=[],this.wants={},this.scannable=[],this.completed={}}function r(e,t){this.rules=e,this.start=t||this.rules[0].name;var n=this.byName={};this.rules.forEach((function(e){n.hasOwnProperty(e.name)||(n[e.name]=[]),n[e.name].push(e)}))}function o(){this.reset("")}function s(e,t,s){if(e instanceof r){var i=e;s=t}else i=r.fromCompiled(e,t);for(var a in this.grammar=i,this.options={keepHistory:!1,lexer:i.lexer||new o},s||{})this.options[a]=s[a];this.lexer=this.options.lexer,this.lexerState=void 0;var l=new n(i,0);this.table=[l],l.wants[i.start]=[],l.predict(i.start),l.process(),this.current=0}function i(e){var t=typeof e;if("string"===t)return e;if("object"===t){if(e.literal)return JSON.stringify(e.literal);if(e instanceof RegExp)return e.toString();if(e.type)return"%"+e.type;if(e.test)return"<"+String(e.test)+">";throw new Error("Unknown symbol type: "+e)}}return e.highestId=0,e.prototype.toString=function(e){var t=void 0===e?this.symbols.map(i).join(" "):this.symbols.slice(0,e).map(i).join(" ")+" ● "+this.symbols.slice(e).map(i).join(" ");return this.name+" → "+t},t.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},t.prototype.nextState=function(e){var n=new t(this.rule,this.dot+1,this.reference,this.wantedBy);return n.left=this,n.right=e,n.isComplete&&(n.data=n.build(),n.right=void 0),n},t.prototype.build=function(){var e=[],t=this;do{e.push(t.right.data),t=t.left}while(t.left);return e.reverse(),e},t.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,s.fail))},n.prototype.process=function(e){for(var t=this.states,n=this.wants,r=this.completed,o=0;o<t.length;o++){var i=t[o];if(i.isComplete){if(i.finish(),i.data!==s.fail){for(var a=i.wantedBy,l=a.length;l--;)this.complete(a[l],i);i.reference===this.index&&(this.completed[u=i.rule.name]=this.completed[u]||[]).push(i)}}else{var u;if("string"!=typeof(u=i.rule.symbols[i.dot])){this.scannable.push(i);continue}if(n[u]){if(n[u].push(i),r.hasOwnProperty(u)){var c=r[u];for(l=0;l<c.length;l++)this.complete(i,c[l])}}else n[u]=[i],this.predict(u)}}},n.prototype.predict=function(e){for(var n=this.grammar.byName[e]||[],r=0;r<n.length;r++){var o=new t(n[r],0,this.index,this.wants[e]);this.states.push(o)}},n.prototype.complete=function(e,t){var n=e.nextState(t);this.states.push(n)},r.fromCompiled=function(t,n){var o=t.Lexer;t.ParserStart&&(n=t.ParserStart,t=t.ParserRules);var s=new r(t=t.map((function(t){return new e(t.name,t.symbols,t.postprocess)})),n);return s.lexer=o,s},o.prototype.reset=function(e,t){this.buffer=e,this.index=0,this.line=t?t.line:1,this.lastLineBreak=t?-t.col:0},o.prototype.next=function(){if(this.index<this.buffer.length){var e=this.buffer[this.index++];return"\n"===e&&(this.line+=1,this.lastLineBreak=this.index),{value:e}}},o.prototype.save=function(){return{line:this.line,col:this.index-this.lastLineBreak}},o.prototype.formatError=function(e,t){var n=this.buffer;if("string"==typeof n){var r=n.split("\n").slice(Math.max(0,this.line-5),this.line),o=n.indexOf("\n",this.index);-1===o&&(o=n.length);var s=this.index-this.lastLineBreak,i=String(this.line).length;return t+=" at line "+this.line+" col "+s+":\n\n",(t+=r.map((function(e,t){return a(this.line-r.length+t+1,i)+" "+e}),this).join("\n"))+"\n"+a("",i+s)+"^\n"}return t+" at index "+(this.index-1);function a(e,t){var n=String(e);return Array(t-n.length+1).join(" ")+n}},s.fail={},s.prototype.feed=function(e){var t,r=this.lexer;for(r.reset(e,this.lexerState);;){try{if(!(t=r.next()))break}catch(e){var s=new n(this.grammar,this.current+1);throw this.table.push(s),(l=new Error(this.reportLexerError(e))).offset=this.current,l.token=e.token,l}var i=this.table[this.current];this.options.keepHistory||delete this.table[this.current-1];var a=this.current+1;s=new n(this.grammar,a),this.table.push(s);for(var l,u=void 0!==t.text?t.text:t.value,c=r.constructor===o?t.value:t,f=i.scannable,p=f.length;p--;){var h=f[p],m=h.rule.symbols[h.dot];if(m.test?m.test(c):m.type?m.type===t.type:m.literal===u){var y=h.nextState({data:c,token:t,isToken:!0,reference:a-1});s.states.push(y)}}if(s.process(),0===s.states.length)throw(l=new Error(this.reportError(t))).offset=this.current,l.token=t,l;this.options.keepHistory&&(i.lexerState=r.save()),this.current++}return i&&(this.lexerState=r.save()),this.results=this.finish(),this},s.prototype.reportLexerError=function(e){var t,n,r=e.token;return r?(t="input "+JSON.stringify(r.text[0])+" (lexer error)",n=this.lexer.formatError(r,"Syntax error")):(t="input (lexer error)",n=e.message),this.reportErrorCommon(n,t)},s.prototype.reportError=function(e){var t=(e.type?e.type+" token: ":"")+JSON.stringify(void 0!==e.value?e.value:e),n=this.lexer.formatError(e,"Syntax error");return this.reportErrorCommon(n,t)},s.prototype.reportErrorCommon=function(e,t){var n=[];n.push(e);var r=this.table[this.table.length-2],o=r.states.filter((function(e){var t=e.rule.symbols[e.dot];return t&&"string"!=typeof t}));return 0===o.length?(n.push("Unexpected "+t+". I did not expect any more input. Here is the state of my parse table:\n"),this.displayStateStack(r.states,n)):(n.push("Unexpected "+t+". Instead, I was expecting to see one of the following:\n"),o.map((function(e){return this.buildFirstStateStack(e,[])||[e]}),this).forEach((function(e){var t=e[0],r=this.getSymbolDisplay(t.rule.symbols[t.dot]);n.push("A "+r+" based on:"),this.displayStateStack(e,n)}),this)),n.push(""),n.join("\n")},s.prototype.displayStateStack=function(e,t){for(var n,r=0,o=0;o<e.length;o++){var s=e[o],i=s.rule.toString(s.dot);i===n?r++:(r>0&&t.push(" ^ "+r+" more lines identical to this"),r=0,t.push(" "+i)),n=i}},s.prototype.getSymbolDisplay=function(e){return function(e){var t=typeof e;if("string"===t)return e;if("object"===t){if(e.literal)return JSON.stringify(e.literal);if(e instanceof RegExp)return"character matching "+e;if(e.type)return e.type+" token";if(e.test)return"token matching "+String(e.test);throw new Error("Unknown symbol type: "+e)}}(e)},s.prototype.buildFirstStateStack=function(e,t){if(-1!==t.indexOf(e))return null;if(0===e.wantedBy.length)return[e];var n=e.wantedBy[0],r=[e].concat(t),o=this.buildFirstStateStack(n,r);return null===o?null:[e].concat(o)},s.prototype.save=function(){var e=this.table[this.current];return e.lexerState=this.lexerState,e},s.prototype.restore=function(e){var t=e.index;this.current=t,this.table[t]=e,this.table.splice(t+1),this.lexerState=e.lexerState,this.results=this.finish()},s.prototype.rewind=function(e){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[e])},s.prototype.finish=function(){var e=[],t=this.grammar.start;return this.table[this.table.length-1].states.forEach((function(n){n.rule.name===t&&n.dot===n.rule.symbols.length&&0===n.reference&&n.data!==s.fail&&e.push(n)})),e.map((function(e){return e.data}))},{Parser:s,Grammar:r,Rule:e}},e.exports?e.exports=n():t.nearley=n()}));function 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=F((function(e){var t,n;t=z,n=function(){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n="boolean"==typeof(new RegExp).sticky;function r(e){return e&&"[object RegExp]"===t.call(e)}function o(e){return e&&"object"==typeof e&&!r(e)&&!Array.isArray(e)}function s(e){return e.length?"(?:"+e.map((function(e){return"(?:"+e+")"})).join("|")+")":"(?!)"}function i(e){if("string"==typeof e)return"(?:"+e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+")";if(r(e)){if(e.ignoreCase)throw new Error("RegExp /i flag not allowed");if(e.global)throw new Error("RegExp /g flag is implied");if(e.sticky)throw new Error("RegExp /y flag is implied");if(e.multiline)throw new Error("RegExp /m flag is implied");return e.source}throw new Error("Not a pattern: "+e)}function a(t,n){if(o(n)||(n={match:n}),n.include)throw new Error("Matching rules cannot also include states");var s={defaultType:t,lineBreaks:!!n.error||!!n.fallback,pop:!1,next:null,push:null,error:!1,fallback:!1,value:null,type:null,shouldThrow:!1};for(var i in n)e.call(n,i)&&(s[i]=n[i]);if("string"==typeof s.type&&t!==s.type)throw new Error("Type transform cannot be a string (type '"+s.type+"' for token '"+t+"')");var a=s.match;return s.match=Array.isArray(a)?a:a?[a]:[],s.match.sort((function(e,t){return r(e)&&r(t)?0:r(t)?-1:r(e)?1:t.length-e.length})),s}function l(e){return Array.isArray(e)?function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];if(r.include)for(var o=[].concat(r.include),s=0;s<o.length;s++)t.push({include:o[s]});else{if(!r.type)throw new Error("Rule has no type: "+JSON.stringify(r));t.push(a(r.type,r))}}return t}(e):function(e){for(var t=Object.getOwnPropertyNames(e),n=[],r=0;r<t.length;r++){var s=t[r],i=[].concat(e[s]);if("include"!==s){var l=[];i.forEach((function(e){o(e)?(l.length&&n.push(a(s,l)),n.push(a(s,e)),l=[]):l.push(e)})),l.length&&n.push(a(s,l))}else for(var u=0;u<i.length;u++)n.push({include:i[u]})}return n}(e)}var u=a("error",{lineBreaks:!0,shouldThrow:!0});function c(e,t){for(var o=null,a=Object.create(null),l=!0,c=null,f=[],p=[],h=0;h<e.length;h++)e[h].fallback&&(l=!1);for(h=0;h<e.length;h++){var m=e[h];if(m.include)throw new Error("Inheritance is not allowed in stateless lexers");if(m.error||m.fallback){if(o)throw!m.fallback==!o.fallback?new Error("Multiple "+(m.fallback?"fallback":"error")+" rules not allowed (for token '"+m.defaultType+"')"):new Error("fallback and error are mutually exclusive (for token '"+m.defaultType+"')");o=m}var y=m.match.slice();if(l)for(;y.length&&"string"==typeof y[0]&&1===y[0].length;)a[y.shift().charCodeAt(0)]=m;if(m.pop||m.push||m.next){if(!t)throw new Error("State-switching options are not allowed in stateless lexers (for token '"+m.defaultType+"')");if(m.fallback)throw new Error("State-switching options are not allowed on fallback tokens (for token '"+m.defaultType+"')")}if(0!==y.length){l=!1,f.push(m);for(var b=0;b<y.length;b++){var d=y[b];if(r(d))if(null===c)c=d.unicode;else if(c!==d.unicode&&!1===m.fallback)throw new Error("If one rule is /u then all must be")}var g=s(y.map(i)),v=new RegExp(g);if(v.test(""))throw new Error("RegExp matches empty string: "+v);if(new RegExp("|"+g).exec("").length-1>0)throw new Error("RegExp has capture groups: "+v+"\nUse (?: … ) instead");if(!m.lineBreaks&&v.test("\n"))throw new Error("Rule should declare lineBreaks: "+v);p.push("("+g+")")}}var $=o&&o.fallback,w=n&&!$?"ym":"gm",x=n||$?"":"|";return!0===c&&(w+="u"),{regexp:new RegExp(s(p)+x,w),groups:f,fast:a,error:o||u}}function f(e,t,n){var r=e&&(e.push||e.next);if(r&&!n[r])throw new Error("Missing state '"+r+"' (in token '"+e.defaultType+"' of state '"+t+"')");if(e&&e.pop&&1!=+e.pop)throw new Error("pop must be 1 (in token '"+e.defaultType+"' of state '"+t+"')")}var p=function(e,t){this.startState=t,this.states=e,this.buffer="",this.stack=[],this.reset()};p.prototype.reset=function(e,t){return this.buffer=e||"",this.index=0,this.line=t?t.line:1,this.col=t?t.col:1,this.queuedToken=t?t.queuedToken:null,this.queuedThrow=t?t.queuedThrow:null,this.setState(t?t.state:this.startState),this.stack=t&&t.stack?t.stack.slice():[],this},p.prototype.save=function(){return{line:this.line,col:this.col,state:this.state,stack:this.stack.slice(),queuedToken:this.queuedToken,queuedThrow:this.queuedThrow}},p.prototype.setState=function(e){if(e&&this.state!==e){this.state=e;var t=this.states[e];this.groups=t.groups,this.error=t.error,this.re=t.regexp,this.fast=t.fast}},p.prototype.popState=function(){this.setState(this.stack.pop())},p.prototype.pushState=function(e){this.stack.push(this.state),this.setState(e)};var h=n?function(e,t){return e.exec(t)}:function(e,t){var n=e.exec(t);return 0===n[0].length?null:n};function m(){return this.value}if(p.prototype._getGroup=function(e){for(var t=this.groups.length,n=0;n<t;n++)if(void 0!==e[n+1])return this.groups[n];throw new Error("Cannot find token type for matched text")},p.prototype.next=function(){var e=this.index;if(this.queuedGroup){var t=this._token(this.queuedGroup,this.queuedText,e);return this.queuedGroup=null,this.queuedText="",t}var n=this.buffer;if(e!==n.length){if(i=this.fast[n.charCodeAt(e)])return this._token(i,n.charAt(e),e);var r=this.re;r.lastIndex=e;var o=h(r,n),s=this.error;if(null==o)return this._token(s,n.slice(e,n.length),e);var i=this._getGroup(o),a=o[0];return s.fallback&&o.index!==e?(this.queuedGroup=i,this.queuedText=a,this._token(s,n.slice(e,o.index),e)):this._token(i,a,e)}},p.prototype._token=function(e,t,n){var r=0;if(e.lineBreaks){var o=/\n/g,s=1;if("\n"===t)r=1;else for(;o.exec(t);)r++,s=o.lastIndex}var i={type:"function"==typeof e.type&&e.type(t)||e.defaultType,value:"function"==typeof e.value?e.value(t):t,text:t,toString:m,offset:n,lineBreaks:r,line:this.line,col:this.col},a=t.length;if(this.index+=a,this.line+=r,0!==r?this.col=a-s+1:this.col+=a,e.shouldThrow)throw new Error(this.formatError(i,"invalid syntax"));return e.pop?this.popState():e.push?this.pushState(e.push):e.next&&this.setState(e.next),i},"undefined"!=typeof Symbol&&Symbol.iterator){var y=function(e){this.lexer=e};y.prototype.next=function(){var e=this.lexer.next();return{value:e,done:!e}},y.prototype[Symbol.iterator]=function(){return this},p.prototype[Symbol.iterator]=function(){return new y(this)}}return p.prototype.formatError=function(e,t){if(null==e){var n=this.buffer.slice(this.index);e={text:n,offset:this.index,lineBreaks:-1===n.indexOf("\n")?0:1,line:this.line,col:this.col}}var r=Math.max(0,e.offset-e.col+1),o=e.lineBreaks?e.text.indexOf("\n"):e.text.length,s=this.buffer.substring(r,e.offset+o);return t+=" at line "+e.line+" col "+e.col+":\n\n",(t+=" "+s+"\n")+" "+Array(e.col).join(" ")+"^"},p.prototype.clone=function(){return new p(this.states,this.state)},p.prototype.has=function(e){return!0},{compile:function(e){var t=c(l(e));return new p({start:t},"start")},states:function(e,t){var n=e.$all?l(e.$all):[];delete e.$all;var r=Object.getOwnPropertyNames(e);t||(t=r[0]);for(var o=Object.create(null),s=0;s<r.length;s++)o[v=r[s]]=l(e[v]).concat(n);for(s=0;s<r.length;s++)for(var i=o[v=r[s]],a=Object.create(null),u=0;u<i.length;u++){var h=i[u];if(h.include){var m=[u,1];if(h.include!==v&&!a[h.include]){a[h.include]=!0;var y=o[h.include];if(!y)throw new Error("Cannot include nonexistent state '"+h.include+"' (in state '"+v+"')");for(var b=0;b<y.length;b++){var d=y[b];-1===i.indexOf(d)&&m.push(d)}}i.splice.apply(i,m),u--}}var g=Object.create(null);for(s=0;s<r.length;s++){var v;g[v=r[s]]=c(o[v],!0)}for(s=0;s<r.length;s++){var $=r[s],w=g[$],x=w.groups;for(u=0;u<x.length;u++)f(x[u],$,g);var S=Object.getOwnPropertyNames(w.fast);for(u=0;u<S.length;u++)f(w.fast[S[u]],$,g)}return new p(g,t)},error:Object.freeze({error:!0}),fallback:Object.freeze({fallback:!0}),keywords:function(e){for(var t=Object.create(null),n=Object.create(null),r=Object.getOwnPropertyNames(e),o=0;o<r.length;o++){var s=r[o],i=e[s];(Array.isArray(i)?i:[i]).forEach((function(e){if((n[e.length]=n[e.length]||[]).push(e),"string"!=typeof e)throw new Error("keyword must be string (in keyword '"+s+"')");t[e]=s}))}function a(e){return JSON.stringify(e)}var l="";for(var u in l+="switch (value.length) {\n",n)l+="case "+u+":\n",l+="switch (value) {\n",n[u].forEach((function(e){var n=t[e];l+="case "+a(e)+": return "+a(n)+"\n"})),l+="}\n";return l+="}\n",Function("value",l)}}},e.exports?e.exports=n():t.moo=n()})),ye={__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:/[0-9a-zA-Z_@]+\b@*/},be=function(e){return!!e.type&&"unit"===e.type},de=function(e){return!!e.type&&"node"===e.type};function ge(){return(ge=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 ve(e){return Array.isArray(e)?e:e instanceof Function?ve(e()):void 0===e?[]:[e]}var $e=function(e,t){void 0===t&&(t={});var n,r=ge({type:"path",id:t.id},t.labels&&{labels:t.labels},t.record&&{record:t.record},{children:e.filter((function(e){return e&&!be(e)}))});if(0===r.children.length)return r.id||r.labels&&r.labels.length>0||r.record?(r.type="node",r):we;if(1===r.children.length){var o=r.children[0];if(r.id||r.labels&&r.labels.length>0||r.record)return be(o)?(r.type="node",r.children=[],r):r;if(be(o))return o;if(de(o))return o;if("type"in(n=o)&&"relation"in n&&"edge"===n.type)return o;if(function(e){return!!e.type&&"path"===e.type}(o))return o}else if(2===r.children.length&&t.relation&&"pair"!==t.relation&&de(r.children[0])&&de(r.children[1]))return r.type="edge",r.relation=t.relation,r;return r.relation=t.relation||"pair",r},we={type:"unit",id:"0",labels:void 0,record:void 0,children:[]},xe=function(e){return{type:"string",value:e}},Se=function(e,t){return void 0===t&&(t=1),e.flat(t).filter((function(e){return null!==e}))};function Ee(e){return e[0]}var ke=me.compile({whitespace:{match:/\s+/,lineBreaks:!0},lineComment:{match:/\/\/.*?\n?$/},hexadecimal:ye.hexadecimal,octal:ye.octal,measurement:ye.measurement,decimal:ye.decimal,integer:ye.integer,taggedString:{match:ye.taggedString},boolean:["true","TRUE","True","false","FALSE","False"],symbol:ye.symbol,identifier:ye.identifier,doubleQuotedString:{match:ye.doubleQuotedString,value:function(e){return e.slice(1,-1)}},singleQuotedString:{match:ye.singleQuotedString,value:function(e){return e.slice(1,-1)}},tickedString:{match:ye.tickedString,value:function(e){return e.slice(1,-1)}},"--\x3e":"--\x3e","--":"--","<--":"<--","-[]->":"-[]->","-[]-":"-[]-","<-[]-":"<-[]-","<-[":"<-[","]->":"]->","-[":"-[","]-":"]-","{":"{","}":"}","[":"[","]":"]","(":"(",")":")",",":",",":":":","`":"`","'":"'"}),Pe=function(){return null},Oe=function(e){return e[0].text},je={Lexer:ke,ParserRules:[{name:"Gram$ebnf$1$subexpression$1$ebnf$1",symbols:[{literal:","}],postprocess:Ee},{name:"Gram$ebnf$1$subexpression$1$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"Gram$ebnf$1$subexpression$1",symbols:["Pathlike","Gram$ebnf$1$subexpression$1$ebnf$1","_"],postprocess:function(e){return e[0]}},{name:"Gram$ebnf$1",symbols:["Gram$ebnf$1$subexpression$1"]},{name:"Gram$ebnf$1$subexpression$2$ebnf$1",symbols:[{literal:","}],postprocess:Ee},{name:"Gram$ebnf$1$subexpression$2$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"Gram$ebnf$1$subexpression$2",symbols:["Pathlike","Gram$ebnf$1$subexpression$2$ebnf$1","_"],postprocess:function(e){return e[0]}},{name:"Gram$ebnf$1",symbols:["Gram$ebnf$1","Gram$ebnf$1$subexpression$2"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"Gram$ebnf$2",symbols:["EOL"],postprocess:Ee},{name:"Gram$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"Gram",symbols:["Gram$ebnf$1","Gram$ebnf$2"],postprocess:function(e){return ge({type:"seq"},void 0,void 0,void 0,{children:ve(Se(e[0]))})}},{name:"Pathlike",symbols:["EdgeExpression"],postprocess:Ee},{name:"Pathlike",symbols:["PathComposition"],postprocess:Ee},{name:"Pathlike",symbols:["Comment"],postprocess:Ee},{name:"EdgeExpression",symbols:["Node","Edge","EdgeExpression"],postprocess:function(e){var t=e[1];return $e([e[0],e[2]],{relation:t.relation,id:t.id,labels:t.labels,record:t.record})}},{name:"EdgeExpression",symbols:["Node"],postprocess:Ee},{name:"Node",symbols:[{literal:"("},"_","Attributes",{literal:")"}],postprocess:function(e){var t=e[2];return function(e,t,n){return ge({type:"node",id:e},t&&{labels:t},n&&{record:n},{children:[]})}(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$ebnf$1",symbols:["Pathlike"],postprocess:Ee},{name:"PathComposition$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathComposition",symbols:[{literal:"["},"_","Attributes","_","PathComposition$ebnf$1","_",{literal:"]"}],postprocess:function(e){var t=e[4];return $e(t?[t]:[],e[2])}},{name:"PathComposition",symbols:[{literal:"["},"_","Attributes","_","Relation","_","Pathlike","_","Pathlike","_",{literal:"]"}],postprocess:function(e){var t=e[2];return $e([e[6],e[8]],{relation:e[4],id:t.id,labels:t.labels,record:t.record})}},{name:"PathComposition$ebnf$2$subexpression$1$ebnf$1",symbols:[{literal:","}],postprocess:Ee},{name:"PathComposition$ebnf$2$subexpression$1$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathComposition$ebnf$2$subexpression$1",symbols:["Pathlike","PathComposition$ebnf$2$subexpression$1$ebnf$1","_"],postprocess:function(e){return e[0]}},{name:"PathComposition$ebnf$2",symbols:["PathComposition$ebnf$2$subexpression$1"]},{name:"PathComposition$ebnf$2$subexpression$2$ebnf$1",symbols:[{literal:","}],postprocess:Ee},{name:"PathComposition$ebnf$2$subexpression$2$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathComposition$ebnf$2$subexpression$2",symbols:["Pathlike","PathComposition$ebnf$2$subexpression$2$ebnf$1","_"],postprocess:function(e){return e[0]}},{name:"PathComposition$ebnf$2",symbols:["PathComposition$ebnf$2","PathComposition$ebnf$2$subexpression$2"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"PathComposition",symbols:[{literal:"["},"_","Attributes","_","PathComposition$ebnf$2",{literal:"]"}],postprocess:function(e){var t=e[2];return $e(function(e,t){void 0===e&&(e="pair");var n=ve(t);return n?n.length>1?[n.reduceRight((function(t,n){return $e([n,t],{relation:e})}),we)]:[n[0]]:[]}("pair",Se(e[4])),t)}},{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:Ee},{name:"Attributes$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"Attributes$ebnf$2",symbols:["LabelList"],postprocess:Ee},{name:"Attributes$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"Attributes$ebnf$3",symbols:["Record"],postprocess:Ee},{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:[ke.has("identifier")?{type:"identifier"}:identifier],postprocess:Oe},{name:"Identity",symbols:[ke.has("symbol")?{type:"symbol"}:symbol],postprocess:Oe},{name:"Identity",symbols:[ke.has("integer")?{type:"integer"}:integer],postprocess:Oe},{name:"Identity",symbols:[ke.has("octal")?{type:"octal"}:octal],postprocess:Oe},{name:"Identity",symbols:[ke.has("hexadecimal")?{type:"hexadecimal"}:hexadecimal],postprocess:Oe},{name:"Identity",symbols:[ke.has("measurement")?{type:"measurement"}:measurement],postprocess:Oe},{name:"Identity",symbols:[ke.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(e){return e[0].text.slice(1,-1)}},{name:"Symbol",symbols:[ke.has("symbol")?{type:"symbol"}:symbol],postprocess:Oe},{name:"Symbol",symbols:[ke.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(e){return e[0].text.slice(1,-1)}},{name:"Record",symbols:[{literal:"{"},"_",{literal:"}"}],postprocess:Pe},{name:"Record$ebnf$1",symbols:[]},{name:"Record$ebnf$1$subexpression$1",symbols:["_",{literal:","},"_","Property"]},{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]}))).reduce((function(e,t){return e[t.name]=t.value,e}),{})}},{name:"Property",symbols:["Symbol","_",{literal:":"},"_","Value"],postprocess:function(e){return{type:"property",name:e[0],value:e[4]}}},{name:"Value",symbols:["StringLiteral"],postprocess:Ee},{name:"Value",symbols:["NumericLiteral"],postprocess:Ee},{name:"Value",symbols:[ke.has("boolean")?{type:"boolean"}:boolean],postprocess:function(e){return{type:"boolean",value:JSON.parse(e[0].value.toLowerCase())?"true":"false"}}},{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:[ke.has("singleQuotedString")?{type:"singleQuotedString"}:singleQuotedString],postprocess:function(e){return xe(e[0].value)}},{name:"StringLiteral",symbols:[ke.has("doubleQuotedString")?{type:"doubleQuotedString"}:doubleQuotedString],postprocess:function(e){return xe(e[0].value)}},{name:"StringLiteral",symbols:[ke.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(e){return xe(e[0].value)}},{name:"StringLiteral",symbols:[ke.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{type:"tagged",value:t.value,tag:t.tag}}},{name:"NumericLiteral",symbols:[ke.has("integer")?{type:"integer"}:integer],postprocess:function(e){return{type:"integer",value:String(e[0].value)}}},{name:"NumericLiteral",symbols:[ke.has("decimal")?{type:"decimal"}:decimal],postprocess:function(e){return{type:"decimal",value:String(e[0].value)}}},{name:"NumericLiteral",symbols:[ke.has("hexadecimal")?{type:"hexadecimal"}:hexadecimal],postprocess:function(e){return{type:"hexadecimal",value:e[0].value}}},{name:"NumericLiteral",symbols:[ke.has("octal")?{type:"octal"}:octal],postprocess:function(e){return{type:"octal",value:e[0].value}}},{name:"NumericLiteral",symbols:[ke.has("measurement")?{type:"measurement"}:measurement],postprocess:function(e){var t,n=function(e){var t=e.match(/(-?[0-9.]+)([a-zA-Z]+)/);if(null==t)throw Error("Malformed measurement : "+e);return{value:t[1],unit:t[2]}}(e[0].value);return t=n.unit,{type:"measurement",value:String(n.value),unit:t}}},{name:"_",symbols:[]},{name:"_",symbols:[ke.has("whitespace")?{type:"whitespace"}:whitespace],postprocess:Pe},{name:"Comment",symbols:[ke.has("lineComment")?{type:"lineComment"}:lineComment],postprocess:Pe},{name:"EOL",symbols:[{literal:"\n"}],postprocess:Pe}],ParserStart:"Gram"},_e=function(e,t){var n,r,o=new pe.Parser(pe.Grammar.fromCompiled(je));try{var s=o.feed(e);if(void 0===s.results[0]&&s.lexerState){var i={line:(r=s.lexerState).line,column:r.col};t.fail("Incomplete parse.",i)}return s.results[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)}},Ae=function(){this.Parser=_e};e.errors={__proto__:null,INCOMPLETE_PARSE:"Incomplete parse.",SYNTAX_ERROR:"Syntax error at"},e.gramParserPlugin=Ae,e.toAST=function(e){return ne().use(Ae).freeze().parse(e)},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e=e||self).gram=e.gram||{},e.gram.parse={}))}(this,(function(e){"use strict";var t=function(e){if(e)throw e},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"==typeof O.setTimeout&&setTimeout,"function"==typeof O.clearTimeout&&clearTimeout,new Date;var _=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,j=function(e){return _.exec(e).slice(1)};function A(e){var t=function(e){return"/"===e.charAt(0)}(e),n="/"===N(e,-1);return(e=function(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}(q(e.split("/"),(function(e){return!!e})),!t).join("/"))||t||(e="."),e&&n&&(e+="/"),(t?"/":"")+e}var C=function(e){return j(e)[3]},T=function(e,t){var n=j(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},R=function(e){var t=j(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},L=function(){var e=Array.prototype.slice.call(arguments,0);return A(q(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){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 N="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)},I=F,B={}.hasOwnProperty,V=F.prototype,M=["history","path","basename","stem","extname","dirname"];function F(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 F))return new F(e);for(this.data={},this.messages=[],this.history=[],this.cwd="/",r=-1,o=M.length;++r<o;)B.call(e,t=M[r])&&(this[t]=e[t]);for(t in e)-1===M.indexOf(t)&&(this[t]=e[t])}function U(e,t){if(-1!==e.indexOf("/"))throw new Error("`"+t+"` cannot be a path: did not expect `/`")}function z(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Q(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}V.toString=function(e){var t=this.contents||"";return n(t)?t.toString(e):String(t)},Object.defineProperty(V,"path",{get:function(){return this.history[this.history.length-1]},set:function(e){z(e,"path"),e!==this.path&&this.history.push(e)}}),Object.defineProperty(V,"dirname",{get:function(){return"string"==typeof this.path?R(this.path):void 0},set:function(e){Q(this.path,"dirname"),this.path=L(e||"",this.basename)}}),Object.defineProperty(V,"basename",{get:function(){return"string"==typeof this.path?T(this.path):void 0},set:function(e){z(e,"basename"),U(e,"basename"),this.path=L(this.dirname||"",e)}}),Object.defineProperty(V,"extname",{get:function(){return"string"==typeof this.path?C(this.path):void 0},set:function(e){var t=e||"";if(U(t,"extname"),Q(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=T(e,C(e))+t;return L(R(e),n)}(this.path,t)}}),Object.defineProperty(V,"stem",{get:function(){return"string"==typeof this.path?T(this.path,this.extname):void 0},set:function(e){z(e,"stem"),U(e,"stem"),this.path=L(this.dirname||"",e+(this.extname||""))}});var D=I,H=I.prototype;H.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},H.info=function(){var e=this.message.apply(this,arguments);return e.fatal=null,e},H.fail=function(){var e=this.message.apply(this,arguments);throw e.fatal=!0,e};var G=function e(){var n=[],r=y(),o={},i=!1,s=-1;return a.data=function(e,t){return"string"==typeof e?2===arguments.length?(ee("data",i),o[e]=t,a):Z.call(o,e)&&o[e]||null:e?(ee("data",i),o=e,a):o},a.freeze=l,a.attachers=n,a.use=function(e){var t;if(ee("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(J.call(arguments))}},a.parse=function(e){var t,n=D(e);return l(),K("parse",t=a.Parser),X(t,"parse")?new t(String(n),n).parse():t(String(n),n)},a.stringify=function(e,t){var n,r=D(t);return l(),W("stringify",n=a.Compiler),te(e),X(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})),ne("runSync","run",o),r},a.process=h,a.processSync=function(e){var n,r=!1;return l(),K("processSync",a.Parser),W("processSync",a.Compiler),h(n=D(e),(function(e){r=!0,t(e)})),ne("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(te(e),l(),n||"function"!=typeof t||(n=t,t=null),!n)return new Promise(o);function o(o,i){r.run(e,D(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(),K("process",a.Parser),W("process",a.Compiler),!t)return new Promise(n);function n(n,r){var o=D(e);Y.run(a,{file:o},(function(e){e?r(e):n?n(o):t(null,o)}))}n(null,t)}}().freeze(),J=[].slice,Z={}.hasOwnProperty,Y=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 X(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 K(e,t){if("function"!=typeof t)throw new Error("Cannot `"+e+"` without `Parser`")}function W(e,t){if("function"!=typeof t)throw new Error("Cannot `"+e+"` without `Compiler`")}function ee(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 te(e){if(!e||"string"!=typeof e.type)throw new Error("Expected node, got `"+e+"`")}function ne(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}var re="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function oe(e,t){return e(t={exports:{}},t.exports),t.exports}var ie=oe((function(e){var t,n;t=re,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 se(){return(se=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 ae=oe((function(e){var t,n;t=re,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()})),le=/[0-9a-zA-Z_@]+\b@*/,ue=new RegExp("^"+le.source+"$"),ce={__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:le,isValidIdentifier:function(e){return e&&ue.test(e)}},fe=function(e){return!!e.type&&"path"===e.type},pe=function(e){return fe(e)&&void 0===e.children&&"ø"===e.id},he=function(e){return fe(e)&&e.children&&0===e.children.length&&"ø"!==e.id};function me(){return(me=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 ye(e){return Array.isArray(e)?e:e instanceof Function?ye(e()):void 0===e?[]:[e]}var de=function(e,t,n,r){return me({type:"seq",id:t},n&&{labels:n},r&&{record:r},{children:ye(e)})},be=function(e,t){void 0===t&&(t={});var n=me({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,ge);if(0===e.length)return"ø"===n.id?ge:(n.children=[],n);if(1===e.length){var r=e[0],o=ge;return pe(r)?(n.children=[],n):(n.children=[r,o],n)}if(2===e.length){if(t.relation&&"pair"!==t.relation&&he(e[0])&&he(e[1]))return n.relation=t.relation,n.children=[e[0],e[1]],n;if(pe(e[0])&&pe(e[1]))return n.relation=t.relation,n.children=[],n;n.children=[e[0],e[1]]}return n.relation=t.relation||"pair",n},ge={type:"path",id:"ø",labels:void 0,record:void 0,children:void 0},ve=function(){return ge},we=function(e,t,n){return me({type:"path"},e&&{id:e},t&&{labels:t},n&&{record:n},{children:[]})},xe=function(e,t,n,r,o){return me({type:"path",id:n},r&&{labels:r},o&&{record:o},{relation:t,children:e})},Se=function(e,t,n,r){return me({type:"path",id:t},n&&{labels:n},r&&{record:r},{children:e})},$e=function(e){return e.reduce((function(e,t){return e[t.name]=t.value,e}),{})},Ee=function(e){return Object.entries(e).reduce((function(e,t){return e.push(ke(t[0],t[1])),e}),[])},ke=function(e,t){return{type:"property",name:e,value:t}},Pe=function(e){return{type:"boolean",value:e?"true":"false"}},Oe=function(e){return{type:"string",value:e}},_e=function(e,t){return{type:"tagged",value:t,tag:e}},je=function(e){return{type:"integer",value:String(e)}},Ae=function(e){return{type:"decimal",value:String(e)}},Ce=function(e){return{type:"hexadecimal",value:"number"==typeof e?e.toString(16):e}},Te=function(e){return{type:"octal",value:"number"==typeof e?e.toString(8):e}},Re=function(e,t){return{type:"measurement",value:String(t),unit:e}},Le=function(e){return _e("date",e instanceof Date?e.toISOString().slice(0,10):e)},qe=function(e){return _e("time",e instanceof Date?e.toTimeString():e)},Ne=function(e){return _e("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)},Ie=function(e,t){return void 0===t&&(t=1),e.flat(t).filter((function(e){return null!==e}))},Be={__proto__:null,seq:de,reduce:function(e,t,n){return void 0===e&&(e="pair"),t.length>1?t.reduceRight((function(t,r){return be([r,t],{relation:e,id:n?""+n+0:void 0})}),ge):t[0]},cons:be,EMPTY_PATH:ge,empty:ve,node:we,edge:xe,path:Se,reduceRecord:$e,unfoldProperties:Ee,property:ke,boolean:Pe,string:Oe,tagged:_e,integer:je,decimal:Ae,hexadecimal:Ce,octal:Te,measurement:Re,year:function(e){return _e("date",e instanceof Date?e.getFullYear().toString():e)},date:Le,dayOfMonth:function(e){return _e("date",e instanceof Date?"--"+e.toISOString().slice(5,10):e)},time:qe,duration:Ne,flatten:Ie,default:{seq:de,empty:ve,cons:be,path:Se,node:we,edge:xe,property:ke,boolean:Pe,string:Oe,tagged:_e,integer:je,decimal:Ae,hexadecimal:Ce,octal:Te,measurement:Re,date:Le,time:qe,duration:Ne,flatten:Ie,reduceRecord:$e,unfoldProperties:Ee}};function Ve(e){return e[0]}var Me=ae.compile({whitespace:{match:/\s+/,lineBreaks:!0},lineComment:{match:/\/\/.*?\n?$/},hexadecimal:ce.hexadecimal,octal:ce.octal,measurement:ce.measurement,decimal:ce.decimal,integer:ce.integer,taggedString:{match:ce.taggedString},boolean:["true","TRUE","True","false","FALSE","False"],symbol:ce.symbol,identifier:ce.identifier,doubleQuotedString:{match:ce.doubleQuotedString,value:function(e){return e.slice(1,-1)}},singleQuotedString:{match:ce.singleQuotedString,value:function(e){return e.slice(1,-1)}},tickedString:{match:ce.tickedString,value:function(e){return e.slice(1,-1)}},"--\x3e":"--\x3e","--":"--","<--":"<--","-[]->":"-[]->","-[]-":"-[]-","<-[]-":"<-[]-","<-[":"<-[","]->":"]->","-[":"-[","]-":"]-","{":"{","}":"}","[":"[","]":"]","(":"(",")":")",",":",",":":":","`":"`","'":"'","ø":"ø"}),Fe=function(){return null},Ue=function(e){return e[0].text},ze={Lexer:Me,ParserRules:[{name:"PathSequence$ebnf$1$subexpression$1$ebnf$1",symbols:[{literal:","}],postprocess:Ve},{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:Ve},{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:Ve},{name:"PathSequence$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"PathSequence",symbols:["PathSequence$ebnf$1","PathSequence$ebnf$2"],postprocess:function(e){return Be.seq(Be.flatten(e[0]))}},{name:"Path",symbols:["NodePattern"],postprocess:Ve},{name:"Path",symbols:["PathComposition"],postprocess:Ve},{name:"Path",symbols:["Comment"],postprocess:Ve},{name:"NodePattern",symbols:["Node","Edge","NodePattern"],postprocess:function(e){var t=e[1];return Be.cons([e[0],e[2]],{relation:t.relation,id:t.id,labels:t.labels,record:t.record})}},{name:"NodePattern",symbols:["Node"],postprocess:Ve},{name:"Node",symbols:[{literal:"("},"_","Attributes",{literal:")"}],postprocess:function(e){var t=e[2];return Be.node(t.id,t.labels,t.record)}},{name:"Edge",symbols:[{literal:"-["},"_","Attributes",{literal:"]->"}],postprocess:function(e){return se({relation:"right"},e[2])}},{name:"Edge",symbols:[{literal:"-["},"_","Attributes",{literal:"]-"}],postprocess:function(e){return se({relation:"either"},e[2])}},{name:"Edge",symbols:[{literal:"<-["},"_","Attributes",{literal:"]-"}],postprocess:function(e){return se({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 Be.empty()}},{name:"PathComposition$ebnf$1",symbols:["Relation"],postprocess:Ve},{name:"PathComposition$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"PathComposition$ebnf$2",symbols:["Path"],postprocess:Ve},{name:"PathComposition$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"PathComposition$ebnf$3",symbols:["Path"],postprocess:Ve},{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 Be.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:Ve},{name:"Attributes$ebnf$1",symbols:[],postprocess:function(){return null}},{name:"Attributes$ebnf$2",symbols:["LabelList"],postprocess:Ve},{name:"Attributes$ebnf$2",symbols:[],postprocess:function(){return null}},{name:"Attributes$ebnf$3",symbols:["Record"],postprocess:Ve},{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:[Me.has("identifier")?{type:"identifier"}:identifier],postprocess:Ue},{name:"Identity",symbols:[{literal:"ø"}],postprocess:Ue},{name:"Identity",symbols:[Me.has("symbol")?{type:"symbol"}:symbol],postprocess:Ue},{name:"Identity",symbols:[Me.has("integer")?{type:"integer"}:integer],postprocess:Ue},{name:"Identity",symbols:[Me.has("octal")?{type:"octal"}:octal],postprocess:Ue},{name:"Identity",symbols:[Me.has("hexadecimal")?{type:"hexadecimal"}:hexadecimal],postprocess:Ue},{name:"Identity",symbols:[Me.has("measurement")?{type:"measurement"}:measurement],postprocess:Ue},{name:"Identity",symbols:[Me.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(e){return e[0].text.slice(1,-1)}},{name:"Symbol",symbols:[Me.has("symbol")?{type:"symbol"}:symbol],postprocess:Ue},{name:"Symbol",symbols:[Me.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(e){return e[0].text.slice(1,-1)}},{name:"Record",symbols:[{literal:"{"},"_",{literal:"}"}],postprocess:Fe},{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 Be.property(e[0],e[4])}},{name:"Value",symbols:["StringLiteral"],postprocess:Ve},{name:"Value",symbols:["NumericLiteral"],postprocess:Ve},{name:"Value",symbols:[Me.has("boolean")?{type:"boolean"}:boolean],postprocess:function(e){return Be.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:[Me.has("singleQuotedString")?{type:"singleQuotedString"}:singleQuotedString],postprocess:function(e){return Be.string(e[0].value)}},{name:"StringLiteral",symbols:[Me.has("doubleQuotedString")?{type:"doubleQuotedString"}:doubleQuotedString],postprocess:function(e){return Be.string(e[0].value)}},{name:"StringLiteral",symbols:[Me.has("tickedString")?{type:"tickedString"}:tickedString],postprocess:function(e){return Be.string(e[0].value)}},{name:"StringLiteral",symbols:[Me.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 Be.tagged(t.tag,t.value)}},{name:"NumericLiteral",symbols:[Me.has("integer")?{type:"integer"}:integer],postprocess:function(e){return Be.integer(e[0].value)}},{name:"NumericLiteral",symbols:[Me.has("decimal")?{type:"decimal"}:decimal],postprocess:function(e){return Be.decimal(e[0].value)}},{name:"NumericLiteral",symbols:[Me.has("hexadecimal")?{type:"hexadecimal"}:hexadecimal],postprocess:function(e){return Be.hexadecimal(e[0].value)}},{name:"NumericLiteral",symbols:[Me.has("octal")?{type:"octal"}:octal],postprocess:function(e){return Be.octal(e[0].value)}},{name:"NumericLiteral",symbols:[Me.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 Be.measurement(t.unit,t.value)}},{name:"_",symbols:[]},{name:"_",symbols:[Me.has("whitespace")?{type:"whitespace"}:whitespace],postprocess:Fe},{name:"Comment",symbols:[Me.has("lineComment")?{type:"lineComment"}:lineComment],postprocess:Fe},{name:"EOL",symbols:[{literal:"\n"}],postprocess:Fe}],ParserStart:"PathSequence"},Qe=function(e,t){var n,r,o=new ie.Parser(ie.Grammar.fromCompiled(ze));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)}},De=function(){this.Parser=Qe};e.errors={__proto__:null,INCOMPLETE_PARSE:"Incomplete parse.",SYNTAX_ERROR:"Syntax error at"},e.gramParserPlugin=De,e.toAST=function(e){return G().use(De).freeze().parse(e)},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=gram-parse.umd.production.min.js.map |
{ | ||
"name": "@gram-data/gram-parse", | ||
"version": "0.1.10", | ||
"version": "2.0.1", | ||
"license": "MIT", | ||
@@ -25,6 +25,6 @@ "main": "dist/index.js", | ||
"lint:fix": "tsdx lint --fix", | ||
"prepare": "run-s build", | ||
"railroad": "nearley-railroad ./src/gram.ne -o docs/railroad.html", | ||
"railroad": "nearley-railroad ./src/gram.ne -o railroad.html", | ||
"build:demo": "shx cp dist/gram-parse.umd.development.* ./public", | ||
"demo": "serve ./public/" | ||
"demo": "serve ./public/", | ||
"prepare": "npm run build" | ||
}, | ||
@@ -44,2 +44,3 @@ "husky": { | ||
"devDependencies": { | ||
"@types/jest": "^26.0.4", | ||
"@types/moo": "^0.5.3", | ||
@@ -57,8 +58,8 @@ "@types/nearley": "^2.11.1", | ||
"tslib": "^2.0.0", | ||
"typescript": "^3.9.6", | ||
"typescript": "^3.9.7", | ||
"unist-util-inspect": "^6.0.0" | ||
}, | ||
"dependencies": { | ||
"@gram-data/gram-ast": "^0.1.10", | ||
"@gram-data/gram-builder": "^0.1.10", | ||
"@gram-data/gram-ast": "^2.0.1", | ||
"@gram-data/gram-builder": "^2.0.1", | ||
"moo": "^0.5.1", | ||
@@ -69,3 +70,3 @@ "nearley": "^2.19.5", | ||
}, | ||
"gitHead": "0df0d0a9641c40097de62219503f626d3913de9c", | ||
"gitHead": "ac6ffd57d6a93bf03097fabc17143d0cfaec7516", | ||
"publishConfig": { | ||
@@ -72,0 +73,0 @@ "access": "public" |
@@ -6,3 +6,3 @@ // Generated automatically by nearley, version 2.19.5 | ||
import moo from 'moo'; | ||
import * as g from '@gram-data/gram-builder'; | ||
import { builder as g } from '@gram-data/gram-builder'; | ||
import { tokens } from '@gram-data/gram-ast'; | ||
@@ -72,2 +72,3 @@ | ||
"'": "'", | ||
ø: 'ø', | ||
}) as unknown) as NearleyLexer; | ||
@@ -143,3 +144,3 @@ | ||
{ | ||
name: 'Gram$ebnf$1$subexpression$1$ebnf$1', | ||
name: 'PathSequence$ebnf$1$subexpression$1$ebnf$1', | ||
symbols: [{ literal: ',' }], | ||
@@ -149,3 +150,3 @@ postprocess: id, | ||
{ | ||
name: 'Gram$ebnf$1$subexpression$1$ebnf$1', | ||
name: 'PathSequence$ebnf$1$subexpression$1$ebnf$1', | ||
symbols: [], | ||
@@ -155,9 +156,12 @@ postprocess: () => null, | ||
{ | ||
name: 'Gram$ebnf$1$subexpression$1', | ||
symbols: ['Pathlike', 'Gram$ebnf$1$subexpression$1$ebnf$1', '_'], | ||
name: 'PathSequence$ebnf$1$subexpression$1', | ||
symbols: ['Path', 'PathSequence$ebnf$1$subexpression$1$ebnf$1', '_'], | ||
postprocess: ([pp]) => pp, | ||
}, | ||
{ name: 'Gram$ebnf$1', symbols: ['Gram$ebnf$1$subexpression$1'] }, | ||
{ | ||
name: 'Gram$ebnf$1$subexpression$2$ebnf$1', | ||
name: 'PathSequence$ebnf$1', | ||
symbols: ['PathSequence$ebnf$1$subexpression$1'], | ||
}, | ||
{ | ||
name: 'PathSequence$ebnf$1$subexpression$2$ebnf$1', | ||
symbols: [{ literal: ',' }], | ||
@@ -167,3 +171,3 @@ postprocess: id, | ||
{ | ||
name: 'Gram$ebnf$1$subexpression$2$ebnf$1', | ||
name: 'PathSequence$ebnf$1$subexpression$2$ebnf$1', | ||
symbols: [], | ||
@@ -173,24 +177,24 @@ postprocess: () => null, | ||
{ | ||
name: 'Gram$ebnf$1$subexpression$2', | ||
symbols: ['Pathlike', 'Gram$ebnf$1$subexpression$2$ebnf$1', '_'], | ||
name: 'PathSequence$ebnf$1$subexpression$2', | ||
symbols: ['Path', 'PathSequence$ebnf$1$subexpression$2$ebnf$1', '_'], | ||
postprocess: ([pp]) => pp, | ||
}, | ||
{ | ||
name: 'Gram$ebnf$1', | ||
symbols: ['Gram$ebnf$1', 'Gram$ebnf$1$subexpression$2'], | ||
name: 'PathSequence$ebnf$1', | ||
symbols: ['PathSequence$ebnf$1', 'PathSequence$ebnf$1$subexpression$2'], | ||
postprocess: d => d[0].concat([d[1]]), | ||
}, | ||
{ name: 'Gram$ebnf$2', symbols: ['EOL'], postprocess: id }, | ||
{ name: 'Gram$ebnf$2', symbols: [], postprocess: () => null }, | ||
{ name: 'PathSequence$ebnf$2', symbols: ['EOL'], postprocess: id }, | ||
{ name: 'PathSequence$ebnf$2', symbols: [], postprocess: () => null }, | ||
{ | ||
name: 'Gram', | ||
symbols: ['Gram$ebnf$1', 'Gram$ebnf$2'], | ||
name: 'PathSequence', | ||
symbols: ['PathSequence$ebnf$1', 'PathSequence$ebnf$2'], | ||
postprocess: ([pp]) => g.seq(g.flatten(pp)), | ||
}, | ||
{ name: 'Pathlike', symbols: ['EdgeExpression'], postprocess: id }, | ||
{ name: 'Pathlike', symbols: ['PathComposition'], postprocess: id }, | ||
{ name: 'Pathlike', symbols: ['Comment'], postprocess: id }, | ||
{ name: 'Path', symbols: ['NodePattern'], postprocess: id }, | ||
{ name: 'Path', symbols: ['PathComposition'], postprocess: id }, | ||
{ name: 'Path', symbols: ['Comment'], postprocess: id }, | ||
{ | ||
name: 'EdgeExpression', | ||
symbols: ['Node', 'Edge', 'EdgeExpression'], | ||
name: 'NodePattern', | ||
symbols: ['Node', 'Edge', 'NodePattern'], | ||
postprocess: ([np, es, ep]) => | ||
@@ -204,3 +208,3 @@ g.cons([np, ep], { | ||
}, | ||
{ name: 'EdgeExpression', symbols: ['Node'], postprocess: id }, | ||
{ name: 'NodePattern', symbols: ['Node'], postprocess: id }, | ||
{ | ||
@@ -257,17 +261,13 @@ name: 'Node', | ||
}, | ||
{ name: 'PathComposition$ebnf$1', symbols: ['Pathlike'], postprocess: id }, | ||
{ name: 'PathComposition$ebnf$1', symbols: [], postprocess: () => null }, | ||
{ | ||
name: 'PathComposition', | ||
symbols: [ | ||
{ literal: '[' }, | ||
'_', | ||
'Attributes', | ||
'_', | ||
'PathComposition$ebnf$1', | ||
'_', | ||
{ literal: ']' }, | ||
], | ||
postprocess: ([, , attr, , sub]) => g.cons(sub ? [sub] : [], attr), | ||
symbols: [{ literal: '[' }, '_', { literal: ']' }], | ||
postprocess: () => 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 }, | ||
{ | ||
@@ -280,7 +280,7 @@ name: 'PathComposition', | ||
'_', | ||
'Relation', | ||
'PathComposition$ebnf$1', | ||
'_', | ||
'Pathlike', | ||
'PathComposition$ebnf$2', | ||
'_', | ||
'Pathlike', | ||
'PathComposition$ebnf$3', | ||
'_', | ||
@@ -290,3 +290,3 @@ { literal: ']' }, | ||
postprocess: ([, , attr, , relation, , lhs, , rhs]) => | ||
g.cons([lhs, rhs], { | ||
g.cons(rhs ? (lhs ? [lhs, rhs] : [rhs]) : [], { | ||
relation, | ||
@@ -299,65 +299,2 @@ id: attr.id, | ||
{ | ||
name: 'PathComposition$ebnf$2$subexpression$1$ebnf$1', | ||
symbols: [{ literal: ',' }], | ||
postprocess: id, | ||
}, | ||
{ | ||
name: 'PathComposition$ebnf$2$subexpression$1$ebnf$1', | ||
symbols: [], | ||
postprocess: () => null, | ||
}, | ||
{ | ||
name: 'PathComposition$ebnf$2$subexpression$1', | ||
symbols: [ | ||
'Pathlike', | ||
'PathComposition$ebnf$2$subexpression$1$ebnf$1', | ||
'_', | ||
], | ||
postprocess: ([pp]) => pp, | ||
}, | ||
{ | ||
name: 'PathComposition$ebnf$2', | ||
symbols: ['PathComposition$ebnf$2$subexpression$1'], | ||
}, | ||
{ | ||
name: 'PathComposition$ebnf$2$subexpression$2$ebnf$1', | ||
symbols: [{ literal: ',' }], | ||
postprocess: id, | ||
}, | ||
{ | ||
name: 'PathComposition$ebnf$2$subexpression$2$ebnf$1', | ||
symbols: [], | ||
postprocess: () => null, | ||
}, | ||
{ | ||
name: 'PathComposition$ebnf$2$subexpression$2', | ||
symbols: [ | ||
'Pathlike', | ||
'PathComposition$ebnf$2$subexpression$2$ebnf$1', | ||
'_', | ||
], | ||
postprocess: ([pp]) => pp, | ||
}, | ||
{ | ||
name: 'PathComposition$ebnf$2', | ||
symbols: [ | ||
'PathComposition$ebnf$2', | ||
'PathComposition$ebnf$2$subexpression$2', | ||
], | ||
postprocess: d => d[0].concat([d[1]]), | ||
}, | ||
{ | ||
name: 'PathComposition', | ||
symbols: [ | ||
{ literal: '[' }, | ||
'_', | ||
'Attributes', | ||
'_', | ||
'PathComposition$ebnf$2', | ||
{ literal: ']' }, | ||
], | ||
postprocess: ([, , attr, , pp]) => | ||
g.cons(g.reduce('pair', g.flatten(pp)), attr), | ||
}, | ||
{ | ||
name: 'Relation', | ||
@@ -420,2 +357,3 @@ symbols: [{ literal: ',' }], | ||
}, | ||
{ name: 'Identity', symbols: [{ literal: 'ø' }], postprocess: text }, | ||
{ | ||
@@ -493,3 +431,3 @@ name: 'Identity', | ||
], | ||
postprocess: ([, , p, ps]) => g.record([p, ...extractPairs(ps)]), | ||
postprocess: ([, , p, ps]) => [p, ...extractPairs(ps)], | ||
}, | ||
@@ -611,5 +549,5 @@ { | ||
], | ||
ParserStart: 'Gram', | ||
ParserStart: 'PathSequence', | ||
}; | ||
export default grammar; |
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2
-33.33%704291
-0.84%15
7.14%5947
-0.15%1
Infinity%+ Added
+ Added
- Removed
- Removed
Updated