package core:odin/ast

Index

Types (97)
Procedure Groups (1)

Types

Array_Type ¶

Array_Type :: struct {
	node:  Expr,
	open:  odin_tokenizer.Pos,
	tag:   ^Expr,
	len:   ^Expr,
	// Ellipsis node for [?]T arrray types, nil for slice types
	close: odin_tokenizer.Pos,
	elem:  ^Expr,
}

Assign_Stmt ¶

Assign_Stmt :: struct {
	node: Stmt,
	lhs:  []^Expr,
	op:   odin_tokenizer.Token,
	rhs:  []^Expr,
}

Attribute ¶

Attribute :: struct {
	node:  Node,
	tok:   odin_tokenizer.Token_Kind,
	open:  odin_tokenizer.Pos,
	elems: []^Expr,
	close: odin_tokenizer.Pos,
}

Auto_Cast ¶

Auto_Cast :: struct {
	node: Expr,
	op:   odin_tokenizer.Token,
	expr: ^Expr,
}

Bad_Decl ¶

Bad_Decl :: struct {
	node: Decl,
}

Bad_Expr ¶

Bad_Expr :: struct {
	node: Expr,
}

Bad_Stmt ¶

Bad_Stmt :: struct {
	node: Stmt,
}

Basic_Directive ¶

Basic_Directive :: struct {
	node: Expr,
	tok:  odin_tokenizer.Token,
	name: string,
}

Basic_Lit ¶

Basic_Lit :: struct {
	node: Expr,
	tok:  odin_tokenizer.Token,
}

Binary_Expr ¶

Binary_Expr :: struct {
	node:  Expr,
	left:  ^Expr,
	op:    odin_tokenizer.Token,
	right: ^Expr,
}

Bit_Set_Type ¶

Bit_Set_Type :: struct {
	node:       Expr,
	tok_pos:    odin_tokenizer.Pos,
	open:       odin_tokenizer.Pos,
	elem:       ^Expr,
	underlying: ^Expr,
	close:      odin_tokenizer.Pos,
}

Block_Stmt ¶

Block_Stmt :: struct {
	node:    Stmt,
	label:   ^Expr,
	open:    odin_tokenizer.Pos,
	stmts:   []^Stmt,
	close:   odin_tokenizer.Pos,
	uses_do: bool,
}

Branch_Stmt ¶

Branch_Stmt :: struct {
	node:  Stmt,
	tok:   odin_tokenizer.Token,
	label: ^Ident,
}

Call_Expr ¶

Call_Expr :: struct {
	node:     Expr,
	inlining: Proc_Inlining,
	expr:     ^Expr,
	open:     odin_tokenizer.Pos,
	args:     []^Expr,
	ellipsis: odin_tokenizer.Token,
	close:    odin_tokenizer.Pos,
}

Case_Clause ¶

Case_Clause :: struct {
	node:       Stmt,
	case_pos:   odin_tokenizer.Pos,
	list:       []^Expr,
	terminator: odin_tokenizer.Token,
	body:       []^Stmt,
}

Comment_Group ¶

Comment_Group :: struct {
	node: Node,
	list: []odin_tokenizer.Token,
}

Comp_Lit ¶

Comp_Lit :: struct {
	node:  Expr,
	type:  ^Expr,
	open:  odin_tokenizer.Pos,
	elems: []^Expr,
	close: odin_tokenizer.Pos,
	tag:   ^Expr,
}

Decl ¶

Decl :: struct {
	decl_base: Stmt,
}

Defer_Stmt ¶

Defer_Stmt :: struct {
	node: Stmt,
	stmt: ^Stmt,
}

Deref_Expr ¶

Deref_Expr :: struct {
	node: Expr,
	expr: ^Expr,
	op:   odin_tokenizer.Token,
}

Distinct_Type ¶

Distinct_Type :: struct {
	node: Expr,
	tok:  odin_tokenizer.Token_Kind,
	type: ^Expr,
}

Dynamic_Array_Type ¶

Dynamic_Array_Type :: struct {
	node:        Expr,
	tag:         ^Expr,
	open:        odin_tokenizer.Pos,
	dynamic_pos: odin_tokenizer.Pos,
	close:       odin_tokenizer.Pos,
	elem:        ^Expr,
}

Ellipsis ¶

Ellipsis :: struct {
	node: Expr,
	tok:  odin_tokenizer.Token_Kind,
	expr: ^Expr,
}

Empty_Stmt ¶

Empty_Stmt :: struct {
	node:      Stmt,
	semicolon: odin_tokenizer.Pos,
}

Enum_Type ¶

Enum_Type :: struct {
	node:      Expr,
	tok_pos:   odin_tokenizer.Pos,
	base_type: ^Expr,
	open:      odin_tokenizer.Pos,
	fields:    []^Expr,
	close:     odin_tokenizer.Pos,
	is_using:  bool,
}

Expr ¶

Expr :: struct {
	expr_base:    Node,
	derived_expr: Any_Expr,
}

Expr_Stmt ¶

Expr_Stmt :: struct {
	node: Stmt,
	expr: ^Expr,
}

Field ¶

Field :: struct {
	node:          Node,
	docs:          ^Comment_Group,
	names:         []^Expr,
	// Could be polymorphic
	type:          ^Expr,
	default_value: ^Expr,
	tag:           odin_tokenizer.Token,
	flags:         Field_Flags,
	comment:       ^Comment_Group,
}

Field_Flag ¶

Field_Flag :: enum int {
	Invalid, 
	Unknown, 
	Ellipsis, 
	Using, 
	No_Alias, 
	C_Vararg, 
	Auto_Cast, 
	Any_Int, 
	Subtype, 
	By_Ptr, 
	Results, 
	Tags, 
	Default_Parameters, 
	Typeid_Token, 
}

Field_Flags ¶

Field_Flags :: distinct bit_set[Field_Flag]

Field_List ¶

Field_List :: struct {
	node:  Node,
	open:  odin_tokenizer.Pos,
	list:  []^Field,
	close: odin_tokenizer.Pos,
}

Field_Value ¶

Field_Value :: struct {
	node:  Expr,
	field: ^Expr,
	sep:   odin_tokenizer.Pos,
	value: ^Expr,
}

File ¶

File :: struct {
	node:                 Node,
	id:                   int,
	pkg:                  ^Package,
	fullpath:             string,
	src:                  string,
	docs:                 ^Comment_Group,
	pkg_decl:             ^Package_Decl,
	pkg_token:            odin_tokenizer.Token,
	pkg_name:             string,
	decls:                [dynamic]^Stmt,
	imports:              [dynamic]^Import_Decl,
	directive_count:      int,
	comments:             [dynamic]^Comment_Group,
	syntax_warning_count: int,
	syntax_error_count:   int,
}

For_Stmt ¶

For_Stmt :: struct {
	node:    Stmt,
	label:   ^Expr,
	for_pos: odin_tokenizer.Pos,
	init:    ^Stmt,
	cond:    ^Expr,
	post:    ^Stmt,
	body:    ^Stmt,
}

Foreign_Block_Decl ¶

Foreign_Block_Decl :: struct {
	node:            Decl,
	docs:            ^Comment_Group,
	attributes:      [dynamic]^Attribute,
	// dynamic as parsing will add to them lazily
	tok:             odin_tokenizer.Token,
	foreign_library: ^Expr,
	body:            ^Stmt,
}

Foreign_Import_Decl ¶

Foreign_Import_Decl :: struct {
	node:            Decl,
	docs:            ^Comment_Group,
	attributes:      [dynamic]^Attribute,
	// dynamic as parsing will add to them lazily
	foreign_tok:     odin_tokenizer.Token,
	import_tok:      odin_tokenizer.Token,
	name:            ^Ident,
	collection_name: string,
	fullpaths:       []string,
	comment:         ^Comment_Group,
}

Helper_Type ¶

Helper_Type :: struct {
	node: Expr,
	tok:  odin_tokenizer.Token_Kind,
	type: ^Expr,
}

Ident ¶

Ident :: struct {
	node: Expr,
	name: string,
}

If_Stmt ¶

If_Stmt :: struct {
	node:      Stmt,
	label:     ^Expr,
	if_pos:    odin_tokenizer.Pos,
	init:      ^Stmt,
	cond:      ^Expr,
	body:      ^Stmt,
	else_pos:  odin_tokenizer.Pos,
	else_stmt: ^Stmt,
}

Implicit ¶

Implicit :: struct {
	node: Expr,
	tok:  odin_tokenizer.Token,
}

Implicit_Selector_Expr ¶

Implicit_Selector_Expr :: struct {
	node:  Expr,
	field: ^Ident,
}

Import_Decl ¶

Import_Decl :: struct {
	node:       Decl,
	docs:       ^Comment_Group,
	is_using:   bool,
	import_tok: odin_tokenizer.Token,
	name:       odin_tokenizer.Token,
	relpath:    odin_tokenizer.Token,
	fullpath:   string,
	comment:    ^Comment_Group,
}

Index_Expr ¶

Index_Expr :: struct {
	node:  Expr,
	expr:  ^Expr,
	open:  odin_tokenizer.Pos,
	index: ^Expr,
	close: odin_tokenizer.Pos,
}

Inline_Asm_Dialect ¶

Inline_Asm_Dialect :: enum u8 {
	Default = 0, 
	ATT     = 1, 
	Intel   = 2, 
}

Inline_Asm_Expr ¶

Inline_Asm_Expr :: struct {
	node:               Expr,
	tok:                odin_tokenizer.Token,
	param_types:        []^Expr,
	return_type:        ^Expr,
	has_side_effects:   bool,
	is_align_stack:     bool,
	dialect:            Inline_Asm_Dialect,
	open:               odin_tokenizer.Pos,
	constraints_string: ^Expr,
	asm_string:         ^Expr,
	close:              odin_tokenizer.Pos,
}

Inline_Range_Stmt ¶

Inline_Range_Stmt :: struct {
	node:       Stmt,
	label:      ^Expr,
	inline_pos: odin_tokenizer.Pos,
	for_pos:    odin_tokenizer.Pos,
	val0:       ^Expr,
	val1:       ^Expr,
	in_pos:     odin_tokenizer.Pos,
	expr:       ^Expr,
	body:       ^Stmt,
}

Map_Type ¶

Map_Type :: struct {
	node:    Expr,
	tok_pos: odin_tokenizer.Pos,
	key:     ^Expr,
	value:   ^Expr,
}

Matrix_Index_Expr ¶

Matrix_Index_Expr :: struct {
	node:         Expr,
	expr:         ^Expr,
	open:         odin_tokenizer.Pos,
	row_index:    ^Expr,
	column_index: ^Expr,
	close:        odin_tokenizer.Pos,
}

Matrix_Type ¶

Matrix_Type :: struct {
	node:         Expr,
	tok_pos:      odin_tokenizer.Pos,
	row_count:    ^Expr,
	column_count: ^Expr,
	elem:         ^Expr,
}

Multi_Pointer_Type ¶

Multi_Pointer_Type :: struct {
	node:    Expr,
	open:    odin_tokenizer.Pos,
	pointer: odin_tokenizer.Pos,
	close:   odin_tokenizer.Pos,
	elem:    ^Expr,
}

Node ¶

Node :: struct {
	pos:         odin_tokenizer.Pos,
	end:         odin_tokenizer.Pos,
	state_flags: Node_State_Flags,
	derived:     Any_Node,
}

Node_State_Flag ¶

Node_State_Flag :: enum int {
	Bounds_Check, 
	No_Bounds_Check, 
}

Node_State_Flags ¶

Node_State_Flags :: distinct bit_set[Node_State_Flag]

Or_Else_Expr ¶

Or_Else_Expr :: struct {
	node:  Expr,
	x:     ^Expr,
	token: odin_tokenizer.Token,
	y:     ^Expr,
}

Or_Return_Expr ¶

Or_Return_Expr :: struct {
	node:  Expr,
	expr:  ^Expr,
	token: odin_tokenizer.Token,
}

Package ¶

Package :: struct {
	node:      Node,
	kind:      Package_Kind,
	id:        int,
	name:      string,
	fullpath:  string,
	files:     map[string]^File,
	user_data: rawptr,
}

Package_Decl ¶

Package_Decl :: struct {
	node:    Decl,
	docs:    ^Comment_Group,
	token:   odin_tokenizer.Token,
	name:    string,
	comment: ^Comment_Group,
}

Package_Kind ¶

Package_Kind :: enum int {
	Normal, 
	Runtime, 
	Init, 
}

Paren_Expr ¶

Paren_Expr :: struct {
	node:  Expr,
	open:  odin_tokenizer.Pos,
	expr:  ^Expr,
	close: odin_tokenizer.Pos,
}

Pointer_Type ¶

Pointer_Type :: struct {
	node:    Expr,
	tag:     ^Expr,
	pointer: odin_tokenizer.Pos,
	elem:    ^Expr,
}

Poly_Type ¶

Poly_Type :: struct {
	node:           Expr,
	dollar:         odin_tokenizer.Pos,
	type:           ^Ident,
	specialization: ^Expr,
}

Proc_Calling_Convention ¶

Proc_Calling_Convention :: union {
	string, 
	Proc_Calling_Convention_Extra, 
}

Proc_Calling_Convention_Extra ¶

Proc_Calling_Convention_Extra :: enum i32 {
	Foreign_Block_Default, 
}

Proc_Group ¶

Proc_Group :: struct {
	node:  Expr,
	tok:   odin_tokenizer.Token,
	open:  odin_tokenizer.Pos,
	args:  []^Expr,
	close: odin_tokenizer.Pos,
}

Proc_Inlining ¶

Proc_Inlining :: enum u32 {
	None      = 0, 
	Inline    = 1, 
	No_Inline = 2, 
}

Proc_Lit ¶

Proc_Lit :: struct {
	node:          Expr,
	type:          ^Proc_Type,
	body:          ^Stmt,
	tags:          Proc_Tags,
	inlining:      Proc_Inlining,
	where_token:   odin_tokenizer.Token,
	where_clauses: []^Expr,
}

Proc_Tag ¶

Proc_Tag :: enum int {
	Bounds_Check, 
	No_Bounds_Check, 
	Optional_Ok, 
	Optional_Allocator_Error, 
}

Proc_Tags ¶

Proc_Tags :: distinct bit_set[Proc_Tag; u32]

Proc_Type ¶

Proc_Type :: struct {
	node:               Expr,
	tok:                odin_tokenizer.Token,
	calling_convention: Proc_Calling_Convention,
	params:             ^Field_List,
	arrow:              odin_tokenizer.Pos,
	results:            ^Field_List,
	tags:               Proc_Tags,
	generic:            bool,
	diverging:          bool,
}

Range_Stmt ¶

Range_Stmt :: struct {
	node:    Stmt,
	label:   ^Expr,
	for_pos: odin_tokenizer.Pos,
	vals:    []^Expr,
	in_pos:  odin_tokenizer.Pos,
	expr:    ^Expr,
	body:    ^Stmt,
}

Relative_Type ¶

Relative_Type :: struct {
	node: Expr,
	tag:  ^Expr,
	type: ^Expr,
}

Return_Stmt ¶

Return_Stmt :: struct {
	node:    Stmt,
	results: []^Expr,
}

Selector_Call_Expr ¶

Selector_Call_Expr :: struct {
	node:          Expr,
	expr:          ^Expr,
	call:          ^Call_Expr,
	modified_call: bool,
}

Selector_Expr ¶

Selector_Expr :: struct {
	node:  Expr,
	expr:  ^Expr,
	op:    odin_tokenizer.Token,
	field: ^Ident,
}

Slice_Expr ¶

Slice_Expr :: struct {
	node:     Expr,
	expr:     ^Expr,
	open:     odin_tokenizer.Pos,
	low:      ^Expr,
	interval: odin_tokenizer.Token,
	high:     ^Expr,
	close:    odin_tokenizer.Pos,
}

Stmt ¶

Stmt :: struct {
	stmt_base:    Node,
	derived_stmt: Any_Stmt,
}

Struct_Type ¶

Struct_Type :: struct {
	node:          Expr,
	tok_pos:       odin_tokenizer.Pos,
	poly_params:   ^Field_List,
	align:         ^Expr,
	where_token:   odin_tokenizer.Token,
	where_clauses: []^Expr,
	is_packed:     bool,
	is_raw_union:  bool,
	fields:        ^Field_List,
	name_count:    int,
}

Switch_Stmt ¶

Switch_Stmt :: struct {
	node:       Stmt,
	label:      ^Expr,
	switch_pos: odin_tokenizer.Pos,
	init:       ^Stmt,
	cond:       ^Expr,
	body:       ^Stmt,
	partial:    bool,
}

Tag_Expr ¶

Tag_Expr :: struct {
	node: Expr,
	op:   odin_tokenizer.Token,
	name: string,
	expr: ^Expr,
}

Tag_Stmt ¶

Tag_Stmt :: struct {
	node: Stmt,
	op:   odin_tokenizer.Token,
	name: string,
	stmt: ^Stmt,
}

Ternary_If_Expr ¶

Ternary_If_Expr :: struct {
	node: Expr,
	x:    ^Expr,
	op1:  odin_tokenizer.Token,
	cond: ^Expr,
	op2:  odin_tokenizer.Token,
	y:    ^Expr,
}

Ternary_When_Expr ¶

Ternary_When_Expr :: struct {
	node: Expr,
	x:    ^Expr,
	op1:  odin_tokenizer.Token,
	cond: ^Expr,
	op2:  odin_tokenizer.Token,
	y:    ^Expr,
}

Type_Assertion ¶

Type_Assertion :: struct {
	node:  Expr,
	expr:  ^Expr,
	dot:   odin_tokenizer.Pos,
	open:  odin_tokenizer.Pos,
	type:  ^Expr,
	close: odin_tokenizer.Pos,
}

Type_Cast ¶

Type_Cast :: struct {
	node:  Expr,
	tok:   odin_tokenizer.Token,
	open:  odin_tokenizer.Pos,
	type:  ^Expr,
	close: odin_tokenizer.Pos,
	expr:  ^Expr,
}

Type_Switch_Stmt ¶

Type_Switch_Stmt :: struct {
	node:       Stmt,
	label:      ^Expr,
	switch_pos: odin_tokenizer.Pos,
	tag:        ^Stmt,
	expr:       ^Expr,
	body:       ^Stmt,
	partial:    bool,
}

Typeid_Type ¶

Typeid_Type :: struct {
	node:           Expr,
	tok:            odin_tokenizer.Token_Kind,
	specialization: ^Expr,
}
 

Types

Unary_Expr ¶

Unary_Expr :: struct {
	node: Expr,
	op:   odin_tokenizer.Token,
	expr: ^Expr,
}

Undef ¶

Undef :: struct {
	node: Expr,
	tok:  odin_tokenizer.Token_Kind,
}

Union_Type ¶

Union_Type :: struct {
	node:          Expr,
	tok_pos:       odin_tokenizer.Pos,
	poly_params:   ^Field_List,
	align:         ^Expr,
	kind:          Union_Type_Kind,
	where_token:   odin_tokenizer.Token,
	where_clauses: []^Expr,
	variants:      []^Expr,
}

Union_Type_Kind ¶

Union_Type_Kind :: enum u8 {
	Normal, 
	maybe, 
	no_nil, 
	shared_nil, 
}

Using_Stmt ¶

Using_Stmt :: struct {
	node: Stmt,
	list: []^Expr,
}

Value_Decl ¶

Value_Decl :: struct {
	node:       Decl,
	docs:       ^Comment_Group,
	attributes: [dynamic]^Attribute,
	// dynamic as parsing will add to them lazily
	names:      []^Expr,
	type:       ^Expr,
	values:     []^Expr,
	comment:    ^Comment_Group,
	is_using:   bool,
	is_mutable: bool,
}

Visitor ¶

Visitor :: struct {
	visit: proc "odin" (visitor: ^Visitor, node: ^Node) -> ^Visitor,
	data:  rawptr,
}
 

A Visitor's visit procedure is invoked for each node encountered by walk If the result visitor is not nil, walk visits each of the children of node with the new visitor, followed by a call of v.visit(v, nil)

When_Stmt ¶

When_Stmt :: struct {
	node:      Stmt,
	when_pos:  odin_tokenizer.Pos,
	cond:      ^Expr,
	body:      ^Stmt,
	else_stmt: ^Stmt,
}

Constants

Field_Flags_Record_Poly_Params ¶

Field_Flags_Record_Poly_Params :: Field_Flags{.Typeid_Token, .Default_Parameters}

Field_Flags_Signature ¶

Field_Flags_Signature :: Field_Flags{.Ellipsis, .Using, .No_Alias, .C_Vararg, .Auto_Cast, .Any_Int, .By_Ptr, .Default_Parameters}

Field_Flags_Signature_Params ¶

Field_Flags_Signature_Params :: Field_Flags_Signature | {Field_Flag.Typeid_Token}

Field_Flags_Signature_Results ¶

Field_Flags_Signature_Results :: Field_Flags_Signature

Field_Flags_Struct ¶

Field_Flags_Struct :: Field_Flags{.Using, .Tags, .Subtype}

Variables

field_flag_strings ¶

field_flag_strings: [Field_Flag]string = …

field_hash_flag_strings ¶

field_hash_flag_strings: []struct {
	key:  string,
	flag: Field_Flag,
} = …

Procedures

clone_array ¶

clone_array :: proc "odin" (array: $A/[]^$) -> $A/[]^$ {…}

clone_decl ¶

clone_decl :: proc "odin" (node: ^Decl) -> ^Decl {…}

clone_dynamic_array ¶

clone_dynamic_array :: proc "odin" (array: $A/[dynamic]^$) -> $A/[dynamic]^$ {…}

clone_expr ¶

clone_expr :: proc "odin" (expr: ^Expr) -> (val: ^Expr) {…}

clone_node ¶

clone_node :: proc "odin" (node: ^Node) -> ^Node {…}

clone_stmt ¶

clone_stmt :: proc "odin" (node: ^Stmt) -> ^Stmt {…}

inspect ¶

inspect :: proc "odin" (node: ^Node, f: proc "odin" (node: ^Node) -> bool) {…}
 

inspect traverses an AST in depth-first order It starts by calling f(node), and node must be non-nil If f returns true, inspect invokes f recursively for each of the non-nil children of node, followed by a call of f(nil)

new ¶

new :: proc "odin" ($T: typeid, pos, end: odin_tokenizer.Pos) -> ^typeid {…}

unparen_expr ¶

unparen_expr :: proc "odin" (expr: ^Expr) -> (val: ^Expr) {…}
 

Other things

walk ¶

walk :: proc "odin" (v: ^Visitor, node: ^Node) {…}
 

walk traverses an AST in depth-first order: It starts by calling v.visit(v, node), and node must not be nil If the visitor returned by v.visit(v, node) is not nil, walk is invoked recursively with the new visitor for each of the non-nil children of node, followed by a call of the new visit procedure

Procedure Groups

Source Files

Generation Information

Generated with odin version dev-2022-10 (vendor "odin") Windows_amd64 @ 2022-10-05 21:11:47.414296100 +0000 UTC