mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-18 05:29:40 +02:00
Application of common header gramnmar for class and sequence diagrams
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
lexer grammar ClassLexer;
|
lexer grammar ClassLexer;
|
||||||
|
import HeaderCommon;
|
||||||
|
|
||||||
|
|
||||||
tokens {
|
tokens {
|
||||||
ACC_TITLE_VALUE,
|
ACC_TITLE_VALUE,
|
||||||
@@ -28,13 +30,13 @@ fragment NOT_DQUOTE: ~[""];
|
|||||||
|
|
||||||
|
|
||||||
// Comments and whitespace
|
// Comments and whitespace
|
||||||
COMMENT: '%%' ~[\r\n]* -> skip;
|
|
||||||
NEWLINE: ('\r'? '\n')+ { this.clearPendingScopes(); };
|
NEWLINE: ('\r'? '\n')+ { this.clearPendingScopes(); };
|
||||||
WS: [ \t]+ -> skip;
|
WS: [ \t]+ -> skip;
|
||||||
|
|
||||||
// Diagram title declaration
|
// Diagram title declaration
|
||||||
CLASS_DIAGRAM_V2: 'classDiagram-v2' -> type(CLASS_DIAGRAM);
|
CLASS_DIAGRAM_V2: 'classDiagram-v2' { this.headerMode = false; } -> type(CLASS_DIAGRAM);
|
||||||
CLASS_DIAGRAM: 'classDiagram';
|
CLASS_DIAGRAM: 'classDiagram' { this.headerMode = false; };
|
||||||
|
|
||||||
// Directions
|
// Directions
|
||||||
DIRECTION_TB: 'direction' WS_INLINE+ 'TB';
|
DIRECTION_TB: 'direction' WS_INLINE+ 'TB';
|
||||||
|
@@ -1,4 +1,6 @@
|
|||||||
lexer grammar FlowLexer;
|
lexer grammar FlowLexer;
|
||||||
|
import HeaderCommon;
|
||||||
|
|
||||||
|
|
||||||
// Virtual tokens for parser
|
// Virtual tokens for parser
|
||||||
tokens {
|
tokens {
|
||||||
@@ -25,7 +27,7 @@ HREF: 'href' WS;
|
|||||||
CLICK: 'click' WS+ [A-Za-z0-9_]+ -> pushMode(CLICK_MODE);
|
CLICK: 'click' WS+ [A-Za-z0-9_]+ -> pushMode(CLICK_MODE);
|
||||||
|
|
||||||
// Graph declaration tokens - these trigger direction mode
|
// Graph declaration tokens - these trigger direction mode
|
||||||
GRAPH: ('flowchart-elk' | 'graph' | 'flowchart') -> pushMode(DIR_MODE);
|
GRAPH: ('flowchart-elk' | 'graph' | 'flowchart') { this.headerMode = false; } -> pushMode(DIR_MODE);
|
||||||
SUBGRAPH: 'subgraph';
|
SUBGRAPH: 'subgraph';
|
||||||
END: 'end';
|
END: 'end';
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user