Enter State Machine Symbols - nasa/fpp GitHub Wiki
This algorithm traverses a state machine definition and enters state machine symbols into their scopes.
- 
A state machine definition smd. 
- 
A state machine analysis data structure sma representing the results of analysis so far. 
Visit each of the state machine members smm of smd as specified below.
Visit a state machine member smm as follows:
- 
Action, guard, choice, and signal definitions: If smm is an action, guard, choice, or signal definition d with name n, then - 
Construct the unique state machine symbol s of the correct kind for d. 
- 
Add the mapping from n to s in the nested scope of sma in the correct name group for the definition kind. There is a separate name group for each of actions, guards, and signal definitions. Choice definitions reside in the state name group. 
- 
Add s to the parent symbol map of sma. 
 
- 
- 
State definitions: If smm is a state definition d with name n, then - 
Construct the unique state definition symbol sym for d. 
- 
Add the mapping from n to sym in the innermost nested scope of sma in the state name group. 
- 
Add sym to the parent symbol map of sma. 
- 
Create a fresh state machine scope s. 
- 
Push s onto the nested scope of sma. 
- 
Add n to the scope name list of sma. 
- 
Visit each state definition member sdm of d, yielding a new state machine analysis sma. 
- 
Remove n from the scope name list of a. 
- 
Let s' be the innermost nested scope of sma. 
- 
Add the mapping from sym to s' in the symbol-scope map of sma. 
- 
Pop s' off the nested scope of sma. 
 
- 
- 
Other members: For other state machine members, do nothing. 
Visit a state definition member sdm as follows:
- 
Choice definitions and state definitions: If sdm is a choice definition d or a state definition d, then - 
Visit d as specified for the corresponding state machine member. 
- 
Add the symbol s associated with d to the parent symbol map of sma. 
 
- 
- 
Other members: For other state definition members, do nothing.