Module

nodes.base

Base node class for Kida AST.

Classes

Node 3
Base class for all AST nodes. All nodes track their source location for error reporting. Nodes are…

Base class for all AST nodes.

All nodes track their source location for error reporting. Nodes are immutable for thread-safety.

Attributes

Name Type Description
lineno int
col_offset int

Methods

iter_child_nodes 0 Iterator[Node]
Yield all direct child AST nodes. Uses ``__dataclass_fields__`` introspection …
def iter_child_nodes(self) -> Iterator[Node]

Yield all direct child AST nodes.

Uses__dataclass_fields__introspection so adding a node type requires zero changes to visitor/transformer code.

Returns
Iterator[Node]

Functions

_iter_sequence 1 Iterator[Node]
Yield Node instances from a (possibly nested) sequence.
def _iter_sequence(seq: list | tuple) -> Iterator[Node]
Parameters
Name Type Description
seq list | tuple
Returns
Iterator[Node]