gen_statem extractor.
Detects gen_statem modules and extracts their state machine structure:
states, transitions, and timeouts. Supports state_functions callback
mode (function names = states) and handle_event_function mode (state
passed as argument).
Approach
For state_functions mode, each exported function whose name isn't a
standard gen_statem callback is treated as a state handler. Transitions
are detected by scanning return tuples for {:next_state, target, ...}
patterns.
For handle_event_function mode, the handle_event/4 function is
analyzed for state argument patterns.
Emitted facts
statem_event_clause(mod, func, event_type)— a clause head matches this event typestatem_call_unreplied(mod, func, site)— a{:call, from}clause returns atsitewithout replying, postponing, or keepingfromstatem_info_catchall(mod, func)— some clause accepts:infowith any contentstatem_event_catchall(mod, func)— some clause accepts any event
The clause-head walk behind the last three lives in
Argus.Extractors.GenStatem.EventClauses.
statem_module(mod, callback_mode)— gen_statem module identificationstatem_state(mod, state)— state in the machinestatem_transition(mod, from, event, to)— state transitionstatem_timeout(mod, state, type, value)— timeout set per state