boundary_core/
analyzer.rs1use std::path::{Path, PathBuf};
2
3use anyhow::Result;
4use tree_sitter::Tree;
5
6use crate::types::{Component, Dependency};
7
8pub struct ParsedFile {
10 pub path: PathBuf,
11 pub tree: Tree,
12 pub content: String,
13}
14
15pub trait LanguageAnalyzer: Send + Sync {
17 fn language(&self) -> &'static str;
19
20 fn file_extensions(&self) -> &[&str];
22
23 fn parse_file(&self, path: &Path, content: &str) -> Result<ParsedFile>;
25
26 fn extract_components(&self, parsed: &ParsedFile) -> Vec<Component>;
28
29 fn extract_dependencies(&self, parsed: &ParsedFile) -> Vec<Dependency>;
31
32 fn is_stdlib_import(&self, _import_path: &str) -> bool {
35 false
36 }
37}