Abstract Syntax Tree for Zig source code. For Zig syntax, the root node is at nodes[0] and contains the list of sub-nodes. For Zon syntax, the root node is at nodes[0] and contains lhs as the node index of the main expression.

Fields

source: [:0]const u8,

Reference to externally-owned data.

tokens: TokenList.Slice,
nodes: NodeList.Slice,

The root AST node is assumed to be index 0. Since there can be no references to the root node, this means 0 is available to indicate null.

extra_data: []Node.Index,
errors: []const Error,

Namespaces

Functions

fn alignedVarDecl(tree: Ast, node: Node.Index) full.VarDecl

No documentation provided.

fn arrayInit(tree: Ast, node: Node.Index) full.ArrayInit

No documentation provided.

fn arrayInitDot(tree: Ast, node: Node.Index) full.ArrayInit

No documentation provided.

fn arrayInitDotTwo(tree: Ast, buffer: *[2]Node.Index, node: Node.Index) full.ArrayInit

No documentation provided.

fn arrayInitOne(tree: Ast, buffer: *[1]Node.Index, node: Node.Index) full.ArrayInit

No documentation provided.

fn arrayType(tree: Ast, node: Node.Index) full.ArrayType

No documentation provided.

fn arrayTypeSentinel(tree: Ast, node: Node.Index) full.ArrayType

No documentation provided.

fn asmFull(tree: Ast, node: Node.Index) full.Asm

No documentation provided.

fn asmSimple(tree: Ast, node: Node.Index) full.Asm

No documentation provided.

fn callFull(tree: Ast, node: Node.Index) full.Call

No documentation provided.

fn callOne(tree: Ast, buffer: *[1]Node.Index, node: Node.Index) full.Call

No documentation provided.

fn containerDecl(tree: Ast, node: Node.Index) full.ContainerDecl

No documentation provided.

fn containerDeclArg(tree: Ast, node: Node.Index) full.ContainerDecl

No documentation provided.

fn containerDeclRoot(tree: Ast) full.ContainerDecl

No documentation provided.

fn containerDeclTwo(tree: Ast, buffer: *[2]Node.Index, node: Node.Index) full.ContainerDecl

No documentation provided.

fn containerField(tree: Ast, node: Node.Index) full.ContainerField

No documentation provided.

fn containerFieldAlign(tree: Ast, node: Node.Index) full.ContainerField

No documentation provided.

fn containerFieldInit(tree: Ast, node: Node.Index) full.ContainerField

No documentation provided.

fn deinit(tree: *Ast, gpa: Allocator) void

No documentation provided.

fn errorOffset(tree: Ast, parse_error: Error) u32

Returns an extra offset for column and byte offset of errors that should point …

Returns an extra offset for column and byte offset of errors that should point after the token in the error message.

fn extraData(tree: Ast, index: usize, comptime T: type) T

No documentation provided.

fn firstToken(tree: Ast, node: Node.Index) TokenIndex

No documentation provided.

fn fnProto(tree: Ast, node: Node.Index) full.FnProto

No documentation provided.

fn fnProtoMulti(tree: Ast, node: Node.Index) full.FnProto

No documentation provided.

fn fnProtoOne(tree: Ast, buffer: *[1]Node.Index, node: Node.Index) full.FnProto

No documentation provided.

fn fnProtoSimple(tree: Ast, buffer: *[1]Node.Index, node: Node.Index) full.FnProto

No documentation provided.

fn forFull(tree: Ast, node: Node.Index) full.For

No documentation provided.

fn forSimple(tree: Ast, node: Node.Index) full.For

No documentation provided.

fn fullArrayInit(tree: Ast, buffer: *[2]Node.Index, node: Node.Index) ?full.ArrayInit

No documentation provided.

fn fullArrayType(tree: Ast, node: Node.Index) ?full.ArrayType

No documentation provided.

fn fullAsm(tree: Ast, node: Node.Index) ?full.Asm

No documentation provided.

fn fullCall(tree: Ast, buffer: *[1]Ast.Node.Index, node: Node.Index) ?full.Call

No documentation provided.

fn fullContainerDecl(tree: Ast, buffer: *[2]Ast.Node.Index, node: Node.Index) ?full.ContainerDecl

No documentation provided.

fn fullContainerField(tree: Ast, node: Node.Index) ?full.ContainerField

No documentation provided.

fn fullFnProto(tree: Ast, buffer: *[1]Ast.Node.Index, node: Node.Index) ?full.FnProto

No documentation provided.

fn fullFor(tree: Ast, node: Node.Index) ?full.For

No documentation provided.

fn fullIf(tree: Ast, node: Node.Index) ?full.If

No documentation provided.

fn fullPtrType(tree: Ast, node: Node.Index) ?full.PtrType

No documentation provided.

fn fullSlice(tree: Ast, node: Node.Index) ?full.Slice

No documentation provided.

fn fullStructInit(tree: Ast, buffer: *[2]Ast.Node.Index, node: Node.Index) ?full.StructInit

No documentation provided.

fn fullSwitchCase(tree: Ast, node: Node.Index) ?full.SwitchCase

No documentation provided.

fn fullVarDecl(tree: Ast, node: Node.Index) ?full.VarDecl

No documentation provided.

fn fullWhile(tree: Ast, node: Node.Index) ?full.While

No documentation provided.

fn getNodeSource(tree: Ast, node: Node.Index) []const u8

No documentation provided.

fn globalVarDecl(tree: Ast, node: Node.Index) full.VarDecl

No documentation provided.

fn ifFull(tree: Ast, node: Node.Index) full.If

No documentation provided.

fn ifSimple(tree: Ast, node: Node.Index) full.If

No documentation provided.

fn lastToken(tree: Ast, node: Node.Index) TokenIndex

No documentation provided.

fn localVarDecl(tree: Ast, node: Node.Index) full.VarDecl

No documentation provided.

fn parse(gpa: Allocator, source: [:0]const u8, mode: Mode) Allocator.Error!Ast

Result should be freed with tree.deinit() when there are no more references to …

Result should be freed with tree.deinit() when there are no more references to any of the tokens or nodes.

fn ptrType(tree: Ast, node: Node.Index) full.PtrType

No documentation provided.

fn ptrTypeAligned(tree: Ast, node: Node.Index) full.PtrType

No documentation provided.

fn ptrTypeBitRange(tree: Ast, node: Node.Index) full.PtrType

No documentation provided.

fn ptrTypeSentinel(tree: Ast, node: Node.Index) full.PtrType

No documentation provided.

fn render(tree: Ast, gpa: Allocator) RenderError![]u8

gpa is used for allocating the resulting formatted source code, as well as fo…

gpa is used for allocating the resulting formatted source code, as well as for allocating extra stack memory if needed, because this function utilizes recursion. Note: that’s not actually true yet, see https://github.com/ziglang/zig/issues/1006. Caller owns the returned slice of bytes, allocated with gpa.

fn renderError(tree: Ast, parse_error: Error, stream: anytype) !void

No documentation provided.

fn renderToArrayList(tree: Ast, buffer: *field_call) RenderError!void

No documentation provided.

fn rootDecls(tree: Ast) []const Node.Index

No documentation provided.

fn simpleVarDecl(tree: Ast, node: Node.Index) full.VarDecl

No documentation provided.

fn slice(tree: Ast, node: Node.Index) full.Slice

No documentation provided.

fn sliceOpen(tree: Ast, node: Node.Index) full.Slice

No documentation provided.

fn sliceSentinel(tree: Ast, node: Node.Index) full.Slice

No documentation provided.

fn structInit(tree: Ast, node: Node.Index) full.StructInit

No documentation provided.

fn structInitDot(tree: Ast, node: Node.Index) full.StructInit

No documentation provided.

fn structInitDotTwo(tree: Ast, buffer: *[2]Node.Index, node: Node.Index) full.StructInit

No documentation provided.

fn structInitOne(tree: Ast, buffer: *[1]Node.Index, node: Node.Index) full.StructInit

No documentation provided.

fn switchCase(tree: Ast, node: Node.Index) full.SwitchCase

No documentation provided.

fn switchCaseOne(tree: Ast, node: Node.Index) full.SwitchCase

No documentation provided.

fn taggedUnion(tree: Ast, node: Node.Index) full.ContainerDecl

No documentation provided.

fn taggedUnionEnumTag(tree: Ast, node: Node.Index) full.ContainerDecl

No documentation provided.

fn taggedUnionTwo(tree: Ast, buffer: *[2]Node.Index, node: Node.Index) full.ContainerDecl

No documentation provided.

fn tokenLocation(self: Ast, start_offset: ByteOffset, token_index: TokenIndex) Location

No documentation provided.

fn tokenSlice(tree: Ast, token_index: TokenIndex) []const u8

No documentation provided.

fn tokensOnSameLine(tree: Ast, token1: TokenIndex, token2: TokenIndex) bool

No documentation provided.

fn whileCont(tree: Ast, node: Node.Index) full.While

No documentation provided.

fn whileFull(tree: Ast, node: Node.Index) full.While

No documentation provided.

fn whileSimple(tree: Ast, node: Node.Index) full.While

No documentation provided.

Values

NodeList
undefined
TokenList
undefined

Error Sets