let compile_states state_list fsm_name =
| (** Compile all states *) |
let states = compile_states_helper state_list [] in
match state_list with
(init_name,_,_)::rest ->
states
| (** Set the initial state *) |
@ [SynVarAssign
(SynVarAssignment
(SynStructOrEnumValue
(SynVarName "ret","currentState",ref VIdUnspecified),
SynVarIdentifier
(SynVarName init_name)))]
| (** Make the state list and set the fsm field *) |
@ (compile_set_statelist (get_state_names state_list) fsm_name)
| [] -> raise_fsm_error ["State machine error: No states specified for state machine."]