Bash.AST.Walkable protocol (Bash v0.6.0)

Copy Markdown View Source

Protocol for traversing and transforming AST nodes.

Each AST node implements this protocol to expose its child statement nodes and allow reconstruction with updated children. This powers the tree traversal functions in Bash.AST.

Statement lists in the AST may contain interleaved separator tuples like {:separator, "\n"} or {:operator, :and}. The protocol implementations filter these out when returning children and splice them back in during reconstruction.

Summary

Types

t()

All the types that implement this protocol.

Functions

Returns child statement nodes as a flat list.

Types

t()

@type t() :: term()

All the types that implement this protocol.

Functions

children(node)

@spec children(t()) :: [Bash.Statement.t()]

Returns child statement nodes as a flat list.