Skip to content

Commit

Permalink
Merge pull request #253 from gibson042/optional-terminal-newline
Browse files Browse the repository at this point in the history
Make sequenceDiagram terminal newline optional
  • Loading branch information
knsv committed Nov 6, 2015
2 parents 49c13f1 + dbd63ff commit 2278325
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
5 changes: 2 additions & 3 deletions src/diagrams/sequenceDiagram/parser/sequenceDiagram.jison
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
\-[x] return 'SOLID_CROSS';
\-\-[x] return 'DOTTED_CROSS';
":"[^#\n;]+ return 'TXT';
<<EOF>> return 'EOF';
<<EOF>> return 'NL';
. return 'INVALID';

/lex
Expand All @@ -57,7 +57,7 @@
%% /* language grammar */

start
: SD document 'EOF' { yy.apply($2);return $2; }
: SD document { yy.apply($2);return $2; }
;

document
Expand All @@ -69,7 +69,6 @@ line
: SPACE statement { $$ = $2 }
| statement { $$ = $1 }
| NL { $$=[];}
| EOF { $$=[];}
;

statement
Expand Down
38 changes: 19 additions & 19 deletions src/diagrams/sequenceDiagram/sequenceDiagram.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('when parsing a sequenceDiagram',function() {
str = 'sequenceDiagram\n' +
'Alice->Bob:Hello Bob, how are you?\n' +
'Note right of Bob: Bob thinks\n' +
'Bob-->Alice: I am good thanks!\n';
'Bob-->Alice: I am good thanks!';

sq.parse(str);
var actors = sq.yy.getActors();
Expand All @@ -49,7 +49,7 @@ describe('when parsing a sequenceDiagram',function() {
it('it should space in actor names', function () {
str = 'sequenceDiagram\n' +
'Alice->Bob:Hello Bob, how are - you?\n' +
'Bob-->Alice: I am good thanks!\n';
'Bob-->Alice: I am good thanks!';

sq.parse(str);
var actors = sq.yy.getActors();
Expand All @@ -64,7 +64,7 @@ describe('when parsing a sequenceDiagram',function() {
});
it('it should handle in async messages', function () {
var str = 'sequenceDiagram\n' +
'Alice-xBob:Hello Bob, how are you?\n';
'Alice-xBob:Hello Bob, how are you?';

sq.parse(str);
var actors = sq.yy.getActors();
Expand All @@ -78,7 +78,7 @@ describe('when parsing a sequenceDiagram',function() {
});
it('it should handle in async dotted messages', function () {
var str = 'sequenceDiagram\n' +
'Alice--xBob:Hello Bob, how are you?\n';
'Alice--xBob:Hello Bob, how are you?';

sq.parse(str);
var actors = sq.yy.getActors();
Expand All @@ -92,7 +92,7 @@ describe('when parsing a sequenceDiagram',function() {
});
it('it should handle in arrow messages', function () {
var str = 'sequenceDiagram\n' +
'Alice->>Bob:Hello Bob, how are you?\n';
'Alice->>Bob:Hello Bob, how are you?';

sq.parse(str);
var actors = sq.yy.getActors();
Expand All @@ -106,7 +106,7 @@ describe('when parsing a sequenceDiagram',function() {
});
it('it should handle in arrow messages', function () {
var str = 'sequenceDiagram\n' +
'Alice-->>Bob:Hello Bob, how are you?\n';
'Alice-->>Bob:Hello Bob, how are you?';

sq.parse(str);
var actors = sq.yy.getActors();
Expand All @@ -123,7 +123,7 @@ describe('when parsing a sequenceDiagram',function() {
'Alice->Bob: Hello Bob, how are you?\n'+
'%% Comment\n' +
'Note right of Bob: Bob thinks\n' +
'Bob-->Alice: I am good thanks!\n';
'Bob-->Alice: I am good thanks!';

sq.parse(str);
var actors = sq.yy.getActors();
Expand Down Expand Up @@ -176,7 +176,7 @@ describe('when parsing a sequenceDiagram',function() {
' Alice->Bob: Hello Bob, how are you?\n\n' +
'%% Comment\n' +
'Note right of Bob: Bob thinks\n' +
'Bob-->Alice: I am good thanks!\n';
'Bob-->Alice: I am good thanks!';

sq.parse(str);
var actors = sq.yy.getActors();
Expand All @@ -194,7 +194,7 @@ describe('when parsing a sequenceDiagram',function() {
' Alice->Bob: Hello Bob, how are you?\n\n' +
'%% Comment\n' +
'Note right of Bob: Bob thinks\n' +
'Bob-->Alice: I am good thanks!\n';
'Bob-->Alice: I am good thanks!';

sq.parse(str);
var actors = sq.yy.getActors();
Expand All @@ -218,7 +218,7 @@ describe('when parsing a sequenceDiagram',function() {
'Note right of John: Rational thoughts<br/>prevail...\n'+
' John-->Alice: Great!\n'+
' John->Bob: How about you?\n'+
'Bob-->John: Jolly good!\n';
'Bob-->John: Jolly good!';

sq.parse(str);
var actors = sq.yy.getActors();
Expand Down Expand Up @@ -636,7 +636,7 @@ describe('when rendering a sequenceDiagram',function() {
it('it should handle one actor', function () {
sd.bounds.init();
var str = 'sequenceDiagram\n' +
'participant Alice\n';
'participant Alice';

sq.parse(str);
sd.draw(str,'tst');
Expand Down Expand Up @@ -668,7 +668,7 @@ describe('when rendering a sequenceDiagram',function() {
sd.bounds.init();
var str = 'sequenceDiagram\n' +
'participant Alice\n' +
'Note left of Alice: Alice thinks\n';
'Note left of Alice: Alice thinks';

sq.parse(str);
sd.draw(str,'tst');
Expand All @@ -684,7 +684,7 @@ describe('when rendering a sequenceDiagram',function() {
sd.bounds.init();
var str = 'sequenceDiagram\n' +
'participant Alice\n' +
'Note right of Alice: Alice thinks\n';
'Note right of Alice: Alice thinks';

sq.parse(str);
sd.draw(str,'tst');
Expand All @@ -699,7 +699,7 @@ describe('when rendering a sequenceDiagram',function() {
it('it should handle two actors', function () {
sd.bounds.init();
var str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n';
'Alice->Bob: Hello Bob, how are you?';

sq.parse(str);
sd.draw(str,'tst');
Expand Down Expand Up @@ -730,7 +730,7 @@ describe('when rendering a sequenceDiagram',function() {
sd.bounds.init();
var str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n'+
'Bob->Alice: Fine!\n';
'Bob->Alice: Fine!';

sq.parse(str);
sd.draw(str,'tst');
Expand All @@ -747,7 +747,7 @@ describe('when rendering a sequenceDiagram',function() {
var str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n'+
'Note right of Bob: Bob thinks\n' +
'Bob->Alice: Fine!\n';
'Bob->Alice: Fine!';

sq.parse(str);
sd.draw(str,'tst');
Expand All @@ -767,7 +767,7 @@ describe('when rendering a sequenceDiagram',function() {
var str = 'sequenceDiagram\n' +
'Alice->Bob: Hello Bob, how are you?\n'+
'Note left of Alice: Bob thinks\n' +
'Bob->Alice: Fine!\n';
'Bob->Alice: Fine!';

sq.parse(str);
sd.draw(str,'tst');
Expand All @@ -786,7 +786,7 @@ describe('when rendering a sequenceDiagram',function() {
'Alice->Bob: Hello Bob, how are you?\n'+
'loop Cheers\n' +
'Bob->Alice: Fine!\n' +
'end\n';
'end';
sq.parse(str);
sd.draw(str,'tst');

Expand Down Expand Up @@ -862,7 +862,7 @@ describe('when rendering a sequenceDiagram with actor mirror activated',function
it('it should handle one actor', function () {
sd.bounds.init();
var str = 'sequenceDiagram\n' +
'participant Alice\n';
'participant Alice';

sq.parse(str);
sd.draw(str,'tst');
Expand Down

0 comments on commit 2278325

Please sign in to comment.