mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
Refactor directive grammar to use name instead of position in production
This commit is contained in:
parent
4b9773a272
commit
fa8e02721a
@ -283,11 +283,11 @@ openDirective
|
|||||||
;
|
;
|
||||||
|
|
||||||
typeDirective
|
typeDirective
|
||||||
: type_directive { yy.parseDirective($1, 'type_directive'); }
|
: type_directive { yy.parseDirective($type_directive, 'type_directive'); }
|
||||||
;
|
;
|
||||||
|
|
||||||
argDirective
|
argDirective
|
||||||
: arg_directive { $1 = $1.trim().replace(/'/g, '"'); yy.parseDirective($1, 'arg_directive'); }
|
: arg_directive { $arg_directive = $arg_directive.trim().replace(/'/g, '"'); yy.parseDirective($arg_directive, 'arg_directive'); }
|
||||||
;
|
;
|
||||||
|
|
||||||
closeDirective
|
closeDirective
|
||||||
@ -303,15 +303,15 @@ document
|
|||||||
{ $$ = [];}
|
{ $$ = [];}
|
||||||
| document line
|
| document line
|
||||||
{
|
{
|
||||||
if(!Array.isArray($2) || $2.length > 0){
|
if(!Array.isArray($line) || $line.length > 0){
|
||||||
$1.push($2);
|
$document.push($line);
|
||||||
}
|
}
|
||||||
$$=$1;}
|
$$=$document;}
|
||||||
;
|
;
|
||||||
|
|
||||||
line
|
line
|
||||||
: statement
|
: statement
|
||||||
{$$=$1;}
|
{$$=$statement;}
|
||||||
| SEMI
|
| SEMI
|
||||||
| NEWLINE
|
| NEWLINE
|
||||||
| SPACE
|
| SPACE
|
||||||
@ -324,15 +324,15 @@ graphConfig
|
|||||||
| GRAPH NODIR
|
| GRAPH NODIR
|
||||||
{ yy.setDirection('TB');$$ = 'TB';}
|
{ yy.setDirection('TB');$$ = 'TB';}
|
||||||
| GRAPH DIR FirstStmtSeperator
|
| GRAPH DIR FirstStmtSeperator
|
||||||
{ yy.setDirection($2);$$ = $2;}
|
{ yy.setDirection($DIR);$$ = $DIR;}
|
||||||
// | GRAPH SPACE TAGEND FirstStmtSeperator
|
// | GRAPH SPACE TAGEND FirstStmtSeperator
|
||||||
// { yy.setDirection("LR");$$ = $3;}
|
// { yy.setDirection("LR");$$ = $TAGEND;}
|
||||||
// | GRAPH SPACE TAGSTART FirstStmtSeperator
|
// | GRAPH SPACE TAGSTART FirstStmtSeperator
|
||||||
// { yy.setDirection("RL");$$ = $3;}
|
// { yy.setDirection("RL");$$ = $TAGSTART;}
|
||||||
// | GRAPH SPACE UP FirstStmtSeperator
|
// | GRAPH SPACE UP FirstStmtSeperator
|
||||||
// { yy.setDirection("BT");$$ = $3;}
|
// { yy.setDirection("BT");$$ = $UP;}
|
||||||
// | GRAPH SPACE DOWN FirstStmtSeperator
|
// | GRAPH SPACE DOWN FirstStmtSeperator
|
||||||
// { yy.setDirection("TB");$$ = $3;}
|
// { yy.setDirection("TB");$$ = $DOWN;}
|
||||||
;
|
;
|
||||||
|
|
||||||
ending: endToken ending
|
ending: endToken ending
|
||||||
|
Loading…
x
Reference in New Issue
Block a user