From 472310fbefd356b027896b803e8a6c1aa8022136 Mon Sep 17 00:00:00 2001 From: knsv Date: Sat, 22 Nov 2014 15:34:21 +0100 Subject: [PATCH] Support for class definitions for nodes Support multiple edges from one node to another --- dist/mermaid.full.js | 246 ++++++++++++++++++++++++++------------- dist/mermaid.full.min.js | 2 +- dist/mermaid.slim.js | 246 ++++++++++++++++++++++++++------------- dist/mermaid.slim.min.js | 2 +- src/graphDb.js | 53 ++++++++- src/main.js | 47 ++++++-- src/parser/flow.jison | 12 ++ src/parser/flow.js | 146 ++++++++++++----------- src/parser/flow.spec.js | 65 ++++++++++- test/web.html | 11 +- 10 files changed, 575 insertions(+), 255 deletions(-) diff --git a/dist/mermaid.full.js b/dist/mermaid.full.js index 0c2ef7c45..26036104a 100644 --- a/dist/mermaid.full.js +++ b/dist/mermaid.full.js @@ -338,20 +338,36 @@ var flow = require('./parser/flow'); var addVertices = function (vert, g) { var keys = Object.keys(vert); + var styleFromStyleArr = function(styleStr,arr){ + var i; + // Create a compound style definition from the style definitions found for the node in the graph definition + for (i = 0; i < arr.length; i++) { + if (typeof arr[i] !== 'undefined') { + styleStr = styleStr + arr[i] + ';'; + } + } + + return styleStr; + } + // Iterate through each item in the vertice object (containing all the vertices found) in the graph definition keys.forEach(function (id) { var vertice = vert[id]; var verticeText; var i; + var style = ''; - // Create a compound style definition from the style definitions found for the node in the graph definition - for (i = 0; i < vertice.styles.length; i++) { - if (typeof vertice.styles[i] !== 'undefined') { - style = style + vertice.styles[i] + ';'; - } + var classes = graph.getClasses(); + // Check if class is defined for the node + for (i = 0; i < vertice.classes.length; i++) { + style = styleFromStyleArr(style,classes[vertice.classes[i]].styles); } + + // Create a compound style definition from the style definitions found for the node in the graph definition + style = styleFromStyleArr(style, vertice.styles); + // Use vertice id as text in the box if no text is provided by the graph definition if (vertice.text === undefined) { verticeText = vertice.id; @@ -360,7 +376,7 @@ var addVertices = function (vert, g) { verticeText = vertice.text; } - // Create the node in the graph nased on defined form + // Create the node in the graph based on defined form if (vertice.type === 'round') { g.setNode(vertice.id, {label: verticeText, rx: 5, ry: 5, style: style}); } else { @@ -379,7 +395,9 @@ var addVertices = function (vert, g) { * @param g */ var addEdges = function (edges, g) { + var cnt=0; edges.forEach(function (edge) { + cnt++; // Set link type for rendering if(edge.type === 'arrow_open'){ @@ -390,22 +408,26 @@ var addEdges = function (edges, g) { } // Add the edge to the graph - if (edge.text === 'undefined') { + if (typeof edge.text === 'undefined') { if(typeof edge.style === 'undefined'){ - g.setEdge(edge.start, edge.end,{ arrowheadStyle: "fill: #333", arrowhead: aHead}); + g.setEdge(edge.start, edge.end,{ arrowheadStyle: "fill: #333", arrowhead: aHead},cnt); }else{ g.setEdge(edge.start, edge.end, { style: edge.style, arrowheadStyle: "fill: #333", arrowhead: aHead - }); + },cnt); } } + // Edge with text else { + if(typeof edge.style === 'undefined'){ - g.setEdge(edge.start, edge.end,{label: edge.text, arrowheadStyle: "fill: #33f", arrowhead: aHead}); + console.log('Edge with Text no style: '+edge.text); + g.setEdge(edge.start, edge.end,{label: edge.text, arrowheadStyle: "fill: #33f", arrowhead: aHead},cnt); }else{ + g.setEdge(edge.start, edge.end, { style: edge.style, arrowheadStyle: "fill: #333", label: edge.text, arrowhead: aHead - }); + },cnt); } } }); @@ -431,11 +453,12 @@ var drawChart = function (text, id) { } // Create the input mermaid.graph - var g = new dagreD3.graphlib.Graph() + var g = new dagreD3.graphlib.Graph({multigraph:true}) .setGraph({ rankdir: dir, marginx: 20, marginy: 20 + }) .setDefaultEdgeLabel(function () { return {}; @@ -582,6 +605,7 @@ global.mermaid = { var vertices = {}; var edges = []; +var classes = []; var direction; /** * Function called by parser when a node definition has been found @@ -591,9 +615,9 @@ var direction; * @param style */ exports.addVertex = function (id, text, type, style) { - console.log('Got node ' + id + ' ' + type + ' ' + text + ' styles: ' + JSON.stringify(style)); + //console.log('Got node ' + id + ' ' + type + ' ' + text + ' styles: ' + JSON.stringify(style)); if (typeof vertices[id] === 'undefined') { - vertices[id] = {id: id, styles: []}; + vertices[id] = {id: id, styles: [], classes:[]}; } if (typeof text !== 'undefined') { vertices[id].text = text; @@ -601,6 +625,9 @@ exports.addVertex = function (id, text, type, style) { if (typeof type !== 'undefined') { vertices[id].type = type; } + if (typeof type !== 'undefined') { + vertices[id].type = type; + } if (typeof style !== 'undefined') { if (style !== null) { style.forEach(function (s) { @@ -637,6 +664,22 @@ exports.updateLink = function (pos, style) { var position = pos.substr(1); edges[position].style = style; }; + +exports.addClass = function (id, style) { + if (typeof classes[id] === 'undefined') { + classes[id] = {id: id, styles: []}; + } + + if (typeof style !== 'undefined') { + if (style !== null) { + style.forEach(function (s) { + console.log('Adding style'+s) + classes[id].styles.push(s); + }); + } + } +}; + /** * Called by parser when a graph definition is found, stores the direction of the chart. * @param dir @@ -644,6 +687,26 @@ exports.updateLink = function (pos, style) { exports.setDirection = function (dir) { direction = dir; }; + +/** + * Called by parser when a graph definition is found, stores the direction of the chart. + * @param dir + */ +exports.setClass = function (id,className) { + console.log('Got id:'+id); + if(id.indexOf(',')>0){ + id.split(',').forEach(function(id2){ + if(typeof vertices[id2] !== 'undefined'){ + vertices[id2].classes.push(className); + } + }); + }else{ + if(typeof vertices[id] !== 'undefined'){ + vertices[id].classes.push(className); + } + } +}; + exports.getDirection = function () { return direction; }; @@ -663,11 +726,20 @@ exports.getEdges = function () { return edges; }; +/** + * Retrieval function for fetching the found class definitions after parsing has completed. + * @returns {{}|*|classes} + */ +exports.getClasses = function () { + return classes; +}; + /** * Clears the internal graph db so that a new graph can be parsed. */ exports.clear = function () { vertices = {}; + classes = {}; edges = []; }; /** @@ -755,12 +827,12 @@ exports.defaultStyle = function () { } */ var parser = (function(){ -var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,7],$V1=[2,10],$V2=[1,15],$V3=[1,16],$V4=[1,17],$V5=[1,18],$V6=[1,19],$V7=[1,20],$V8=[1,21],$V9=[1,22],$Va=[1,23],$Vb=[1,24],$Vc=[1,11],$Vd=[6,9],$Ve=[11,27,28,29,30,31,32,33,34,35,36,37,45],$Vf=[2,7],$Vg=[11,40,41,42,43],$Vh=[9,11,18,20,21,22,23,24,40,41,42,43,44],$Vi=[9,11,18,20,21,22,23,24,28,29,30,31,32,33,34,35,36,37,40,41,42,43,44],$Vj=[9,11,18,20,21,22,23,24,27,28,29,30,31,32,33,34,35,36,37,40,41,42,43,44],$Vk=[28,29,30,31,32,33,34,35,36,37],$Vl=[28,29,30,31,32,33,34,35,36,37,44],$Vm=[20,22,24,44],$Vn=[1,75],$Vo=[1,72],$Vp=[1,70],$Vq=[1,73],$Vr=[1,71],$Vs=[1,76],$Vt=[1,74],$Vu=[1,80],$Vv=[11,31],$Vw=[9,11,27,28,29,30,31,47,50]; +var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,7],$V1=[2,12],$V2=[1,19],$V3=[1,20],$V4=[1,21],$V5=[1,22],$V6=[1,23],$V7=[1,24],$V8=[1,25],$V9=[1,26],$Va=[1,27],$Vb=[1,28],$Vc=[1,14],$Vd=[1,15],$Ve=[1,13],$Vf=[6,9],$Vg=[11,29,30,31,32,33,34,35,36,37,38,39,47,49,50],$Vh=[2,7],$Vi=[11,42,43,44,45],$Vj=[9,11,20,22,23,24,25,26,42,43,44,45,46],$Vk=[9,11,20,22,23,24,25,26,30,31,32,33,34,35,36,37,38,39,42,43,44,45,46],$Vl=[9,11,20,22,23,24,25,26,29,30,31,32,33,34,35,36,37,38,39,42,43,44,45,46],$Vm=[30,31,32,33,34,35,36,37,38,39],$Vn=[30,31,32,33,34,35,36,37,38,39,46],$Vo=[22,24,26,46],$Vp=[1,87],$Vq=[1,84],$Vr=[1,82],$Vs=[1,85],$Vt=[1,83],$Vu=[1,88],$Vv=[1,86],$Vw=[1,94],$Vx=[11,33],$Vy=[9,11,29,30,31,32,33,51,54]; var parser = {trace: function trace() { }, yy: {}, -symbols_: {"error":2,"expressions":3,"graphConfig":4,"statements":5,"EOF":6,"spaceList":7,"GRAPH":8,"SPACE":9,"DIR":10,"SEMI":11,"statement":12,"verticeStatement":13,"styleStatement":14,"vertex":15,"link":16,"alphaNum":17,"SQS":18,"text":19,"SQE":20,"PS":21,"PE":22,"DIAMOND_START":23,"DIAMOND_STOP":24,"alphaNumStatement":25,"alphaNumToken":26,"MINUS":27,"ALPHA":28,"NUM":29,"COLON":30,"COMMA":31,"PLUS":32,"EQUALS":33,"MULT":34,"DOT":35,"TAGSTART":36,"TAGEND":37,"linkStatement":38,"arrowText":39,"ARROW_POINT":40,"ARROW_CIRCLE":41,"ARROW_CROSS":42,"ARROW_OPEN":43,"PIPE":44,"STYLE":45,"stylesOpt":46,"HEX":47,"style":48,"styleComponent":49,"UNIT":50,"$accept":0,"$end":1}, -terminals_: {2:"error",6:"EOF",8:"GRAPH",9:"SPACE",10:"DIR",11:"SEMI",18:"SQS",20:"SQE",21:"PS",22:"PE",23:"DIAMOND_START",24:"DIAMOND_STOP",27:"MINUS",28:"ALPHA",29:"NUM",30:"COLON",31:"COMMA",32:"PLUS",33:"EQUALS",34:"MULT",35:"DOT",36:"TAGSTART",37:"TAGEND",40:"ARROW_POINT",41:"ARROW_CIRCLE",42:"ARROW_CROSS",43:"ARROW_OPEN",44:"PIPE",45:"STYLE",47:"HEX",50:"UNIT"}, -productions_: [0,[3,3],[3,4],[4,4],[5,3],[5,1],[7,2],[7,1],[12,2],[12,2],[13,0],[13,3],[13,1],[15,4],[15,4],[15,4],[15,1],[17,1],[17,2],[25,1],[25,3],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[16,2],[16,1],[38,1],[38,1],[38,1],[38,1],[39,3],[19,3],[19,5],[19,1],[14,5],[14,5],[46,1],[46,3],[48,1],[48,2],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1]], +symbols_: {"error":2,"expressions":3,"graphConfig":4,"statements":5,"EOF":6,"spaceList":7,"GRAPH":8,"SPACE":9,"DIR":10,"SEMI":11,"statement":12,"verticeStatement":13,"styleStatement":14,"classDefStatement":15,"classStatement":16,"vertex":17,"link":18,"alphaNum":19,"SQS":20,"text":21,"SQE":22,"PS":23,"PE":24,"DIAMOND_START":25,"DIAMOND_STOP":26,"alphaNumStatement":27,"alphaNumToken":28,"MINUS":29,"ALPHA":30,"NUM":31,"COLON":32,"COMMA":33,"PLUS":34,"EQUALS":35,"MULT":36,"DOT":37,"TAGSTART":38,"TAGEND":39,"linkStatement":40,"arrowText":41,"ARROW_POINT":42,"ARROW_CIRCLE":43,"ARROW_CROSS":44,"ARROW_OPEN":45,"PIPE":46,"CLASSDEF":47,"stylesOpt":48,"CLASS":49,"STYLE":50,"HEX":51,"style":52,"styleComponent":53,"UNIT":54,"$accept":0,"$end":1}, +terminals_: {2:"error",6:"EOF",8:"GRAPH",9:"SPACE",10:"DIR",11:"SEMI",20:"SQS",22:"SQE",23:"PS",24:"PE",25:"DIAMOND_START",26:"DIAMOND_STOP",29:"MINUS",30:"ALPHA",31:"NUM",32:"COLON",33:"COMMA",34:"PLUS",35:"EQUALS",36:"MULT",37:"DOT",38:"TAGSTART",39:"TAGEND",42:"ARROW_POINT",43:"ARROW_CIRCLE",44:"ARROW_CROSS",45:"ARROW_OPEN",46:"PIPE",47:"CLASSDEF",49:"CLASS",50:"STYLE",51:"HEX",54:"UNIT"}, +productions_: [0,[3,3],[3,4],[4,4],[5,3],[5,1],[7,2],[7,1],[12,2],[12,2],[12,2],[12,2],[13,0],[13,3],[13,1],[17,4],[17,4],[17,4],[17,1],[19,1],[19,2],[27,1],[27,3],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[18,2],[18,1],[40,1],[40,1],[40,1],[40,1],[41,3],[21,3],[21,5],[21,1],[15,5],[16,5],[14,5],[14,5],[48,1],[48,3],[52,1],[52,2],[53,1],[53,1],[53,1],[53,1],[53,1],[53,1],[53,1]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ @@ -772,82 +844,88 @@ break; case 3: yy.setDirection($$[$0-1]);this.$ = $$[$0-1]; break; -case 11: +case 13: yy.addLink($$[$0-2],$$[$0],$$[$0-1]);this.$ = 'oy' break; -case 12: +case 14: this.$ = 'yo'; break; -case 13: +case 15: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'square'); break; -case 14: +case 16: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'round'); break; -case 15: +case 17: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'diamond'); break; -case 16: +case 18: this.$ = $$[$0];yy.addVertex($$[$0]); break; -case 17: case 19: case 21: case 22: case 45: +case 19: case 21: case 23: case 24: case 49: this.$=$$[$0]; break; -case 18: +case 20: this.$=$$[$0-1]+''+$$[$0]; break; -case 20: +case 22: this.$=$$[$0-2]+'-'+$$[$0]; break; -case 23: case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 32: case 40: +case 25: case 26: case 27: case 28: case 29: case 30: case 31: case 32: case 34: case 42: this.$ = $$[$0]; break; -case 31: +case 33: $$[$0-1].text = $$[$0];this.$ = $$[$0-1]; break; -case 33: +case 35: this.$ = {"type":"arrow"}; break; -case 34: +case 36: this.$ = {"type":"arrow_circle"}; break; -case 35: +case 37: this.$ = {"type":"arrow_cross"}; break; -case 36: +case 38: this.$ = {"type":"arrow_open"}; break; -case 37: +case 39: this.$ = $$[$0-1]; break; -case 38: +case 40: this.$ = $$[$0-2] + ' ' +$$[$0]; break; -case 39: +case 41: this.$ = $$[$0-4] + ' - ' +$$[$0]; break; -case 41: -this.$ = $$[$0-4];yy.addVertex($$[$0-2],undefined,undefined,$$[$0]); -break; -case 42: -this.$ = $$[$0-4];yy.updateLink($$[$0-2],$$[$0]); -break; case 43: -this.$ = [$$[$0]] +this.$ = $$[$0-4];yy.addClass($$[$0-2],$$[$0]); break; case 44: -$$[$0-2].push($$[$0]);this.$ = $$[$0-2]; +this.$ = $$[$0-4];yy.setClass($$[$0-2], $$[$0]); +break; +case 45: +this.$ = $$[$0-4];yy.addVertex($$[$0-2],undefined,undefined,$$[$0]); break; case 46: +this.$ = $$[$0-4];yy.updateLink($$[$0-2],$$[$0]); +break; +case 47: +this.$ = [$$[$0]] +break; +case 48: +$$[$0-2].push($$[$0]);this.$ = $$[$0-2]; +break; +case 50: this.$ = $$[$0-1] + $$[$0]; break; -case 47: case 48: case 49: case 50: case 51: case 52: case 53: +case 51: case 52: case 53: case 54: case 55: case 56: case 57: this.$=$$[$0] break; } }, -table: [{3:1,4:2,8:[1,3]},{1:[3]},{5:4,7:5,9:$V0,11:$V1,12:6,13:8,14:9,15:10,17:12,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb,45:$Vc},{9:[1,25]},{6:[1,26],7:27,9:$V0},{5:28,11:$V1,12:6,13:8,14:9,15:10,17:12,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb,45:$Vc},o($Vd,[2,5]),o($Ve,$Vf,{7:29,9:$V0}),{11:[1,30]},{11:[1,31]},{11:[2,12],16:32,38:33,40:[1,34],41:[1,35],42:[1,36],43:[1,37]},{9:[1,38]},o($Vg,[2,16],{18:[1,39],21:[1,40],23:[1,41]}),o($Vh,[2,17],{25:13,26:14,17:42,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb}),o($Vi,[2,19],{27:[1,43]}),o($Vj,[2,21]),o($Vj,[2,22]),o($Vj,[2,23]),o($Vj,[2,24]),o($Vj,[2,25]),o($Vj,[2,26]),o($Vj,[2,27]),o($Vj,[2,28]),o($Vj,[2,29]),o($Vj,[2,30]),{10:[1,44]},{1:[2,1]},{11:$V1,12:45,13:8,14:9,15:10,17:12,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb,45:$Vc},{6:[1,46],7:27,9:$V0},o($Ve,[2,6]),o($Vd,[2,8]),o($Vd,[2,9]),{15:47,17:12,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},o($Vk,[2,32],{39:48,44:[1,49]}),o($Vl,[2,33]),o($Vl,[2,34]),o($Vl,[2,35]),o($Vl,[2,36]),{17:50,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb,47:[1,51]},{17:53,19:52,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},{17:53,19:54,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},{17:53,19:55,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},o($Vh,[2,18]),{26:56,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},{11:[1,57]},o($Vd,[2,4]),{1:[2,2]},{11:[2,11]},o($Vk,[2,31]),{17:53,19:58,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},{9:[1,59]},{9:[1,60]},{20:[1,61]},o($Vm,[2,40],{7:63,9:[1,62]}),{22:[1,64]},{24:[1,65]},o($Vi,[2,20]),o([9,11,28,29,30,31,32,33,34,35,36,37,45],[2,3]),{44:[1,66]},{9:$Vn,27:$Vo,28:$Vp,29:$Vq,30:$Vr,46:67,47:$Vs,48:68,49:69,50:$Vt},{9:$Vn,27:$Vo,28:$Vp,29:$Vq,30:$Vr,46:77,47:$Vs,48:68,49:69,50:$Vt},o($Vg,[2,13]),{7:29,9:$V0,17:53,19:78,25:13,26:14,27:$Vf,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},{27:[1,79]},o($Vg,[2,14]),o($Vg,[2,15]),o($Vk,[2,37]),{11:[2,41],31:$Vu},o($Vv,[2,43],{49:81,9:$Vn,27:$Vo,28:$Vp,29:$Vq,30:$Vr,47:$Vs,50:$Vt}),o($Vw,[2,45]),o($Vw,[2,47]),o($Vw,[2,48]),o($Vw,[2,49]),o($Vw,[2,50]),o($Vw,[2,51]),o($Vw,[2,52]),o($Vw,[2,53]),{11:[2,42],31:$Vu},o($Vm,[2,38]),{7:82,9:$V0},{9:$Vn,27:$Vo,28:$Vp,29:$Vq,30:$Vr,47:$Vs,48:83,49:69,50:$Vt},o($Vw,[2,46]),{17:53,19:84,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},o($Vv,[2,44],{49:81,9:$Vn,27:$Vo,28:$Vp,29:$Vq,30:$Vr,47:$Vs,50:$Vt}),o($Vm,[2,39])], -defaultActions: {26:[2,1],46:[2,2],47:[2,11]}, +table: [{3:1,4:2,8:[1,3]},{1:[3]},{5:4,7:5,9:$V0,11:$V1,12:6,13:8,14:9,15:10,16:11,17:12,19:16,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb,47:$Vc,49:$Vd,50:$Ve},{9:[1,29]},{6:[1,30],7:31,9:$V0},{5:32,11:$V1,12:6,13:8,14:9,15:10,16:11,17:12,19:16,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb,47:$Vc,49:$Vd,50:$Ve},o($Vf,[2,5]),o($Vg,$Vh,{7:33,9:$V0}),{11:[1,34]},{11:[1,35]},{11:[1,36]},{11:[1,37]},{11:[2,14],18:38,40:39,42:[1,40],43:[1,41],44:[1,42],45:[1,43]},{9:[1,44]},{9:[1,45]},{9:[1,46]},o($Vi,[2,18],{20:[1,47],23:[1,48],25:[1,49]}),o($Vj,[2,19],{27:17,28:18,19:50,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb}),o($Vk,[2,21],{29:[1,51]}),o($Vl,[2,23]),o($Vl,[2,24]),o($Vl,[2,25]),o($Vl,[2,26]),o($Vl,[2,27]),o($Vl,[2,28]),o($Vl,[2,29]),o($Vl,[2,30]),o($Vl,[2,31]),o($Vl,[2,32]),{10:[1,52]},{1:[2,1]},{11:$V1,12:53,13:8,14:9,15:10,16:11,17:12,19:16,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb,47:$Vc,49:$Vd,50:$Ve},{6:[1,54],7:31,9:$V0},o($Vg,[2,6]),o($Vf,[2,8]),o($Vf,[2,9]),o($Vf,[2,10]),o($Vf,[2,11]),{17:55,19:16,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},o($Vm,[2,34],{41:56,46:[1,57]}),o($Vn,[2,35]),o($Vn,[2,36]),o($Vn,[2,37]),o($Vn,[2,38]),{19:58,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb,51:[1,59]},{19:60,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},{19:61,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},{19:63,21:62,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},{19:63,21:64,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},{19:63,21:65,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},o($Vj,[2,20]),{28:66,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},{11:[1,67]},o($Vf,[2,4]),{1:[2,2]},{11:[2,13]},o($Vm,[2,33]),{19:63,21:68,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},{9:[1,69]},{9:[1,70]},{9:[1,71]},{9:[1,72]},{22:[1,73]},o($Vo,[2,42],{7:75,9:[1,74]}),{24:[1,76]},{26:[1,77]},o($Vk,[2,22]),o([9,11,30,31,32,33,34,35,36,37,38,39,47,49,50],[2,3]),{46:[1,78]},{9:$Vp,29:$Vq,30:$Vr,31:$Vs,32:$Vt,48:79,51:$Vu,52:80,53:81,54:$Vv},{9:$Vp,29:$Vq,30:$Vr,31:$Vs,32:$Vt,48:89,51:$Vu,52:80,53:81,54:$Vv},{9:$Vp,29:$Vq,30:$Vr,31:$Vs,32:$Vt,48:90,51:$Vu,52:80,53:81,54:$Vv},{19:91,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},o($Vi,[2,15]),{7:33,9:$V0,19:63,21:92,27:17,28:18,29:$Vh,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},{29:[1,93]},o($Vi,[2,16]),o($Vi,[2,17]),o($Vm,[2,39]),{11:[2,45],33:$Vw},o($Vx,[2,47],{53:95,9:$Vp,29:$Vq,30:$Vr,31:$Vs,32:$Vt,51:$Vu,54:$Vv}),o($Vy,[2,49]),o($Vy,[2,51]),o($Vy,[2,52]),o($Vy,[2,53]),o($Vy,[2,54]),o($Vy,[2,55]),o($Vy,[2,56]),o($Vy,[2,57]),{11:[2,46],33:$Vw},{11:[2,43],33:$Vw},{11:[2,44]},o($Vo,[2,40]),{7:96,9:$V0},{9:$Vp,29:$Vq,30:$Vr,31:$Vs,32:$Vt,51:$Vu,52:97,53:81,54:$Vv},o($Vy,[2,50]),{19:63,21:98,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},o($Vx,[2,48],{53:95,9:$Vp,29:$Vq,30:$Vr,31:$Vs,32:$Vt,51:$Vu,54:$Vv}),o($Vo,[2,41])], +defaultActions: {30:[2,1],54:[2,2],55:[2,13],91:[2,44]}, parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); @@ -1320,35 +1398,35 @@ options: {}, performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { var YYSTATE=YY_START; switch($avoiding_name_collisions) { -case 0:return 45; +case 0:return 50; break; -case 1:return 8; +case 1:return 47; break; -case 2:return 10; +case 2:return 49; break; -case 3:return 10; +case 3:return 8; break; -case 4:return 47; +case 4:return 10; break; -case 5:return 29; +case 5:return 10; break; -case 6:return 'BRKT'; +case 6:return 51; break; -case 7:return 50; +case 7:return 31; break; -case 8:return 50; +case 8:return 'BRKT'; break; -case 9:return 50; +case 9:return 54; break; -case 10:return 30; +case 10:return 54; break; -case 11:return 11; +case 11:return 54; break; -case 12:return 31; +case 12:return 32; break; -case 13:return 33; +case 13:return 11; break; -case 14:return 34; +case 14:return 33; break; case 15:return 35; break; @@ -1356,46 +1434,50 @@ case 16:return 36; break; case 17:return 37; break; -case 18:return 42; +case 18:return 38; break; -case 19:return 40; +case 19:return 39; break; -case 20:return 41; +case 20:return 44; break; -case 21:return 43; +case 21:return 42; break; -case 22:return 27; +case 22:return 43; break; -case 23:return 32; +case 23:return 45; break; -case 24:return 33; +case 24:return 29; break; -case 25:return 28; +case 25:return 34; break; -case 26:return 44; +case 26:return 35; break; -case 27:return 21; +case 27:return 30; break; -case 28:return 22; +case 28:return 46; break; -case 29:return 18; +case 29:return 23; break; -case 30:return 20; +case 30:return 24; break; -case 31:return 23 +case 31:return 20; break; -case 32:return 24 +case 32:return 22; break; -case 33:return 9; +case 33:return 25 break; -case 34:return 'NEWLINE'; +case 34:return 26 break; -case 35:return 6; +case 35:return 9; +break; +case 36:return 'NEWLINE'; +break; +case 37:return 6; break; } }, -rules: [/^(?:style\b)/,/^(?:graph\b)/,/^(?:LR\b)/,/^(?:TD\b)/,/^(?:#[a-f0-9]+)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?:px\b)/,/^(?:pt\b)/,/^(?:dot\b)/,/^(?::)/,/^(?:;)/,/^(?:,)/,/^(?:=)/,/^(?:\*)/,/^(?:\.)/,/^(?:<)/,/^(?:>)/,/^(?:--[x])/,/^(?:-->)/,/^(?:--[o])/,/^(?:---)/,/^(?:-)/,/^(?:\+)/,/^(?:=)/,/^(?:[a-zåäöæøA-ZÅÄÖÆØ_]+)/,/^(?:\|)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:\s)/,/^(?:\n)/,/^(?:$)/], -conditions: {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35],"inclusive":true}} +rules: [/^(?:style\b)/,/^(?:classDef\b)/,/^(?:class\b)/,/^(?:graph\b)/,/^(?:LR\b)/,/^(?:TD\b)/,/^(?:#[a-f0-9]+)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?:px\b)/,/^(?:pt\b)/,/^(?:dot\b)/,/^(?::)/,/^(?:;)/,/^(?:,)/,/^(?:=)/,/^(?:\*)/,/^(?:\.)/,/^(?:<)/,/^(?:>)/,/^(?:--[x])/,/^(?:-->)/,/^(?:--[o])/,/^(?:---)/,/^(?:-)/,/^(?:\+)/,/^(?:=)/,/^(?:[a-zåäöæøA-ZÅÄÖÆØ_]+)/,/^(?:\|)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:\s)/,/^(?:\n)/,/^(?:$)/], +conditions: {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"inclusive":true}} }); return lexer; })(); diff --git a/dist/mermaid.full.min.js b/dist/mermaid.full.min.js index 726e3d08b..191e7d39a 100644 --- a/dist/mermaid.full.min.js +++ b/dist/mermaid.full.min.js @@ -30,4 +30,4 @@ module.exports={graphlib:require("./lib/graphlib"),dagre:require("./lib/dagre"), }));_.each(g.nodes(),function(v){var node=g.node(v);if(_.has(node,"rank")){node.rank-=min}})}function removeEmptyRanks(g){var offset=_.min(_.map(g.nodes(),function(v){return g.node(v).rank}));var layers=[];_.each(g.nodes(),function(v){var rank=g.node(v).rank-offset;if(!_.has(layers,rank)){layers[rank]=[]}layers[rank].push(v)});var delta=0,nodeRankFactor=g.graph().nodeRankFactor;_.each(layers,function(vs,i){if(_.isUndefined(vs)&&i%nodeRankFactor!==0){--delta}else if(delta){_.each(vs,function(v){g.node(v).rank+=delta})}})}function addBorderNode(g,prefix,rank,order){var node={width:0,height:0};if(arguments.length>=4){node.rank=rank;node.order=order}return addDummyNode(g,"border",node,prefix)}function maxRank(g){return _.max(_.map(g.nodes(),function(v){var rank=g.node(v).rank;if(!_.isUndefined(rank)){return rank}}))}function partition(collection,fn){var result={lhs:[],rhs:[]};_.each(collection,function(value){if(fn(value)){result.lhs.push(value)}else{result.rhs.push(value)}});return result}function time(name,fn){var start=_.now();try{return fn()}finally{console.log(name+" time: "+(_.now()-start)+"ms")}}function notime(name,fn){return fn()}},{"./graphlib":33,"./lodash":36}],56:[function(require,module,exports){module.exports="0.6.1"},{}],57:[function(require,module,exports){var lib=require("./lib");module.exports={Graph:lib.Graph,json:require("./lib/json"),alg:require("./lib/alg"),version:lib.version}},{"./lib":73,"./lib/alg":64,"./lib/json":74}],58:[function(require,module,exports){var _=require("../lodash");module.exports=components;function components(g){var visited={},cmpts=[],cmpt;function dfs(v){if(_.has(visited,v))return;visited[v]=true;cmpt.push(v);_.each(g.successors(v),dfs);_.each(g.predecessors(v),dfs)}_.each(g.nodes(),function(v){cmpt=[];dfs(v);if(cmpt.length){cmpts.push(cmpt)}});return cmpts}},{"../lodash":75}],59:[function(require,module,exports){var _=require("../lodash");module.exports=dfs;function dfs(g,vs,order){if(!_.isArray(vs)){vs=[vs]}var acc=[],visited={};_.each(vs,function(v){if(!g.hasNode(v)){throw new Error("Graph does not have node: "+v)}doDfs(g,v,order==="post",visited,acc)});return acc}function doDfs(g,v,postorder,visited,acc){if(!_.has(visited,v)){visited[v]=true;if(!postorder){acc.push(v)}_.each(g.neighbors(v),function(w){doDfs(g,w,postorder,visited,acc)});if(postorder){acc.push(v)}}}},{"../lodash":75}],60:[function(require,module,exports){var dijkstra=require("./dijkstra"),_=require("../lodash");module.exports=dijkstraAll;function dijkstraAll(g,weightFunc,edgeFunc){return _.transform(g.nodes(),function(acc,v){acc[v]=dijkstra(g,v,weightFunc,edgeFunc)},{})}},{"../lodash":75,"./dijkstra":61}],61:[function(require,module,exports){var _=require("../lodash"),PriorityQueue=require("../data/priority-queue");module.exports=dijkstra;var DEFAULT_WEIGHT_FUNC=_.constant(1);function dijkstra(g,source,weightFn,edgeFn){return runDijkstra(g,String(source),weightFn||DEFAULT_WEIGHT_FUNC,edgeFn||function(v){return g.outEdges(v)})}function runDijkstra(g,source,weightFn,edgeFn){var results={},pq=new PriorityQueue,v,vEntry;var updateNeighbors=function(edge){var w=edge.v!==v?edge.v:edge.w,wEntry=results[w],weight=weightFn(edge),distance=vEntry.distance+weight;if(weight<0){throw new Error("dijkstra does not allow negative edge weights. "+"Bad edge: "+edge+" Weight: "+weight)}if(distance0){v=pq.removeMin();vEntry=results[v];if(vEntry.distance===Number.POSITIVE_INFINITY){break}edgeFn(v).forEach(updateNeighbors)}return results}},{"../data/priority-queue":71,"../lodash":75}],62:[function(require,module,exports){var _=require("../lodash"),tarjan=require("./tarjan");module.exports=findCycles;function findCycles(g){return _.filter(tarjan(g),function(cmpt){return cmpt.length>1})}},{"../lodash":75,"./tarjan":69}],63:[function(require,module,exports){var _=require("../lodash");module.exports=floydWarshall;var DEFAULT_WEIGHT_FUNC=_.constant(1);function floydWarshall(g,weightFn,edgeFn){return runFloydWarshall(g,weightFn||DEFAULT_WEIGHT_FUNC,edgeFn||function(v){return g.outEdges(v)})}function runFloydWarshall(g,weightFn,edgeFn){var results={},nodes=g.nodes();nodes.forEach(function(v){results[v]={};results[v][v]={distance:0};nodes.forEach(function(w){if(v!==w){results[v][w]={distance:Number.POSITIVE_INFINITY}}});edgeFn(v).forEach(function(edge){var w=edge.v===v?edge.w:edge.v,d=weightFn(edge);results[v][w]={distance:d,predecessor:v}})});nodes.forEach(function(k){var rowK=results[k];nodes.forEach(function(i){var rowI=results[i];nodes.forEach(function(j){var ik=rowI[k];var kj=rowK[j];var ij=rowI[j];var altDistance=ik.distance+kj.distance;if(altDistance0){v=pq.removeMin();if(_.has(parents,v)){result.setEdge(v,parents[v])}else if(init){throw new Error("Input graph is not connected: "+g)}else{init=true}g.nodeEdges(v).forEach(updateNeighbors)}return result}},{"../data/priority-queue":71,"../graph":72,"../lodash":75}],69:[function(require,module,exports){var _=require("../lodash");module.exports=tarjan;function tarjan(g){var index=0,stack=[],visited={},results=[];function dfs(v){var entry=visited[v]={onStack:true,lowlink:index,index:index++};stack.push(v);g.successors(v).forEach(function(w){if(!_.has(visited,w)){dfs(w);entry.lowlink=Math.min(entry.lowlink,visited[w].lowlink)}else if(visited[w].onStack){entry.lowlink=Math.min(entry.lowlink,visited[w].index)}});if(entry.lowlink===entry.index){var cmpt=[],w;do{w=stack.pop();visited[w].onStack=false;cmpt.push(w)}while(v!==w);results.push(cmpt)}}g.nodes().forEach(function(v){if(!_.has(visited,v)){dfs(v)}});return results}},{"../lodash":75}],70:[function(require,module,exports){var _=require("../lodash");module.exports=topsort;topsort.CycleException=CycleException;function topsort(g){var visited={},stack={},results=[];function visit(node){if(_.has(stack,node)){throw new CycleException}if(!_.has(visited,node)){stack[node]=true;visited[node]=true;_.each(g.predecessors(node),visit);delete stack[node];results.push(node)}}_.each(g.sinks(),visit);if(_.size(visited)!==g.nodeCount()){throw new CycleException}return results}function CycleException(){}},{"../lodash":75}],71:[function(require,module,exports){var _=require("../lodash");module.exports=PriorityQueue;function PriorityQueue(){this._arr=[];this._keyIndices={}}PriorityQueue.prototype.size=function(){return this._arr.length};PriorityQueue.prototype.keys=function(){return this._arr.map(function(x){return x.key})};PriorityQueue.prototype.has=function(key){return _.has(this._keyIndices,key)};PriorityQueue.prototype.priority=function(key){var index=this._keyIndices[key];if(index!==undefined){return this._arr[index].priority}};PriorityQueue.prototype.min=function(){if(this.size()===0){throw new Error("Queue underflow")}return this._arr[0].key};PriorityQueue.prototype.add=function(key,priority){var keyIndices=this._keyIndices;key=String(key);if(!_.has(keyIndices,key)){var arr=this._arr;var index=arr.length;keyIndices[key]=index;arr.push({key:key,priority:priority});this._decrease(index);return true}return false};PriorityQueue.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var min=this._arr.pop();delete this._keyIndices[min.key];this._heapify(0);return min.key};PriorityQueue.prototype.decrease=function(key,priority){var index=this._keyIndices[key];if(priority>this._arr[index].priority){throw new Error("New priority is greater than current priority. "+"Key: "+key+" Old: "+this._arr[index].priority+" New: "+priority)}this._arr[index].priority=priority;this._decrease(index)};PriorityQueue.prototype._heapify=function(i){var arr=this._arr;var l=2*i,r=l+1,largest=i;if(l>1;if(arr[parent].priority1){this.setNode(v,value)}else{this.setNode(v)}},this);return this};Graph.prototype.setNode=function(v,value){if(_.has(this._nodes,v)){if(arguments.length>1){this._nodes[v]=value}return this}this._nodes[v]=arguments.length>1?value:this._defaultNodeLabelFn(v);if(this._isCompound){this._parent[v]=GRAPH_NODE;this._children[v]={};this._children[GRAPH_NODE][v]=true}this._in[v]={};this._preds[v]={};this._out[v]={};this._sucs[v]={};++this._nodeCount;return this};Graph.prototype.node=function(v){return this._nodes[v]};Graph.prototype.hasNode=function(v){return _.has(this._nodes,v)};Graph.prototype.removeNode=function(v){var self=this;if(_.has(this._nodes,v)){var removeEdge=function(e){self.removeEdge(self._edgeObjs[e])};delete this._nodes[v];if(this._isCompound){this._removeFromParentsChildList(v);delete this._parent[v];_.each(this.children(v),function(child){this.setParent(child)},this);delete this._children[v]}_.each(_.keys(this._in[v]),removeEdge);delete this._in[v];delete this._preds[v];_.each(_.keys(this._out[v]),removeEdge);delete this._out[v];delete this._sucs[v];--this._nodeCount}return this};Graph.prototype.setParent=function(v,parent){if(!this._isCompound){throw new Error("Cannot set parent in a non-compound graph")}if(_.isUndefined(parent)){parent=GRAPH_NODE}else{for(var ancestor=parent;!_.isUndefined(ancestor);ancestor=this.parent(ancestor)){if(ancestor===v){throw new Error("Setting "+parent+" as parent of "+v+" would create create a cycle")}}this.setNode(parent)}this.setNode(v);this._removeFromParentsChildList(v);this._parent[v]=parent;this._children[parent][v]=true;return this};Graph.prototype._removeFromParentsChildList=function(v){delete this._children[this._parent[v]][v]};Graph.prototype.parent=function(v){if(this._isCompound){var parent=this._parent[v];if(parent!==GRAPH_NODE){return parent}}};Graph.prototype.children=function(v){if(_.isUndefined(v)){v=GRAPH_NODE}if(this._isCompound){var children=this._children[v];if(children){return _.keys(children)}}else if(v===GRAPH_NODE){return this.nodes()}else if(this.hasNode(v)){return[]}};Graph.prototype.predecessors=function(v){var predsV=this._preds[v];if(predsV){return _.keys(predsV)}};Graph.prototype.successors=function(v){var sucsV=this._sucs[v];if(sucsV){return _.keys(sucsV)}};Graph.prototype.neighbors=function(v){var preds=this.predecessors(v);if(preds){return _.union(preds,this.successors(v))}};Graph.prototype.setDefaultEdgeLabel=function(newDefault){if(!_.isFunction(newDefault)){newDefault=_.constant(newDefault)}this._defaultEdgeLabelFn=newDefault;return this};Graph.prototype.edgeCount=function(){return this._edgeCount};Graph.prototype.edges=function(){return _.values(this._edgeObjs)};Graph.prototype.setPath=function(vs,value){var self=this,args=arguments;_.reduce(vs,function(v,w){if(args.length>1){self.setEdge(v,w,value)}else{self.setEdge(v,w)}return w});return this};Graph.prototype.setEdge=function(v,w,value,name){var valueSpecified=arguments.length>2;v=String(v);w=String(w);if(!_.isUndefined(name)){name=String(name)}if(_.isPlainObject(arguments[0])){v=arguments[0].v;w=arguments[0].w;name=arguments[0].name;if(arguments.length===2){value=arguments[1];valueSpecified=true}}var e=edgeArgsToId(this._isDirected,v,w,name);if(_.has(this._edgeLabels,e)){if(valueSpecified){this._edgeLabels[e]=value}return this}if(!_.isUndefined(name)&&!this._isMultigraph){throw new Error("Cannot set a named edge when isMultigraph = false")}this.setNode(v);this.setNode(w);this._edgeLabels[e]=valueSpecified?value:this._defaultEdgeLabelFn(v,w,name);var edgeObj=edgeArgsToObj(this._isDirected,v,w,name);v=edgeObj.v;w=edgeObj.w;Object.freeze(edgeObj);this._edgeObjs[e]=edgeObj;incrementOrInitEntry(this._preds[w],v);incrementOrInitEntry(this._sucs[v],w);this._in[w][e]=edgeObj;this._out[v][e]=edgeObj;this._edgeCount++;return this};Graph.prototype.edge=function(v,w,name){var e=arguments.length===1?edgeObjToId(this._isDirected,arguments[0]):edgeArgsToId(this._isDirected,v,w,name);return this._edgeLabels[e]};Graph.prototype.hasEdge=function(v,w,name){var e=arguments.length===1?edgeObjToId(this._isDirected,arguments[0]):edgeArgsToId(this._isDirected,v,w,name);return _.has(this._edgeLabels,e)};Graph.prototype.removeEdge=function(v,w,name){var e=arguments.length===1?edgeObjToId(this._isDirected,arguments[0]):edgeArgsToId(this._isDirected,v,w,name),edge=this._edgeObjs[e];if(edge){v=edge.v;w=edge.w;delete this._edgeLabels[e];delete this._edgeObjs[e];decrementOrRemoveEntry(this._preds[w],v);decrementOrRemoveEntry(this._sucs[v],w);delete this._in[w][e];delete this._out[v][e];this._edgeCount--}return this};Graph.prototype.inEdges=function(v,u){var inV=this._in[v];if(inV){var edges=_.values(inV);if(!u){return edges}return _.filter(edges,function(edge){return edge.v===u})}};Graph.prototype.outEdges=function(v,w){var outV=this._out[v];if(outV){var edges=_.values(outV);if(!w){return edges}return _.filter(edges,function(edge){return edge.w===w})}};Graph.prototype.nodeEdges=function(v,w){var inEdges=this.inEdges(v,w);if(inEdges){return inEdges.concat(this.outEdges(v,w))}};function incrementOrInitEntry(map,k){if(_.has(map,k)){map[k]++}else{map[k]=1}}function decrementOrRemoveEntry(map,k){if(!--map[k]){delete map[k]}}function edgeArgsToId(isDirected,v,w,name){if(!isDirected&&v>w){var tmp=v;v=w;w=tmp}return v+EDGE_KEY_DELIM+w+EDGE_KEY_DELIM+(_.isUndefined(name)?DEFAULT_EDGE_NAME:name)}function edgeArgsToObj(isDirected,v,w,name){if(!isDirected&&v>w){var tmp=v;v=w;w=tmp}var edgeObj={v:v,w:w};if(name){edgeObj.name=name}return edgeObj}function edgeObjToId(isDirected,edgeObj){return edgeArgsToId(isDirected,edgeObj.v,edgeObj.w,edgeObj.name)}},{"./lodash":75}],73:[function(require,module,exports){module.exports={Graph:require("./graph"),version:require("./version")}},{"./graph":72,"./version":76}],74:[function(require,module,exports){var _=require("./lodash"),Graph=require("./graph");module.exports={write:write,read:read};function write(g){var json={options:{directed:g.isDirected(),multigraph:g.isMultigraph(),compound:g.isCompound()},nodes:writeNodes(g),edges:writeEdges(g)};if(!_.isUndefined(g.graph())){json.value=_.clone(g.graph())}return json}function writeNodes(g){return _.map(g.nodes(),function(v){var nodeValue=g.node(v),parent=g.parent(v),node={v:v};if(!_.isUndefined(nodeValue)){node.value=nodeValue}if(!_.isUndefined(parent)){node.parent=parent}return node})}function writeEdges(g){return _.map(g.edges(),function(e){var edgeValue=g.edge(e),edge={v:e.v,w:e.w};if(!_.isUndefined(e.name)){edge.name=e.name}if(!_.isUndefined(edgeValue)){edge.value=edgeValue}return edge})}function read(json){var g=new Graph(json.options).setGraph(json.value);_.each(json.nodes,function(entry){g.setNode(entry.v,entry.value);if(entry.parent){g.setParent(entry.v,entry.parent)}});_.each(json.edges,function(entry){g.setEdge({v:entry.v,w:entry.w,name:entry.name},entry.value)});return g}},{"./graph":72,"./lodash":75}],75:[function(require,module,exports){module.exports=require(20)},{"/Users/cpettitt/projects/dagre-d3/lib/lodash.js":20,lodash:77}],76:[function(require,module,exports){module.exports="0.9.1"},{}],77:[function(require,module,exports){(function(global){(function(){var undefined;var arrayPool=[],objectPool=[];var idCounter=0;var keyPrefix=+new Date+"";var largeArraySize=75;var maxPoolSize=40;var whitespace=" \f "+"\n\r\u2028\u2029"+" ᠎              ";var reEmptyStringLeading=/\b__p \+= '';/g,reEmptyStringMiddle=/\b(__p \+=) '' \+/g,reEmptyStringTrailing=/(__e\(.*?\)|\b__t\)) \+\n'';/g;var reEsTemplate=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;var reFlags=/\w*$/;var reFuncName=/^\s*function[ \n\r\t]+\w/;var reInterpolate=/<%=([\s\S]+?)%>/g;var reLeadingSpacesAndZeros=RegExp("^["+whitespace+"]*0+(?=.$)");var reNoMatch=/($^)/;var reThis=/\bthis\b/;var reUnescapedString=/['\n\r\t\u2028\u2029\\]/g;var contextProps=["Array","Boolean","Date","Function","Math","Number","Object","RegExp","String","_","attachEvent","clearTimeout","isFinite","isNaN","parseInt","setTimeout"];var templateCounter=0;var argsClass="[object Arguments]",arrayClass="[object Array]",boolClass="[object Boolean]",dateClass="[object Date]",funcClass="[object Function]",numberClass="[object Number]",objectClass="[object Object]",regexpClass="[object RegExp]",stringClass="[object String]";var cloneableClasses={};cloneableClasses[funcClass]=false;cloneableClasses[argsClass]=cloneableClasses[arrayClass]=cloneableClasses[boolClass]=cloneableClasses[dateClass]=cloneableClasses[numberClass]=cloneableClasses[objectClass]=cloneableClasses[regexpClass]=cloneableClasses[stringClass]=true;var debounceOptions={leading:false,maxWait:0,trailing:false};var descriptor={configurable:false,enumerable:false,value:null,writable:false};var objectTypes={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false};var stringEscapes={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};var root=objectTypes[typeof window]&&window||this;var freeExports=objectTypes[typeof exports]&&exports&&!exports.nodeType&&exports;var freeModule=objectTypes[typeof module]&&module&&!module.nodeType&&module;var moduleExports=freeModule&&freeModule.exports===freeExports&&freeExports;var freeGlobal=objectTypes[typeof global]&&global;if(freeGlobal&&(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal)){root=freeGlobal}function baseIndexOf(array,value,fromIndex){var index=(fromIndex||0)-1,length=array?array.length:0;while(++index-1?0:-1:cache?0:-1}function cachePush(value){var cache=this.cache,type=typeof value;if(type=="boolean"||value==null){cache[value]=true}else{if(type!="number"&&type!="string"){type="object"}var key=type=="number"?value:keyPrefix+value,typeCache=cache[type]||(cache[type]={});if(type=="object"){(typeCache[key]||(typeCache[key]=[])).push(value)}else{typeCache[key]=true}}}function charAtCallback(value){return value.charCodeAt(0)}function compareAscending(a,b){var ac=a.criteria,bc=b.criteria,index=-1,length=ac.length;while(++indexother||typeof value=="undefined"){return 1}if(value/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:reInterpolate,variable:"",imports:{_:lodash}};function baseBind(bindData){var func=bindData[0],partialArgs=bindData[2],thisArg=bindData[4];function bound(){if(partialArgs){var args=slice(partialArgs);push.apply(args,arguments)}if(this instanceof bound){var thisBinding=baseCreate(func.prototype),result=func.apply(thisBinding,args||arguments);return isObject(result)?result:thisBinding}return func.apply(thisArg,args||arguments)}setBindData(bound,bindData);return bound}function baseClone(value,isDeep,callback,stackA,stackB){if(callback){var result=callback(value);if(typeof result!="undefined"){return result}}var isObj=isObject(value);if(isObj){var className=toString.call(value);if(!cloneableClasses[className]){return value}var ctor=ctorByClass[className];switch(className){case boolClass:case dateClass:return new ctor(+value);case numberClass:case stringClass:return new ctor(value);case regexpClass:result=ctor(value.source,reFlags.exec(value));result.lastIndex=value.lastIndex;return result}}else{return value}var isArr=isArray(value);if(isDeep){var initedStack=!stackA;stackA||(stackA=getArray());stackB||(stackB=getArray());var length=stackA.length;while(length--){if(stackA[length]==value){return stackB[length]}}result=isArr?ctor(value.length):{}}else{result=isArr?slice(value):assign({},value)}if(isArr){if(hasOwnProperty.call(value,"index")){result.index=value.index}if(hasOwnProperty.call(value,"input")){result.input=value.input}}if(!isDeep){return result}stackA.push(value);stackB.push(result);(isArr?forEach:forOwn)(value,function(objValue,key){result[key]=baseClone(objValue,isDeep,callback,stackA,stackB)});if(initedStack){releaseArray(stackA);releaseArray(stackB)}return result}function baseCreate(prototype,properties){return isObject(prototype)?nativeCreate(prototype):{}}if(!nativeCreate){baseCreate=function(){function Object(){}return function(prototype){if(isObject(prototype)){Object.prototype=prototype;var result=new Object;Object.prototype=null}return result||context.Object()}}()}function baseCreateCallback(func,thisArg,argCount){if(typeof func!="function"){return identity}if(typeof thisArg=="undefined"||!("prototype"in func)){return func}var bindData=func.__bindData__;if(typeof bindData=="undefined"){if(support.funcNames){bindData=!func.name}bindData=bindData||!support.funcDecomp;if(!bindData){var source=fnToString.call(func);if(!support.funcNames){bindData=!reFuncName.test(source)}if(!bindData){bindData=reThis.test(source);setBindData(func,bindData)}}}if(bindData===false||bindData!==true&&bindData[1]&1){return func}switch(argCount){case 1:return function(value){return func.call(thisArg,value)};case 2:return function(a,b){return func.call(thisArg,a,b)};case 3:return function(value,index,collection){return func.call(thisArg,value,index,collection)};case 4:return function(accumulator,value,index,collection){return func.call(thisArg,accumulator,value,index,collection)}}return bind(func,thisArg)}function baseCreateWrapper(bindData){var func=bindData[0],bitmask=bindData[1],partialArgs=bindData[2],partialRightArgs=bindData[3],thisArg=bindData[4],arity=bindData[5];var isBind=bitmask&1,isBindKey=bitmask&2,isCurry=bitmask&4,isCurryBound=bitmask&8,key=func;function bound(){var thisBinding=isBind?thisArg:this;if(partialArgs){var args=slice(partialArgs);push.apply(args,arguments)}if(partialRightArgs||isCurry){args||(args=slice(arguments));if(partialRightArgs){push.apply(args,partialRightArgs)}if(isCurry&&args.length=largeArraySize&&indexOf===baseIndexOf,result=[];if(isLarge){var cache=createCache(values);if(cache){indexOf=cacheIndexOf;values=cache}else{isLarge=false}}while(++index-1}})}}stackA.pop();stackB.pop();if(initedStack){releaseArray(stackA);releaseArray(stackB)}return result}function baseMerge(object,source,callback,stackA,stackB){(isArray(source)?forEach:forOwn)(source,function(source,key){var found,isArr,result=source,value=object[key];if(source&&((isArr=isArray(source))||isPlainObject(source))){var stackLength=stackA.length;while(stackLength--){if(found=stackA[stackLength]==source){value=stackB[stackLength];break}}if(!found){var isShallow;if(callback){result=callback(value,source);if(isShallow=typeof result!="undefined"){value=result}}if(!isShallow){value=isArr?isArray(value)?value:[]:isPlainObject(value)?value:{}}stackA.push(source);stackB.push(value);if(!isShallow){baseMerge(value,source,callback,stackA,stackB)}}}else{if(callback){result=callback(value,source);if(typeof result=="undefined"){result=source}}if(typeof result!="undefined"){value=result}}object[key]=value})}function baseRandom(min,max){return min+floor(nativeRandom()*(max-min+1))}function baseUniq(array,isSorted,callback){var index=-1,indexOf=getIndexOf(),length=array?array.length:0,result=[];var isLarge=!isSorted&&length>=largeArraySize&&indexOf===baseIndexOf,seen=callback||isLarge?getArray():result;if(isLarge){var cache=createCache(seen);indexOf=cacheIndexOf;seen=cache}while(++index":">",'"':""","'":"'"};var htmlUnescapes=invert(htmlEscapes);var reEscapedHtml=RegExp("("+keys(htmlUnescapes).join("|")+")","g"),reUnescapedHtml=RegExp("["+keys(htmlEscapes).join("")+"]","g");var assign=function(object,source,guard){var index,iterable=object,result=iterable;if(!iterable)return result;var args=arguments,argsIndex=0,argsLength=typeof guard=="number"?2:args.length;if(argsLength>3&&typeof args[argsLength-2]=="function"){var callback=baseCreateCallback(args[--argsLength-1],args[argsLength--],2)}else if(argsLength>2&&typeof args[argsLength-1]=="function"){callback=args[--argsLength]}while(++argsIndex3&&typeof args[length-2]=="function"){var callback=baseCreateCallback(args[--length-1],args[length--],2)}else if(length>2&&typeof args[length-1]=="function"){callback=args[--length]}var sources=slice(arguments,1,length),index=-1,stackA=getArray(),stackB=getArray();while(++index-1}else if(typeof length=="number"){result=(isString(collection)?collection.indexOf(target,fromIndex):indexOf(collection,target,fromIndex))>-1}else{forOwn(collection,function(value){if(++index>=fromIndex){return!(result=value===target)}})}return result}var countBy=createAggregator(function(result,value,key){hasOwnProperty.call(result,key)?result[key]++:result[key]=1});function every(collection,callback,thisArg){var result=true;callback=lodash.createCallback(callback,thisArg,3);var index=-1,length=collection?collection.length:0;if(typeof length=="number"){while(++indexresult){result=value}}}else{callback=callback==null&&isString(collection)?charAtCallback:lodash.createCallback(callback,thisArg,3);forEach(collection,function(value,index,collection){var current=callback(value,index,collection);if(current>computed){computed=current;result=value}})}return result}function min(collection,callback,thisArg){var computed=Infinity,result=computed;if(typeof callback!="function"&&thisArg&&thisArg[callback]===collection){callback=null}if(callback==null&&isArray(collection)){var index=-1,length=collection.length;while(++index=largeArraySize&&createCache(argsIndex?args[argsIndex]:seen))}}var array=args[0],index=-1,length=array?array.length:0,result=[];outer:while(++index>>1;callback(array[mid])1?arguments:arguments[0],index=-1,length=array?max(pluck(array,"length")):0,result=Array(length<0?0:length);while(++index2?createWrapper(func,17,slice(arguments,2),null,thisArg):createWrapper(func,1,null,null,thisArg)}function bindAll(object){var funcs=arguments.length>1?baseFlatten(arguments,true,false,1):functions(object),index=-1,length=funcs.length;while(++index2?createWrapper(key,19,slice(arguments,2),null,object):createWrapper(key,3,null,null,object)}function compose(){var funcs=arguments,length=funcs.length;while(length--){if(!isFunction(funcs[length])){throw new TypeError}}return function(){var args=arguments,length=funcs.length;while(length--){args=[funcs[length].apply(this,args)]}return args[0]}}function curry(func,arity){arity=typeof arity=="number"?arity:+arity||func.length;return createWrapper(func,4,null,null,null,arity)}function debounce(func,wait,options){var args,maxTimeoutId,result,stamp,thisArg,timeoutId,trailingCall,lastCalled=0,maxWait=false,trailing=true;if(!isFunction(func)){throw new TypeError}wait=nativeMax(0,wait)||0;if(options===true){var leading=true;trailing=false}else if(isObject(options)){leading=options.leading;maxWait="maxWait"in options&&(nativeMax(wait,options.maxWait)||0);trailing="trailing"in options?options.trailing:trailing}var delayed=function(){var remaining=wait-(now()-stamp);if(remaining<=0){if(maxTimeoutId){clearTimeout(maxTimeoutId)}var isCalled=trailingCall;maxTimeoutId=timeoutId=trailingCall=undefined;if(isCalled){lastCalled=now();result=func.apply(thisArg,args);if(!timeoutId&&!maxTimeoutId){args=thisArg=null}}}else{timeoutId=setTimeout(delayed,remaining)}};var maxDelayed=function(){if(timeoutId){clearTimeout(timeoutId)}maxTimeoutId=timeoutId=trailingCall=undefined;if(trailing||maxWait!==wait){lastCalled=now();result=func.apply(thisArg,args);if(!timeoutId&&!maxTimeoutId){args=thisArg=null}}};return function(){args=arguments;stamp=now();thisArg=this;trailingCall=trailing&&(timeoutId||!leading);if(maxWait===false){var leadingCall=leading&&!timeoutId}else{if(!maxTimeoutId&&!leading){lastCalled=stamp}var remaining=maxWait-(stamp-lastCalled),isCalled=remaining<=0;if(isCalled){if(maxTimeoutId){maxTimeoutId=clearTimeout(maxTimeoutId)}lastCalled=stamp;result=func.apply(thisArg,args)}else if(!maxTimeoutId){maxTimeoutId=setTimeout(maxDelayed,remaining)}}if(isCalled&&timeoutId){timeoutId=clearTimeout(timeoutId)}else if(!timeoutId&&wait!==maxWait){timeoutId=setTimeout(delayed,wait)}if(leadingCall){isCalled=true;result=func.apply(thisArg,args)}if(isCalled&&!timeoutId&&!maxTimeoutId){args=thisArg=null}return result}}function defer(func){if(!isFunction(func)){throw new TypeError}var args=slice(arguments,1);return setTimeout(function(){func.apply(undefined,args)},1)}function delay(func,wait){if(!isFunction(func)){throw new TypeError}var args=slice(arguments,2);return setTimeout(function(){func.apply(undefined,args)},wait)}function memoize(func,resolver){if(!isFunction(func)){throw new TypeError}var memoized=function(){var cache=memoized.cache,key=resolver?resolver.apply(this,arguments):keyPrefix+arguments[0];return hasOwnProperty.call(cache,key)?cache[key]:cache[key]=func.apply(this,arguments)};memoized.cache={};return memoized}function once(func){var ran,result;if(!isFunction(func)){throw new TypeError}return function(){if(ran){return result}ran=true;result=func.apply(this,arguments); func=null;return result}}function partial(func){return createWrapper(func,16,slice(arguments,1))}function partialRight(func){return createWrapper(func,32,null,slice(arguments,1))}function throttle(func,wait,options){var leading=true,trailing=true;if(!isFunction(func)){throw new TypeError}if(options===false){leading=false}else if(isObject(options)){leading="leading"in options?options.leading:leading;trailing="trailing"in options?options.trailing:trailing}debounceOptions.leading=leading;debounceOptions.maxWait=wait;debounceOptions.trailing=trailing;return debounce(func,wait,debounceOptions)}function wrap(value,wrapper){return createWrapper(wrapper,16,[value])}function constant(value){return function(){return value}}function createCallback(func,thisArg,argCount){var type=typeof func;if(func==null||type=="function"){return baseCreateCallback(func,thisArg,argCount)}if(type!="object"){return property(func)}var props=keys(func),key=props[0],a=func[key];if(props.length==1&&a===a&&!isObject(a)){return function(object){var b=object[key];return a===b&&(a!==0||1/a==1/b)}}return function(object){var length=props.length,result=false;while(length--){if(!(result=baseIsEqual(object[props[length]],func[props[length]],null,true))){break}}return result}}function escape(string){return string==null?"":String(string).replace(reUnescapedHtml,escapeHtmlChar)}function identity(value){return value}function mixin(object,source,options){var chain=true,methodNames=source&&functions(source);if(!source||!options&&!methodNames.length){if(options==null){options=source}ctor=lodashWrapper;source=object;object=lodash;methodNames=functions(source)}if(options===false){chain=false}else if(isObject(options)&&"chain"in options){chain=options.chain}var ctor=object,isFunc=isFunction(ctor);forEach(methodNames,function(methodName){var func=object[methodName]=source[methodName];if(isFunc){ctor.prototype[methodName]=function(){var chainAll=this.__chain__,value=this.__wrapped__,args=[value];push.apply(args,arguments);var result=func.apply(object,args);if(chain||chainAll){if(value===result&&isObject(result)){return this}result=new ctor(result);result.__chain__=chainAll}return result}}})}function noConflict(){context._=oldDash;return this}function noop(){}var now=isNative(now=Date.now)&&now||function(){return(new Date).getTime()};var parseInt=nativeParseInt(whitespace+"08")==8?nativeParseInt:function(value,radix){return nativeParseInt(isString(value)?value.replace(reLeadingSpacesAndZeros,""):value,radix||0)};function property(key){return function(object){return object[key]}}function random(min,max,floating){var noMin=min==null,noMax=max==null;if(floating==null){if(typeof min=="boolean"&&noMax){floating=min;min=1}else if(!noMax&&typeof max=="boolean"){floating=max;noMax=true}}if(noMin&&noMax){max=1}min=+min||0;if(noMax){max=min;min=0}else{max=+max||0}if(floating||min%1||max%1){var rand=nativeRandom();return nativeMin(min+rand*(max-min+parseFloat("1e-"+((rand+"").length-1))),max)}return baseRandom(min,max)}function result(object,key){if(object){var value=object[key];return isFunction(value)?object[key]():value}}function template(text,data,options){var settings=lodash.templateSettings;text=String(text||"");options=defaults({},options,settings);var imports=defaults({},options.imports,settings.imports),importsKeys=keys(imports),importsValues=values(imports);var isEvaluating,index=0,interpolate=options.interpolate||reNoMatch,source="__p += '";var reDelimiters=RegExp((options.escape||reNoMatch).source+"|"+interpolate.source+"|"+(interpolate===reInterpolate?reEsTemplate:reNoMatch).source+"|"+(options.evaluate||reNoMatch).source+"|$","g");text.replace(reDelimiters,function(match,escapeValue,interpolateValue,esTemplateValue,evaluateValue,offset){interpolateValue||(interpolateValue=esTemplateValue);source+=text.slice(index,offset).replace(reUnescapedString,escapeStringChar);if(escapeValue){source+="' +\n__e("+escapeValue+") +\n'"}if(evaluateValue){isEvaluating=true;source+="';\n"+evaluateValue+";\n__p += '"}if(interpolateValue){source+="' +\n((__t = ("+interpolateValue+")) == null ? '' : __t) +\n'"}index=offset+match.length;return match});source+="';\n";var variable=options.variable,hasVariable=variable;if(!hasVariable){variable="obj";source="with ("+variable+") {\n"+source+"\n}\n"}source=(isEvaluating?source.replace(reEmptyStringLeading,""):source).replace(reEmptyStringMiddle,"$1").replace(reEmptyStringTrailing,"$1;");source="function("+variable+") {\n"+(hasVariable?"":variable+" || ("+variable+" = {});\n")+"var __t, __p = '', __e = _.escape"+(isEvaluating?", __j = Array.prototype.join;\n"+"function print() { __p += __j.call(arguments, '') }\n":";\n")+source+"return __p\n}";var sourceURL="\n/*\n//# sourceURL="+(options.sourceURL||"/lodash/template/source["+templateCounter++ +"]")+"\n*/";try{var result=Function(importsKeys,"return "+source+sourceURL).apply(undefined,importsValues)}catch(e){e.source=source;throw e}if(data){return result(data)}result.source=source;return result}function times(n,callback,thisArg){n=(n=+n)>-1?n:0;var index=-1,result=Array(n);callback=baseCreateCallback(callback,thisArg,1);while(++index=0;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function r(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r=-1&&!i;s--){var a=s>=0?arguments[s]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(n=a+"/"+n,i="/"===a.charAt(0))}return n=e(r(n.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+n||"."},n.normalize=function(t){var i=n.isAbsolute(t),s="/"===a(t,-1);return t=e(r(t.split("/"),function(t){return!!t}),!i).join("/"),t||i||(t="."),t&&s&&(t+="/"),(i?"/":"")+t},n.isAbsolute=function(t){return"/"===t.charAt(0)},n.join=function(){var t=Array.prototype.slice.call(arguments,0);return n.normalize(r(t,function(t){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},n.relative=function(t,e){function r(t){for(var e=0;e=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=n.resolve(t).substr(1),e=n.resolve(e).substr(1);for(var i=r(t.split("/")),s=r(e.split("/")),a=Math.min(i.length,s.length),o=a,c=0;a>c;c++)if(i[c]!==s[c]){o=c;break}for(var l=[],c=o;ce&&(e=t.length+e),t.substr(e,n)}}).call(this,t("1YiZ5S"))},{"1YiZ5S":3}],3:[function(t,e){function n(){}var r=e.exports={};r.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){var e=t.source;if((e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),n.length>0)){var r=n.shift();r()}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=n,r.addListener=n,r.once=n,r.off=n,r.removeListener=n,r.removeAllListeners=n,r.emit=n,r.binding=function(){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")}},{}],4:[function(t,e,n){(function(e){var r=t("./graphDb"),s=t("./parser/flow"),a=function(t,e){var n=Object.keys(t);n.forEach(function(n){var r,i,s=t[n],a="";for(i=0;i',c(a,r)}};n.version=function(){return"0.2.1"};var h=function(t,e){return"undefined"!=typeof e?!1:t===e};document.addEventListener("DOMContentLoaded",function(){"undefined"!=typeof mermaid_config?h(!0,mermaid_config.startOnLoad)&&l():l()},!1),e.mermaid={init:function(){l()},version:function(){return n.version()}}}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./graphDb":5,"./parser/flow":6}],5:[function(t,e,n){var r,i={},s=[];n.addVertex=function(t,e,n,r){console.log("Got node "+t+" "+n+" "+e+" styles: "+JSON.stringify(r)),"undefined"==typeof i[t]&&(i[t]={id:t,styles:[]}),"undefined"!=typeof e&&(i[t].text=e),"undefined"!=typeof n&&(i[t].type=n),"undefined"!=typeof r&&null!==r&&r.forEach(function(e){i[t].styles.push(e)})},n.addLink=function(t,e,n,r){var i={start:t,end:e,type:void 0,text:""},r=n.text;"undefined"!=typeof r&&(i.text=r),"undefined"!=typeof n&&(i.type=n.type),s.push(i)},n.updateLink=function(t,e){var n=t.substr(1);s[n].style=e},n.setDirection=function(t){r=t},n.getDirection=function(){return r},n.getVertices=function(){return i},n.getEdges=function(){return s},n.clear=function(){i={},s=[]},n.defaultStyle=function(){return"fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;"}},{}],6:[function(t,e,n){(function(r){var i=function(){function t(){this.yy={}}var e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,7],r=[2,10],i=[1,15],s=[1,16],a=[1,17],o=[1,18],c=[1,19],l=[1,20],h=[1,21],u=[1,22],f=[1,23],y=[1,24],d=[1,11],p=[6,9],g=[11,27,28,29,30,31,32,33,34,35,36,37,45],m=[2,7],_=[11,40,41,42,43],v=[9,11,18,20,21,22,23,24,40,41,42,43,44],b=[9,11,18,20,21,22,23,24,28,29,30,31,32,33,34,35,36,37,40,41,42,43,44],k=[9,11,18,20,21,22,23,24,27,28,29,30,31,32,33,34,35,36,37,40,41,42,43,44],x=[28,29,30,31,32,33,34,35,36,37],w=[28,29,30,31,32,33,34,35,36,37,44],S=[20,22,24,44],E=[1,75],A=[1,72],O=[1,70],I=[1,73],L=[1,71],T=[1,76],P=[1,74],$=[1,80],R=[11,31],N=[9,11,27,28,29,30,31,47,50],D={trace:function(){},yy:{},symbols_:{error:2,expressions:3,graphConfig:4,statements:5,EOF:6,spaceList:7,GRAPH:8,SPACE:9,DIR:10,SEMI:11,statement:12,verticeStatement:13,styleStatement:14,vertex:15,link:16,alphaNum:17,SQS:18,text:19,SQE:20,PS:21,PE:22,DIAMOND_START:23,DIAMOND_STOP:24,alphaNumStatement:25,alphaNumToken:26,MINUS:27,ALPHA:28,NUM:29,COLON:30,COMMA:31,PLUS:32,EQUALS:33,MULT:34,DOT:35,TAGSTART:36,TAGEND:37,linkStatement:38,arrowText:39,ARROW_POINT:40,ARROW_CIRCLE:41,ARROW_CROSS:42,ARROW_OPEN:43,PIPE:44,STYLE:45,stylesOpt:46,HEX:47,style:48,styleComponent:49,UNIT:50,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",8:"GRAPH",9:"SPACE",10:"DIR",11:"SEMI",18:"SQS",20:"SQE",21:"PS",22:"PE",23:"DIAMOND_START",24:"DIAMOND_STOP",27:"MINUS",28:"ALPHA",29:"NUM",30:"COLON",31:"COMMA",32:"PLUS",33:"EQUALS",34:"MULT",35:"DOT",36:"TAGSTART",37:"TAGEND",40:"ARROW_POINT",41:"ARROW_CIRCLE",42:"ARROW_CROSS",43:"ARROW_OPEN",44:"PIPE",45:"STYLE",47:"HEX",50:"UNIT"},productions_:[0,[3,3],[3,4],[4,4],[5,3],[5,1],[7,2],[7,1],[12,2],[12,2],[13,0],[13,3],[13,1],[15,4],[15,4],[15,4],[15,1],[17,1],[17,2],[25,1],[25,3],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[16,2],[16,1],[38,1],[38,1],[38,1],[38,1],[39,3],[19,3],[19,5],[19,1],[14,5],[14,5],[46,1],[46,3],[48,1],[48,2],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1]],performAction:function(t,e,n,r,i,s){var a=s.length-1;switch(i){case 2:this.$=s[a-3];break;case 3:r.setDirection(s[a-1]),this.$=s[a-1];break;case 11:r.addLink(s[a-2],s[a],s[a-1]),this.$="oy";break;case 12:this.$="yo";break;case 13:this.$=s[a-3],r.addVertex(s[a-3],s[a-1],"square");break;case 14:this.$=s[a-3],r.addVertex(s[a-3],s[a-1],"round");break;case 15:this.$=s[a-3],r.addVertex(s[a-3],s[a-1],"diamond");break;case 16:this.$=s[a],r.addVertex(s[a]);break;case 17:case 19:case 21:case 22:case 45:this.$=s[a];break;case 18:this.$=s[a-1]+""+s[a];break;case 20:this.$=s[a-2]+"-"+s[a];break;case 23:case 24:case 25:case 26:case 27:case 28:case 29:case 30:case 32:case 40:this.$=s[a];break;case 31:s[a-1].text=s[a],this.$=s[a-1];break;case 33:this.$={type:"arrow"};break;case 34:this.$={type:"arrow_circle"};break;case 35:this.$={type:"arrow_cross"};break;case 36:this.$={type:"arrow_open"};break;case 37:this.$=s[a-1];break;case 38:this.$=s[a-2]+" "+s[a];break;case 39:this.$=s[a-4]+" - "+s[a];break;case 41:this.$=s[a-4],r.addVertex(s[a-2],void 0,void 0,s[a]);break;case 42:this.$=s[a-4],r.updateLink(s[a-2],s[a]);break;case 43:this.$=[s[a]];break;case 44:s[a-2].push(s[a]),this.$=s[a-2];break;case 46:this.$=s[a-1]+s[a];break;case 47:case 48:case 49:case 50:case 51:case 52:case 53:this.$=s[a]}},table:[{3:1,4:2,8:[1,3]},{1:[3]},{5:4,7:5,9:n,11:r,12:6,13:8,14:9,15:10,17:12,25:13,26:14,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y,45:d},{9:[1,25]},{6:[1,26],7:27,9:n},{5:28,11:r,12:6,13:8,14:9,15:10,17:12,25:13,26:14,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y,45:d},e(p,[2,5]),e(g,m,{7:29,9:n}),{11:[1,30]},{11:[1,31]},{11:[2,12],16:32,38:33,40:[1,34],41:[1,35],42:[1,36],43:[1,37]},{9:[1,38]},e(_,[2,16],{18:[1,39],21:[1,40],23:[1,41]}),e(v,[2,17],{25:13,26:14,17:42,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y}),e(b,[2,19],{27:[1,43]}),e(k,[2,21]),e(k,[2,22]),e(k,[2,23]),e(k,[2,24]),e(k,[2,25]),e(k,[2,26]),e(k,[2,27]),e(k,[2,28]),e(k,[2,29]),e(k,[2,30]),{10:[1,44]},{1:[2,1]},{11:r,12:45,13:8,14:9,15:10,17:12,25:13,26:14,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y,45:d},{6:[1,46],7:27,9:n},e(g,[2,6]),e(p,[2,8]),e(p,[2,9]),{15:47,17:12,25:13,26:14,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y},e(x,[2,32],{39:48,44:[1,49]}),e(w,[2,33]),e(w,[2,34]),e(w,[2,35]),e(w,[2,36]),{17:50,25:13,26:14,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y,47:[1,51]},{17:53,19:52,25:13,26:14,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y},{17:53,19:54,25:13,26:14,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y},{17:53,19:55,25:13,26:14,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y},e(v,[2,18]),{26:56,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y},{11:[1,57]},e(p,[2,4]),{1:[2,2]},{11:[2,11]},e(x,[2,31]),{17:53,19:58,25:13,26:14,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y},{9:[1,59]},{9:[1,60]},{20:[1,61]},e(S,[2,40],{7:63,9:[1,62]}),{22:[1,64]},{24:[1,65]},e(b,[2,20]),e([9,11,28,29,30,31,32,33,34,35,36,37,45],[2,3]),{44:[1,66]},{9:E,27:A,28:O,29:I,30:L,46:67,47:T,48:68,49:69,50:P},{9:E,27:A,28:O,29:I,30:L,46:77,47:T,48:68,49:69,50:P},e(_,[2,13]),{7:29,9:n,17:53,19:78,25:13,26:14,27:m,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y},{27:[1,79]},e(_,[2,14]),e(_,[2,15]),e(x,[2,37]),{11:[2,41],31:$},e(R,[2,43],{49:81,9:E,27:A,28:O,29:I,30:L,47:T,50:P}),e(N,[2,45]),e(N,[2,47]),e(N,[2,48]),e(N,[2,49]),e(N,[2,50]),e(N,[2,51]),e(N,[2,52]),e(N,[2,53]),{11:[2,42],31:$},e(S,[2,38]),{7:82,9:n},{9:E,27:A,28:O,29:I,30:L,47:T,48:83,49:69,50:P},e(N,[2,46]),{17:53,19:84,25:13,26:14,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y},e(R,[2,44],{49:81,9:E,27:A,28:O,29:I,30:L,47:T,50:P}),e(S,[2,39])],defaultActions:{26:[2,1],46:[2,2],47:[2,11]},parseError:function(t,e){if(!e.recoverable)throw new Error(t);this.trace(t)},parse:function(t){function e(){var t;return t=d.lex()||f,"number"!=typeof t&&(t=n.symbols_[t]||t),t}var n=this,r=[0],i=[null],s=[],a=this.table,o="",c=0,l=0,h=0,u=2,f=1,y=s.slice.call(arguments,1),d=Object.create(this.lexer),p={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(p.yy[g]=this.yy[g]);d.setInput(t,p.yy),p.yy.lexer=d,p.yy.parser=this,"undefined"==typeof d.yylloc&&(d.yylloc={});var m=d.yylloc;s.push(m);var _=d.options&&d.options.ranges;this.parseError="function"==typeof p.yy.parseError?p.yy.parseError:Object.getPrototypeOf(this).parseError;for(var v,b,k,x,w,S,E,A,O,I={};;){if(k=r[r.length-1],this.defaultActions[k]?x=this.defaultActions[k]:((null===v||"undefined"==typeof v)&&(v=e()),x=a[k]&&a[k][v]),"undefined"==typeof x||!x.length||!x[0]){var L="";O=[];for(S in a[k])this.terminals_[S]&&S>u&&O.push("'"+this.terminals_[S]+"'");L=d.showPosition?"Parse error on line "+(c+1)+":\n"+d.showPosition()+"\nExpecting "+O.join(", ")+", got '"+(this.terminals_[v]||v)+"'":"Parse error on line "+(c+1)+": Unexpected "+(v==f?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(L,{text:d.match,token:this.terminals_[v]||v,line:d.yylineno,loc:m,expected:O})}if(x[0]instanceof Array&&x.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+v);switch(x[0]){case 1:r.push(v),i.push(d.yytext),s.push(d.yylloc),r.push(x[1]),v=null,b?(v=b,b=null):(l=d.yyleng,o=d.yytext,c=d.yylineno,m=d.yylloc,h>0&&h--);break;case 2:if(E=this.productions_[x[1]][1],I.$=i[i.length-E],I._$={first_line:s[s.length-(E||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(E||1)].first_column,last_column:s[s.length-1].last_column},_&&(I._$.range=[s[s.length-(E||1)].range[0],s[s.length-1].range[1]]),w=this.performAction.apply(I,[o,l,c,p.yy,x[1],i,s].concat(y)),"undefined"!=typeof w)return w;E&&(r=r.slice(0,-1*E*2),i=i.slice(0,-1*E),s=s.slice(0,-1*E)),r.push(this.productions_[x[1]][0]),i.push(I.$),s.push(I._$),A=a[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0}},M=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var e=t.match(/(?:\r\n?|\n).*/g);return e?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),r=t[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var s in i)this[s]=i[s];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var t,e,n,r;this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),s=0;se[0].length)){if(e=n,r=s,this.options.backtrack_lexer){if(t=this.test_match(n,i[s]),t!==!1)return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?(t=this.test_match(e,i[r]),t!==!1?t:!1):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){var t=this.conditionStack.length-1;return t>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return t=this.conditionStack.length-1-Math.abs(t||0),t>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return 45;case 1:return 8;case 2:return 10;case 3:return 10;case 4:return 47;case 5:return 29;case 6:return"BRKT";case 7:return 50;case 8:return 50;case 9:return 50;case 10:return 30;case 11:return 11;case 12:return 31;case 13:return 33;case 14:return 34;case 15:return 35;case 16:return 36;case 17:return 37;case 18:return 42;case 19:return 40;case 20:return 41;case 21:return 43;case 22:return 27;case 23:return 32;case 24:return 33;case 25:return 28;case 26:return 44;case 27:return 21;case 28:return 22;case 29:return 18;case 30:return 20;case 31:return 23;case 32:return 24;case 33:return 9;case 34:return"NEWLINE";case 35:return 6}},rules:[/^(?:style\b)/,/^(?:graph\b)/,/^(?:LR\b)/,/^(?:TD\b)/,/^(?:#[a-f0-9]+)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?:px\b)/,/^(?:pt\b)/,/^(?:dot\b)/,/^(?::)/,/^(?:;)/,/^(?:,)/,/^(?:=)/,/^(?:\*)/,/^(?:\.)/,/^(?:<)/,/^(?:>)/,/^(?:--[x])/,/^(?:-->)/,/^(?:--[o])/,/^(?:---)/,/^(?:-)/,/^(?:\+)/,/^(?:=)/,/^(?:[a-zåäöæøA-ZÅÄÖÆØ_]+)/,/^(?:\|)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:\s)/,/^(?:\n)/,/^(?:$)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35],inclusive:!0}}};return t}();return D.lexer=M,t.prototype=D,D.Parser=t,new t}();"undefined"!=typeof t&&"undefined"!=typeof n&&(n.parser=i,n.Parser=i.Parser,n.parse=function(){return i.parse.apply(i,arguments)},n.main=function(e){e[1]||(console.log("Usage: "+e[0]+" FILE"),r.exit(1));var i=t("fs").readFileSync(t("path").normalize(e[1]),"utf8");return n.parser.parse(i)},"undefined"!=typeof e&&t.main===e&&n.main(r.argv.slice(1)))}).call(this,t("1YiZ5S"))},{"1YiZ5S":3,fs:1,path:2}]},{},[4]); \ No newline at end of file +!function t(e,n,r){function s(a,o){if(!n[a]){if(!e[a]){var c="function"==typeof require&&require;if(!o&&c)return c(a,!0);if(i)return i(a,!0);throw new Error("Cannot find module '"+a+"'")}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return s(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a=0;r--){var s=t[r];"."===s?t.splice(r,1):".."===s?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function r(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r=-1&&!s;i--){var a=i>=0?arguments[i]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(n=a+"/"+n,s="/"===a.charAt(0))}return n=e(r(n.split("/"),function(t){return!!t}),!s).join("/"),(s?"/":"")+n||"."},n.normalize=function(t){var s=n.isAbsolute(t),i="/"===a(t,-1);return t=e(r(t.split("/"),function(t){return!!t}),!s).join("/"),t||s||(t="."),t&&i&&(t+="/"),(s?"/":"")+t},n.isAbsolute=function(t){return"/"===t.charAt(0)},n.join=function(){var t=Array.prototype.slice.call(arguments,0);return n.normalize(r(t,function(t){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},n.relative=function(t,e){function r(t){for(var e=0;e=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=n.resolve(t).substr(1),e=n.resolve(e).substr(1);for(var s=r(t.split("/")),i=r(e.split("/")),a=Math.min(s.length,i.length),o=a,c=0;a>c;c++)if(s[c]!==i[c]){o=c;break}for(var l=[],c=o;ce&&(e=t.length+e),t.substr(e,n)}}).call(this,t("1YiZ5S"))},{"1YiZ5S":3}],3:[function(t,e){function n(){}var r=e.exports={};r.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){var e=t.source;if((e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),n.length>0)){var r=n.shift();r()}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=n,r.addListener=n,r.once=n,r.off=n,r.removeListener=n,r.removeAllListeners=n,r.emit=n,r.binding=function(){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")}},{}],4:[function(t,e,n){(function(e){var r=t("./graphDb"),s=t("./parser/flow"),a=function(t,e){var n=Object.keys(t),s=function(t,e){var n;for(n=0;n',c(a,r)}};n.version=function(){return"0.2.1"};var h=function(t,e){return"undefined"!=typeof e?!1:t===e};document.addEventListener("DOMContentLoaded",function(){"undefined"!=typeof mermaid_config?h(!0,mermaid_config.startOnLoad)&&l():l()},!1),e.mermaid={init:function(){l()},version:function(){return n.version()}}}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./graphDb":5,"./parser/flow":6}],5:[function(t,e,n){var r,s={},i=[],a=[];n.addVertex=function(t,e,n,r){"undefined"==typeof s[t]&&(s[t]={id:t,styles:[],classes:[]}),"undefined"!=typeof e&&(s[t].text=e),"undefined"!=typeof n&&(s[t].type=n),"undefined"!=typeof n&&(s[t].type=n),"undefined"!=typeof r&&null!==r&&r.forEach(function(e){s[t].styles.push(e)})},n.addLink=function(t,e,n,r){var s={start:t,end:e,type:void 0,text:""},r=n.text;"undefined"!=typeof r&&(s.text=r),"undefined"!=typeof n&&(s.type=n.type),i.push(s)},n.updateLink=function(t,e){var n=t.substr(1);i[n].style=e},n.addClass=function(t,e){"undefined"==typeof a[t]&&(a[t]={id:t,styles:[]}),"undefined"!=typeof e&&null!==e&&e.forEach(function(e){console.log("Adding style"+e),a[t].styles.push(e)})},n.setDirection=function(t){r=t},n.setClass=function(t,e){console.log("Got id:"+t),t.indexOf(",")>0?t.split(",").forEach(function(t){"undefined"!=typeof s[t]&&s[t].classes.push(e)}):"undefined"!=typeof s[t]&&s[t].classes.push(e)},n.getDirection=function(){return r},n.getVertices=function(){return s},n.getEdges=function(){return i},n.getClasses=function(){return a},n.clear=function(){s={},a={},i=[]},n.defaultStyle=function(){return"fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;"}},{}],6:[function(t,e,n){(function(r){var s=function(){function t(){this.yy={}}var e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,7],r=[2,12],s=[1,19],i=[1,20],a=[1,21],o=[1,22],c=[1,23],l=[1,24],h=[1,25],u=[1,26],f=[1,27],y=[1,28],d=[1,14],p=[1,15],g=[1,13],m=[6,9],_=[11,29,30,31,32,33,34,35,36,37,38,39,47,49,50],v=[2,7],b=[11,42,43,44,45],k=[9,11,20,22,23,24,25,26,42,43,44,45,46],x=[9,11,20,22,23,24,25,26,30,31,32,33,34,35,36,37,38,39,42,43,44,45,46],S=[9,11,20,22,23,24,25,26,29,30,31,32,33,34,35,36,37,38,39,42,43,44,45,46],w=[30,31,32,33,34,35,36,37,38,39],E=[30,31,32,33,34,35,36,37,38,39,46],A=[22,24,26,46],L=[1,87],O=[1,84],I=[1,82],T=[1,85],$=[1,83],P=[1,88],D=[1,86],R=[1,94],N=[11,33],C=[9,11,29,30,31,32,33,51,54],M={trace:function(){},yy:{},symbols_:{error:2,expressions:3,graphConfig:4,statements:5,EOF:6,spaceList:7,GRAPH:8,SPACE:9,DIR:10,SEMI:11,statement:12,verticeStatement:13,styleStatement:14,classDefStatement:15,classStatement:16,vertex:17,link:18,alphaNum:19,SQS:20,text:21,SQE:22,PS:23,PE:24,DIAMOND_START:25,DIAMOND_STOP:26,alphaNumStatement:27,alphaNumToken:28,MINUS:29,ALPHA:30,NUM:31,COLON:32,COMMA:33,PLUS:34,EQUALS:35,MULT:36,DOT:37,TAGSTART:38,TAGEND:39,linkStatement:40,arrowText:41,ARROW_POINT:42,ARROW_CIRCLE:43,ARROW_CROSS:44,ARROW_OPEN:45,PIPE:46,CLASSDEF:47,stylesOpt:48,CLASS:49,STYLE:50,HEX:51,style:52,styleComponent:53,UNIT:54,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",8:"GRAPH",9:"SPACE",10:"DIR",11:"SEMI",20:"SQS",22:"SQE",23:"PS",24:"PE",25:"DIAMOND_START",26:"DIAMOND_STOP",29:"MINUS",30:"ALPHA",31:"NUM",32:"COLON",33:"COMMA",34:"PLUS",35:"EQUALS",36:"MULT",37:"DOT",38:"TAGSTART",39:"TAGEND",42:"ARROW_POINT",43:"ARROW_CIRCLE",44:"ARROW_CROSS",45:"ARROW_OPEN",46:"PIPE",47:"CLASSDEF",49:"CLASS",50:"STYLE",51:"HEX",54:"UNIT"},productions_:[0,[3,3],[3,4],[4,4],[5,3],[5,1],[7,2],[7,1],[12,2],[12,2],[12,2],[12,2],[13,0],[13,3],[13,1],[17,4],[17,4],[17,4],[17,1],[19,1],[19,2],[27,1],[27,3],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[18,2],[18,1],[40,1],[40,1],[40,1],[40,1],[41,3],[21,3],[21,5],[21,1],[15,5],[16,5],[14,5],[14,5],[48,1],[48,3],[52,1],[52,2],[53,1],[53,1],[53,1],[53,1],[53,1],[53,1],[53,1]],performAction:function(t,e,n,r,s,i){var a=i.length-1;switch(s){case 2:this.$=i[a-3];break;case 3:r.setDirection(i[a-1]),this.$=i[a-1];break;case 13:r.addLink(i[a-2],i[a],i[a-1]),this.$="oy";break;case 14:this.$="yo";break;case 15:this.$=i[a-3],r.addVertex(i[a-3],i[a-1],"square");break;case 16:this.$=i[a-3],r.addVertex(i[a-3],i[a-1],"round");break;case 17:this.$=i[a-3],r.addVertex(i[a-3],i[a-1],"diamond");break;case 18:this.$=i[a],r.addVertex(i[a]);break;case 19:case 21:case 23:case 24:case 49:this.$=i[a];break;case 20:this.$=i[a-1]+""+i[a];break;case 22:this.$=i[a-2]+"-"+i[a];break;case 25:case 26:case 27:case 28:case 29:case 30:case 31:case 32:case 34:case 42:this.$=i[a];break;case 33:i[a-1].text=i[a],this.$=i[a-1];break;case 35:this.$={type:"arrow"};break;case 36:this.$={type:"arrow_circle"};break;case 37:this.$={type:"arrow_cross"};break;case 38:this.$={type:"arrow_open"};break;case 39:this.$=i[a-1];break;case 40:this.$=i[a-2]+" "+i[a];break;case 41:this.$=i[a-4]+" - "+i[a];break;case 43:this.$=i[a-4],r.addClass(i[a-2],i[a]);break;case 44:this.$=i[a-4],r.setClass(i[a-2],i[a]);break;case 45:this.$=i[a-4],r.addVertex(i[a-2],void 0,void 0,i[a]);break;case 46:this.$=i[a-4],r.updateLink(i[a-2],i[a]);break;case 47:this.$=[i[a]];break;case 48:i[a-2].push(i[a]),this.$=i[a-2];break;case 50:this.$=i[a-1]+i[a];break;case 51:case 52:case 53:case 54:case 55:case 56:case 57:this.$=i[a]}},table:[{3:1,4:2,8:[1,3]},{1:[3]},{5:4,7:5,9:n,11:r,12:6,13:8,14:9,15:10,16:11,17:12,19:16,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y,47:d,49:p,50:g},{9:[1,29]},{6:[1,30],7:31,9:n},{5:32,11:r,12:6,13:8,14:9,15:10,16:11,17:12,19:16,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y,47:d,49:p,50:g},e(m,[2,5]),e(_,v,{7:33,9:n}),{11:[1,34]},{11:[1,35]},{11:[1,36]},{11:[1,37]},{11:[2,14],18:38,40:39,42:[1,40],43:[1,41],44:[1,42],45:[1,43]},{9:[1,44]},{9:[1,45]},{9:[1,46]},e(b,[2,18],{20:[1,47],23:[1,48],25:[1,49]}),e(k,[2,19],{27:17,28:18,19:50,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y}),e(x,[2,21],{29:[1,51]}),e(S,[2,23]),e(S,[2,24]),e(S,[2,25]),e(S,[2,26]),e(S,[2,27]),e(S,[2,28]),e(S,[2,29]),e(S,[2,30]),e(S,[2,31]),e(S,[2,32]),{10:[1,52]},{1:[2,1]},{11:r,12:53,13:8,14:9,15:10,16:11,17:12,19:16,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y,47:d,49:p,50:g},{6:[1,54],7:31,9:n},e(_,[2,6]),e(m,[2,8]),e(m,[2,9]),e(m,[2,10]),e(m,[2,11]),{17:55,19:16,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},e(w,[2,34],{41:56,46:[1,57]}),e(E,[2,35]),e(E,[2,36]),e(E,[2,37]),e(E,[2,38]),{19:58,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y,51:[1,59]},{19:60,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},{19:61,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},{19:63,21:62,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},{19:63,21:64,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},{19:63,21:65,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},e(k,[2,20]),{28:66,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},{11:[1,67]},e(m,[2,4]),{1:[2,2]},{11:[2,13]},e(w,[2,33]),{19:63,21:68,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},{9:[1,69]},{9:[1,70]},{9:[1,71]},{9:[1,72]},{22:[1,73]},e(A,[2,42],{7:75,9:[1,74]}),{24:[1,76]},{26:[1,77]},e(x,[2,22]),e([9,11,30,31,32,33,34,35,36,37,38,39,47,49,50],[2,3]),{46:[1,78]},{9:L,29:O,30:I,31:T,32:$,48:79,51:P,52:80,53:81,54:D},{9:L,29:O,30:I,31:T,32:$,48:89,51:P,52:80,53:81,54:D},{9:L,29:O,30:I,31:T,32:$,48:90,51:P,52:80,53:81,54:D},{19:91,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},e(b,[2,15]),{7:33,9:n,19:63,21:92,27:17,28:18,29:v,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},{29:[1,93]},e(b,[2,16]),e(b,[2,17]),e(w,[2,39]),{11:[2,45],33:R},e(N,[2,47],{53:95,9:L,29:O,30:I,31:T,32:$,51:P,54:D}),e(C,[2,49]),e(C,[2,51]),e(C,[2,52]),e(C,[2,53]),e(C,[2,54]),e(C,[2,55]),e(C,[2,56]),e(C,[2,57]),{11:[2,46],33:R},{11:[2,43],33:R},{11:[2,44]},e(A,[2,40]),{7:96,9:n},{9:L,29:O,30:I,31:T,32:$,51:P,52:97,53:81,54:D},e(C,[2,50]),{19:63,21:98,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},e(N,[2,48],{53:95,9:L,29:O,30:I,31:T,32:$,51:P,54:D}),e(A,[2,41])],defaultActions:{30:[2,1],54:[2,2],55:[2,13],91:[2,44]},parseError:function(t,e){if(!e.recoverable)throw new Error(t);this.trace(t)},parse:function(t){function e(){var t;return t=d.lex()||f,"number"!=typeof t&&(t=n.symbols_[t]||t),t}var n=this,r=[0],s=[null],i=[],a=this.table,o="",c=0,l=0,h=0,u=2,f=1,y=i.slice.call(arguments,1),d=Object.create(this.lexer),p={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(p.yy[g]=this.yy[g]);d.setInput(t,p.yy),p.yy.lexer=d,p.yy.parser=this,"undefined"==typeof d.yylloc&&(d.yylloc={});var m=d.yylloc;i.push(m);var _=d.options&&d.options.ranges;this.parseError="function"==typeof p.yy.parseError?p.yy.parseError:Object.getPrototypeOf(this).parseError;for(var v,b,k,x,S,w,E,A,L,O={};;){if(k=r[r.length-1],this.defaultActions[k]?x=this.defaultActions[k]:((null===v||"undefined"==typeof v)&&(v=e()),x=a[k]&&a[k][v]),"undefined"==typeof x||!x.length||!x[0]){var I="";L=[];for(w in a[k])this.terminals_[w]&&w>u&&L.push("'"+this.terminals_[w]+"'");I=d.showPosition?"Parse error on line "+(c+1)+":\n"+d.showPosition()+"\nExpecting "+L.join(", ")+", got '"+(this.terminals_[v]||v)+"'":"Parse error on line "+(c+1)+": Unexpected "+(v==f?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(I,{text:d.match,token:this.terminals_[v]||v,line:d.yylineno,loc:m,expected:L})}if(x[0]instanceof Array&&x.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+v);switch(x[0]){case 1:r.push(v),s.push(d.yytext),i.push(d.yylloc),r.push(x[1]),v=null,b?(v=b,b=null):(l=d.yyleng,o=d.yytext,c=d.yylineno,m=d.yylloc,h>0&&h--);break;case 2:if(E=this.productions_[x[1]][1],O.$=s[s.length-E],O._$={first_line:i[i.length-(E||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(E||1)].first_column,last_column:i[i.length-1].last_column},_&&(O._$.range=[i[i.length-(E||1)].range[0],i[i.length-1].range[1]]),S=this.performAction.apply(O,[o,l,c,p.yy,x[1],s,i].concat(y)),"undefined"!=typeof S)return S;E&&(r=r.slice(0,-1*E*2),s=s.slice(0,-1*E),i=i.slice(0,-1*E)),r.push(this.productions_[x[1]][0]),s.push(O.$),i.push(O._$),A=a[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0}},U=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var e=t.match(/(?:\r\n?|\n).*/g);return e?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var s=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,s;if(this.options.backtrack_lexer&&(s={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(s.yylloc.range=this.yylloc.range.slice(0))),r=t[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var i in s)this[i]=s[i];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var t,e,n,r;this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),i=0;ie[0].length)){if(e=n,r=i,this.options.backtrack_lexer){if(t=this.test_match(n,s[i]),t!==!1)return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?(t=this.test_match(e,s[r]),t!==!1?t:!1):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){var t=this.conditionStack.length-1;return t>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return t=this.conditionStack.length-1-Math.abs(t||0),t>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return 50;case 1:return 47;case 2:return 49;case 3:return 8;case 4:return 10;case 5:return 10;case 6:return 51;case 7:return 31;case 8:return"BRKT";case 9:return 54;case 10:return 54;case 11:return 54;case 12:return 32;case 13:return 11;case 14:return 33;case 15:return 35;case 16:return 36;case 17:return 37;case 18:return 38;case 19:return 39;case 20:return 44;case 21:return 42;case 22:return 43;case 23:return 45;case 24:return 29;case 25:return 34;case 26:return 35;case 27:return 30;case 28:return 46;case 29:return 23;case 30:return 24;case 31:return 20;case 32:return 22;case 33:return 25;case 34:return 26;case 35:return 9;case 36:return"NEWLINE";case 37:return 6}},rules:[/^(?:style\b)/,/^(?:classDef\b)/,/^(?:class\b)/,/^(?:graph\b)/,/^(?:LR\b)/,/^(?:TD\b)/,/^(?:#[a-f0-9]+)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?:px\b)/,/^(?:pt\b)/,/^(?:dot\b)/,/^(?::)/,/^(?:;)/,/^(?:,)/,/^(?:=)/,/^(?:\*)/,/^(?:\.)/,/^(?:<)/,/^(?:>)/,/^(?:--[x])/,/^(?:-->)/,/^(?:--[o])/,/^(?:---)/,/^(?:-)/,/^(?:\+)/,/^(?:=)/,/^(?:[a-zåäöæøA-ZÅÄÖÆØ_]+)/,/^(?:\|)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:\s)/,/^(?:\n)/,/^(?:$)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],inclusive:!0}}};return t}();return M.lexer=U,t.prototype=M,M.Parser=t,new t}();"undefined"!=typeof t&&"undefined"!=typeof n&&(n.parser=s,n.Parser=s.Parser,n.parse=function(){return s.parse.apply(s,arguments)},n.main=function(e){e[1]||(console.log("Usage: "+e[0]+" FILE"),r.exit(1));var s=t("fs").readFileSync(t("path").normalize(e[1]),"utf8");return n.parser.parse(s)},"undefined"!=typeof e&&t.main===e&&n.main(r.argv.slice(1)))}).call(this,t("1YiZ5S"))},{"1YiZ5S":3,fs:1,path:2}]},{},[4]); \ No newline at end of file diff --git a/dist/mermaid.slim.js b/dist/mermaid.slim.js index 5105f3d26..e64888ebd 100644 --- a/dist/mermaid.slim.js +++ b/dist/mermaid.slim.js @@ -306,20 +306,36 @@ var flow = require('./parser/flow'); var addVertices = function (vert, g) { var keys = Object.keys(vert); + var styleFromStyleArr = function(styleStr,arr){ + var i; + // Create a compound style definition from the style definitions found for the node in the graph definition + for (i = 0; i < arr.length; i++) { + if (typeof arr[i] !== 'undefined') { + styleStr = styleStr + arr[i] + ';'; + } + } + + return styleStr; + } + // Iterate through each item in the vertice object (containing all the vertices found) in the graph definition keys.forEach(function (id) { var vertice = vert[id]; var verticeText; var i; + var style = ''; - // Create a compound style definition from the style definitions found for the node in the graph definition - for (i = 0; i < vertice.styles.length; i++) { - if (typeof vertice.styles[i] !== 'undefined') { - style = style + vertice.styles[i] + ';'; - } + var classes = graph.getClasses(); + // Check if class is defined for the node + for (i = 0; i < vertice.classes.length; i++) { + style = styleFromStyleArr(style,classes[vertice.classes[i]].styles); } + + // Create a compound style definition from the style definitions found for the node in the graph definition + style = styleFromStyleArr(style, vertice.styles); + // Use vertice id as text in the box if no text is provided by the graph definition if (vertice.text === undefined) { verticeText = vertice.id; @@ -328,7 +344,7 @@ var addVertices = function (vert, g) { verticeText = vertice.text; } - // Create the node in the graph nased on defined form + // Create the node in the graph based on defined form if (vertice.type === 'round') { g.setNode(vertice.id, {label: verticeText, rx: 5, ry: 5, style: style}); } else { @@ -347,7 +363,9 @@ var addVertices = function (vert, g) { * @param g */ var addEdges = function (edges, g) { + var cnt=0; edges.forEach(function (edge) { + cnt++; // Set link type for rendering if(edge.type === 'arrow_open'){ @@ -358,22 +376,26 @@ var addEdges = function (edges, g) { } // Add the edge to the graph - if (edge.text === 'undefined') { + if (typeof edge.text === 'undefined') { if(typeof edge.style === 'undefined'){ - g.setEdge(edge.start, edge.end,{ arrowheadStyle: "fill: #333", arrowhead: aHead}); + g.setEdge(edge.start, edge.end,{ arrowheadStyle: "fill: #333", arrowhead: aHead},cnt); }else{ g.setEdge(edge.start, edge.end, { style: edge.style, arrowheadStyle: "fill: #333", arrowhead: aHead - }); + },cnt); } } + // Edge with text else { + if(typeof edge.style === 'undefined'){ - g.setEdge(edge.start, edge.end,{label: edge.text, arrowheadStyle: "fill: #33f", arrowhead: aHead}); + console.log('Edge with Text no style: '+edge.text); + g.setEdge(edge.start, edge.end,{label: edge.text, arrowheadStyle: "fill: #33f", arrowhead: aHead},cnt); }else{ + g.setEdge(edge.start, edge.end, { style: edge.style, arrowheadStyle: "fill: #333", label: edge.text, arrowhead: aHead - }); + },cnt); } } }); @@ -399,11 +421,12 @@ var drawChart = function (text, id) { } // Create the input mermaid.graph - var g = new dagreD3.graphlib.Graph() + var g = new dagreD3.graphlib.Graph({multigraph:true}) .setGraph({ rankdir: dir, marginx: 20, marginy: 20 + }) .setDefaultEdgeLabel(function () { return {}; @@ -550,6 +573,7 @@ global.mermaid = { var vertices = {}; var edges = []; +var classes = []; var direction; /** * Function called by parser when a node definition has been found @@ -559,9 +583,9 @@ var direction; * @param style */ exports.addVertex = function (id, text, type, style) { - console.log('Got node ' + id + ' ' + type + ' ' + text + ' styles: ' + JSON.stringify(style)); + //console.log('Got node ' + id + ' ' + type + ' ' + text + ' styles: ' + JSON.stringify(style)); if (typeof vertices[id] === 'undefined') { - vertices[id] = {id: id, styles: []}; + vertices[id] = {id: id, styles: [], classes:[]}; } if (typeof text !== 'undefined') { vertices[id].text = text; @@ -569,6 +593,9 @@ exports.addVertex = function (id, text, type, style) { if (typeof type !== 'undefined') { vertices[id].type = type; } + if (typeof type !== 'undefined') { + vertices[id].type = type; + } if (typeof style !== 'undefined') { if (style !== null) { style.forEach(function (s) { @@ -605,6 +632,22 @@ exports.updateLink = function (pos, style) { var position = pos.substr(1); edges[position].style = style; }; + +exports.addClass = function (id, style) { + if (typeof classes[id] === 'undefined') { + classes[id] = {id: id, styles: []}; + } + + if (typeof style !== 'undefined') { + if (style !== null) { + style.forEach(function (s) { + console.log('Adding style'+s) + classes[id].styles.push(s); + }); + } + } +}; + /** * Called by parser when a graph definition is found, stores the direction of the chart. * @param dir @@ -612,6 +655,26 @@ exports.updateLink = function (pos, style) { exports.setDirection = function (dir) { direction = dir; }; + +/** + * Called by parser when a graph definition is found, stores the direction of the chart. + * @param dir + */ +exports.setClass = function (id,className) { + console.log('Got id:'+id); + if(id.indexOf(',')>0){ + id.split(',').forEach(function(id2){ + if(typeof vertices[id2] !== 'undefined'){ + vertices[id2].classes.push(className); + } + }); + }else{ + if(typeof vertices[id] !== 'undefined'){ + vertices[id].classes.push(className); + } + } +}; + exports.getDirection = function () { return direction; }; @@ -631,11 +694,20 @@ exports.getEdges = function () { return edges; }; +/** + * Retrieval function for fetching the found class definitions after parsing has completed. + * @returns {{}|*|classes} + */ +exports.getClasses = function () { + return classes; +}; + /** * Clears the internal graph db so that a new graph can be parsed. */ exports.clear = function () { vertices = {}; + classes = {}; edges = []; }; /** @@ -723,12 +795,12 @@ exports.defaultStyle = function () { } */ var parser = (function(){ -var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,7],$V1=[2,10],$V2=[1,15],$V3=[1,16],$V4=[1,17],$V5=[1,18],$V6=[1,19],$V7=[1,20],$V8=[1,21],$V9=[1,22],$Va=[1,23],$Vb=[1,24],$Vc=[1,11],$Vd=[6,9],$Ve=[11,27,28,29,30,31,32,33,34,35,36,37,45],$Vf=[2,7],$Vg=[11,40,41,42,43],$Vh=[9,11,18,20,21,22,23,24,40,41,42,43,44],$Vi=[9,11,18,20,21,22,23,24,28,29,30,31,32,33,34,35,36,37,40,41,42,43,44],$Vj=[9,11,18,20,21,22,23,24,27,28,29,30,31,32,33,34,35,36,37,40,41,42,43,44],$Vk=[28,29,30,31,32,33,34,35,36,37],$Vl=[28,29,30,31,32,33,34,35,36,37,44],$Vm=[20,22,24,44],$Vn=[1,75],$Vo=[1,72],$Vp=[1,70],$Vq=[1,73],$Vr=[1,71],$Vs=[1,76],$Vt=[1,74],$Vu=[1,80],$Vv=[11,31],$Vw=[9,11,27,28,29,30,31,47,50]; +var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,7],$V1=[2,12],$V2=[1,19],$V3=[1,20],$V4=[1,21],$V5=[1,22],$V6=[1,23],$V7=[1,24],$V8=[1,25],$V9=[1,26],$Va=[1,27],$Vb=[1,28],$Vc=[1,14],$Vd=[1,15],$Ve=[1,13],$Vf=[6,9],$Vg=[11,29,30,31,32,33,34,35,36,37,38,39,47,49,50],$Vh=[2,7],$Vi=[11,42,43,44,45],$Vj=[9,11,20,22,23,24,25,26,42,43,44,45,46],$Vk=[9,11,20,22,23,24,25,26,30,31,32,33,34,35,36,37,38,39,42,43,44,45,46],$Vl=[9,11,20,22,23,24,25,26,29,30,31,32,33,34,35,36,37,38,39,42,43,44,45,46],$Vm=[30,31,32,33,34,35,36,37,38,39],$Vn=[30,31,32,33,34,35,36,37,38,39,46],$Vo=[22,24,26,46],$Vp=[1,87],$Vq=[1,84],$Vr=[1,82],$Vs=[1,85],$Vt=[1,83],$Vu=[1,88],$Vv=[1,86],$Vw=[1,94],$Vx=[11,33],$Vy=[9,11,29,30,31,32,33,51,54]; var parser = {trace: function trace() { }, yy: {}, -symbols_: {"error":2,"expressions":3,"graphConfig":4,"statements":5,"EOF":6,"spaceList":7,"GRAPH":8,"SPACE":9,"DIR":10,"SEMI":11,"statement":12,"verticeStatement":13,"styleStatement":14,"vertex":15,"link":16,"alphaNum":17,"SQS":18,"text":19,"SQE":20,"PS":21,"PE":22,"DIAMOND_START":23,"DIAMOND_STOP":24,"alphaNumStatement":25,"alphaNumToken":26,"MINUS":27,"ALPHA":28,"NUM":29,"COLON":30,"COMMA":31,"PLUS":32,"EQUALS":33,"MULT":34,"DOT":35,"TAGSTART":36,"TAGEND":37,"linkStatement":38,"arrowText":39,"ARROW_POINT":40,"ARROW_CIRCLE":41,"ARROW_CROSS":42,"ARROW_OPEN":43,"PIPE":44,"STYLE":45,"stylesOpt":46,"HEX":47,"style":48,"styleComponent":49,"UNIT":50,"$accept":0,"$end":1}, -terminals_: {2:"error",6:"EOF",8:"GRAPH",9:"SPACE",10:"DIR",11:"SEMI",18:"SQS",20:"SQE",21:"PS",22:"PE",23:"DIAMOND_START",24:"DIAMOND_STOP",27:"MINUS",28:"ALPHA",29:"NUM",30:"COLON",31:"COMMA",32:"PLUS",33:"EQUALS",34:"MULT",35:"DOT",36:"TAGSTART",37:"TAGEND",40:"ARROW_POINT",41:"ARROW_CIRCLE",42:"ARROW_CROSS",43:"ARROW_OPEN",44:"PIPE",45:"STYLE",47:"HEX",50:"UNIT"}, -productions_: [0,[3,3],[3,4],[4,4],[5,3],[5,1],[7,2],[7,1],[12,2],[12,2],[13,0],[13,3],[13,1],[15,4],[15,4],[15,4],[15,1],[17,1],[17,2],[25,1],[25,3],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[16,2],[16,1],[38,1],[38,1],[38,1],[38,1],[39,3],[19,3],[19,5],[19,1],[14,5],[14,5],[46,1],[46,3],[48,1],[48,2],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1]], +symbols_: {"error":2,"expressions":3,"graphConfig":4,"statements":5,"EOF":6,"spaceList":7,"GRAPH":8,"SPACE":9,"DIR":10,"SEMI":11,"statement":12,"verticeStatement":13,"styleStatement":14,"classDefStatement":15,"classStatement":16,"vertex":17,"link":18,"alphaNum":19,"SQS":20,"text":21,"SQE":22,"PS":23,"PE":24,"DIAMOND_START":25,"DIAMOND_STOP":26,"alphaNumStatement":27,"alphaNumToken":28,"MINUS":29,"ALPHA":30,"NUM":31,"COLON":32,"COMMA":33,"PLUS":34,"EQUALS":35,"MULT":36,"DOT":37,"TAGSTART":38,"TAGEND":39,"linkStatement":40,"arrowText":41,"ARROW_POINT":42,"ARROW_CIRCLE":43,"ARROW_CROSS":44,"ARROW_OPEN":45,"PIPE":46,"CLASSDEF":47,"stylesOpt":48,"CLASS":49,"STYLE":50,"HEX":51,"style":52,"styleComponent":53,"UNIT":54,"$accept":0,"$end":1}, +terminals_: {2:"error",6:"EOF",8:"GRAPH",9:"SPACE",10:"DIR",11:"SEMI",20:"SQS",22:"SQE",23:"PS",24:"PE",25:"DIAMOND_START",26:"DIAMOND_STOP",29:"MINUS",30:"ALPHA",31:"NUM",32:"COLON",33:"COMMA",34:"PLUS",35:"EQUALS",36:"MULT",37:"DOT",38:"TAGSTART",39:"TAGEND",42:"ARROW_POINT",43:"ARROW_CIRCLE",44:"ARROW_CROSS",45:"ARROW_OPEN",46:"PIPE",47:"CLASSDEF",49:"CLASS",50:"STYLE",51:"HEX",54:"UNIT"}, +productions_: [0,[3,3],[3,4],[4,4],[5,3],[5,1],[7,2],[7,1],[12,2],[12,2],[12,2],[12,2],[13,0],[13,3],[13,1],[17,4],[17,4],[17,4],[17,1],[19,1],[19,2],[27,1],[27,3],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[18,2],[18,1],[40,1],[40,1],[40,1],[40,1],[41,3],[21,3],[21,5],[21,1],[15,5],[16,5],[14,5],[14,5],[48,1],[48,3],[52,1],[52,2],[53,1],[53,1],[53,1],[53,1],[53,1],[53,1],[53,1]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ @@ -740,82 +812,88 @@ break; case 3: yy.setDirection($$[$0-1]);this.$ = $$[$0-1]; break; -case 11: +case 13: yy.addLink($$[$0-2],$$[$0],$$[$0-1]);this.$ = 'oy' break; -case 12: +case 14: this.$ = 'yo'; break; -case 13: +case 15: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'square'); break; -case 14: +case 16: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'round'); break; -case 15: +case 17: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'diamond'); break; -case 16: +case 18: this.$ = $$[$0];yy.addVertex($$[$0]); break; -case 17: case 19: case 21: case 22: case 45: +case 19: case 21: case 23: case 24: case 49: this.$=$$[$0]; break; -case 18: +case 20: this.$=$$[$0-1]+''+$$[$0]; break; -case 20: +case 22: this.$=$$[$0-2]+'-'+$$[$0]; break; -case 23: case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 32: case 40: +case 25: case 26: case 27: case 28: case 29: case 30: case 31: case 32: case 34: case 42: this.$ = $$[$0]; break; -case 31: +case 33: $$[$0-1].text = $$[$0];this.$ = $$[$0-1]; break; -case 33: +case 35: this.$ = {"type":"arrow"}; break; -case 34: +case 36: this.$ = {"type":"arrow_circle"}; break; -case 35: +case 37: this.$ = {"type":"arrow_cross"}; break; -case 36: +case 38: this.$ = {"type":"arrow_open"}; break; -case 37: +case 39: this.$ = $$[$0-1]; break; -case 38: +case 40: this.$ = $$[$0-2] + ' ' +$$[$0]; break; -case 39: +case 41: this.$ = $$[$0-4] + ' - ' +$$[$0]; break; -case 41: -this.$ = $$[$0-4];yy.addVertex($$[$0-2],undefined,undefined,$$[$0]); -break; -case 42: -this.$ = $$[$0-4];yy.updateLink($$[$0-2],$$[$0]); -break; case 43: -this.$ = [$$[$0]] +this.$ = $$[$0-4];yy.addClass($$[$0-2],$$[$0]); break; case 44: -$$[$0-2].push($$[$0]);this.$ = $$[$0-2]; +this.$ = $$[$0-4];yy.setClass($$[$0-2], $$[$0]); +break; +case 45: +this.$ = $$[$0-4];yy.addVertex($$[$0-2],undefined,undefined,$$[$0]); break; case 46: +this.$ = $$[$0-4];yy.updateLink($$[$0-2],$$[$0]); +break; +case 47: +this.$ = [$$[$0]] +break; +case 48: +$$[$0-2].push($$[$0]);this.$ = $$[$0-2]; +break; +case 50: this.$ = $$[$0-1] + $$[$0]; break; -case 47: case 48: case 49: case 50: case 51: case 52: case 53: +case 51: case 52: case 53: case 54: case 55: case 56: case 57: this.$=$$[$0] break; } }, -table: [{3:1,4:2,8:[1,3]},{1:[3]},{5:4,7:5,9:$V0,11:$V1,12:6,13:8,14:9,15:10,17:12,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb,45:$Vc},{9:[1,25]},{6:[1,26],7:27,9:$V0},{5:28,11:$V1,12:6,13:8,14:9,15:10,17:12,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb,45:$Vc},o($Vd,[2,5]),o($Ve,$Vf,{7:29,9:$V0}),{11:[1,30]},{11:[1,31]},{11:[2,12],16:32,38:33,40:[1,34],41:[1,35],42:[1,36],43:[1,37]},{9:[1,38]},o($Vg,[2,16],{18:[1,39],21:[1,40],23:[1,41]}),o($Vh,[2,17],{25:13,26:14,17:42,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb}),o($Vi,[2,19],{27:[1,43]}),o($Vj,[2,21]),o($Vj,[2,22]),o($Vj,[2,23]),o($Vj,[2,24]),o($Vj,[2,25]),o($Vj,[2,26]),o($Vj,[2,27]),o($Vj,[2,28]),o($Vj,[2,29]),o($Vj,[2,30]),{10:[1,44]},{1:[2,1]},{11:$V1,12:45,13:8,14:9,15:10,17:12,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb,45:$Vc},{6:[1,46],7:27,9:$V0},o($Ve,[2,6]),o($Vd,[2,8]),o($Vd,[2,9]),{15:47,17:12,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},o($Vk,[2,32],{39:48,44:[1,49]}),o($Vl,[2,33]),o($Vl,[2,34]),o($Vl,[2,35]),o($Vl,[2,36]),{17:50,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb,47:[1,51]},{17:53,19:52,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},{17:53,19:54,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},{17:53,19:55,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},o($Vh,[2,18]),{26:56,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},{11:[1,57]},o($Vd,[2,4]),{1:[2,2]},{11:[2,11]},o($Vk,[2,31]),{17:53,19:58,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},{9:[1,59]},{9:[1,60]},{20:[1,61]},o($Vm,[2,40],{7:63,9:[1,62]}),{22:[1,64]},{24:[1,65]},o($Vi,[2,20]),o([9,11,28,29,30,31,32,33,34,35,36,37,45],[2,3]),{44:[1,66]},{9:$Vn,27:$Vo,28:$Vp,29:$Vq,30:$Vr,46:67,47:$Vs,48:68,49:69,50:$Vt},{9:$Vn,27:$Vo,28:$Vp,29:$Vq,30:$Vr,46:77,47:$Vs,48:68,49:69,50:$Vt},o($Vg,[2,13]),{7:29,9:$V0,17:53,19:78,25:13,26:14,27:$Vf,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},{27:[1,79]},o($Vg,[2,14]),o($Vg,[2,15]),o($Vk,[2,37]),{11:[2,41],31:$Vu},o($Vv,[2,43],{49:81,9:$Vn,27:$Vo,28:$Vp,29:$Vq,30:$Vr,47:$Vs,50:$Vt}),o($Vw,[2,45]),o($Vw,[2,47]),o($Vw,[2,48]),o($Vw,[2,49]),o($Vw,[2,50]),o($Vw,[2,51]),o($Vw,[2,52]),o($Vw,[2,53]),{11:[2,42],31:$Vu},o($Vm,[2,38]),{7:82,9:$V0},{9:$Vn,27:$Vo,28:$Vp,29:$Vq,30:$Vr,47:$Vs,48:83,49:69,50:$Vt},o($Vw,[2,46]),{17:53,19:84,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},o($Vv,[2,44],{49:81,9:$Vn,27:$Vo,28:$Vp,29:$Vq,30:$Vr,47:$Vs,50:$Vt}),o($Vm,[2,39])], -defaultActions: {26:[2,1],46:[2,2],47:[2,11]}, +table: [{3:1,4:2,8:[1,3]},{1:[3]},{5:4,7:5,9:$V0,11:$V1,12:6,13:8,14:9,15:10,16:11,17:12,19:16,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb,47:$Vc,49:$Vd,50:$Ve},{9:[1,29]},{6:[1,30],7:31,9:$V0},{5:32,11:$V1,12:6,13:8,14:9,15:10,16:11,17:12,19:16,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb,47:$Vc,49:$Vd,50:$Ve},o($Vf,[2,5]),o($Vg,$Vh,{7:33,9:$V0}),{11:[1,34]},{11:[1,35]},{11:[1,36]},{11:[1,37]},{11:[2,14],18:38,40:39,42:[1,40],43:[1,41],44:[1,42],45:[1,43]},{9:[1,44]},{9:[1,45]},{9:[1,46]},o($Vi,[2,18],{20:[1,47],23:[1,48],25:[1,49]}),o($Vj,[2,19],{27:17,28:18,19:50,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb}),o($Vk,[2,21],{29:[1,51]}),o($Vl,[2,23]),o($Vl,[2,24]),o($Vl,[2,25]),o($Vl,[2,26]),o($Vl,[2,27]),o($Vl,[2,28]),o($Vl,[2,29]),o($Vl,[2,30]),o($Vl,[2,31]),o($Vl,[2,32]),{10:[1,52]},{1:[2,1]},{11:$V1,12:53,13:8,14:9,15:10,16:11,17:12,19:16,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb,47:$Vc,49:$Vd,50:$Ve},{6:[1,54],7:31,9:$V0},o($Vg,[2,6]),o($Vf,[2,8]),o($Vf,[2,9]),o($Vf,[2,10]),o($Vf,[2,11]),{17:55,19:16,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},o($Vm,[2,34],{41:56,46:[1,57]}),o($Vn,[2,35]),o($Vn,[2,36]),o($Vn,[2,37]),o($Vn,[2,38]),{19:58,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb,51:[1,59]},{19:60,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},{19:61,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},{19:63,21:62,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},{19:63,21:64,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},{19:63,21:65,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},o($Vj,[2,20]),{28:66,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},{11:[1,67]},o($Vf,[2,4]),{1:[2,2]},{11:[2,13]},o($Vm,[2,33]),{19:63,21:68,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},{9:[1,69]},{9:[1,70]},{9:[1,71]},{9:[1,72]},{22:[1,73]},o($Vo,[2,42],{7:75,9:[1,74]}),{24:[1,76]},{26:[1,77]},o($Vk,[2,22]),o([9,11,30,31,32,33,34,35,36,37,38,39,47,49,50],[2,3]),{46:[1,78]},{9:$Vp,29:$Vq,30:$Vr,31:$Vs,32:$Vt,48:79,51:$Vu,52:80,53:81,54:$Vv},{9:$Vp,29:$Vq,30:$Vr,31:$Vs,32:$Vt,48:89,51:$Vu,52:80,53:81,54:$Vv},{9:$Vp,29:$Vq,30:$Vr,31:$Vs,32:$Vt,48:90,51:$Vu,52:80,53:81,54:$Vv},{19:91,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},o($Vi,[2,15]),{7:33,9:$V0,19:63,21:92,27:17,28:18,29:$Vh,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},{29:[1,93]},o($Vi,[2,16]),o($Vi,[2,17]),o($Vm,[2,39]),{11:[2,45],33:$Vw},o($Vx,[2,47],{53:95,9:$Vp,29:$Vq,30:$Vr,31:$Vs,32:$Vt,51:$Vu,54:$Vv}),o($Vy,[2,49]),o($Vy,[2,51]),o($Vy,[2,52]),o($Vy,[2,53]),o($Vy,[2,54]),o($Vy,[2,55]),o($Vy,[2,56]),o($Vy,[2,57]),{11:[2,46],33:$Vw},{11:[2,43],33:$Vw},{11:[2,44]},o($Vo,[2,40]),{7:96,9:$V0},{9:$Vp,29:$Vq,30:$Vr,31:$Vs,32:$Vt,51:$Vu,52:97,53:81,54:$Vv},o($Vy,[2,50]),{19:63,21:98,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},o($Vx,[2,48],{53:95,9:$Vp,29:$Vq,30:$Vr,31:$Vs,32:$Vt,51:$Vu,54:$Vv}),o($Vo,[2,41])], +defaultActions: {30:[2,1],54:[2,2],55:[2,13],91:[2,44]}, parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); @@ -1288,35 +1366,35 @@ options: {}, performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { var YYSTATE=YY_START; switch($avoiding_name_collisions) { -case 0:return 45; +case 0:return 50; break; -case 1:return 8; +case 1:return 47; break; -case 2:return 10; +case 2:return 49; break; -case 3:return 10; +case 3:return 8; break; -case 4:return 47; +case 4:return 10; break; -case 5:return 29; +case 5:return 10; break; -case 6:return 'BRKT'; +case 6:return 51; break; -case 7:return 50; +case 7:return 31; break; -case 8:return 50; +case 8:return 'BRKT'; break; -case 9:return 50; +case 9:return 54; break; -case 10:return 30; +case 10:return 54; break; -case 11:return 11; +case 11:return 54; break; -case 12:return 31; +case 12:return 32; break; -case 13:return 33; +case 13:return 11; break; -case 14:return 34; +case 14:return 33; break; case 15:return 35; break; @@ -1324,46 +1402,50 @@ case 16:return 36; break; case 17:return 37; break; -case 18:return 42; +case 18:return 38; break; -case 19:return 40; +case 19:return 39; break; -case 20:return 41; +case 20:return 44; break; -case 21:return 43; +case 21:return 42; break; -case 22:return 27; +case 22:return 43; break; -case 23:return 32; +case 23:return 45; break; -case 24:return 33; +case 24:return 29; break; -case 25:return 28; +case 25:return 34; break; -case 26:return 44; +case 26:return 35; break; -case 27:return 21; +case 27:return 30; break; -case 28:return 22; +case 28:return 46; break; -case 29:return 18; +case 29:return 23; break; -case 30:return 20; +case 30:return 24; break; -case 31:return 23 +case 31:return 20; break; -case 32:return 24 +case 32:return 22; break; -case 33:return 9; +case 33:return 25 break; -case 34:return 'NEWLINE'; +case 34:return 26 break; -case 35:return 6; +case 35:return 9; +break; +case 36:return 'NEWLINE'; +break; +case 37:return 6; break; } }, -rules: [/^(?:style\b)/,/^(?:graph\b)/,/^(?:LR\b)/,/^(?:TD\b)/,/^(?:#[a-f0-9]+)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?:px\b)/,/^(?:pt\b)/,/^(?:dot\b)/,/^(?::)/,/^(?:;)/,/^(?:,)/,/^(?:=)/,/^(?:\*)/,/^(?:\.)/,/^(?:<)/,/^(?:>)/,/^(?:--[x])/,/^(?:-->)/,/^(?:--[o])/,/^(?:---)/,/^(?:-)/,/^(?:\+)/,/^(?:=)/,/^(?:[a-zåäöæøA-ZÅÄÖÆØ_]+)/,/^(?:\|)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:\s)/,/^(?:\n)/,/^(?:$)/], -conditions: {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35],"inclusive":true}} +rules: [/^(?:style\b)/,/^(?:classDef\b)/,/^(?:class\b)/,/^(?:graph\b)/,/^(?:LR\b)/,/^(?:TD\b)/,/^(?:#[a-f0-9]+)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?:px\b)/,/^(?:pt\b)/,/^(?:dot\b)/,/^(?::)/,/^(?:;)/,/^(?:,)/,/^(?:=)/,/^(?:\*)/,/^(?:\.)/,/^(?:<)/,/^(?:>)/,/^(?:--[x])/,/^(?:-->)/,/^(?:--[o])/,/^(?:---)/,/^(?:-)/,/^(?:\+)/,/^(?:=)/,/^(?:[a-zåäöæøA-ZÅÄÖÆØ_]+)/,/^(?:\|)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:\s)/,/^(?:\n)/,/^(?:$)/], +conditions: {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"inclusive":true}} }); return lexer; })(); diff --git a/dist/mermaid.slim.min.js b/dist/mermaid.slim.min.js index faa868111..30db23c47 100644 --- a/dist/mermaid.slim.min.js +++ b/dist/mermaid.slim.min.js @@ -1 +1 @@ -!function t(e,n,r){function i(a,o){if(!n[a]){if(!e[a]){var c="function"==typeof require&&require;if(!o&&c)return c(a,!0);if(s)return s(a,!0);throw new Error("Cannot find module '"+a+"'")}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return i(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var s="function"==typeof require&&require,a=0;a=0;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function r(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r=-1&&!i;s--){var a=s>=0?arguments[s]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(n=a+"/"+n,i="/"===a.charAt(0))}return n=e(r(n.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+n||"."},n.normalize=function(t){var i=n.isAbsolute(t),s="/"===a(t,-1);return t=e(r(t.split("/"),function(t){return!!t}),!i).join("/"),t||i||(t="."),t&&s&&(t+="/"),(i?"/":"")+t},n.isAbsolute=function(t){return"/"===t.charAt(0)},n.join=function(){var t=Array.prototype.slice.call(arguments,0);return n.normalize(r(t,function(t){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},n.relative=function(t,e){function r(t){for(var e=0;e=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=n.resolve(t).substr(1),e=n.resolve(e).substr(1);for(var i=r(t.split("/")),s=r(e.split("/")),a=Math.min(i.length,s.length),o=a,c=0;a>c;c++)if(i[c]!==s[c]){o=c;break}for(var l=[],c=o;ce&&(e=t.length+e),t.substr(e,n)}}).call(this,t("1YiZ5S"))},{"1YiZ5S":3}],3:[function(t,e){function n(){}var r=e.exports={};r.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){var e=t.source;if((e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),n.length>0)){var r=n.shift();r()}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=n,r.addListener=n,r.once=n,r.off=n,r.removeListener=n,r.removeAllListeners=n,r.emit=n,r.binding=function(){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")}},{}],4:[function(t,e,n){(function(e){var r=t("./graphDb"),s=t("./parser/flow"),a=function(t,e){var n=Object.keys(t);n.forEach(function(n){var r,i,s=t[n],a="";for(i=0;i',c(a,r)}};n.version=function(){return"0.2.1"};var h=function(t,e){return"undefined"!=typeof e?!1:t===e};document.addEventListener("DOMContentLoaded",function(){"undefined"!=typeof mermaid_config?h(!0,mermaid_config.startOnLoad)&&l():l()},!1),e.mermaid={init:function(){l()},version:function(){return n.version()}}}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./graphDb":5,"./parser/flow":6}],5:[function(t,e,n){var r,i={},s=[];n.addVertex=function(t,e,n,r){console.log("Got node "+t+" "+n+" "+e+" styles: "+JSON.stringify(r)),"undefined"==typeof i[t]&&(i[t]={id:t,styles:[]}),"undefined"!=typeof e&&(i[t].text=e),"undefined"!=typeof n&&(i[t].type=n),"undefined"!=typeof r&&null!==r&&r.forEach(function(e){i[t].styles.push(e)})},n.addLink=function(t,e,n,r){var i={start:t,end:e,type:void 0,text:""},r=n.text;"undefined"!=typeof r&&(i.text=r),"undefined"!=typeof n&&(i.type=n.type),s.push(i)},n.updateLink=function(t,e){var n=t.substr(1);s[n].style=e},n.setDirection=function(t){r=t},n.getDirection=function(){return r},n.getVertices=function(){return i},n.getEdges=function(){return s},n.clear=function(){i={},s=[]},n.defaultStyle=function(){return"fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;"}},{}],6:[function(t,e,n){(function(r){var i=function(){function t(){this.yy={}}var e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,7],r=[2,10],i=[1,15],s=[1,16],a=[1,17],o=[1,18],c=[1,19],l=[1,20],h=[1,21],u=[1,22],f=[1,23],y=[1,24],d=[1,11],p=[6,9],g=[11,27,28,29,30,31,32,33,34,35,36,37,45],m=[2,7],_=[11,40,41,42,43],v=[9,11,18,20,21,22,23,24,40,41,42,43,44],b=[9,11,18,20,21,22,23,24,28,29,30,31,32,33,34,35,36,37,40,41,42,43,44],k=[9,11,18,20,21,22,23,24,27,28,29,30,31,32,33,34,35,36,37,40,41,42,43,44],x=[28,29,30,31,32,33,34,35,36,37],w=[28,29,30,31,32,33,34,35,36,37,44],S=[20,22,24,44],E=[1,75],A=[1,72],O=[1,70],I=[1,73],L=[1,71],T=[1,76],P=[1,74],$=[1,80],R=[11,31],N=[9,11,27,28,29,30,31,47,50],D={trace:function(){},yy:{},symbols_:{error:2,expressions:3,graphConfig:4,statements:5,EOF:6,spaceList:7,GRAPH:8,SPACE:9,DIR:10,SEMI:11,statement:12,verticeStatement:13,styleStatement:14,vertex:15,link:16,alphaNum:17,SQS:18,text:19,SQE:20,PS:21,PE:22,DIAMOND_START:23,DIAMOND_STOP:24,alphaNumStatement:25,alphaNumToken:26,MINUS:27,ALPHA:28,NUM:29,COLON:30,COMMA:31,PLUS:32,EQUALS:33,MULT:34,DOT:35,TAGSTART:36,TAGEND:37,linkStatement:38,arrowText:39,ARROW_POINT:40,ARROW_CIRCLE:41,ARROW_CROSS:42,ARROW_OPEN:43,PIPE:44,STYLE:45,stylesOpt:46,HEX:47,style:48,styleComponent:49,UNIT:50,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",8:"GRAPH",9:"SPACE",10:"DIR",11:"SEMI",18:"SQS",20:"SQE",21:"PS",22:"PE",23:"DIAMOND_START",24:"DIAMOND_STOP",27:"MINUS",28:"ALPHA",29:"NUM",30:"COLON",31:"COMMA",32:"PLUS",33:"EQUALS",34:"MULT",35:"DOT",36:"TAGSTART",37:"TAGEND",40:"ARROW_POINT",41:"ARROW_CIRCLE",42:"ARROW_CROSS",43:"ARROW_OPEN",44:"PIPE",45:"STYLE",47:"HEX",50:"UNIT"},productions_:[0,[3,3],[3,4],[4,4],[5,3],[5,1],[7,2],[7,1],[12,2],[12,2],[13,0],[13,3],[13,1],[15,4],[15,4],[15,4],[15,1],[17,1],[17,2],[25,1],[25,3],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[16,2],[16,1],[38,1],[38,1],[38,1],[38,1],[39,3],[19,3],[19,5],[19,1],[14,5],[14,5],[46,1],[46,3],[48,1],[48,2],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1]],performAction:function(t,e,n,r,i,s){var a=s.length-1;switch(i){case 2:this.$=s[a-3];break;case 3:r.setDirection(s[a-1]),this.$=s[a-1];break;case 11:r.addLink(s[a-2],s[a],s[a-1]),this.$="oy";break;case 12:this.$="yo";break;case 13:this.$=s[a-3],r.addVertex(s[a-3],s[a-1],"square");break;case 14:this.$=s[a-3],r.addVertex(s[a-3],s[a-1],"round");break;case 15:this.$=s[a-3],r.addVertex(s[a-3],s[a-1],"diamond");break;case 16:this.$=s[a],r.addVertex(s[a]);break;case 17:case 19:case 21:case 22:case 45:this.$=s[a];break;case 18:this.$=s[a-1]+""+s[a];break;case 20:this.$=s[a-2]+"-"+s[a];break;case 23:case 24:case 25:case 26:case 27:case 28:case 29:case 30:case 32:case 40:this.$=s[a];break;case 31:s[a-1].text=s[a],this.$=s[a-1];break;case 33:this.$={type:"arrow"};break;case 34:this.$={type:"arrow_circle"};break;case 35:this.$={type:"arrow_cross"};break;case 36:this.$={type:"arrow_open"};break;case 37:this.$=s[a-1];break;case 38:this.$=s[a-2]+" "+s[a];break;case 39:this.$=s[a-4]+" - "+s[a];break;case 41:this.$=s[a-4],r.addVertex(s[a-2],void 0,void 0,s[a]);break;case 42:this.$=s[a-4],r.updateLink(s[a-2],s[a]);break;case 43:this.$=[s[a]];break;case 44:s[a-2].push(s[a]),this.$=s[a-2];break;case 46:this.$=s[a-1]+s[a];break;case 47:case 48:case 49:case 50:case 51:case 52:case 53:this.$=s[a]}},table:[{3:1,4:2,8:[1,3]},{1:[3]},{5:4,7:5,9:n,11:r,12:6,13:8,14:9,15:10,17:12,25:13,26:14,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y,45:d},{9:[1,25]},{6:[1,26],7:27,9:n},{5:28,11:r,12:6,13:8,14:9,15:10,17:12,25:13,26:14,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y,45:d},e(p,[2,5]),e(g,m,{7:29,9:n}),{11:[1,30]},{11:[1,31]},{11:[2,12],16:32,38:33,40:[1,34],41:[1,35],42:[1,36],43:[1,37]},{9:[1,38]},e(_,[2,16],{18:[1,39],21:[1,40],23:[1,41]}),e(v,[2,17],{25:13,26:14,17:42,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y}),e(b,[2,19],{27:[1,43]}),e(k,[2,21]),e(k,[2,22]),e(k,[2,23]),e(k,[2,24]),e(k,[2,25]),e(k,[2,26]),e(k,[2,27]),e(k,[2,28]),e(k,[2,29]),e(k,[2,30]),{10:[1,44]},{1:[2,1]},{11:r,12:45,13:8,14:9,15:10,17:12,25:13,26:14,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y,45:d},{6:[1,46],7:27,9:n},e(g,[2,6]),e(p,[2,8]),e(p,[2,9]),{15:47,17:12,25:13,26:14,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y},e(x,[2,32],{39:48,44:[1,49]}),e(w,[2,33]),e(w,[2,34]),e(w,[2,35]),e(w,[2,36]),{17:50,25:13,26:14,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y,47:[1,51]},{17:53,19:52,25:13,26:14,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y},{17:53,19:54,25:13,26:14,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y},{17:53,19:55,25:13,26:14,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y},e(v,[2,18]),{26:56,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y},{11:[1,57]},e(p,[2,4]),{1:[2,2]},{11:[2,11]},e(x,[2,31]),{17:53,19:58,25:13,26:14,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y},{9:[1,59]},{9:[1,60]},{20:[1,61]},e(S,[2,40],{7:63,9:[1,62]}),{22:[1,64]},{24:[1,65]},e(b,[2,20]),e([9,11,28,29,30,31,32,33,34,35,36,37,45],[2,3]),{44:[1,66]},{9:E,27:A,28:O,29:I,30:L,46:67,47:T,48:68,49:69,50:P},{9:E,27:A,28:O,29:I,30:L,46:77,47:T,48:68,49:69,50:P},e(_,[2,13]),{7:29,9:n,17:53,19:78,25:13,26:14,27:m,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y},{27:[1,79]},e(_,[2,14]),e(_,[2,15]),e(x,[2,37]),{11:[2,41],31:$},e(R,[2,43],{49:81,9:E,27:A,28:O,29:I,30:L,47:T,50:P}),e(N,[2,45]),e(N,[2,47]),e(N,[2,48]),e(N,[2,49]),e(N,[2,50]),e(N,[2,51]),e(N,[2,52]),e(N,[2,53]),{11:[2,42],31:$},e(S,[2,38]),{7:82,9:n},{9:E,27:A,28:O,29:I,30:L,47:T,48:83,49:69,50:P},e(N,[2,46]),{17:53,19:84,25:13,26:14,28:i,29:s,30:a,31:o,32:c,33:l,34:h,35:u,36:f,37:y},e(R,[2,44],{49:81,9:E,27:A,28:O,29:I,30:L,47:T,50:P}),e(S,[2,39])],defaultActions:{26:[2,1],46:[2,2],47:[2,11]},parseError:function(t,e){if(!e.recoverable)throw new Error(t);this.trace(t)},parse:function(t){function e(){var t;return t=d.lex()||f,"number"!=typeof t&&(t=n.symbols_[t]||t),t}var n=this,r=[0],i=[null],s=[],a=this.table,o="",c=0,l=0,h=0,u=2,f=1,y=s.slice.call(arguments,1),d=Object.create(this.lexer),p={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(p.yy[g]=this.yy[g]);d.setInput(t,p.yy),p.yy.lexer=d,p.yy.parser=this,"undefined"==typeof d.yylloc&&(d.yylloc={});var m=d.yylloc;s.push(m);var _=d.options&&d.options.ranges;this.parseError="function"==typeof p.yy.parseError?p.yy.parseError:Object.getPrototypeOf(this).parseError;for(var v,b,k,x,w,S,E,A,O,I={};;){if(k=r[r.length-1],this.defaultActions[k]?x=this.defaultActions[k]:((null===v||"undefined"==typeof v)&&(v=e()),x=a[k]&&a[k][v]),"undefined"==typeof x||!x.length||!x[0]){var L="";O=[];for(S in a[k])this.terminals_[S]&&S>u&&O.push("'"+this.terminals_[S]+"'");L=d.showPosition?"Parse error on line "+(c+1)+":\n"+d.showPosition()+"\nExpecting "+O.join(", ")+", got '"+(this.terminals_[v]||v)+"'":"Parse error on line "+(c+1)+": Unexpected "+(v==f?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(L,{text:d.match,token:this.terminals_[v]||v,line:d.yylineno,loc:m,expected:O})}if(x[0]instanceof Array&&x.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+v);switch(x[0]){case 1:r.push(v),i.push(d.yytext),s.push(d.yylloc),r.push(x[1]),v=null,b?(v=b,b=null):(l=d.yyleng,o=d.yytext,c=d.yylineno,m=d.yylloc,h>0&&h--);break;case 2:if(E=this.productions_[x[1]][1],I.$=i[i.length-E],I._$={first_line:s[s.length-(E||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(E||1)].first_column,last_column:s[s.length-1].last_column},_&&(I._$.range=[s[s.length-(E||1)].range[0],s[s.length-1].range[1]]),w=this.performAction.apply(I,[o,l,c,p.yy,x[1],i,s].concat(y)),"undefined"!=typeof w)return w;E&&(r=r.slice(0,-1*E*2),i=i.slice(0,-1*E),s=s.slice(0,-1*E)),r.push(this.productions_[x[1]][0]),i.push(I.$),s.push(I._$),A=a[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0}},M=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var e=t.match(/(?:\r\n?|\n).*/g);return e?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),r=t[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var s in i)this[s]=i[s];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var t,e,n,r;this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),s=0;se[0].length)){if(e=n,r=s,this.options.backtrack_lexer){if(t=this.test_match(n,i[s]),t!==!1)return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?(t=this.test_match(e,i[r]),t!==!1?t:!1):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){var t=this.conditionStack.length-1;return t>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return t=this.conditionStack.length-1-Math.abs(t||0),t>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return 45;case 1:return 8;case 2:return 10;case 3:return 10;case 4:return 47;case 5:return 29;case 6:return"BRKT";case 7:return 50;case 8:return 50;case 9:return 50;case 10:return 30;case 11:return 11;case 12:return 31;case 13:return 33;case 14:return 34;case 15:return 35;case 16:return 36;case 17:return 37;case 18:return 42;case 19:return 40;case 20:return 41;case 21:return 43;case 22:return 27;case 23:return 32;case 24:return 33;case 25:return 28;case 26:return 44;case 27:return 21;case 28:return 22;case 29:return 18;case 30:return 20;case 31:return 23;case 32:return 24;case 33:return 9;case 34:return"NEWLINE";case 35:return 6}},rules:[/^(?:style\b)/,/^(?:graph\b)/,/^(?:LR\b)/,/^(?:TD\b)/,/^(?:#[a-f0-9]+)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?:px\b)/,/^(?:pt\b)/,/^(?:dot\b)/,/^(?::)/,/^(?:;)/,/^(?:,)/,/^(?:=)/,/^(?:\*)/,/^(?:\.)/,/^(?:<)/,/^(?:>)/,/^(?:--[x])/,/^(?:-->)/,/^(?:--[o])/,/^(?:---)/,/^(?:-)/,/^(?:\+)/,/^(?:=)/,/^(?:[a-zåäöæøA-ZÅÄÖÆØ_]+)/,/^(?:\|)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:\s)/,/^(?:\n)/,/^(?:$)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35],inclusive:!0}}};return t}();return D.lexer=M,t.prototype=D,D.Parser=t,new t}();"undefined"!=typeof t&&"undefined"!=typeof n&&(n.parser=i,n.Parser=i.Parser,n.parse=function(){return i.parse.apply(i,arguments)},n.main=function(e){e[1]||(console.log("Usage: "+e[0]+" FILE"),r.exit(1));var i=t("fs").readFileSync(t("path").normalize(e[1]),"utf8");return n.parser.parse(i)},"undefined"!=typeof e&&t.main===e&&n.main(r.argv.slice(1)))}).call(this,t("1YiZ5S"))},{"1YiZ5S":3,fs:1,path:2}]},{},[4]); \ No newline at end of file +!function t(e,n,r){function s(a,o){if(!n[a]){if(!e[a]){var c="function"==typeof require&&require;if(!o&&c)return c(a,!0);if(i)return i(a,!0);throw new Error("Cannot find module '"+a+"'")}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return s(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a=0;r--){var s=t[r];"."===s?t.splice(r,1):".."===s?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function r(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r=-1&&!s;i--){var a=i>=0?arguments[i]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(n=a+"/"+n,s="/"===a.charAt(0))}return n=e(r(n.split("/"),function(t){return!!t}),!s).join("/"),(s?"/":"")+n||"."},n.normalize=function(t){var s=n.isAbsolute(t),i="/"===a(t,-1);return t=e(r(t.split("/"),function(t){return!!t}),!s).join("/"),t||s||(t="."),t&&i&&(t+="/"),(s?"/":"")+t},n.isAbsolute=function(t){return"/"===t.charAt(0)},n.join=function(){var t=Array.prototype.slice.call(arguments,0);return n.normalize(r(t,function(t){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t}).join("/"))},n.relative=function(t,e){function r(t){for(var e=0;e=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=n.resolve(t).substr(1),e=n.resolve(e).substr(1);for(var s=r(t.split("/")),i=r(e.split("/")),a=Math.min(s.length,i.length),o=a,c=0;a>c;c++)if(s[c]!==i[c]){o=c;break}for(var l=[],c=o;ce&&(e=t.length+e),t.substr(e,n)}}).call(this,t("1YiZ5S"))},{"1YiZ5S":3}],3:[function(t,e){function n(){}var r=e.exports={};r.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var n=[];return window.addEventListener("message",function(t){var e=t.source;if((e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),n.length>0)){var r=n.shift();r()}},!0),function(t){n.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=n,r.addListener=n,r.once=n,r.off=n,r.removeListener=n,r.removeAllListeners=n,r.emit=n,r.binding=function(){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")}},{}],4:[function(t,e,n){(function(e){var r=t("./graphDb"),s=t("./parser/flow"),a=function(t,e){var n=Object.keys(t),s=function(t,e){var n;for(n=0;n',c(a,r)}};n.version=function(){return"0.2.1"};var h=function(t,e){return"undefined"!=typeof e?!1:t===e};document.addEventListener("DOMContentLoaded",function(){"undefined"!=typeof mermaid_config?h(!0,mermaid_config.startOnLoad)&&l():l()},!1),e.mermaid={init:function(){l()},version:function(){return n.version()}}}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./graphDb":5,"./parser/flow":6}],5:[function(t,e,n){var r,s={},i=[],a=[];n.addVertex=function(t,e,n,r){"undefined"==typeof s[t]&&(s[t]={id:t,styles:[],classes:[]}),"undefined"!=typeof e&&(s[t].text=e),"undefined"!=typeof n&&(s[t].type=n),"undefined"!=typeof n&&(s[t].type=n),"undefined"!=typeof r&&null!==r&&r.forEach(function(e){s[t].styles.push(e)})},n.addLink=function(t,e,n,r){var s={start:t,end:e,type:void 0,text:""},r=n.text;"undefined"!=typeof r&&(s.text=r),"undefined"!=typeof n&&(s.type=n.type),i.push(s)},n.updateLink=function(t,e){var n=t.substr(1);i[n].style=e},n.addClass=function(t,e){"undefined"==typeof a[t]&&(a[t]={id:t,styles:[]}),"undefined"!=typeof e&&null!==e&&e.forEach(function(e){console.log("Adding style"+e),a[t].styles.push(e)})},n.setDirection=function(t){r=t},n.setClass=function(t,e){console.log("Got id:"+t),t.indexOf(",")>0?t.split(",").forEach(function(t){"undefined"!=typeof s[t]&&s[t].classes.push(e)}):"undefined"!=typeof s[t]&&s[t].classes.push(e)},n.getDirection=function(){return r},n.getVertices=function(){return s},n.getEdges=function(){return i},n.getClasses=function(){return a},n.clear=function(){s={},a={},i=[]},n.defaultStyle=function(){return"fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;"}},{}],6:[function(t,e,n){(function(r){var s=function(){function t(){this.yy={}}var e=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},n=[1,7],r=[2,12],s=[1,19],i=[1,20],a=[1,21],o=[1,22],c=[1,23],l=[1,24],h=[1,25],u=[1,26],f=[1,27],y=[1,28],d=[1,14],p=[1,15],g=[1,13],m=[6,9],_=[11,29,30,31,32,33,34,35,36,37,38,39,47,49,50],v=[2,7],b=[11,42,43,44,45],k=[9,11,20,22,23,24,25,26,42,43,44,45,46],x=[9,11,20,22,23,24,25,26,30,31,32,33,34,35,36,37,38,39,42,43,44,45,46],S=[9,11,20,22,23,24,25,26,29,30,31,32,33,34,35,36,37,38,39,42,43,44,45,46],w=[30,31,32,33,34,35,36,37,38,39],E=[30,31,32,33,34,35,36,37,38,39,46],A=[22,24,26,46],L=[1,87],O=[1,84],I=[1,82],T=[1,85],$=[1,83],P=[1,88],D=[1,86],R=[1,94],N=[11,33],C=[9,11,29,30,31,32,33,51,54],M={trace:function(){},yy:{},symbols_:{error:2,expressions:3,graphConfig:4,statements:5,EOF:6,spaceList:7,GRAPH:8,SPACE:9,DIR:10,SEMI:11,statement:12,verticeStatement:13,styleStatement:14,classDefStatement:15,classStatement:16,vertex:17,link:18,alphaNum:19,SQS:20,text:21,SQE:22,PS:23,PE:24,DIAMOND_START:25,DIAMOND_STOP:26,alphaNumStatement:27,alphaNumToken:28,MINUS:29,ALPHA:30,NUM:31,COLON:32,COMMA:33,PLUS:34,EQUALS:35,MULT:36,DOT:37,TAGSTART:38,TAGEND:39,linkStatement:40,arrowText:41,ARROW_POINT:42,ARROW_CIRCLE:43,ARROW_CROSS:44,ARROW_OPEN:45,PIPE:46,CLASSDEF:47,stylesOpt:48,CLASS:49,STYLE:50,HEX:51,style:52,styleComponent:53,UNIT:54,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",8:"GRAPH",9:"SPACE",10:"DIR",11:"SEMI",20:"SQS",22:"SQE",23:"PS",24:"PE",25:"DIAMOND_START",26:"DIAMOND_STOP",29:"MINUS",30:"ALPHA",31:"NUM",32:"COLON",33:"COMMA",34:"PLUS",35:"EQUALS",36:"MULT",37:"DOT",38:"TAGSTART",39:"TAGEND",42:"ARROW_POINT",43:"ARROW_CIRCLE",44:"ARROW_CROSS",45:"ARROW_OPEN",46:"PIPE",47:"CLASSDEF",49:"CLASS",50:"STYLE",51:"HEX",54:"UNIT"},productions_:[0,[3,3],[3,4],[4,4],[5,3],[5,1],[7,2],[7,1],[12,2],[12,2],[12,2],[12,2],[13,0],[13,3],[13,1],[17,4],[17,4],[17,4],[17,1],[19,1],[19,2],[27,1],[27,3],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[18,2],[18,1],[40,1],[40,1],[40,1],[40,1],[41,3],[21,3],[21,5],[21,1],[15,5],[16,5],[14,5],[14,5],[48,1],[48,3],[52,1],[52,2],[53,1],[53,1],[53,1],[53,1],[53,1],[53,1],[53,1]],performAction:function(t,e,n,r,s,i){var a=i.length-1;switch(s){case 2:this.$=i[a-3];break;case 3:r.setDirection(i[a-1]),this.$=i[a-1];break;case 13:r.addLink(i[a-2],i[a],i[a-1]),this.$="oy";break;case 14:this.$="yo";break;case 15:this.$=i[a-3],r.addVertex(i[a-3],i[a-1],"square");break;case 16:this.$=i[a-3],r.addVertex(i[a-3],i[a-1],"round");break;case 17:this.$=i[a-3],r.addVertex(i[a-3],i[a-1],"diamond");break;case 18:this.$=i[a],r.addVertex(i[a]);break;case 19:case 21:case 23:case 24:case 49:this.$=i[a];break;case 20:this.$=i[a-1]+""+i[a];break;case 22:this.$=i[a-2]+"-"+i[a];break;case 25:case 26:case 27:case 28:case 29:case 30:case 31:case 32:case 34:case 42:this.$=i[a];break;case 33:i[a-1].text=i[a],this.$=i[a-1];break;case 35:this.$={type:"arrow"};break;case 36:this.$={type:"arrow_circle"};break;case 37:this.$={type:"arrow_cross"};break;case 38:this.$={type:"arrow_open"};break;case 39:this.$=i[a-1];break;case 40:this.$=i[a-2]+" "+i[a];break;case 41:this.$=i[a-4]+" - "+i[a];break;case 43:this.$=i[a-4],r.addClass(i[a-2],i[a]);break;case 44:this.$=i[a-4],r.setClass(i[a-2],i[a]);break;case 45:this.$=i[a-4],r.addVertex(i[a-2],void 0,void 0,i[a]);break;case 46:this.$=i[a-4],r.updateLink(i[a-2],i[a]);break;case 47:this.$=[i[a]];break;case 48:i[a-2].push(i[a]),this.$=i[a-2];break;case 50:this.$=i[a-1]+i[a];break;case 51:case 52:case 53:case 54:case 55:case 56:case 57:this.$=i[a]}},table:[{3:1,4:2,8:[1,3]},{1:[3]},{5:4,7:5,9:n,11:r,12:6,13:8,14:9,15:10,16:11,17:12,19:16,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y,47:d,49:p,50:g},{9:[1,29]},{6:[1,30],7:31,9:n},{5:32,11:r,12:6,13:8,14:9,15:10,16:11,17:12,19:16,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y,47:d,49:p,50:g},e(m,[2,5]),e(_,v,{7:33,9:n}),{11:[1,34]},{11:[1,35]},{11:[1,36]},{11:[1,37]},{11:[2,14],18:38,40:39,42:[1,40],43:[1,41],44:[1,42],45:[1,43]},{9:[1,44]},{9:[1,45]},{9:[1,46]},e(b,[2,18],{20:[1,47],23:[1,48],25:[1,49]}),e(k,[2,19],{27:17,28:18,19:50,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y}),e(x,[2,21],{29:[1,51]}),e(S,[2,23]),e(S,[2,24]),e(S,[2,25]),e(S,[2,26]),e(S,[2,27]),e(S,[2,28]),e(S,[2,29]),e(S,[2,30]),e(S,[2,31]),e(S,[2,32]),{10:[1,52]},{1:[2,1]},{11:r,12:53,13:8,14:9,15:10,16:11,17:12,19:16,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y,47:d,49:p,50:g},{6:[1,54],7:31,9:n},e(_,[2,6]),e(m,[2,8]),e(m,[2,9]),e(m,[2,10]),e(m,[2,11]),{17:55,19:16,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},e(w,[2,34],{41:56,46:[1,57]}),e(E,[2,35]),e(E,[2,36]),e(E,[2,37]),e(E,[2,38]),{19:58,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y,51:[1,59]},{19:60,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},{19:61,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},{19:63,21:62,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},{19:63,21:64,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},{19:63,21:65,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},e(k,[2,20]),{28:66,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},{11:[1,67]},e(m,[2,4]),{1:[2,2]},{11:[2,13]},e(w,[2,33]),{19:63,21:68,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},{9:[1,69]},{9:[1,70]},{9:[1,71]},{9:[1,72]},{22:[1,73]},e(A,[2,42],{7:75,9:[1,74]}),{24:[1,76]},{26:[1,77]},e(x,[2,22]),e([9,11,30,31,32,33,34,35,36,37,38,39,47,49,50],[2,3]),{46:[1,78]},{9:L,29:O,30:I,31:T,32:$,48:79,51:P,52:80,53:81,54:D},{9:L,29:O,30:I,31:T,32:$,48:89,51:P,52:80,53:81,54:D},{9:L,29:O,30:I,31:T,32:$,48:90,51:P,52:80,53:81,54:D},{19:91,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},e(b,[2,15]),{7:33,9:n,19:63,21:92,27:17,28:18,29:v,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},{29:[1,93]},e(b,[2,16]),e(b,[2,17]),e(w,[2,39]),{11:[2,45],33:R},e(N,[2,47],{53:95,9:L,29:O,30:I,31:T,32:$,51:P,54:D}),e(C,[2,49]),e(C,[2,51]),e(C,[2,52]),e(C,[2,53]),e(C,[2,54]),e(C,[2,55]),e(C,[2,56]),e(C,[2,57]),{11:[2,46],33:R},{11:[2,43],33:R},{11:[2,44]},e(A,[2,40]),{7:96,9:n},{9:L,29:O,30:I,31:T,32:$,51:P,52:97,53:81,54:D},e(C,[2,50]),{19:63,21:98,27:17,28:18,30:s,31:i,32:a,33:o,34:c,35:l,36:h,37:u,38:f,39:y},e(N,[2,48],{53:95,9:L,29:O,30:I,31:T,32:$,51:P,54:D}),e(A,[2,41])],defaultActions:{30:[2,1],54:[2,2],55:[2,13],91:[2,44]},parseError:function(t,e){if(!e.recoverable)throw new Error(t);this.trace(t)},parse:function(t){function e(){var t;return t=d.lex()||f,"number"!=typeof t&&(t=n.symbols_[t]||t),t}var n=this,r=[0],s=[null],i=[],a=this.table,o="",c=0,l=0,h=0,u=2,f=1,y=i.slice.call(arguments,1),d=Object.create(this.lexer),p={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(p.yy[g]=this.yy[g]);d.setInput(t,p.yy),p.yy.lexer=d,p.yy.parser=this,"undefined"==typeof d.yylloc&&(d.yylloc={});var m=d.yylloc;i.push(m);var _=d.options&&d.options.ranges;this.parseError="function"==typeof p.yy.parseError?p.yy.parseError:Object.getPrototypeOf(this).parseError;for(var v,b,k,x,S,w,E,A,L,O={};;){if(k=r[r.length-1],this.defaultActions[k]?x=this.defaultActions[k]:((null===v||"undefined"==typeof v)&&(v=e()),x=a[k]&&a[k][v]),"undefined"==typeof x||!x.length||!x[0]){var I="";L=[];for(w in a[k])this.terminals_[w]&&w>u&&L.push("'"+this.terminals_[w]+"'");I=d.showPosition?"Parse error on line "+(c+1)+":\n"+d.showPosition()+"\nExpecting "+L.join(", ")+", got '"+(this.terminals_[v]||v)+"'":"Parse error on line "+(c+1)+": Unexpected "+(v==f?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(I,{text:d.match,token:this.terminals_[v]||v,line:d.yylineno,loc:m,expected:L})}if(x[0]instanceof Array&&x.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+v);switch(x[0]){case 1:r.push(v),s.push(d.yytext),i.push(d.yylloc),r.push(x[1]),v=null,b?(v=b,b=null):(l=d.yyleng,o=d.yytext,c=d.yylineno,m=d.yylloc,h>0&&h--);break;case 2:if(E=this.productions_[x[1]][1],O.$=s[s.length-E],O._$={first_line:i[i.length-(E||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(E||1)].first_column,last_column:i[i.length-1].last_column},_&&(O._$.range=[i[i.length-(E||1)].range[0],i[i.length-1].range[1]]),S=this.performAction.apply(O,[o,l,c,p.yy,x[1],s,i].concat(y)),"undefined"!=typeof S)return S;E&&(r=r.slice(0,-1*E*2),s=s.slice(0,-1*E),i=i.slice(0,-1*E)),r.push(this.productions_[x[1]][0]),s.push(O.$),i.push(O._$),A=a[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0}},U=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var e=t.match(/(?:\r\n?|\n).*/g);return e?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var s=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var n,r,s;if(this.options.backtrack_lexer&&(s={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(s.yylloc.range=this.yylloc.range.slice(0))),r=t[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var i in s)this[i]=s[i];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var t,e,n,r;this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),i=0;ie[0].length)){if(e=n,r=i,this.options.backtrack_lexer){if(t=this.test_match(n,s[i]),t!==!1)return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?(t=this.test_match(e,s[r]),t!==!1?t:!1):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){var t=this.conditionStack.length-1;return t>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return t=this.conditionStack.length-1-Math.abs(t||0),t>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return 50;case 1:return 47;case 2:return 49;case 3:return 8;case 4:return 10;case 5:return 10;case 6:return 51;case 7:return 31;case 8:return"BRKT";case 9:return 54;case 10:return 54;case 11:return 54;case 12:return 32;case 13:return 11;case 14:return 33;case 15:return 35;case 16:return 36;case 17:return 37;case 18:return 38;case 19:return 39;case 20:return 44;case 21:return 42;case 22:return 43;case 23:return 45;case 24:return 29;case 25:return 34;case 26:return 35;case 27:return 30;case 28:return 46;case 29:return 23;case 30:return 24;case 31:return 20;case 32:return 22;case 33:return 25;case 34:return 26;case 35:return 9;case 36:return"NEWLINE";case 37:return 6}},rules:[/^(?:style\b)/,/^(?:classDef\b)/,/^(?:class\b)/,/^(?:graph\b)/,/^(?:LR\b)/,/^(?:TD\b)/,/^(?:#[a-f0-9]+)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?:px\b)/,/^(?:pt\b)/,/^(?:dot\b)/,/^(?::)/,/^(?:;)/,/^(?:,)/,/^(?:=)/,/^(?:\*)/,/^(?:\.)/,/^(?:<)/,/^(?:>)/,/^(?:--[x])/,/^(?:-->)/,/^(?:--[o])/,/^(?:---)/,/^(?:-)/,/^(?:\+)/,/^(?:=)/,/^(?:[a-zåäöæøA-ZÅÄÖÆØ_]+)/,/^(?:\|)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:\s)/,/^(?:\n)/,/^(?:$)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],inclusive:!0}}};return t}();return M.lexer=U,t.prototype=M,M.Parser=t,new t}();"undefined"!=typeof t&&"undefined"!=typeof n&&(n.parser=s,n.Parser=s.Parser,n.parse=function(){return s.parse.apply(s,arguments)},n.main=function(e){e[1]||(console.log("Usage: "+e[0]+" FILE"),r.exit(1));var s=t("fs").readFileSync(t("path").normalize(e[1]),"utf8");return n.parser.parse(s)},"undefined"!=typeof e&&t.main===e&&n.main(r.argv.slice(1)))}).call(this,t("1YiZ5S"))},{"1YiZ5S":3,fs:1,path:2}]},{},[4]); \ No newline at end of file diff --git a/src/graphDb.js b/src/graphDb.js index 71edb3a0b..ad175c997 100644 --- a/src/graphDb.js +++ b/src/graphDb.js @@ -4,6 +4,7 @@ var vertices = {}; var edges = []; +var classes = []; var direction; /** * Function called by parser when a node definition has been found @@ -13,9 +14,9 @@ var direction; * @param style */ exports.addVertex = function (id, text, type, style) { - console.log('Got node ' + id + ' ' + type + ' ' + text + ' styles: ' + JSON.stringify(style)); + //console.log('Got node ' + id + ' ' + type + ' ' + text + ' styles: ' + JSON.stringify(style)); if (typeof vertices[id] === 'undefined') { - vertices[id] = {id: id, styles: []}; + vertices[id] = {id: id, styles: [], classes:[]}; } if (typeof text !== 'undefined') { vertices[id].text = text; @@ -23,6 +24,9 @@ exports.addVertex = function (id, text, type, style) { if (typeof type !== 'undefined') { vertices[id].type = type; } + if (typeof type !== 'undefined') { + vertices[id].type = type; + } if (typeof style !== 'undefined') { if (style !== null) { style.forEach(function (s) { @@ -59,6 +63,22 @@ exports.updateLink = function (pos, style) { var position = pos.substr(1); edges[position].style = style; }; + +exports.addClass = function (id, style) { + if (typeof classes[id] === 'undefined') { + classes[id] = {id: id, styles: []}; + } + + if (typeof style !== 'undefined') { + if (style !== null) { + style.forEach(function (s) { + console.log('Adding style'+s) + classes[id].styles.push(s); + }); + } + } +}; + /** * Called by parser when a graph definition is found, stores the direction of the chart. * @param dir @@ -66,6 +86,26 @@ exports.updateLink = function (pos, style) { exports.setDirection = function (dir) { direction = dir; }; + +/** + * Called by parser when a graph definition is found, stores the direction of the chart. + * @param dir + */ +exports.setClass = function (id,className) { + console.log('Got id:'+id); + if(id.indexOf(',')>0){ + id.split(',').forEach(function(id2){ + if(typeof vertices[id2] !== 'undefined'){ + vertices[id2].classes.push(className); + } + }); + }else{ + if(typeof vertices[id] !== 'undefined'){ + vertices[id].classes.push(className); + } + } +}; + exports.getDirection = function () { return direction; }; @@ -85,11 +125,20 @@ exports.getEdges = function () { return edges; }; +/** + * Retrieval function for fetching the found class definitions after parsing has completed. + * @returns {{}|*|classes} + */ +exports.getClasses = function () { + return classes; +}; + /** * Clears the internal graph db so that a new graph can be parsed. */ exports.clear = function () { vertices = {}; + classes = {}; edges = []; }; /** diff --git a/src/main.js b/src/main.js index 691251211..ea2e9fdbb 100644 --- a/src/main.js +++ b/src/main.js @@ -9,20 +9,36 @@ var flow = require('./parser/flow'); var addVertices = function (vert, g) { var keys = Object.keys(vert); + var styleFromStyleArr = function(styleStr,arr){ + var i; + // Create a compound style definition from the style definitions found for the node in the graph definition + for (i = 0; i < arr.length; i++) { + if (typeof arr[i] !== 'undefined') { + styleStr = styleStr + arr[i] + ';'; + } + } + + return styleStr; + } + // Iterate through each item in the vertice object (containing all the vertices found) in the graph definition keys.forEach(function (id) { var vertice = vert[id]; var verticeText; var i; + var style = ''; - // Create a compound style definition from the style definitions found for the node in the graph definition - for (i = 0; i < vertice.styles.length; i++) { - if (typeof vertice.styles[i] !== 'undefined') { - style = style + vertice.styles[i] + ';'; - } + var classes = graph.getClasses(); + // Check if class is defined for the node + for (i = 0; i < vertice.classes.length; i++) { + style = styleFromStyleArr(style,classes[vertice.classes[i]].styles); } + + // Create a compound style definition from the style definitions found for the node in the graph definition + style = styleFromStyleArr(style, vertice.styles); + // Use vertice id as text in the box if no text is provided by the graph definition if (vertice.text === undefined) { verticeText = vertice.id; @@ -31,7 +47,7 @@ var addVertices = function (vert, g) { verticeText = vertice.text; } - // Create the node in the graph nased on defined form + // Create the node in the graph based on defined form if (vertice.type === 'round') { g.setNode(vertice.id, {label: verticeText, rx: 5, ry: 5, style: style}); } else { @@ -50,7 +66,9 @@ var addVertices = function (vert, g) { * @param g */ var addEdges = function (edges, g) { + var cnt=0; edges.forEach(function (edge) { + cnt++; // Set link type for rendering if(edge.type === 'arrow_open'){ @@ -61,22 +79,26 @@ var addEdges = function (edges, g) { } // Add the edge to the graph - if (edge.text === 'undefined') { + if (typeof edge.text === 'undefined') { if(typeof edge.style === 'undefined'){ - g.setEdge(edge.start, edge.end,{ arrowheadStyle: "fill: #333", arrowhead: aHead}); + g.setEdge(edge.start, edge.end,{ arrowheadStyle: "fill: #333", arrowhead: aHead},cnt); }else{ g.setEdge(edge.start, edge.end, { style: edge.style, arrowheadStyle: "fill: #333", arrowhead: aHead - }); + },cnt); } } + // Edge with text else { + if(typeof edge.style === 'undefined'){ - g.setEdge(edge.start, edge.end,{label: edge.text, arrowheadStyle: "fill: #33f", arrowhead: aHead}); + console.log('Edge with Text no style: '+edge.text); + g.setEdge(edge.start, edge.end,{label: edge.text, arrowheadStyle: "fill: #33f", arrowhead: aHead},cnt); }else{ + g.setEdge(edge.start, edge.end, { style: edge.style, arrowheadStyle: "fill: #333", label: edge.text, arrowhead: aHead - }); + },cnt); } } }); @@ -102,11 +124,12 @@ var drawChart = function (text, id) { } // Create the input mermaid.graph - var g = new dagreD3.graphlib.Graph() + var g = new dagreD3.graphlib.Graph({multigraph:true}) .setGraph({ rankdir: dir, marginx: 20, marginy: 20 + }) .setDefaultEdgeLabel(function () { return {}; diff --git a/src/parser/flow.jison b/src/parser/flow.jison index ca59bece2..f1bbcc4bf 100644 --- a/src/parser/flow.jison +++ b/src/parser/flow.jison @@ -5,6 +5,8 @@ %% "style" return 'STYLE'; +"classDef" return 'CLASSDEF'; +"class" return 'CLASS'; "graph" return 'GRAPH'; "LR" return 'DIR'; "TD" return 'DIR'; @@ -75,6 +77,8 @@ spaceList statement : verticeStatement SEMI | styleStatement SEMI + | classDefStatement SEMI + | classStatement SEMI ; verticeStatement: @@ -161,6 +165,14 @@ text: alphaNum SPACE text {$$ = $1;} ; +classDefStatement:CLASSDEF SPACE alphaNum SPACE stylesOpt + {$$ = $1;yy.addClass($3,$5);} + ; + +classStatement:CLASS SPACE alphaNum SPACE alphaNum + {$$ = $1;yy.setClass($3, $5);} + ; + styleStatement:STYLE SPACE alphaNum SPACE stylesOpt {$$ = $1;yy.addVertex($3,undefined,undefined,$5);} | STYLE SPACE HEX SPACE stylesOpt diff --git a/src/parser/flow.js b/src/parser/flow.js index 76d3d5128..d806f910b 100644 --- a/src/parser/flow.js +++ b/src/parser/flow.js @@ -72,12 +72,12 @@ } */ var parser = (function(){ -var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,7],$V1=[2,10],$V2=[1,15],$V3=[1,16],$V4=[1,17],$V5=[1,18],$V6=[1,19],$V7=[1,20],$V8=[1,21],$V9=[1,22],$Va=[1,23],$Vb=[1,24],$Vc=[1,11],$Vd=[6,9],$Ve=[11,27,28,29,30,31,32,33,34,35,36,37,45],$Vf=[2,7],$Vg=[11,40,41,42,43],$Vh=[9,11,18,20,21,22,23,24,40,41,42,43,44],$Vi=[9,11,18,20,21,22,23,24,28,29,30,31,32,33,34,35,36,37,40,41,42,43,44],$Vj=[9,11,18,20,21,22,23,24,27,28,29,30,31,32,33,34,35,36,37,40,41,42,43,44],$Vk=[28,29,30,31,32,33,34,35,36,37],$Vl=[28,29,30,31,32,33,34,35,36,37,44],$Vm=[20,22,24,44],$Vn=[1,75],$Vo=[1,72],$Vp=[1,70],$Vq=[1,73],$Vr=[1,71],$Vs=[1,76],$Vt=[1,74],$Vu=[1,80],$Vv=[11,31],$Vw=[9,11,27,28,29,30,31,47,50]; +var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,7],$V1=[2,12],$V2=[1,19],$V3=[1,20],$V4=[1,21],$V5=[1,22],$V6=[1,23],$V7=[1,24],$V8=[1,25],$V9=[1,26],$Va=[1,27],$Vb=[1,28],$Vc=[1,14],$Vd=[1,15],$Ve=[1,13],$Vf=[6,9],$Vg=[11,29,30,31,32,33,34,35,36,37,38,39,47,49,50],$Vh=[2,7],$Vi=[11,42,43,44,45],$Vj=[9,11,20,22,23,24,25,26,42,43,44,45,46],$Vk=[9,11,20,22,23,24,25,26,30,31,32,33,34,35,36,37,38,39,42,43,44,45,46],$Vl=[9,11,20,22,23,24,25,26,29,30,31,32,33,34,35,36,37,38,39,42,43,44,45,46],$Vm=[30,31,32,33,34,35,36,37,38,39],$Vn=[30,31,32,33,34,35,36,37,38,39,46],$Vo=[22,24,26,46],$Vp=[1,87],$Vq=[1,84],$Vr=[1,82],$Vs=[1,85],$Vt=[1,83],$Vu=[1,88],$Vv=[1,86],$Vw=[1,94],$Vx=[11,33],$Vy=[9,11,29,30,31,32,33,51,54]; var parser = {trace: function trace() { }, yy: {}, -symbols_: {"error":2,"expressions":3,"graphConfig":4,"statements":5,"EOF":6,"spaceList":7,"GRAPH":8,"SPACE":9,"DIR":10,"SEMI":11,"statement":12,"verticeStatement":13,"styleStatement":14,"vertex":15,"link":16,"alphaNum":17,"SQS":18,"text":19,"SQE":20,"PS":21,"PE":22,"DIAMOND_START":23,"DIAMOND_STOP":24,"alphaNumStatement":25,"alphaNumToken":26,"MINUS":27,"ALPHA":28,"NUM":29,"COLON":30,"COMMA":31,"PLUS":32,"EQUALS":33,"MULT":34,"DOT":35,"TAGSTART":36,"TAGEND":37,"linkStatement":38,"arrowText":39,"ARROW_POINT":40,"ARROW_CIRCLE":41,"ARROW_CROSS":42,"ARROW_OPEN":43,"PIPE":44,"STYLE":45,"stylesOpt":46,"HEX":47,"style":48,"styleComponent":49,"UNIT":50,"$accept":0,"$end":1}, -terminals_: {2:"error",6:"EOF",8:"GRAPH",9:"SPACE",10:"DIR",11:"SEMI",18:"SQS",20:"SQE",21:"PS",22:"PE",23:"DIAMOND_START",24:"DIAMOND_STOP",27:"MINUS",28:"ALPHA",29:"NUM",30:"COLON",31:"COMMA",32:"PLUS",33:"EQUALS",34:"MULT",35:"DOT",36:"TAGSTART",37:"TAGEND",40:"ARROW_POINT",41:"ARROW_CIRCLE",42:"ARROW_CROSS",43:"ARROW_OPEN",44:"PIPE",45:"STYLE",47:"HEX",50:"UNIT"}, -productions_: [0,[3,3],[3,4],[4,4],[5,3],[5,1],[7,2],[7,1],[12,2],[12,2],[13,0],[13,3],[13,1],[15,4],[15,4],[15,4],[15,1],[17,1],[17,2],[25,1],[25,3],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[16,2],[16,1],[38,1],[38,1],[38,1],[38,1],[39,3],[19,3],[19,5],[19,1],[14,5],[14,5],[46,1],[46,3],[48,1],[48,2],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1],[49,1]], +symbols_: {"error":2,"expressions":3,"graphConfig":4,"statements":5,"EOF":6,"spaceList":7,"GRAPH":8,"SPACE":9,"DIR":10,"SEMI":11,"statement":12,"verticeStatement":13,"styleStatement":14,"classDefStatement":15,"classStatement":16,"vertex":17,"link":18,"alphaNum":19,"SQS":20,"text":21,"SQE":22,"PS":23,"PE":24,"DIAMOND_START":25,"DIAMOND_STOP":26,"alphaNumStatement":27,"alphaNumToken":28,"MINUS":29,"ALPHA":30,"NUM":31,"COLON":32,"COMMA":33,"PLUS":34,"EQUALS":35,"MULT":36,"DOT":37,"TAGSTART":38,"TAGEND":39,"linkStatement":40,"arrowText":41,"ARROW_POINT":42,"ARROW_CIRCLE":43,"ARROW_CROSS":44,"ARROW_OPEN":45,"PIPE":46,"CLASSDEF":47,"stylesOpt":48,"CLASS":49,"STYLE":50,"HEX":51,"style":52,"styleComponent":53,"UNIT":54,"$accept":0,"$end":1}, +terminals_: {2:"error",6:"EOF",8:"GRAPH",9:"SPACE",10:"DIR",11:"SEMI",20:"SQS",22:"SQE",23:"PS",24:"PE",25:"DIAMOND_START",26:"DIAMOND_STOP",29:"MINUS",30:"ALPHA",31:"NUM",32:"COLON",33:"COMMA",34:"PLUS",35:"EQUALS",36:"MULT",37:"DOT",38:"TAGSTART",39:"TAGEND",42:"ARROW_POINT",43:"ARROW_CIRCLE",44:"ARROW_CROSS",45:"ARROW_OPEN",46:"PIPE",47:"CLASSDEF",49:"CLASS",50:"STYLE",51:"HEX",54:"UNIT"}, +productions_: [0,[3,3],[3,4],[4,4],[5,3],[5,1],[7,2],[7,1],[12,2],[12,2],[12,2],[12,2],[13,0],[13,3],[13,1],[17,4],[17,4],[17,4],[17,1],[19,1],[19,2],[27,1],[27,3],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[28,1],[18,2],[18,1],[40,1],[40,1],[40,1],[40,1],[41,3],[21,3],[21,5],[21,1],[15,5],[16,5],[14,5],[14,5],[48,1],[48,3],[52,1],[52,2],[53,1],[53,1],[53,1],[53,1],[53,1],[53,1],[53,1]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ @@ -89,82 +89,88 @@ break; case 3: yy.setDirection($$[$0-1]);this.$ = $$[$0-1]; break; -case 11: +case 13: yy.addLink($$[$0-2],$$[$0],$$[$0-1]);this.$ = 'oy' break; -case 12: +case 14: this.$ = 'yo'; break; -case 13: +case 15: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'square'); break; -case 14: +case 16: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'round'); break; -case 15: +case 17: this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'diamond'); break; -case 16: +case 18: this.$ = $$[$0];yy.addVertex($$[$0]); break; -case 17: case 19: case 21: case 22: case 45: +case 19: case 21: case 23: case 24: case 49: this.$=$$[$0]; break; -case 18: +case 20: this.$=$$[$0-1]+''+$$[$0]; break; -case 20: +case 22: this.$=$$[$0-2]+'-'+$$[$0]; break; -case 23: case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 32: case 40: +case 25: case 26: case 27: case 28: case 29: case 30: case 31: case 32: case 34: case 42: this.$ = $$[$0]; break; -case 31: +case 33: $$[$0-1].text = $$[$0];this.$ = $$[$0-1]; break; -case 33: +case 35: this.$ = {"type":"arrow"}; break; -case 34: +case 36: this.$ = {"type":"arrow_circle"}; break; -case 35: +case 37: this.$ = {"type":"arrow_cross"}; break; -case 36: +case 38: this.$ = {"type":"arrow_open"}; break; -case 37: +case 39: this.$ = $$[$0-1]; break; -case 38: +case 40: this.$ = $$[$0-2] + ' ' +$$[$0]; break; -case 39: +case 41: this.$ = $$[$0-4] + ' - ' +$$[$0]; break; -case 41: -this.$ = $$[$0-4];yy.addVertex($$[$0-2],undefined,undefined,$$[$0]); -break; -case 42: -this.$ = $$[$0-4];yy.updateLink($$[$0-2],$$[$0]); -break; case 43: -this.$ = [$$[$0]] +this.$ = $$[$0-4];yy.addClass($$[$0-2],$$[$0]); break; case 44: -$$[$0-2].push($$[$0]);this.$ = $$[$0-2]; +this.$ = $$[$0-4];yy.setClass($$[$0-2], $$[$0]); +break; +case 45: +this.$ = $$[$0-4];yy.addVertex($$[$0-2],undefined,undefined,$$[$0]); break; case 46: +this.$ = $$[$0-4];yy.updateLink($$[$0-2],$$[$0]); +break; +case 47: +this.$ = [$$[$0]] +break; +case 48: +$$[$0-2].push($$[$0]);this.$ = $$[$0-2]; +break; +case 50: this.$ = $$[$0-1] + $$[$0]; break; -case 47: case 48: case 49: case 50: case 51: case 52: case 53: +case 51: case 52: case 53: case 54: case 55: case 56: case 57: this.$=$$[$0] break; } }, -table: [{3:1,4:2,8:[1,3]},{1:[3]},{5:4,7:5,9:$V0,11:$V1,12:6,13:8,14:9,15:10,17:12,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb,45:$Vc},{9:[1,25]},{6:[1,26],7:27,9:$V0},{5:28,11:$V1,12:6,13:8,14:9,15:10,17:12,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb,45:$Vc},o($Vd,[2,5]),o($Ve,$Vf,{7:29,9:$V0}),{11:[1,30]},{11:[1,31]},{11:[2,12],16:32,38:33,40:[1,34],41:[1,35],42:[1,36],43:[1,37]},{9:[1,38]},o($Vg,[2,16],{18:[1,39],21:[1,40],23:[1,41]}),o($Vh,[2,17],{25:13,26:14,17:42,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb}),o($Vi,[2,19],{27:[1,43]}),o($Vj,[2,21]),o($Vj,[2,22]),o($Vj,[2,23]),o($Vj,[2,24]),o($Vj,[2,25]),o($Vj,[2,26]),o($Vj,[2,27]),o($Vj,[2,28]),o($Vj,[2,29]),o($Vj,[2,30]),{10:[1,44]},{1:[2,1]},{11:$V1,12:45,13:8,14:9,15:10,17:12,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb,45:$Vc},{6:[1,46],7:27,9:$V0},o($Ve,[2,6]),o($Vd,[2,8]),o($Vd,[2,9]),{15:47,17:12,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},o($Vk,[2,32],{39:48,44:[1,49]}),o($Vl,[2,33]),o($Vl,[2,34]),o($Vl,[2,35]),o($Vl,[2,36]),{17:50,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb,47:[1,51]},{17:53,19:52,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},{17:53,19:54,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},{17:53,19:55,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},o($Vh,[2,18]),{26:56,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},{11:[1,57]},o($Vd,[2,4]),{1:[2,2]},{11:[2,11]},o($Vk,[2,31]),{17:53,19:58,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},{9:[1,59]},{9:[1,60]},{20:[1,61]},o($Vm,[2,40],{7:63,9:[1,62]}),{22:[1,64]},{24:[1,65]},o($Vi,[2,20]),o([9,11,28,29,30,31,32,33,34,35,36,37,45],[2,3]),{44:[1,66]},{9:$Vn,27:$Vo,28:$Vp,29:$Vq,30:$Vr,46:67,47:$Vs,48:68,49:69,50:$Vt},{9:$Vn,27:$Vo,28:$Vp,29:$Vq,30:$Vr,46:77,47:$Vs,48:68,49:69,50:$Vt},o($Vg,[2,13]),{7:29,9:$V0,17:53,19:78,25:13,26:14,27:$Vf,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},{27:[1,79]},o($Vg,[2,14]),o($Vg,[2,15]),o($Vk,[2,37]),{11:[2,41],31:$Vu},o($Vv,[2,43],{49:81,9:$Vn,27:$Vo,28:$Vp,29:$Vq,30:$Vr,47:$Vs,50:$Vt}),o($Vw,[2,45]),o($Vw,[2,47]),o($Vw,[2,48]),o($Vw,[2,49]),o($Vw,[2,50]),o($Vw,[2,51]),o($Vw,[2,52]),o($Vw,[2,53]),{11:[2,42],31:$Vu},o($Vm,[2,38]),{7:82,9:$V0},{9:$Vn,27:$Vo,28:$Vp,29:$Vq,30:$Vr,47:$Vs,48:83,49:69,50:$Vt},o($Vw,[2,46]),{17:53,19:84,25:13,26:14,28:$V2,29:$V3,30:$V4,31:$V5,32:$V6,33:$V7,34:$V8,35:$V9,36:$Va,37:$Vb},o($Vv,[2,44],{49:81,9:$Vn,27:$Vo,28:$Vp,29:$Vq,30:$Vr,47:$Vs,50:$Vt}),o($Vm,[2,39])], -defaultActions: {26:[2,1],46:[2,2],47:[2,11]}, +table: [{3:1,4:2,8:[1,3]},{1:[3]},{5:4,7:5,9:$V0,11:$V1,12:6,13:8,14:9,15:10,16:11,17:12,19:16,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb,47:$Vc,49:$Vd,50:$Ve},{9:[1,29]},{6:[1,30],7:31,9:$V0},{5:32,11:$V1,12:6,13:8,14:9,15:10,16:11,17:12,19:16,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb,47:$Vc,49:$Vd,50:$Ve},o($Vf,[2,5]),o($Vg,$Vh,{7:33,9:$V0}),{11:[1,34]},{11:[1,35]},{11:[1,36]},{11:[1,37]},{11:[2,14],18:38,40:39,42:[1,40],43:[1,41],44:[1,42],45:[1,43]},{9:[1,44]},{9:[1,45]},{9:[1,46]},o($Vi,[2,18],{20:[1,47],23:[1,48],25:[1,49]}),o($Vj,[2,19],{27:17,28:18,19:50,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb}),o($Vk,[2,21],{29:[1,51]}),o($Vl,[2,23]),o($Vl,[2,24]),o($Vl,[2,25]),o($Vl,[2,26]),o($Vl,[2,27]),o($Vl,[2,28]),o($Vl,[2,29]),o($Vl,[2,30]),o($Vl,[2,31]),o($Vl,[2,32]),{10:[1,52]},{1:[2,1]},{11:$V1,12:53,13:8,14:9,15:10,16:11,17:12,19:16,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb,47:$Vc,49:$Vd,50:$Ve},{6:[1,54],7:31,9:$V0},o($Vg,[2,6]),o($Vf,[2,8]),o($Vf,[2,9]),o($Vf,[2,10]),o($Vf,[2,11]),{17:55,19:16,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},o($Vm,[2,34],{41:56,46:[1,57]}),o($Vn,[2,35]),o($Vn,[2,36]),o($Vn,[2,37]),o($Vn,[2,38]),{19:58,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb,51:[1,59]},{19:60,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},{19:61,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},{19:63,21:62,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},{19:63,21:64,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},{19:63,21:65,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},o($Vj,[2,20]),{28:66,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},{11:[1,67]},o($Vf,[2,4]),{1:[2,2]},{11:[2,13]},o($Vm,[2,33]),{19:63,21:68,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},{9:[1,69]},{9:[1,70]},{9:[1,71]},{9:[1,72]},{22:[1,73]},o($Vo,[2,42],{7:75,9:[1,74]}),{24:[1,76]},{26:[1,77]},o($Vk,[2,22]),o([9,11,30,31,32,33,34,35,36,37,38,39,47,49,50],[2,3]),{46:[1,78]},{9:$Vp,29:$Vq,30:$Vr,31:$Vs,32:$Vt,48:79,51:$Vu,52:80,53:81,54:$Vv},{9:$Vp,29:$Vq,30:$Vr,31:$Vs,32:$Vt,48:89,51:$Vu,52:80,53:81,54:$Vv},{9:$Vp,29:$Vq,30:$Vr,31:$Vs,32:$Vt,48:90,51:$Vu,52:80,53:81,54:$Vv},{19:91,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},o($Vi,[2,15]),{7:33,9:$V0,19:63,21:92,27:17,28:18,29:$Vh,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},{29:[1,93]},o($Vi,[2,16]),o($Vi,[2,17]),o($Vm,[2,39]),{11:[2,45],33:$Vw},o($Vx,[2,47],{53:95,9:$Vp,29:$Vq,30:$Vr,31:$Vs,32:$Vt,51:$Vu,54:$Vv}),o($Vy,[2,49]),o($Vy,[2,51]),o($Vy,[2,52]),o($Vy,[2,53]),o($Vy,[2,54]),o($Vy,[2,55]),o($Vy,[2,56]),o($Vy,[2,57]),{11:[2,46],33:$Vw},{11:[2,43],33:$Vw},{11:[2,44]},o($Vo,[2,40]),{7:96,9:$V0},{9:$Vp,29:$Vq,30:$Vr,31:$Vs,32:$Vt,51:$Vu,52:97,53:81,54:$Vv},o($Vy,[2,50]),{19:63,21:98,27:17,28:18,30:$V2,31:$V3,32:$V4,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,38:$Va,39:$Vb},o($Vx,[2,48],{53:95,9:$Vp,29:$Vq,30:$Vr,31:$Vs,32:$Vt,51:$Vu,54:$Vv}),o($Vo,[2,41])], +defaultActions: {30:[2,1],54:[2,2],55:[2,13],91:[2,44]}, parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); @@ -637,35 +643,35 @@ options: {}, performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { var YYSTATE=YY_START; switch($avoiding_name_collisions) { -case 0:return 45; +case 0:return 50; break; -case 1:return 8; +case 1:return 47; break; -case 2:return 10; +case 2:return 49; break; -case 3:return 10; +case 3:return 8; break; -case 4:return 47; +case 4:return 10; break; -case 5:return 29; +case 5:return 10; break; -case 6:return 'BRKT'; +case 6:return 51; break; -case 7:return 50; +case 7:return 31; break; -case 8:return 50; +case 8:return 'BRKT'; break; -case 9:return 50; +case 9:return 54; break; -case 10:return 30; +case 10:return 54; break; -case 11:return 11; +case 11:return 54; break; -case 12:return 31; +case 12:return 32; break; -case 13:return 33; +case 13:return 11; break; -case 14:return 34; +case 14:return 33; break; case 15:return 35; break; @@ -673,46 +679,50 @@ case 16:return 36; break; case 17:return 37; break; -case 18:return 42; +case 18:return 38; break; -case 19:return 40; +case 19:return 39; break; -case 20:return 41; +case 20:return 44; break; -case 21:return 43; +case 21:return 42; break; -case 22:return 27; +case 22:return 43; break; -case 23:return 32; +case 23:return 45; break; -case 24:return 33; +case 24:return 29; break; -case 25:return 28; +case 25:return 34; break; -case 26:return 44; +case 26:return 35; break; -case 27:return 21; +case 27:return 30; break; -case 28:return 22; +case 28:return 46; break; -case 29:return 18; +case 29:return 23; break; -case 30:return 20; +case 30:return 24; break; -case 31:return 23 +case 31:return 20; break; -case 32:return 24 +case 32:return 22; break; -case 33:return 9; +case 33:return 25 break; -case 34:return 'NEWLINE'; +case 34:return 26 break; -case 35:return 6; +case 35:return 9; +break; +case 36:return 'NEWLINE'; +break; +case 37:return 6; break; } }, -rules: [/^(?:style\b)/,/^(?:graph\b)/,/^(?:LR\b)/,/^(?:TD\b)/,/^(?:#[a-f0-9]+)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?:px\b)/,/^(?:pt\b)/,/^(?:dot\b)/,/^(?::)/,/^(?:;)/,/^(?:,)/,/^(?:=)/,/^(?:\*)/,/^(?:\.)/,/^(?:<)/,/^(?:>)/,/^(?:--[x])/,/^(?:-->)/,/^(?:--[o])/,/^(?:---)/,/^(?:-)/,/^(?:\+)/,/^(?:=)/,/^(?:[a-zåäöæøA-ZÅÄÖÆØ_]+)/,/^(?:\|)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:\s)/,/^(?:\n)/,/^(?:$)/], -conditions: {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35],"inclusive":true}} +rules: [/^(?:style\b)/,/^(?:classDef\b)/,/^(?:class\b)/,/^(?:graph\b)/,/^(?:LR\b)/,/^(?:TD\b)/,/^(?:#[a-f0-9]+)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?:px\b)/,/^(?:pt\b)/,/^(?:dot\b)/,/^(?::)/,/^(?:;)/,/^(?:,)/,/^(?:=)/,/^(?:\*)/,/^(?:\.)/,/^(?:<)/,/^(?:>)/,/^(?:--[x])/,/^(?:-->)/,/^(?:--[o])/,/^(?:---)/,/^(?:-)/,/^(?:\+)/,/^(?:=)/,/^(?:[a-zåäöæøA-ZÅÄÖÆØ_]+)/,/^(?:\|)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:\s)/,/^(?:\n)/,/^(?:$)/], +conditions: {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"inclusive":true}} }); return lexer; })(); diff --git a/src/parser/flow.spec.js b/src/parser/flow.spec.js index cf6528b68..aafe093f9 100644 --- a/src/parser/flow.spec.js +++ b/src/parser/flow.spec.js @@ -12,7 +12,6 @@ describe('when parsing ',function(){ /*flow.parser.parse.parseError= function parseError(str, hash) { console.log(str); }*/ - console.log('in mm spec'); }); it('should handle a nodes and edges',function(){ @@ -101,6 +100,22 @@ describe('when parsing ',function(){ expect(edges[1].text).toBe('more text with space'); }); + it('should handle multiple edges',function(){ + var res = flow.parser.parse('graph TD;A---|This is the 123 s text|B;\nA---|This is the second edge|B;'); + var vert = flow.parser.yy.getVertices(); + var edges = flow.parser.yy.getEdges(); + + expect(vert['A'].id).toBe('A'); + expect(vert['B'].id).toBe('B'); + expect(edges.length).toBe(2); + expect(edges[0].start).toBe('A'); + expect(edges[0].end).toBe('B'); + expect(edges[0].text).toBe('This is the 123 s text'); + expect(edges[1].start).toBe('A'); + expect(edges[1].end).toBe('B'); + expect(edges[1].text).toBe('This is the second edge'); + }); + it('should handle text in vertices with space',function(){ var res = flow.parser.parse('graph TD;A[chimpansen hoppar]-->C;'); @@ -268,7 +283,7 @@ describe('when parsing ',function(){ expect(vert['T'].styles[1]).toBe('border:1px solid red'); }); - ddescribe('special characters should be be handled.',function(){ + describe('special characters should be be handled.',function(){ var charTest = function(char){ var res = flow.parser.parse('graph TD;A('+char+')-->B;'); @@ -322,4 +337,50 @@ describe('when parsing ',function(){ }); }); + + it('should be possible to declare a class',function(){ + var res = flow.parser.parse('graph TD;classDef exClass background:#bbb,border:1px solid red;'); + //var res = flow.parser.parse('graph TD;style T background: #bbb;'); + + var classes = flow.parser.yy.getClasses(); + + expect(classes['exClass'].styles.length).toBe(2); + expect(classes['exClass'].styles[0]).toBe('background:#bbb'); + expect(classes['exClass'].styles[1]).toBe('border:1px solid red'); + }); + it('should be possible to apply a class to a vertex',function(){ + var statement = ''; + + statement = statement + 'graph TD;' + '\n'; + statement = statement + 'classDef exClass background:#bbb,border:1px solid red;' + '\n'; + statement = statement + 'a-->b;' + '\n'; + statement = statement + 'class a exClass;'; + + var res = flow.parser.parse(statement); + + var classes = flow.parser.yy.getClasses(); + + expect(classes['exClass'].styles.length).toBe(2); + expect(classes['exClass'].styles[0]).toBe('background:#bbb'); + expect(classes['exClass'].styles[1]).toBe('border:1px solid red'); + }); + it('should be possible to apply a class to a comma separated list of vertices',function(){ + var statement = ''; + + statement = statement + 'graph TD;' + '\n'; + statement = statement + 'classDef exClass background:#bbb,border:1px solid red;' + '\n'; + statement = statement + 'a-->b;' + '\n'; + statement = statement + 'class a,b exClass;'; + + var res = flow.parser.parse(statement); + + var classes = flow.parser.yy.getClasses(); + var vertices = flow.parser.yy.getVertices(); + + expect(classes['exClass'].styles.length).toBe(2); + expect(classes['exClass'].styles[0]).toBe('background:#bbb'); + expect(classes['exClass'].styles[1]).toBe('border:1px solid red'); + expect(vertices['a'].classes[0]).toBe('exClass'); + expect(vertices['b'].classes[0]).toBe('exClass'); + }); }); diff --git a/test/web.html b/test/web.html index a405bd891..97c845c47 100644 --- a/test/web.html +++ b/test/web.html @@ -38,8 +38,11 @@
graph LR; + classDef red fill:#ddd,stroke:#00f,stroke-width:2px,stroke-dasharray: 5, 5; A---|This is the 123 s text|B; - A---|This is the second edge|B; + B---|This is the second edge|C; + class A red; + class B,C red;
graph TD;A(Astrid)-->B[Irene]; @@ -52,15 +55,13 @@ E-->H[Bjarke]; E-->I[Ingvild];
-
+
graph TD; eag[Läsa bok 2]-->b; b{Fundera}---|Klocka|c(Vidar); b-->|Lego text|d(Bjarke går); e(orphan); - - style eag fill:#6ff,stroke:#f66,stroke-width:2px,stroke-dasharray: 5, 5; - style #2 stroke:#0f0; + style eag red;