TextFSM.Engine (TextFSM v0.1.2)

Copy Markdown View Source

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

Functions

Creates a new Engine instance.

Runs the engine until completion.

Types

t()

@type t() :: %TextFSM.Engine{
  context: TextFSM.Engine.Context.t(),
  lines: [String.t()],
  memory: TextFSM.Engine.Memory.t(),
  template: TextFSM.Template.t()
}

table()

@type table() :: %{required(value_name()) => [value()]}

value()

@type value() :: nil | String.t() | [String.t()]

value_name()

@type value_name() :: String.t()

Functions

new(template, text)

@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

Returns

  • TextFSM.Engine.t()

run(engine)

@spec run(t()) :: table()

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

Returns

  • table() - The parsed data as a map of value names to lists of values (columns).