MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / parse_source

Method parse_source

src/extraction/kotlin_extractor.rs:174–183  ·  view source on GitHub ↗

Parse source code into a tree-sitter AST.

(source: &str)

Source from the content-addressed store, hash-verified

172
173 /// Parse source code into a tree-sitter AST.
174 fn parse_source(source: &str) -> Result<Tree, String> {
175 let mut parser = Parser::new();
176 let language = crate::extraction::ts_provider::try_language("kotlin")?;
177 parser
178 .set_language(&language)
179 .map_err(|e| format!("failed to load Kotlin grammar: {e}"))?;
180 parser
181 .parse(source, None)
182 .ok_or_else(|| "tree-sitter parse returned None".to_string())
183 }
184
185 /// Visit all children of a node.
186 fn visit_children(state: &mut ExtractionState, node: TsNode<'_>) {

Callers

nothing calls this directly

Calls 2

try_languageFunction · 0.85
parseMethod · 0.45

Tested by

no test coverage detected