Packages

builtin
cbindgen
core
core.alloc
core.alloc.arena
core.alloc.atomic
core.alloc.fixed
core.alloc.gc
core.alloc.heap
core.alloc.log
core.alloc.memdebug
core.alloc.pool
core.alloc.ring
core.arg_parse
core.array
core.avl_tree
core.bucket_array
core.conv
core.doc
core.encoding
core.encoding.base64
core.encoding.csv
core.encoding.hex
core.encoding.json
core.encoding.kdl
core.encoding.osad
core.encoding.utf8
core.hash
core.hash.md5
core.hash.sha1
core.hash.sha256
core.heap
core.intrinsics
core.intrinsics.atomics
core.intrinsics.onyx
core.intrinsics.types
core.intrinsics.wasm
core.io
core.io.binary
core.iter
core.js
core.list
core.map
core.math
core.memory
core.misc
core.net
core.os
core.random
core.set
core.slice
core.string
core.sync
core.test
core.thread
core.time
main
runtime
runtime.info
runtime.platform
runtime.vars
simd

package core.encoding.kdl

Document
Document :: struct {
    allocator: Allocator;
    nodes: [..] &Node;
}
Methods
Document.create_node
Document.create_node :: (d: &Document, name: [] u8) -> &Node
Document.query
Document.query :: (d: &Document, query: [] u8) -> ? &Node
Document.query_all
Document.query_all :: (d: &Document, query: [] u8) -> Iterator(&Node)
Matcher
Matcher :: struct {
    details: [..] MatcherDetails;
}
MatcherDetails
MatcherDetails :: struct {
    accessor: MatcherAccessor;
    op: AttributeOp;
    value: ? Value;
}
Node
Node :: struct {
    node: [] u8;
    type_annotation: ? [] u8;
    values: [..] Value;
    props: Map([] u8, Value);
    children: [..] &Node;
}
Methods
Node.add_value
Node.add_value :: (n: &Node, value: Value.Value_Data) -> void
Node.query
Node.query :: (n: &Node, query: [] u8) -> ? &Node
Node.query_all
Node.query_all :: (n: &Node, query: [] u8) -> Iterator(&Node)
Node.set_prop
Node.set_prop :: (n: &Node, name: [] u8, value: Value.Value_Data) -> void
Node.value
Node.value :: (n: &Node, index: i32) -> ? Value
Node.value_or_null
Node.value_or_null :: (n: &Node, index: i32) -> Value
Query
Query :: struct {
    matches_any: [..] &Selector;
}
QueryIterator
QueryIterator :: struct {
    d: &Document;
    q: Query;
    stack: [..] QueryStack;
    arena: Arena;
    top_level_node: i32;
    current_selector: i32;
}
Methods
QueryIterator.make
QueryIterator.make :: (d: &Document, q: Query, arena: Arena) -> QueryIterator
QueryParser
QueryParser :: struct {
    query: [] u8;
    cursor: u32;
    al: Allocator;
}
Methods
QueryParser.rem
QueryParser.rem :: (p: &QueryParser) -> [] u8
QueryStack
QueryStack :: struct {
    node: &Node;
    current_child: i32;
}
Selector
Selector :: struct {
    segments: [..] &SelectorSegment;
}
SelectorSegment
SelectorSegment :: struct {
    op: ? SelectorOp;
    matcher: &Matcher;
}
Methods
SelectorSegment.is_scope
SelectorSegment.is_scope :: (s: &SelectorSegment) -> bool
Value
Value :: struct {
    data: Value.Value_Data;
    type_annotation: ? [] u8;
}
Methods
Value.as_bool
Value.as_bool :: (v: Value) -> ? bool
Value.as_float
Value.as_float :: (v: Value) -> ? f64
Value.as_int
Value.as_int :: (v: Value) -> ? i64
Value.as_str
Value.as_str :: (v: Value) -> ? [] u8
AttributeOp
AttributeOp :: enum {
    Equal :: 0;
    NotEqual :: 1;
    Gt :: 2;
    Gte :: 3;
    Lt :: 4;
    Lte :: 5;
    StartsWith :: 6;
    EndsWith :: 7;
    Contains :: 8;
}
Parser_State
Parser_State :: enum #flags {
    Outside_Node :: 1;
    Inside_Node :: 2;
    Line_Continuation :: 256;
    Annotation_Start :: 512;
    Annotation_End :: 1024;
    Annotation_Ended :: 2048;
    In_Property :: 4096;
    Whitespace_Banned :: 7680;
}
SelectorOp
SelectorOp :: enum {
    Child :: 0;
    Descendant :: 1;
    Neighbor :: 2;
    Sibling :: 3;
}
KDL_Number
KDL_Number :: union {
    Integer: i64;
    Float: f64;
    String: [] u8;
}
MatcherAccessor
MatcherAccessor :: union {
    Scope: void;
    Node: void;
    Annotation: void;
    Arg: u32;
    Prop: [] u8;
}
Parse_Error
Parse_Error :: union {
    None: void;
    Whitespace_Banned: void;
    Parser_Error: [] u8;
}
free
free :: (d: Document) -> void

Releases all resources allocated for the document.

free_node
free_node :: (al: Allocator, n: &Node) -> void
free_value
free_value :: (al: Allocator, v: &Value) -> void
new_doc
new_doc :: (allocator: Allocator) -> Document

Creates a new KDL document, using the allocator provided.

operate_on_values
operate_on_values :: (v1: Value, v2: Value, op: AttributeOp) -> bool
parse
parse :: (s: [] u8, allocator: Allocator) -> Result(Document, Parse_Error)
parse :: (r: &Reader, allocator: Allocator) -> Result(Document, Parse_Error)

Parses a string or io.Reader into a KDL document, using the allocator provided for internal allocations.

Call core.encoding.kdl.free to free the returned document.

parse_identifier
parse_identifier :: (p: &QueryParser) -> [] u8
parse_matcher
parse_matcher :: (p: &QueryParser) -> ? &Matcher
parse_number
parse_number :: (p: &QueryParser) -> u32
parse_query
parse_query :: (q: [] u8, al: Allocator) -> Query
parse_selector
parse_selector :: (p: &QueryParser) -> &Selector
query
query :: (d: &Document, query: [] u8) -> ? &Node
query :: (n: &Node, query: [] u8) -> ? &Node
query_all
query_all :: (d: &Document, query: [] u8) -> Iterator(&Node)
query_all :: (n: &Node, query: [] u8) -> Iterator(&Node)
query_doc
query_doc :: (d: &Document, query: [] u8) -> ? &Node
query_doc_all
query_doc_all :: (d: &Document, query: [] u8) -> Iterator(&Node)
query_matcher_matches
query_matcher_matches :: (s: &Matcher, node: &Node) -> bool
query_next
query_next :: (ctx: &QueryIterator) -> ? &Node
query_node
query_node :: (n: &Node, query: [] u8) -> ? &Node
query_node_all
query_node_all :: (n: &Node, query: [] u8) -> Iterator(&Node)
query_selector_matches
query_selector_matches :: (s: &Selector, trail: [] QueryStack) -> bool
reached_end
reached_end :: macro (p: &QueryParser) -> unknown
read_until
read_until :: (p: &QueryParser, c: u8) -> [] u8
skip_whitespace
skip_whitespace :: (p: &QueryParser) -> void
write
write :: (d: &Document, w: &Writer) -> void
write_node
write_node :: (n: &Node, w: &Writer, indentation: i32) -> void
write_value
write_value :: (v: Value, w: &Writer) -> void