use std::path::Path;
use tree_sitter::{Node, Parser, Tree};
use crate::ast::types::{ClassInfo, FunctionInfo, ImportInfo};
use crate::cfg::types::CFGInfo;
use crate::dfg::types::DFGInfo;
use crate::error::Result;
pub trait Language: Send + Sync {
fn name(&self) -> &'static str;
fn extensions(&self) -> &[&'static str];
fn parser(&self) -> Result<Parser>;
fn parser_for_path(&self, _path: &Path) -> Result<Parser> {
self.parser()
}
fn extract_function(&self, node: Node, source: &[u8]) -> Option<FunctionInfo>;
fn extract_class(&self, node: Node, source: &[u8]) -> Option<ClassInfo>;
fn extract_imports(&self, tree: &Tree, source: &[u8]) -> Vec<ImportInfo>;
fn extract_module_docstring(&self, _tree: &Tree, _source: &[u8]) -> Option<String> {
None
}
fn function_query(&self) -> &'static str;
fn class_query(&self) -> &'static str;
#[allow(dead_code)]
fn call_query(&self) -> &'static str;
fn build_cfg(&self, node: Node, source: &[u8]) -> Result<CFGInfo>;
fn build_dfg(&self, node: Node, source: &[u8]) -> Result<DFGInfo>;
fn should_skip_file(&self, _path: &Path, _content: &[u8]) -> bool {
false
}
}
pub type BoxedLanguage = Box<dyn Language>;