Fix for issue #170

This commit is contained in:
knsv 2015-06-14 09:33:48 +02:00
parent e5c16fd960
commit efb4e464b2
3 changed files with 114 additions and 105 deletions

View File

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

View File

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