The Engine is responsible for executing the TextFSM state machine against input text.
It maintains the current state (context), the accumulated data (memory), and the template rules. The engine processes text line by line, matching against the rules of the current state, and executing corresponding actions (recording data, transitioning states, etc.).
Summary
Types
@type t() :: %TextFSM.Engine{ context: TextFSM.Engine.Context.t(), lines: [String.t()], memory: TextFSM.Engine.Memory.t(), template: TextFSM.Template.t() }
@type table() :: %{required(value_name()) => [value()]}
@type value_name() :: String.t()
Functions
@spec new(TextFSM.Template.t(), String.t()) :: t()
Creates a new Engine instance.
Initializes the engine with the compiled template and the input text.
Parameters
template- The compiledTextFSM.Template.text- The input text string.
Returns
TextFSM.Engine.t()
Runs the engine until completion.
It steps through the state machine processing lines until it halts (End state or EOF). Finally, it returns the parsed data as a column-oriented table represented as a map from value names to columns.
Parameters
engine- The initializedTextFSM.Enginestruct.
Returns
table()- The parsed data as a map of value names to lists of values (columns).