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.
- Text
Position - A zero-based byte position in source text.
- Text
Range - A byte range in source text.
Enums§
- Severity
- Severity level for a source diagnostic.
Functions§
- is_
child_ for_ field - Returns true when
nodeis the child assigned tofield_nameonparent. - 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.