Added keywords as valid text token, fix for issue #8

This commit is contained in:
knsv
2014-12-03 07:49:41 +01:00
parent 7b09a6d1bf
commit 0539b8a74e
3 changed files with 36 additions and 24 deletions

View File

@@ -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;}
;

File diff suppressed because one or more lines are too long

View File

@@ -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;');