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

Method parse_source

src/extraction/qbasic_extractor.rs:175–184  ·  view source on GitHub ↗

Parse source code into a tree-sitter AST.

(source: &str)

Source from the content-addressed store, hash-verified

173
174 /// Parse source code into a tree-sitter AST.
175 fn parse_source(source: &str) -> Result<Tree, String> {
176 let mut parser = Parser::new();
177 let language = crate::extraction::ts_provider::try_language("qbasic")?;
178 parser
179 .set_language(&language)
180 .map_err(|e| format!("failed to load QBasic grammar: {e}"))?;
181 parser
182 .parse(source, None)
183 .ok_or_else(|| "tree-sitter parse returned None".to_string())
184 }
185
186 /// Extract a comment from a line node, if the line is purely a comment.
187 /// Returns the comment text (with leading ' stripped), or None if not a comment line.

Callers

nothing calls this directly

Calls 2

try_languageFunction · 0.85
parseMethod · 0.45

Tested by

no test coverage detected