TLX.Extractor.GenStatem
(TLX v0.5.2)
Copy Markdown
Extracts state machine structure from gen_statem/GenStateMachine source code.
Parses Elixir source with Code.string_to_quoted/1 and walks the AST to
extract states, transitions, initial state, and callback mode. Supports
both handle_event_function and state_functions callback modes.
Usage
{:ok, result} = TLX.Extractor.GenStatem.extract_from_file("lib/my_machine.ex")
result.states #=> [:idle, :running, :done]
result.initial #=> :idle
result.transitions #=> [%{event: :start, from: :idle, to: :running, ...}, ...]The result can feed into TLX.Patterns.OTP.StateMachine or
TLX.Importer.Codegen.from_state_machine/3.
Summary
Functions
Extract state machine structure from a source file.
Extract state machine structure from an Elixir source string.