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