# `TextFSM.Engine`
[🔗](https://github.com/amitbashan/textfsm/blob/main/lib/textfsm/engine.ex#L1)

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.).

# `t`

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

# `table`

```elixir
@type table() :: %{required(value_name()) =&gt; [value()]}
```

# `value`

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

# `value_name`

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

# `new`

```elixir
@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 compiled `TextFSM.Template`.
* `text` - The input text string.

## Returns

* `TextFSM.Engine.t()`

# `run`

```elixir
@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

* `engine` - The initialized `TextFSM.Engine` struct.

## Returns

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
