Skip to content
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
2 changes: 1 addition & 1 deletion src/grammar.ebnf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
document ::= statement*

statement ::=
( 'title' ':' message
( 'title' ':'? message
| 'participant' actor ('as' alias)?
| 'note' (
( 'left of' | 'right of') actor
Expand Down
5 changes: 4 additions & 1 deletion src/grammar.jison
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
// Pre-lexer code can go here
%}

%x title

%%

[\r\n]+ return 'NL';
Expand All @@ -21,7 +23,8 @@
"right of" return 'right_of';
"over" return 'over';
"note" return 'note';
"title" return 'title';
"title" { this.begin('title'); return 'title'; }
<title>[^\r\n]+ { this.popState(); return 'MESSAGE'; }
"," return ',';
[^\->:,\r\n"]+ return 'ACTOR';
\"[^"]+\" return 'ACTOR';
Expand Down
2 changes: 2 additions & 0 deletions test/grammar-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ test('Dashed Open Arrow', function() {
test('Titles', function() {
equal(Diagram.parse('Title: title').title, 'title', 'Title');
equal(Diagram.parse('Title: line1\\nline2').title, 'line1\nline2', 'Multiline Title');
equal(Diagram.parse('Title title').title, 'title', 'Title without colon');
equal(Diagram.parse('Title:: title').title, ': title', 'Title with multiple colons');
});

test('Unicode', function() {
Expand Down