Release 0.2.16

This commit is contained in:
knsv
2014-12-15 19:35:09 +01:00
parent e32cbe3004
commit 5712c6de7b
12 changed files with 324 additions and 355 deletions

View File

@@ -138,6 +138,7 @@ graphConfig
statements
: statement spaceListNewline statements
| statement statements
| statement
;
@@ -157,27 +158,16 @@ spaceList
statement
: commentStatement NEWLINE
{$$='Comment';}
| verticeStatement SEMI
| verticeStatement NEWLINE
| verticeStatement EOF
| styleStatement SEMI
| styleStatement NEWLINE
| styleStatement EOF
| linkStyleStatement SEMI
| linkStyleStatement NEWLINE
| linkStyleStatement EOF
| classDefStatement SEMI
| classDefStatement NEWLINE
| classDefStatement EOF
| classStatement SEMI
| classStatement NEWLINE
| classStatement EOF
| clickStatement SEMI
| clickStatement NEWLINE
| clickStatement EOF
| verticeStatement separator
| styleStatement separator
| linkStyleStatement separator
| classDefStatement separator
| classStatement separator
| clickStatement separator
;
separator: NEWLINE | SEMI | EOF ;
verticeStatement:
vertex link vertex
{ yy.addLink($1,$3,$2);$$ = 'oy'}

File diff suppressed because one or more lines are too long

View File

@@ -61,6 +61,21 @@ describe('when parsing ',function(){
expect(edges[0].type).toBe('arrow');
expect(edges[0].text).toBe('');
});
it('should handle statements ending without semicolon',function(){
var res = flow.parser.parse('graph TD\nA-->B\nB-->C');
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[1].start).toBe('B');
expect(edges[1].end).toBe('C');
expect(edges[0].type).toBe('arrow');
expect(edges[0].text).toBe('');
});
it('should handle a comments',function(){
var res = flow.parser.parse('graph TD;\n%% CComment\n A-->B;');