Fix for being able to use the character v in node ids as described in issue #192
This commit is contained in:
parent
80912ffaee
commit
3ec7c6d18b
|
@ -277,8 +277,10 @@ alphaNumStatement
|
|||
{$$=$1;}
|
||||
| alphaNumToken
|
||||
{$$=$1;}
|
||||
| alphaNumToken MINUS alphaNumToken
|
||||
{$$=$1+'-'+$3;}
|
||||
| DOWN
|
||||
{$$='v';}
|
||||
| MINUS
|
||||
{$$='-';}
|
||||
;
|
||||
|
||||
link: linkStatement arrowText
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -538,6 +538,54 @@ describe('when parsing ',function(){
|
|||
expect(edges[0].type).toBe('arrow_cross');
|
||||
expect(edges[0].text).toBe('text including `');
|
||||
|
||||
});
|
||||
it('should handle v in node ids only v',function(){
|
||||
// only v
|
||||
var res = flow.parser.parse('graph TD;A--xv(my text);');
|
||||
|
||||
var vert = flow.parser.yy.getVertices();
|
||||
var edges = flow.parser.yy.getEdges();
|
||||
|
||||
|
||||
expect(edges[0].type).toBe('arrow_cross');
|
||||
expect(vert['v'].text).toBe('my text');
|
||||
|
||||
});
|
||||
it('should handle v in node ids v at end',function(){
|
||||
// v at end
|
||||
var res = flow.parser.parse('graph TD;A--xcsv(my text);');
|
||||
|
||||
var vert = flow.parser.yy.getVertices();
|
||||
var edges = flow.parser.yy.getEdges();
|
||||
|
||||
|
||||
expect(edges[0].type).toBe('arrow_cross');
|
||||
expect(vert['csv'].text).toBe('my text');
|
||||
|
||||
});
|
||||
it('should handle v in node ids v in middle',function(){
|
||||
// v in middle
|
||||
var res = flow.parser.parse('graph TD;A--xava(my text);');
|
||||
|
||||
var vert = flow.parser.yy.getVertices();
|
||||
var edges = flow.parser.yy.getEdges();
|
||||
|
||||
|
||||
expect(edges[0].type).toBe('arrow_cross');
|
||||
expect(vert['ava'].text).toBe('my text');
|
||||
|
||||
});
|
||||
it('should handle v in node ids, v at start',function(){
|
||||
// v at start
|
||||
var res = flow.parser.parse('graph TD;A--xva(my text);');
|
||||
|
||||
var vert = flow.parser.yy.getVertices();
|
||||
var edges = flow.parser.yy.getEdges();
|
||||
|
||||
|
||||
expect(edges[0].type).toBe('arrow_cross');
|
||||
expect(vert['va'].text).toBe('my text');
|
||||
|
||||
});
|
||||
it('should handle keywords',function(){
|
||||
var res = flow.parser.parse('graph TD;A--x|text including graph space|B;');
|
||||
|
|
Loading…
Reference in New Issue