Expand description
Source-code parser using tree-sitter.
Converts source code into one Section per top-level callable or
type definition (function, method, struct, class, enum, trait, impl
block). The section body is the verbatim source span of the item, making
it the natural unit for embedding: the whole function is the chunk.
When no structured items are found (e.g. a header-only file or a file that the grammar does not handle), a single headless section covering the full source is returned so the pipeline always has something to embed.
§Supported languages
Rust, Python, JavaScript, TypeScript, Go, Java, C, C++.
Languages are selected by CodeLanguage; the grammar is compiled
from C source by each grammar crate’s build.rs.
Functions§
- parse_
code - Parse source code into structural sections.