Document :: struct {
allocator: Allocator;
nodes: [..] &Node;
}
Document.create_node :: (d: &Document, name: [] u8) -> &Node
Document.query :: (d: &Document, query: [] u8) -> ? &Node
Document.query_all :: (d: &Document, query: [] u8) -> Iterator(&Node)
Matcher :: struct {
details: [..] MatcherDetails;
}
MatcherDetails :: struct {
accessor: MatcherAccessor;
op: AttributeOp;
value: ? Value;
}
Node :: struct {
node: [] u8;
type_annotation: ? [] u8;
values: [..] Value;
props: Map([] u8, Value);
children: [..] &Node;
}
Node.add_value :: (n: &Node, value: Value.Value_Data) -> void
Node.query :: (n: &Node, query: [] u8) -> ? &Node
Node.query_all :: (n: &Node, query: [] u8) -> Iterator(&Node)
Node.set_prop :: (n: &Node, name: [] u8, value: Value.Value_Data) -> void
Node.value :: (n: &Node, index: i32) -> ? Value
Node.value_or_null :: (n: &Node, index: i32) -> Value
Query :: struct {
matches_any: [..] &Selector;
}
QueryIterator :: struct {
d: &Document;
q: Query;
stack: [..] QueryStack;
arena: Arena;
top_level_node: i32;
current_selector: i32;
}
QueryIterator.make :: (d: &Document, q: Query, arena: Arena) -> QueryIterator
QueryParser :: struct {
query: [] u8;
cursor: u32;
al: Allocator;
}
QueryParser.rem :: (p: &QueryParser) -> [] u8
QueryStack :: struct {
node: &Node;
current_child: i32;
}
Selector :: struct {
segments: [..] &SelectorSegment;
}
SelectorSegment :: struct {
op: ? SelectorOp;
matcher: &Matcher;
}
SelectorSegment.is_scope :: (s: &SelectorSegment) -> bool
Value :: struct {
data: Value.Value_Data;
type_annotation: ? [] u8;
}
Value.as_bool :: (v: Value) -> ? bool
Value.as_float :: (v: Value) -> ? f64
Value.as_int :: (v: Value) -> ? i64
Value.as_str :: (v: Value) -> ? [] u8
AttributeOp :: enum {
Equal :: 0;
NotEqual :: 1;
Gt :: 2;
Gte :: 3;
Lt :: 4;
Lte :: 5;
StartsWith :: 6;
EndsWith :: 7;
Contains :: 8;
}
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 :: enum {
Child :: 0;
Descendant :: 1;
Neighbor :: 2;
Sibling :: 3;
}
KDL_Number :: union {
Integer: i64;
Float: f64;
String: [] u8;
}
MatcherAccessor :: union {
Scope: void;
Node: void;
Annotation: void;
Arg: u32;
Prop: [] u8;
}
Parse_Error :: union {
None: void;
Whitespace_Banned: void;
Parser_Error: [] u8;
}
free :: (d: Document) -> void
Releases all resources allocated for the document.
free_node :: (al: Allocator, n: &Node) -> void
free_value :: (al: Allocator, v: &Value) -> void
new_doc :: (allocator: Allocator) -> Document
Creates a new KDL document, using the allocator provided.
operate_on_values :: (v1: Value, v2: Value, op: AttributeOp) -> bool
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 :: (p: &QueryParser) -> [] u8
parse_matcher :: (p: &QueryParser) -> ? &Matcher
parse_number :: (p: &QueryParser) -> u32
parse_query :: (q: [] u8, al: Allocator) -> Query
parse_selector :: (p: &QueryParser) -> &Selector
query :: (d: &Document, query: [] u8) -> ? &Node
query :: (n: &Node, query: [] u8) -> ? &Node
query_all :: (d: &Document, query: [] u8) -> Iterator(&Node)
query_all :: (n: &Node, query: [] u8) -> Iterator(&Node)
query_doc :: (d: &Document, query: [] u8) -> ? &Node
query_doc_all :: (d: &Document, query: [] u8) -> Iterator(&Node)
query_matcher_matches :: (s: &Matcher, node: &Node) -> bool
query_next :: (ctx: &QueryIterator) -> ? &Node
query_node :: (n: &Node, query: [] u8) -> ? &Node
query_node_all :: (n: &Node, query: [] u8) -> Iterator(&Node)
query_selector_matches :: (s: &Selector, trail: [] QueryStack) -> bool
reached_end :: macro (p: &QueryParser) -> unknown
read_until :: (p: &QueryParser, c: u8) -> [] u8
skip_whitespace :: (p: &QueryParser) -> void
write :: (d: &Document, w: &Writer) -> void
write_node :: (n: &Node, w: &Writer, indentation: i32) -> void
write_value :: (v: Value, w: &Writer) -> void