zyntex.parsing.syntax¶
- class zyntex.parsing.syntax.FunctionDeclaration(name, body, return_type, params=None, is_public=False, is_extern=False, is_export=False)[source]¶
Represents a Zig function declaration.
- property body: str | None¶
Raw body of the function declaration. None if the function is declared with extern.
- property params: list[FunctionParam]¶
List of function parameters.
- class zyntex.parsing.syntax.INodeElement(*args, **kwargs)[source]¶
Base class for all Zig AST node wrappers.
- class zyntex.parsing.syntax.LazyInit(node)[source]¶
Marker object that carries a PyASTNode to support lazy attribute init.
Instances of this class are stored on objects to indicate that the real attribute value should be computed later from the provided AST node.
- class zyntex.parsing.syntax.TestDeclaration(name, body)[source]¶
Represents a Zig test declaration.
- class zyntex.parsing.syntax.TypeNode(array_type=None, array_length=None, optional_type=None, pointer_type=None, type=None, is_const=False, is_error_union=False)[source]¶
A High-level wrapper for Zig Types.
Provides methods to check if a type is an array, optional, pointer, or constant, and to access related subtypes. Distinguishes between primitive and custom (user-defined) types.
- property absolute_type: CustomType | PrimitiveType¶
Resolve the absolute base type.
Walks through optional/array/pointer wrappers to locate the underlying identifier. Returns PrimitiveType for known primitives or CustomType for user-defined names. Raises NotImplementedError for unsupported type nodes.
- property array_length: str | None¶
Declared length of the array. None if the type node is not an array.
The value is returned as a string because it may represent either a numeric literal or a symbolic name (variable/expression).
- property type: PrimitiveType | CustomType | None¶
Immediate type as PrimitiveType or CustomType, if identifier.
- class zyntex.parsing.syntax.VariableDeclaration(name, value, type_hint, alignment=None, is_public=False, is_const=False, is_extern=False, is_export=False)[source]¶
Represents a Zig variable declaration.
- zyntex.parsing.syntax.lazy_invoke(func)[source]¶
A decorator for lazy properties.
Apply this to a @property method so its value is computed only on first access and then reused. The computed value is stored on a private attribute named _<property_name>. If that attribute is a LazyInit marker, the wrapped function will run to produce the value.