mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-22 00:40:22 +02:00
#945 Handling recursive state statements
This commit is contained in:
@@ -34,7 +34,7 @@
|
|||||||
<SCALE>\d+ return 'WIDTH';
|
<SCALE>\d+ return 'WIDTH';
|
||||||
<SCALE>\s+"width" {this.popState();}
|
<SCALE>\s+"width" {this.popState();}
|
||||||
|
|
||||||
"state"\s+ { this.pushState('STATE'); }
|
<INITIAL,struct>"state"\s+ { this.pushState('STATE'); }
|
||||||
<STATE>[^\n\s\{]+ {console.log('COMPOSIT_STATE', yytext);return 'COMPOSIT_STATE';}
|
<STATE>[^\n\s\{]+ {console.log('COMPOSIT_STATE', yytext);return 'COMPOSIT_STATE';}
|
||||||
<STATE>\{ {this.popState();this.pushState('struct'); console.log('begin struct', yytext);return 'STRUCT_START';}
|
<STATE>\{ {this.popState();this.pushState('struct'); console.log('begin struct', yytext);return 'STRUCT_START';}
|
||||||
<struct>\} { console.log('Ending struct'); this.popState(); return 'STRUCT_STOP';}}
|
<struct>\} { console.log('Ending struct'); this.popState(); return 'STRUCT_STOP';}}
|
||||||
|
@@ -80,7 +80,7 @@ describe('state diagram, ', function() {
|
|||||||
|
|
||||||
parser.parse(str);
|
parser.parse(str);
|
||||||
});
|
});
|
||||||
xit('should handle relation definitions', function() {
|
it('should handle recursive state definitions', function() {
|
||||||
const str = `stateDiagram\n
|
const str = `stateDiagram\n
|
||||||
state Configuring {
|
state Configuring {
|
||||||
[*] --> NewValueSelection
|
[*] --> NewValueSelection
|
||||||
@@ -89,14 +89,14 @@ describe('state diagram, ', function() {
|
|||||||
NewValuePreview --> NewValueSelection : EvNewValueSaved
|
NewValuePreview --> NewValueSelection : EvNewValueSaved
|
||||||
|
|
||||||
state NewValuePreview {
|
state NewValuePreview {
|
||||||
State1 -> State2
|
State1 --> State2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
parser.parse(str);
|
parser.parse(str);
|
||||||
});
|
});
|
||||||
xit('should handle relation definitions', function() {
|
it('should handle multiple recursive state definitions', function() {
|
||||||
const str = `stateDiagram\n
|
const str = `stateDiagram\n
|
||||||
scale 350 width
|
scale 350 width
|
||||||
[*] --> NotShooting
|
[*] --> NotShooting
|
||||||
@@ -114,7 +114,7 @@ describe('state diagram, ', function() {
|
|||||||
NewValuePreview --> NewValueSelection : EvNewValueSaved
|
NewValuePreview --> NewValueSelection : EvNewValueSaved
|
||||||
|
|
||||||
state NewValuePreview {
|
state NewValuePreview {
|
||||||
State1 -> State2
|
State1 --> State2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
Reference in New Issue
Block a user