tokensave 7.2.0

Code intelligence tool that builds a semantic knowledge graph from Rust, Go, Java, Scala, TypeScript, Python, C, C++, Kotlin, C#, Swift, and many more codebases
use std::{fs, path::Path};

fn main() {
    let out_path = Path::new("src/resources/logo.ansi");
    let logo_bytes = include_bytes!("src/resources/logo.png");
    let ansi = logo_art::image_to_ansi(logo_bytes, 90);
    fs::write(out_path, ansi).unwrap();
    println!("cargo::rerun-if-changed=src/resources/logo.png");

    // Vendored WGSL grammar — compiled only when lang-wgsl is enabled.
    // Using vendored sources avoids pulling in tree-sitter-wgsl 0.0.6 which was
    // built against the incompatible tree-sitter 0.20 API.
    if std::env::var("CARGO_FEATURE_LANG_WGSL").is_ok() {
        let wgsl_dir = Path::new("vendor/tree-sitter-wgsl/src");
        cc::Build::new()
            .include(wgsl_dir)
            .file(wgsl_dir.join("parser.c"))
            .file(wgsl_dir.join("scanner.c"))
            .warnings(false)
            .compile("tree_sitter_wgsl");
        println!("cargo::rerun-if-changed=vendor/tree-sitter-wgsl/src/parser.c");
        println!("cargo::rerun-if-changed=vendor/tree-sitter-wgsl/src/scanner.c");
    }

    // Vendored ActionScript grammar (tree-sitter-actionscript, jcs090218).
    // parser.c only — the grammar has no external scanner.
    if std::env::var("CARGO_FEATURE_LANG_ACTIONSCRIPT").is_ok() {
        let as_dir = Path::new("vendor/tree-sitter-actionscript/src");
        cc::Build::new()
            .include(as_dir)
            .file(as_dir.join("parser.c"))
            .warnings(false)
            .compile("tree_sitter_actionscript");
        println!("cargo::rerun-if-changed=vendor/tree-sitter-actionscript/src/parser.c");
    }

    // Vendored GDScript grammar (tree-sitter-gdscript, PrestonKnopp).
    // parser.c + scanner.c — the grammar has an external scanner.
    if std::env::var("CARGO_FEATURE_LANG_GDSCRIPT").is_ok() {
        let gdscript_dir = Path::new("vendor/tree-sitter-gdscript/src");
        cc::Build::new()
            .include(gdscript_dir)
            .file(gdscript_dir.join("parser.c"))
            .file(gdscript_dir.join("scanner.c"))
            .warnings(false)
            .compile("tree_sitter_gdscript");
        println!("cargo::rerun-if-changed=vendor/tree-sitter-gdscript/src/parser.c");
        println!("cargo::rerun-if-changed=vendor/tree-sitter-gdscript/src/scanner.c");
    }
}