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

Method parse_source

src/extraction/lua_extractor.rs:127–136  ·  view source on GitHub ↗

Parse source code into a tree-sitter AST.

(source: &str)

Source from the content-addressed store, hash-verified

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