#945 Handling recursive state statements

This commit is contained in:
knsv
2019-09-21 08:54:18 -07:00
parent 6f054519e7
commit 9993b90a20
2 changed files with 5 additions and 5 deletions

View File

@@ -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';}}

View File

@@ -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
} }
} }
`; `;