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

Method parse_source

src/extraction/nix_extractor.rs:126–135  ·  view source on GitHub ↗

Parse source code into a tree-sitter AST.

(source: &str)

Source from the content-addressed store, hash-verified

124
125 /// Parse source code into a tree-sitter AST.
126 fn parse_source(source: &str) -> Result<Tree, String> {
127 let mut parser = Parser::new();
128 let language = crate::extraction::ts_provider::try_language("nix")?;
129 parser
130 .set_language(&language)
131 .map_err(|e| format!("failed to load Nix grammar: {e}"))?;
132 parser
133 .parse(source, None)
134 .ok_or_else(|| "tree-sitter parse returned None".to_string())
135 }
136
137 /// Visit all children of a node.
138 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