codegraph_swift/lib.rs
1//! Swift parser for CodeGraph
2//!
3//! This crate provides Swift language support for the CodeGraph code analysis tool.
4//! It uses tree-sitter-swift to parse Swift source files and extract code entities
5//! and relationships.
6//!
7//! # Example
8//!
9//! ```rust
10//! use codegraph::CodeGraph;
11//! use codegraph_swift::SwiftParser;
12//! use codegraph_parser_api::CodeParser;
13//! use std::path::Path;
14//!
15//! let parser = SwiftParser::new();
16//! let mut graph = CodeGraph::in_memory().unwrap();
17//!
18//! let source = r#"
19//! class Person {
20//! var name: String
21//! init(name: String) {
22//! self.name = name
23//! }
24//! }
25//! "#;
26//!
27//! let file_info = parser.parse_source(source, Path::new("Person.swift"), &mut graph).unwrap();
28//! assert!(!file_info.classes.is_empty());
29//! ```
30
31mod extractor;
32mod mapper;
33mod parser_impl;
34mod visitor;
35
36pub use parser_impl::SwiftParser;