Skip to content

Commit 60f23c8

Browse files
authored
Merge pull request #1281 from mermaid-js/feature/1249_BlockComments
Multiline comments
2 parents dcd807c + e62027b commit 60f23c8

File tree

7 files changed

+12
-5
lines changed

7 files changed

+12
-5
lines changed

src/diagrams/class/parser/classDiagram.jison

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
%x string generic struct
1010

1111
%%
12-
\%\%[^\n]*\n* /* do nothing */
12+
\%\%[^\n]*\n* /* skip comments */
13+
\%\%\*((.|\n)*)\*\%\% /* multiline skip comments */
1314
\n+ return 'NEWLINE';
1415
\s+ /* skip whitespace */
1516
"classDiagram" return 'CLASS_DIAGRAM';

src/diagrams/flowchart/parser/flow.jison

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
%x dir
1111
%x vertex
1212
%%
13-
\%\%[^\n]*\n* /* do nothing */
13+
\%\%[^\n]*\n* /* skip comments */
14+
\%\%\*((.|\n)*)\*\%\% /* multiline skip comments */
1415
["] this.begin("string");
1516
<string>["] this.popState();
1617
<string>[^"]* return "STR";

src/diagrams/gantt/parser/gantt.jison

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
\s+ /* skip whitespace */
1818
\#[^\n]* /* skip comments */
1919
\%%[^\n]* /* skip comments */
20+
\%\%\*((.|\n)*)\*\%\% /* multiline skip comments */
2021

2122
/*
2223
---interactivity command---

src/diagrams/git/parser/gitGraph.jison

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
\s+ /* skip all whitespace */
1919
\#[^\n]* /* skip comments */
2020
\%%[^\n]* /* skip comments */
21+
\%\%\*((.|\n)*)\*\%\% /* multiline skip comments */
2122
"gitGraph" return 'GG';
2223
"commit" return 'COMMIT';
2324
"branch" return 'BRANCH';

src/diagrams/pie/parser/pie.jison

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
%}
1313

1414
%%
15-
\%\%[^\n]* /* do nothing */
15+
\%\%[^\n]* /* skip comments */
16+
\%\%\*((.|\n)*)\*\%\% /* multiline skip comments */
1617
\s+ /* skip whitespace */
1718
"pie" return 'pie' ;
1819
[\s\n\r]+ return 'NL' ;

src/diagrams/sequence/parser/sequenceDiagram.jison

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<ID,ALIAS,LINE>((?!\n)\s)+ /* skip same-line whitespace */
2727
<INITIAL,ID,ALIAS,LINE>\#[^\n]* /* skip comments */
2828
\%%[^\n]* /* skip comments */
29+
\%\%\*((.|\n)*)\*\%\% /* multiline skip comments */
2930
"participant" { this.begin('ID'); return 'participant'; }
3031
<ID>[^\->:\n,;]+?(?=((?!\n)\s)+"as"(?!\n)\s|[#\n;]|$) { yytext = yytext.trim(); this.begin('ALIAS'); return 'ACTOR'; }
3132
<ALIAS>"as" { this.popState(); this.popState(); this.begin('LINE'); return 'AS'; }

src/diagrams/state/parser/stateDiagram.jison

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@
3333
%%
3434

3535
[\n]+ return 'NL';
36-
\s+ /* skip all whitespace */
36+
\s+ /* skip all whitespace */
3737
<ID,STATE,struct,LINE>((?!\n)\s)+ /* skip same-line whitespace */
3838
<INITIAL,ID,STATE,struct,LINE>\#[^\n]* /* skip comments */
39-
\%%[^\n]* /* skip comments */
39+
\%%[^\n]* /* skip comments */
40+
\%\%\*((.|\n)*)\*\%\% /* multiline skip comments */
4041

4142
"scale"\s+ { this.pushState('SCALE'); /* console.log('Got scale', yytext);*/ return 'scale'; }
4243
<SCALE>\d+ return 'WIDTH';

0 commit comments

Comments
 (0)