mod go;
mod java;
mod kotlin;
mod python;
mod ruby;
mod rust;
mod typescript;
mod walker;
pub use go::parse_go_file;
pub use java::parse_java_file;
pub use kotlin::parse_kotlin_file;
pub use python::{parse_python_file, FileParseResult, RawImport};
pub use ruby::parse_ruby_file;
pub use rust::parse_rust_file;
pub use typescript::{parse_ts_file, TsLang};
pub use walker::{index_directory, IndexResult};
use chrono::{DateTime, Utc};
pub fn parse_file(
ext: &str,
file_path: &str,
source: &str,
project: &str,
mtime: DateTime<Utc>,
) -> Option<FileParseResult> {
match ext {
"py" => Some(parse_python_file(file_path, source, project, mtime)),
"rs" => Some(parse_rust_file(file_path, source, project, mtime)),
"rb" => Some(parse_ruby_file(file_path, source, project, mtime)),
"go" => Some(parse_go_file(file_path, source, project, mtime)),
"java" => Some(parse_java_file(file_path, source, project, mtime)),
"kt" | "kts" => Some(parse_kotlin_file(file_path, source, project, mtime)),
ext => {
let lang = TsLang::from_extension(ext)?;
Some(parse_ts_file(file_path, source, project, mtime, lang))
}
}
}