mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-12-20 03:07:21 +01:00
Release 0.2.16
This commit is contained in:
@@ -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
@@ -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;');
|
||||
|
||||
Reference in New Issue
Block a user