package core:odin/tool-format

⌘K
Ctrl+K
or
/

    Overview

    The formats of the files odin exchanges with editors and other tools.

    • Overlay: read by -overlay:<file>, to check unsaved buffers in place of the files on disk
    • Semantics: written by -export-semantics:<json|cbor>, what each identifier refers to
    • Diagnostics: written by -json-errors, the errors and warnings

    Index

    Constants (1)
    Variables (0)

    This section is empty.

    Procedure Groups (0)

    This section is empty.

    Types

    Diagnostic ¶

    Diagnostic :: struct {
    	type: string,
    	// "error" or "warning"
    	pos:  Diagnostic_Pos,
    	// zero when there is no position
    	msgs: []string,
    }

    Diagnostic_Pos ¶

    Diagnostic_Pos :: struct {
    	file:       string,
    	offset:     int,
    	// in bytes
    	line:       int,
    	column:     int,
    	end_column: int,
    }
     

    Lines and columns start at 1, and columns count runes

    Diagnostics ¶

    Diagnostics :: struct {
    	error_count: int,
    	errors:      []Diagnostic,
    }

    Entity ¶

    Entity :: struct {
    	name:   string,
    	kind:   Entity_Kind,
    	pkg:    string,
    	// empty for local entities
    	file:   int,
    	offset: int,
    	type:   int,
    	value:  string,
    	// concrete types only, `align` is 0 otherwise
    	size:   int,
    	align:  int,
    	fields: []Field,
    }

    Entity_Kind ¶

    Entity_Kind :: enum u8 {
    	Invalid, 
    	Constant, 
    	Field, 
    	Parameter, 
    	Variable, 
    	Type, 
    	Procedure, 
    	Group, 
    	Builtin, 
    	Import, 
    	Library, 
    	Nil, 
    	Label, 
    	Asm, 
    }

    Exported_File ¶

    Exported_File :: struct {
    	file:        int,
    	uses:        []i32,
    	// offset, entity, ... sorted by offset
    	definitions: []i32,
    	// offset, entity, ... sorted by offset
    	inactive:    []i32,
    }

    Field ¶

    Field :: struct {
    	name:   string,
    	offset: int,
    }

    Ident ¶

    Ident :: struct {
    	offset: i32,
    	entity: i32,
    }
     

    One offset, entity pair of uses or definitions

    Overlay ¶

    Overlay :: struct {
    	replace: map[string]string `json:"Replace"`,
    }
     

    The same format as Go's -overlay. Each key is a path the compiler would read, and its value is the path to read instead, or "" to treat it as deleted. A key that does not exist on disk adds a file to its directory's package. Relative paths are relative to the working directory of odin.

    Semantics ¶

    Semantics :: struct {
    	version:  int,
    	files:    []string,
    	// the exported files come first, in the same order as `exported`
    	types:    []string,
    	entities: []Entity,
    	exported: []Exported_File,
    }
     

    file, type and entity fields are indices into files, types and entities, -1 when there is none. Offsets are in bytes. The copies of a declaration made by each instantiation of a generic are one entity, keeping only what they agree on, otherwise the generic's own type, if any, and no value or layout.

    Semantics_Error ¶

    Semantics_Error :: enum int {
    	None, 
    	Unsupported_Version, 
    }

    Unmarshal_Error ¶

    Unmarshal_Error :: union {
    	Semantics_Error, 
    	encoding_json.Unmarshal_Error, 
    	encoding_cbor.Unmarshal_Error, 
    }

    Constants

    Variables

    This section is empty.

    Procedures

    find_idents ¶

    find_idents :: proc(pairs: []i32, offset: int) -> []Ident {…}
     

    The pairs of uses or definitions for the identifier starting at offset. There can be more than one: each instantiation of a generic can refer to something different, and a use of a generic type also records the type it instantiates.

    marshal_overlay ¶

    marshal_overlay :: proc(
    	overlay:   Overlay, 
    	allocator := context.allocator, 
    ) -> (data: []u8, err: encoding_json.Marshal_Error) {…}

    unmarshal_semantics ¶

    unmarshal_semantics :: proc(
    	data:      []u8, 
    	semantics: ^Semantics, 
    	allocator := context.allocator, 
    ) -> Unmarshal_Error {…}
     

    Decodes either format, as CBOR starts with a map header and JSON never does. Everything is allocated with allocator, so an arena suits it.

    Procedure Groups

    This section is empty.

    Source Files

    Generation Information

    Generated with odin version dev-2026-10 (vendor "odin") Windows_amd64 @ 2026-10-12 23:46:18.383355400 +0000 UTC