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

Method parse_source

src/extraction/msbasic2_extractor.rs:143–152  ·  view source on GitHub ↗

Parse source code into a tree-sitter AST.

(source: &str)

Source from the content-addressed store, hash-verified

141
142 /// Parse source code into a tree-sitter AST.
143 fn parse_source(source: &str) -> Result<Tree, String> {
144 let mut parser = Parser::new();
145 let language = crate::extraction::ts_provider::try_language("msbasic2")?;
146 parser
147 .set_language(&language)
148 .map_err(|e| format!("failed to load MS BASIC 2.0 grammar: {e}"))?;
149 parser
150 .parse(source, None)
151 .ok_or_else(|| "tree-sitter parse returned None".to_string())
152 }
153
154 /// Collect all lines from the program into a structured list.
155 fn collect_lines<'a>(state: &ExtractionState, root: TsNode<'a>) -> Vec<BasicLine<'a>> {

Callers

nothing calls this directly

Calls 2

try_languageFunction · 0.85
parseMethod · 0.45

Tested by

no test coverage detected