From 0539b8a74e91c2c6136eea9cd7e0c5ee8e0d7cc1 Mon Sep 17 00:00:00 2001 From: knsv Date: Wed, 3 Dec 2014 07:49:41 +0100 Subject: [PATCH] Added keywords as valid text token, fix for issue #8 --- src/parser/flow.jison | 7 +++++-- src/parser/flow.js | 44 ++++++++++++++++++++--------------------- src/parser/flow.spec.js | 9 +++++++++ 3 files changed, 36 insertions(+), 24 deletions(-) diff --git a/src/parser/flow.jison b/src/parser/flow.jison index 088a5222ea..1729a632ed 100644 --- a/src/parser/flow.jison +++ b/src/parser/flow.jison @@ -264,9 +264,12 @@ textToken: ALPHA {$$ = $1;} | MINUS {$$ = $1;} - | DIR + | keywords {$$ = $1;} ; +keywords + : STYLE | LINKSTYLE | CLASSDEF | CLASS | CLICK | GRAPH | DIR; + textNoTags: textNoTagsToken {$$=$1;} @@ -296,7 +299,7 @@ textNoTagsToken: ALPHA {$$ = $1;} | MINUS {$$ = $1;} - | DIR + | keywords {$$ = $1;} ; diff --git a/src/parser/flow.js b/src/parser/flow.js index d4c997096a..cd37807b24 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=[1,23],$V2=[1,24],$V3=[1,25],$V4=[1,26],$V5=[1,27],$V6=[1,28],$V7=[1,29],$V8=[1,30],$V9=[1,31],$Va=[1,17],$Vb=[1,18],$Vc=[1,19],$Vd=[1,15],$Ve=[1,16],$Vf=[34,35,36,37,38,39,40,41,42,54,56,57,58,60],$Vg=[11,45,46,47,48],$Vh=[9,11,22,25,27,29,30,45,46,47,48],$Vi=[9,11,22,25,27,29,30,34,35,36,37,38,39,40,41,42,45,46,47,48],$Vj=[9,11,22,25,27,29,30,33,34,35,36,37,38,39,40,41,42,45,46,47,48],$Vk=[6,9],$Vl=[34,35,36,37,38,39,40,41,42],$Vm=[34,35,36,37,38,39,40,41,42,49],$Vn=[1,86],$Vo=[1,88],$Vp=[1,84],$Vq=[1,83],$Vr=[1,87],$Vs=[1,75],$Vt=[1,76],$Vu=[1,77],$Vv=[1,78],$Vw=[1,79],$Vx=[1,80],$Vy=[1,81],$Vz=[1,82],$VA=[1,85],$VB=[9,10,24,26,28,29,30,33,34,35,36,37,38,39,40,41,42,49],$VC=[2,56],$VD=[1,119],$VE=[1,116],$VF=[1,114],$VG=[1,117],$VH=[1,115],$VI=[1,122],$VJ=[1,121],$VK=[1,120],$VL=[1,118],$VM=[2,21],$VN=[1,129],$VO=[11,37],$VP=[9,11,33,34,35,36,37,41,42,59,63]; +var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,7],$V1=[1,23],$V2=[1,24],$V3=[1,25],$V4=[1,26],$V5=[1,27],$V6=[1,28],$V7=[1,29],$V8=[1,30],$V9=[1,31],$Va=[1,15],$Vb=[1,16],$Vc=[1,17],$Vd=[1,18],$Ve=[1,19],$Vf=[34,35,36,37,38,39,40,41,42,53,54,55,56,57],$Vg=[11,45,46,47,48],$Vh=[9,11,22,25,27,29,30,45,46,47,48],$Vi=[9,11,22,25,27,29,30,34,35,36,37,38,39,40,41,42,45,46,47,48],$Vj=[9,11,22,25,27,29,30,33,34,35,36,37,38,39,40,41,42,45,46,47,48],$Vk=[6,9],$Vl=[34,35,36,37,38,39,40,41,42],$Vm=[34,35,36,37,38,39,40,41,42,49],$Vn=[1,94],$Vo=[1,86],$Vp=[1,95],$Vq=[1,84],$Vr=[1,83],$Vs=[1,87],$Vt=[1,75],$Vu=[1,76],$Vv=[1,77],$Vw=[1,78],$Vx=[1,79],$Vy=[1,80],$Vz=[1,81],$VA=[1,82],$VB=[1,85],$VC=[1,89],$VD=[1,90],$VE=[1,91],$VF=[1,92],$VG=[1,93],$VH=[8,9,10,24,26,28,29,30,33,34,35,36,37,38,39,40,41,42,49,53,54,55,56,57],$VI=[2,56],$VJ=[1,126],$VK=[1,123],$VL=[1,121],$VM=[1,124],$VN=[1,122],$VO=[1,129],$VP=[1,128],$VQ=[1,127],$VR=[1,125],$VS=[2,21],$VT=[1,136],$VU=[11,37],$VV=[9,11,33,34,35,36,37,41,42,61,64]; 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,"linkStyleStatement":15,"classDefStatement":16,"classStatement":17,"clickStatement":18,"vertex":19,"link":20,"alphaNum":21,"SQS":22,"text":23,"SQE":24,"PS":25,"PE":26,"DIAMOND_START":27,"DIAMOND_STOP":28,"TAGEND":29,"TAGSTART":30,"alphaNumStatement":31,"alphaNumToken":32,"MINUS":33,"ALPHA":34,"NUM":35,"COLON":36,"COMMA":37,"PLUS":38,"EQUALS":39,"MULT":40,"DOT":41,"BRKT":42,"linkStatement":43,"arrowText":44,"ARROW_POINT":45,"ARROW_CIRCLE":46,"ARROW_CROSS":47,"ARROW_OPEN":48,"PIPE":49,"textToken":50,"textStatement":51,"textNoTags":52,"textNoTagsToken":53,"CLASSDEF":54,"stylesOpt":55,"CLASS":56,"CLICK":57,"STYLE":58,"HEX":59,"LINKSTYLE":60,"style":61,"styleComponent":62,"UNIT":63,"$accept":0,"$end":1}, -terminals_: {2:"error",6:"EOF",8:"GRAPH",9:"SPACE",10:"DIR",11:"SEMI",22:"SQS",24:"SQE",25:"PS",26:"PE",27:"DIAMOND_START",28:"DIAMOND_STOP",29:"TAGEND",30:"TAGSTART",33:"MINUS",34:"ALPHA",35:"NUM",36:"COLON",37:"COMMA",38:"PLUS",39:"EQUALS",40:"MULT",41:"DOT",42:"BRKT",45:"ARROW_POINT",46:"ARROW_CIRCLE",47:"ARROW_CROSS",48:"ARROW_OPEN",49:"PIPE",54:"CLASSDEF",56:"CLASS",57:"CLICK",58:"STYLE",59:"HEX",60:"LINKSTYLE",63:"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],[12,2],[12,2],[13,3],[13,1],[19,4],[19,6],[19,4],[19,4],[19,4],[19,4],[19,1],[21,1],[21,2],[31,1],[31,3],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[20,2],[20,1],[43,1],[43,1],[43,1],[43,1],[44,3],[23,1],[23,2],[51,1],[51,2],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[52,1],[52,2],[53,1],[53,1],[53,1],[53,1],[53,1],[53,1],[53,1],[53,1],[53,1],[53,1],[53,1],[53,1],[16,5],[17,5],[18,5],[14,5],[14,5],[15,5],[55,1],[55,3],[61,1],[61,2],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,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,"linkStyleStatement":15,"classDefStatement":16,"classStatement":17,"clickStatement":18,"vertex":19,"link":20,"alphaNum":21,"SQS":22,"text":23,"SQE":24,"PS":25,"PE":26,"DIAMOND_START":27,"DIAMOND_STOP":28,"TAGEND":29,"TAGSTART":30,"alphaNumStatement":31,"alphaNumToken":32,"MINUS":33,"ALPHA":34,"NUM":35,"COLON":36,"COMMA":37,"PLUS":38,"EQUALS":39,"MULT":40,"DOT":41,"BRKT":42,"linkStatement":43,"arrowText":44,"ARROW_POINT":45,"ARROW_CIRCLE":46,"ARROW_CROSS":47,"ARROW_OPEN":48,"PIPE":49,"textToken":50,"textStatement":51,"keywords":52,"STYLE":53,"LINKSTYLE":54,"CLASSDEF":55,"CLASS":56,"CLICK":57,"textNoTags":58,"textNoTagsToken":59,"stylesOpt":60,"HEX":61,"style":62,"styleComponent":63,"UNIT":64,"$accept":0,"$end":1}, +terminals_: {2:"error",6:"EOF",8:"GRAPH",9:"SPACE",10:"DIR",11:"SEMI",22:"SQS",24:"SQE",25:"PS",26:"PE",27:"DIAMOND_START",28:"DIAMOND_STOP",29:"TAGEND",30:"TAGSTART",33:"MINUS",34:"ALPHA",35:"NUM",36:"COLON",37:"COMMA",38:"PLUS",39:"EQUALS",40:"MULT",41:"DOT",42:"BRKT",45:"ARROW_POINT",46:"ARROW_CIRCLE",47:"ARROW_CROSS",48:"ARROW_OPEN",49:"PIPE",53:"STYLE",54:"LINKSTYLE",55:"CLASSDEF",56:"CLASS",57:"CLICK",61:"HEX",64:"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],[12,2],[12,2],[13,3],[13,1],[19,4],[19,6],[19,4],[19,4],[19,4],[19,4],[19,1],[21,1],[21,2],[31,1],[31,3],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[20,2],[20,1],[43,1],[43,1],[43,1],[43,1],[44,3],[23,1],[23,2],[51,1],[51,2],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[50,1],[52,1],[52,1],[52,1],[52,1],[52,1],[52,1],[52,1],[58,1],[58,2],[59,1],[59,1],[59,1],[59,1],[59,1],[59,1],[59,1],[59,1],[59,1],[59,1],[59,1],[59,1],[16,5],[17,5],[18,5],[14,5],[14,5],[15,5],[60,1],[60,3],[62,1],[62,2],[63,1],[63,1],[63,1],[63,1],[63,1],[63,1],[63,1],[63,1],[63,1]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ @@ -113,19 +113,19 @@ break; case 22: this.$ = $$[$0];yy.addVertex($$[$0]); break; -case 23: case 25: case 27: case 28: case 43: case 47: case 48: case 61: case 63: case 64: case 83: +case 23: case 25: case 27: case 28: case 43: case 47: case 48: case 68: case 70: case 71: case 90: this.$=$$[$0]; break; -case 24: case 44: case 62: +case 24: case 44: case 69: this.$=$$[$0-1]+''+$$[$0]; break; case 26: this.$=$$[$0-2]+'-'+$$[$0]; break; -case 29: case 30: case 31: case 32: case 33: case 34: case 37: case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 58: case 59: case 60: case 65: case 66: case 67: case 68: case 69: case 70: case 72: case 73: case 74: +case 29: case 30: case 31: case 32: case 33: case 34: case 37: case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 58: case 59: case 60: case 72: case 73: case 74: case 75: case 76: case 77: case 79: case 80: case 81: this.$ = $$[$0]; break; -case 35: case 57: case 71: +case 35: case 57: case 78: this.$ = '
'; break; case 36: @@ -146,37 +146,37 @@ break; case 42: this.$ = $$[$0-1]; break; -case 75: +case 82: this.$ = $$[$0-4];yy.addClass($$[$0-2],$$[$0]); break; -case 76: +case 83: this.$ = $$[$0-4];yy.setClass($$[$0-2], $$[$0]); break; -case 77: +case 84: this.$ = $$[$0-4];yy.setClickEvent($$[$0-2], $$[$0]); break; -case 78: +case 85: this.$ = $$[$0-4];yy.addVertex($$[$0-2],undefined,undefined,$$[$0]); break; -case 79: case 80: +case 86: case 87: this.$ = $$[$0-4];yy.updateLink($$[$0-2],$$[$0]); break; -case 81: +case 88: this.$ = [$$[$0]] break; -case 82: +case 89: $$[$0-2].push($$[$0]);this.$ = $$[$0-2]; break; -case 84: +case 91: this.$ = $$[$0-1] + $$[$0]; break; -case 85: case 86: case 87: case 88: case 89: case 90: case 91: case 92: case 93: +case 92: case 93: case 94: case 95: case 96: case 97: case 98: case 99: case 100: this.$=$$[$0] break; } }, -table: [{3:1,4:2,8:[1,3]},{1:[3]},{5:4,7:5,9:$V0,12:6,13:8,14:9,15:10,16:11,17:12,18:13,19:14,21:20,31:21,32:22,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9,54:$Va,56:$Vb,57:$Vc,58:$Vd,60:$Ve},{9:[1,32]},{6:[1,33]},{5:34,12:6,13:8,14:9,15:10,16:11,17:12,18:13,19:14,21:20,31:21,32:22,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9,54:$Va,56:$Vb,57:$Vc,58:$Vd,60:$Ve},{6:[2,5],7:35,9:$V0},o($Vf,[2,7],{7:36,9:$V0}),{11:[1,37]},{11:[1,38]},{11:[1,39]},{11:[1,40]},{11:[1,41]},{11:[1,42]},{11:[2,15],20:43,43:44,45:[1,45],46:[1,46],47:[1,47],48:[1,48]},{9:[1,49]},{9:[1,50]},{9:[1,51]},{9:[1,52]},{9:[1,53]},o($Vg,[2,22],{22:[1,54],25:[1,55],27:[1,56],29:[1,57],30:[1,58]}),o($Vh,[2,23],{31:21,32:22,21:59,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9}),o($Vi,[2,25],{33:[1,60]}),o($Vj,[2,27]),o($Vj,[2,28]),o($Vj,[2,29]),o($Vj,[2,30]),o($Vj,[2,31]),o($Vj,[2,32]),o($Vj,[2,33]),o($Vj,[2,34]),o($Vj,[2,35]),{10:[1,61]},{1:[2,1]},{6:[1,62]},{5:63,12:6,13:8,14:9,15:10,16:11,17:12,18:13,19:14,21:20,31:21,32:22,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9,54:$Va,56:$Vb,57:$Vc,58:$Vd,60:$Ve},o($Vf,[2,6]),o($Vk,[2,8]),o($Vk,[2,9]),o($Vk,[2,10]),o($Vk,[2,11]),o($Vk,[2,12]),o($Vk,[2,13]),{19:64,21:20,31:21,32:22,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9},o($Vl,[2,37],{44:65,49:[1,66]}),o($Vm,[2,38]),o($Vm,[2,39]),o($Vm,[2,40]),o($Vm,[2,41]),{21:67,31:21,32:22,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9,59:[1,68]},{35:[1,69]},{21:70,31:21,32:22,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9},{21:71,31:21,32:22,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9},{21:72,31:21,32:22,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9},{9:$Vn,10:$Vo,23:73,29:$Vp,30:$Vq,33:$Vr,34:$Vs,35:$Vt,36:$Vu,37:$Vv,38:$Vw,39:$Vx,40:$Vy,41:$Vz,42:$VA,50:74},{9:$Vn,10:$Vo,23:90,25:[1,89],29:$Vp,30:$Vq,33:$Vr,34:$Vs,35:$Vt,36:$Vu,37:$Vv,38:$Vw,39:$Vx,40:$Vy,41:$Vz,42:$VA,50:74},{9:$Vn,10:$Vo,23:91,29:$Vp,30:$Vq,33:$Vr,34:$Vs,35:$Vt,36:$Vu,37:$Vv,38:$Vw,39:$Vx,40:$Vy,41:$Vz,42:$VA,50:74},{9:$Vn,10:$Vo,23:92,29:$Vp,30:$Vq,33:$Vr,34:$Vs,35:$Vt,36:$Vu,37:$Vv,38:$Vw,39:$Vx,40:$Vy,41:$Vz,42:$VA,50:74},{9:$Vn,10:$Vo,23:93,29:$Vp,30:$Vq,33:$Vr,34:$Vs,35:$Vt,36:$Vu,37:$Vv,38:$Vw,39:$Vx,40:$Vy,41:$Vz,42:$VA,50:74},o($Vh,[2,24]),{32:94,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9},{11:[1,95]},{1:[2,2]},{6:[2,4]},{11:[2,14]},o($Vl,[2,36]),{9:$Vn,10:$Vo,23:96,29:$Vp,30:$Vq,33:$Vr,34:$Vs,35:$Vt,36:$Vu,37:$Vv,38:$Vw,39:$Vx,40:$Vy,41:$Vz,42:$VA,50:74},{9:[1,97]},{9:[1,98]},{9:[1,99]},{9:[1,100]},{9:[1,101]},{9:[1,102]},{9:$Vn,10:$Vo,24:[1,103],29:$Vp,30:$Vq,33:$Vr,34:$Vs,35:$Vt,36:$Vu,37:$Vv,38:$Vw,39:$Vx,40:$Vy,41:$Vz,42:$VA,50:104},o($VB,[2,43]),o($VB,[2,47]),o($VB,[2,48]),o($VB,[2,49]),o($VB,[2,50]),o($VB,[2,51]),o($VB,[2,52]),o($VB,[2,53]),o($VB,[2,54]),o($VB,[2,55]),o($VB,$VC),o($VB,[2,57]),o($VB,[2,58]),o($VB,[2,59]),o($VB,[2,60]),{9:$Vn,10:$Vo,23:105,29:$Vp,30:$Vq,33:$Vr,34:$Vs,35:$Vt,36:$Vu,37:$Vv,38:$Vw,39:$Vx,40:$Vy,41:$Vz,42:$VA,50:74},{9:$Vn,10:$Vo,26:[1,106],29:$Vp,30:$Vq,33:$Vr,34:$Vs,35:$Vt,36:$Vu,37:$Vv,38:$Vw,39:$Vx,40:$Vy,41:$Vz,42:$VA,50:104},{9:$Vn,10:$Vo,28:[1,107],29:$Vp,30:$Vq,33:$Vr,34:$Vs,35:$Vt,36:$Vu,37:$Vv,38:$Vw,39:$Vx,40:$Vy,41:$Vz,42:$VA,50:104},{9:$Vn,10:$Vo,24:[1,108],29:$Vp,30:$Vq,33:$Vr,34:$Vs,35:$Vt,36:$Vu,37:$Vv,38:$Vw,39:$Vx,40:$Vy,41:$Vz,42:$VA,50:104},{9:$Vn,10:$Vo,29:[1,109],30:$Vq,33:$Vr,34:$Vs,35:$Vt,36:$Vu,37:$Vv,38:$Vw,39:$Vx,40:$Vy,41:$Vz,42:$VA,50:104},o($Vi,[2,26]),o([9,34,35,36,37,38,39,40,41,42,54,56,57,58,60],[2,3]),{9:$Vn,10:$Vo,29:$Vp,30:$Vq,33:$Vr,34:$Vs,35:$Vt,36:$Vu,37:$Vv,38:$Vw,39:$Vx,40:$Vy,41:$Vz,42:$VA,49:[1,110],50:104},{9:$VD,33:$VE,34:$VF,35:$VG,36:$VH,41:$VI,42:$VJ,55:111,59:$VK,61:112,62:113,63:$VL},{9:$VD,33:$VE,34:$VF,35:$VG,36:$VH,41:$VI,42:$VJ,55:123,59:$VK,61:112,62:113,63:$VL},{9:$VD,33:$VE,34:$VF,35:$VG,36:$VH,41:$VI,42:$VJ,55:124,59:$VK,61:112,62:113,63:$VL},{9:$VD,33:$VE,34:$VF,35:$VG,36:$VH,41:$VI,42:$VJ,55:125,59:$VK,61:112,62:113,63:$VL},{21:126,31:21,32:22,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9},{21:127,31:21,32:22,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9},o($Vg,[2,16]),o($VB,[2,44]),{9:$Vn,10:$Vo,26:[1,128],29:$Vp,30:$Vq,33:$Vr,34:$Vs,35:$Vt,36:$Vu,37:$Vv,38:$Vw,39:$Vx,40:$Vy,41:$Vz,42:$VA,50:104},o($Vg,[2,18]),o($Vg,[2,19]),o($Vg,[2,20]),o([9,10,29,30,33,34,35,36,37,38,39,40,41,42],$VC,{11:$VM,45:$VM,46:$VM,47:$VM,48:$VM}),o($Vl,[2,42]),{11:[2,78],37:$VN},o($VO,[2,81],{62:130,9:$VD,33:$VE,34:$VF,35:$VG,36:$VH,41:$VI,42:$VJ,59:$VK,63:$VL}),o($VP,[2,83]),o($VP,[2,85]),o($VP,[2,86]),o($VP,[2,87]),o($VP,[2,88]),o($VP,[2,89]),o($VP,[2,90]),o($VP,[2,91]),o($VP,[2,92]),o($VP,[2,93]),{11:[2,79],37:$VN},{11:[2,80],37:$VN},{11:[2,75],37:$VN},{11:[2,76]},{11:[2,77]},{26:[1,131]},{9:$VD,33:$VE,34:$VF,35:$VG,36:$VH,41:$VI,42:$VJ,59:$VK,61:132,62:113,63:$VL},o($VP,[2,84]),o($Vg,[2,17]),o($VO,[2,82],{62:130,9:$VD,33:$VE,34:$VF,35:$VG,36:$VH,41:$VI,42:$VJ,59:$VK,63:$VL})], -defaultActions: {33:[2,1],62:[2,2],63:[2,4],64:[2,14],126:[2,76],127:[2,77]}, +table: [{3:1,4:2,8:[1,3]},{1:[3]},{5:4,7:5,9:$V0,12:6,13:8,14:9,15:10,16:11,17:12,18:13,19:14,21:20,31:21,32:22,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9,53:$Va,54:$Vb,55:$Vc,56:$Vd,57:$Ve},{9:[1,32]},{6:[1,33]},{5:34,12:6,13:8,14:9,15:10,16:11,17:12,18:13,19:14,21:20,31:21,32:22,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9,53:$Va,54:$Vb,55:$Vc,56:$Vd,57:$Ve},{6:[2,5],7:35,9:$V0},o($Vf,[2,7],{7:36,9:$V0}),{11:[1,37]},{11:[1,38]},{11:[1,39]},{11:[1,40]},{11:[1,41]},{11:[1,42]},{11:[2,15],20:43,43:44,45:[1,45],46:[1,46],47:[1,47],48:[1,48]},{9:[1,49]},{9:[1,50]},{9:[1,51]},{9:[1,52]},{9:[1,53]},o($Vg,[2,22],{22:[1,54],25:[1,55],27:[1,56],29:[1,57],30:[1,58]}),o($Vh,[2,23],{31:21,32:22,21:59,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9}),o($Vi,[2,25],{33:[1,60]}),o($Vj,[2,27]),o($Vj,[2,28]),o($Vj,[2,29]),o($Vj,[2,30]),o($Vj,[2,31]),o($Vj,[2,32]),o($Vj,[2,33]),o($Vj,[2,34]),o($Vj,[2,35]),{10:[1,61]},{1:[2,1]},{6:[1,62]},{5:63,12:6,13:8,14:9,15:10,16:11,17:12,18:13,19:14,21:20,31:21,32:22,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9,53:$Va,54:$Vb,55:$Vc,56:$Vd,57:$Ve},o($Vf,[2,6]),o($Vk,[2,8]),o($Vk,[2,9]),o($Vk,[2,10]),o($Vk,[2,11]),o($Vk,[2,12]),o($Vk,[2,13]),{19:64,21:20,31:21,32:22,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9},o($Vl,[2,37],{44:65,49:[1,66]}),o($Vm,[2,38]),o($Vm,[2,39]),o($Vm,[2,40]),o($Vm,[2,41]),{21:67,31:21,32:22,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9,61:[1,68]},{35:[1,69]},{21:70,31:21,32:22,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9},{21:71,31:21,32:22,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9},{21:72,31:21,32:22,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9},{8:$Vn,9:$Vo,10:$Vp,23:73,29:$Vq,30:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,42:$VB,50:74,52:88,53:$VC,54:$VD,55:$VE,56:$VF,57:$VG},{8:$Vn,9:$Vo,10:$Vp,23:97,25:[1,96],29:$Vq,30:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,42:$VB,50:74,52:88,53:$VC,54:$VD,55:$VE,56:$VF,57:$VG},{8:$Vn,9:$Vo,10:$Vp,23:98,29:$Vq,30:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,42:$VB,50:74,52:88,53:$VC,54:$VD,55:$VE,56:$VF,57:$VG},{8:$Vn,9:$Vo,10:$Vp,23:99,29:$Vq,30:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,42:$VB,50:74,52:88,53:$VC,54:$VD,55:$VE,56:$VF,57:$VG},{8:$Vn,9:$Vo,10:$Vp,23:100,29:$Vq,30:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,42:$VB,50:74,52:88,53:$VC,54:$VD,55:$VE,56:$VF,57:$VG},o($Vh,[2,24]),{32:101,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9},{11:[1,102]},{1:[2,2]},{6:[2,4]},{11:[2,14]},o($Vl,[2,36]),{8:$Vn,9:$Vo,10:$Vp,23:103,29:$Vq,30:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,42:$VB,50:74,52:88,53:$VC,54:$VD,55:$VE,56:$VF,57:$VG},{9:[1,104]},{9:[1,105]},{9:[1,106]},{9:[1,107]},{9:[1,108]},{9:[1,109]},{8:$Vn,9:$Vo,10:$Vp,24:[1,110],29:$Vq,30:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,42:$VB,50:111,52:88,53:$VC,54:$VD,55:$VE,56:$VF,57:$VG},o($VH,[2,43]),o($VH,[2,47]),o($VH,[2,48]),o($VH,[2,49]),o($VH,[2,50]),o($VH,[2,51]),o($VH,[2,52]),o($VH,[2,53]),o($VH,[2,54]),o($VH,[2,55]),o($VH,$VI),o($VH,[2,57]),o($VH,[2,58]),o($VH,[2,59]),o($VH,[2,60]),o($VH,[2,61]),o($VH,[2,62]),o($VH,[2,63]),o($VH,[2,64]),o($VH,[2,65]),o($VH,[2,66]),o($VH,[2,67]),{8:$Vn,9:$Vo,10:$Vp,23:112,29:$Vq,30:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,42:$VB,50:74,52:88,53:$VC,54:$VD,55:$VE,56:$VF,57:$VG},{8:$Vn,9:$Vo,10:$Vp,26:[1,113],29:$Vq,30:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,42:$VB,50:111,52:88,53:$VC,54:$VD,55:$VE,56:$VF,57:$VG},{8:$Vn,9:$Vo,10:$Vp,28:[1,114],29:$Vq,30:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,42:$VB,50:111,52:88,53:$VC,54:$VD,55:$VE,56:$VF,57:$VG},{8:$Vn,9:$Vo,10:$Vp,24:[1,115],29:$Vq,30:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,42:$VB,50:111,52:88,53:$VC,54:$VD,55:$VE,56:$VF,57:$VG},{8:$Vn,9:$Vo,10:$Vp,29:[1,116],30:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,42:$VB,50:111,52:88,53:$VC,54:$VD,55:$VE,56:$VF,57:$VG},o($Vi,[2,26]),o([9,34,35,36,37,38,39,40,41,42,53,54,55,56,57],[2,3]),{8:$Vn,9:$Vo,10:$Vp,29:$Vq,30:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,42:$VB,49:[1,117],50:111,52:88,53:$VC,54:$VD,55:$VE,56:$VF,57:$VG},{9:$VJ,33:$VK,34:$VL,35:$VM,36:$VN,41:$VO,42:$VP,60:118,61:$VQ,62:119,63:120,64:$VR},{9:$VJ,33:$VK,34:$VL,35:$VM,36:$VN,41:$VO,42:$VP,60:130,61:$VQ,62:119,63:120,64:$VR},{9:$VJ,33:$VK,34:$VL,35:$VM,36:$VN,41:$VO,42:$VP,60:131,61:$VQ,62:119,63:120,64:$VR},{9:$VJ,33:$VK,34:$VL,35:$VM,36:$VN,41:$VO,42:$VP,60:132,61:$VQ,62:119,63:120,64:$VR},{21:133,31:21,32:22,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9},{21:134,31:21,32:22,34:$V1,35:$V2,36:$V3,37:$V4,38:$V5,39:$V6,40:$V7,41:$V8,42:$V9},o($Vg,[2,16]),o($VH,[2,44]),{8:$Vn,9:$Vo,10:$Vp,26:[1,135],29:$Vq,30:$Vr,33:$Vs,34:$Vt,35:$Vu,36:$Vv,37:$Vw,38:$Vx,39:$Vy,40:$Vz,41:$VA,42:$VB,50:111,52:88,53:$VC,54:$VD,55:$VE,56:$VF,57:$VG},o($Vg,[2,18]),o($Vg,[2,19]),o($Vg,[2,20]),o([8,9,10,29,30,33,34,35,36,37,38,39,40,41,42,53,54,55,56,57],$VI,{11:$VS,45:$VS,46:$VS,47:$VS,48:$VS}),o($Vl,[2,42]),{11:[2,85],37:$VT},o($VU,[2,88],{63:137,9:$VJ,33:$VK,34:$VL,35:$VM,36:$VN,41:$VO,42:$VP,61:$VQ,64:$VR}),o($VV,[2,90]),o($VV,[2,92]),o($VV,[2,93]),o($VV,[2,94]),o($VV,[2,95]),o($VV,[2,96]),o($VV,[2,97]),o($VV,[2,98]),o($VV,[2,99]),o($VV,[2,100]),{11:[2,86],37:$VT},{11:[2,87],37:$VT},{11:[2,82],37:$VT},{11:[2,83]},{11:[2,84]},{26:[1,138]},{9:$VJ,33:$VK,34:$VL,35:$VM,36:$VN,41:$VO,42:$VP,61:$VQ,62:139,63:120,64:$VR},o($VV,[2,91]),o($Vg,[2,17]),o($VU,[2,89],{63:137,9:$VJ,33:$VK,34:$VL,35:$VM,36:$VN,41:$VO,42:$VP,61:$VQ,64:$VR})], +defaultActions: {33:[2,1],62:[2,2],63:[2,4],64:[2,14],133:[2,83],134:[2,84]}, parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); @@ -650,11 +650,11 @@ options: {}, performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { var YYSTATE=YY_START; switch($avoiding_name_collisions) { -case 0:return 58; +case 0:return 53; break; -case 1:return 60; +case 1:return 54; break; -case 2:return 54; +case 2:return 55; break; case 3:return 56; break; diff --git a/src/parser/flow.spec.js b/src/parser/flow.spec.js index f4730e7d03..935102d9c7 100644 --- a/src/parser/flow.spec.js +++ b/src/parser/flow.spec.js @@ -98,6 +98,15 @@ describe('when parsing ',function(){ expect(edges[0].type).toBe('arrow_cross'); expect(edges[0].text).toBe('text including URL space'); + }); + it('should handle text on edges with graph keyword',function(){ + var res = flow.parser.parse('graph TD;A--x|text including graph space|B;'); + + var vert = flow.parser.yy.getVertices(); + var edges = flow.parser.yy.getEdges(); + + expect(edges[0].text).toBe('text including graph space'); + }); it('should handle multi-line text',function(){ var res = flow.parser.parse('graph TD;A--o|text space|B;\n B-->|more text with space|C;');