Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sequenceDiagram terminal newline optional #253

Merged
merged 1 commit into from
Nov 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -611,7 +611,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 All @@ -627,7 +627,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 @@ -643,7 +643,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 @@ -658,7 +658,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 All @@ -674,7 +674,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 @@ -691,7 +691,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 @@ -711,7 +711,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 @@ -730,7 +730,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 @@ -806,7 +806,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