Parse source code into a tree-sitter AST.
(source: &str)
| 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. |
nothing calls this directly
no test coverage detected