//! Per-file symbol + structural-edge extraction via tree-sitter.
//!
//! One supported source file becomes a `Module` node (the file itself) plus one node per declared
//! item that Glyph treats as source knowledge. Language-specific modules own their parser and
//! framework conventions; this module only dispatches by [`SourceLanguage`].

use std::path::Path;

use crate::glyph::graph::FileGraph;
use crate::glyph::language::SourceLanguage;

mod common;
mod imports;
mod intent;
mod python;
mod python_fastapi;
mod rust;
mod typescript;
mod typescript_react;

/// Parse one source file into its symbol nodes and structural edges using the selected language.
pub(crate) fn symbols_in_file_with_language(
    path: &Path,
    base: &Path,
    language: SourceLanguage,
) -> FileGraph {
    match language {
        SourceLanguage::Rust => rust::symbols_in_file(path, base),
        SourceLanguage::Python => python::symbols_in_file(path, base),
        SourceLanguage::TypeScript | SourceLanguage::Tsx => {
            typescript::symbols_in_file(path, base, language)
        }
    }
}
