mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
Fix for issue #170
This commit is contained in:
parent
e5c16fd960
commit
efb4e464b2
@ -6,10 +6,13 @@
|
||||
|
||||
/* lexical grammar */
|
||||
%lex
|
||||
%x string
|
||||
|
||||
%%
|
||||
\%\%[^\n]* /* do nothing */
|
||||
\"[^\n]*\" return TESTSTR;
|
||||
["] this.begin("string");
|
||||
<string>["] this.popState();
|
||||
<string>[^"]* return "STR";
|
||||
"style" return 'STYLE';
|
||||
"default" return 'DEFAULT';
|
||||
"linkStyle" return 'LINKSTYLE';
|
||||
@ -347,7 +350,7 @@ text: textToken
|
||||
{$$=$1;}
|
||||
| text textToken
|
||||
{$$=$1+''+$2;}
|
||||
| TESTSTR
|
||||
| STR
|
||||
{$$=$1;}
|
||||
;
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -5,7 +5,7 @@
|
||||
var graph = require('../graphDb');
|
||||
var flow = require('./flow');
|
||||
|
||||
describe('when parsing ',function(){
|
||||
ddescribe('when parsing ',function(){
|
||||
beforeEach(function(){
|
||||
flow.parser.yy = require('../graphDb');
|
||||
flow.parser.yy.clear();
|
||||
@ -561,10 +561,10 @@ describe('when parsing ',function(){
|
||||
expect(vert['a'].text).toBe('v');
|
||||
});
|
||||
it('should handle quoted text',function(){
|
||||
var res = flow.parser.parse('graph TD;V-- "test string" -->a[v]');
|
||||
var res = flow.parser.parse('graph TD;V-- "test string()" -->a[v]');
|
||||
var vert = flow.parser.yy.getVertices();
|
||||
var edges = flow.parser.yy.getEdges();
|
||||
expect(edges[0].text).toBe('test string');
|
||||
expect(edges[0].text).toBe('test string()');
|
||||
});
|
||||
});
|
||||
|
||||
@ -799,13 +799,13 @@ describe('when parsing ',function(){
|
||||
});
|
||||
|
||||
it('should handle quoted text in vertices ',function(){
|
||||
var res = flow.parser.parse('graph TD;A["chimpansen hoppar"] --> C;');
|
||||
var res = flow.parser.parse('graph TD;A["chimpansen hoppar ()[]"] --> C;');
|
||||
|
||||
var vert = flow.parser.yy.getVertices();
|
||||
var edges = flow.parser.yy.getEdges();
|
||||
|
||||
expect(vert['A'].type).toBe('square');
|
||||
expect(vert['A'].text).toBe('chimpansen hoppar');
|
||||
expect(vert['A'].text).toBe('chimpansen hoppar ()[]');
|
||||
});
|
||||
it('should handle text in circle vertices with space',function(){
|
||||
var res = flow.parser.parse('graph TD;A((chimpansen hoppar))-->C;');
|
||||
|
Loading…
x
Reference in New Issue
Block a user