Crate codegraph_swift

Crate codegraph_swift 

Source
Expand description

Swift parser for CodeGraph

This crate provides Swift language support for the CodeGraph code analysis tool. It uses tree-sitter-swift to parse Swift source files and extract code entities and relationships.

§Example

use codegraph::CodeGraph;
use codegraph_swift::SwiftParser;
use codegraph_parser_api::CodeParser;
use std::path::Path;

let parser = SwiftParser::new();
let mut graph = CodeGraph::in_memory().unwrap();

let source = r#"
class Person {
    var name: String
    init(name: String) {
        self.name = name
    }
}
"#;

let file_info = parser.parse_source(source, Path::new("Person.swift"), &mut graph).unwrap();
assert!(!file_info.classes.is_empty());

Structs§

SwiftParser
Swift language parser