Skip to main content

Crate achitek_source

Crate achitek_source 

Source
Expand description

Shared source-analysis primitives for Achitek crates.

This crate intentionally stays small. It contains cross-language plumbing such as byte positions, source ranges, spanned values, diagnostic severity, and Tree-sitter range helpers. Domain-specific models and diagnostic codes belong in the language crates that define those contracts.

§Example

let range = achitek_source::TextRange {
    start: achitek_source::TextPosition { line: 0, byte: 0 },
    end: achitek_source::TextPosition { line: 0, byte: 7 },
};
let spanned = achitek_source::Spanned {
    value: "project",
    range,
};

assert_eq!(spanned.as_ref(), &"project");
assert_eq!(spanned.range.start.line, 0);

Structs§

Spanned
A value paired with the source range that produced it.
TextPosition
A zero-based byte position in source text.
TextRange
A byte range in source text.

Enums§

Severity
Severity level for a source diagnostic.

Functions§

is_child_for_field
Returns true when node is the child assigned to field_name on parent.
named_children
Returns named children for a Tree-sitter node.
text
Returns the UTF-8 source text covered by a Tree-sitter node.
text_range_for_node
Converts a Tree-sitter node range into a source text range.