The StateMachineParser currently doesn't properly handle complex state expressions. This results in incomplete transitions in the state machine diagram. This happens because the getStateExpressions() method simply extracts state names from the AST but ignores their logic.
Needed Improvements
The parser needs to correctly interpret the following patterns in @StateRefinement annotations:
Conjunctions
- Pattern:
from="x && state1", where x can be any boolean expression
- Interpretation: can only transition when
x is true and in state state1
- Diagram:
Disjunctions
- Pattern:
from="x || state1", where x can be any boolean expression
- Interpretation: can transition when either
x is true or in state state1
- Diagram:
method → state1
x → state1
Conditionals
- Pattern:
from="x ? state1 : state2", where x can be any boolean expression
- Interpretation: can transition to
state1 when x is true and to state2 when x is false
- Diagram:
method (x) → state1
method (!x) → state2