Skip to content

Commit f7fa1f2

Browse files
Fix exit function for transient states.
1 parent 0254160 commit f7fa1f2

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Semantics/Operation.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ allHandlers g = fromList $
7575
finalStates :: Gr EnterExitState Happening -> [Node]
7676
finalStates g = nodes g \\
7777
do (n, EnterExitState {st=st@(State _)}) <- states
78-
(Event _, Just (st', ev')) <- toList $ Map.map (! st) ahs
78+
(e, Just (st', ev')) <- toList $ Map.map (! st) ahs
79+
guard $ canTransition e
7980
(m, EnterExitState {st=st''}) <- states
8081
guard $ st' == st''
8182
(_, _, Happening {flags}) <- out g m
@@ -84,3 +85,6 @@ finalStates g = nodes g \\
8485
where
8586
ahs = allHandlers g
8687
states = labNodes g
88+
canTransition EventEnter = True
89+
canTransition (Event _) = True
90+
canTransition _ = False

examples/showoff.smudge

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
[
99
_ -(SM3."External")-> B
1010
],
11+
D --> A,
1112
B (@enterB)
1213
[
1314
"Whee" --> C,
@@ -17,7 +18,8 @@
1718
* C
1819
[
1920
Beedoo --> A,
20-
GoB -(@gob)-> B
21+
GoB -(@gob)-> B,
22+
something --> D
2123
]
2224
}
2325

0 commit comments

Comments
 (0)