Skip to main content

Crate semtree_parse

Crate semtree_parse 

Source
Expand description

Tree-sitter parsing and chunk extraction for semtree.

Turns source files into structured Chunks - functions, methods, structs, classes - aligned to real syntax boundaries instead of arbitrary line windows. Supports Rust, Python, JavaScript, TypeScript and Go; non-code text falls back to fixed-size windows.

use semtree_parse::extract_file;

let chunks = extract_file(std::path::Path::new("src/lib.rs"))?;
for c in &chunks {
    println!("{:?} {:?}", c.kind, c.name);
}

Structs§

ParsedTree
SemtreeParser

Enums§

ParseError

Traits§

Extractor

Functions§

chunk_text
Split plain text into overlapping chunks of ~chunk_lines lines.
extract_file
Extract chunks from any supported file - code or plain text.
is_text_file
File types we handle as plain text (no AST)
parse_and_extract
parse_and_extract_file