#![doc = include_str!("../README.md")]

use arborium_tree_sitter::Language;

unsafe extern "C" {
    fn tree_sitter_cpp() -> Language;
}

/// Returns the cpp tree-sitter language.
pub fn language() -> Language {
    unsafe { tree_sitter_cpp() }
}



/// The highlights query for cpp (base query only).
/// Use [`HIGHLIGHTS_QUERY`] for the full query including inherited queries.
const HIGHLIGHTS_QUERY_BASE: &str = include_str!("../queries/highlights.scm");

/// The highlights query for cpp.
/// Includes inherited queries from: arborium_c.
pub static HIGHLIGHTS_QUERY: std::sync::LazyLock<String> = std::sync::LazyLock::new(|| {
    let mut query = String::new();

    query.push_str(&arborium_c::HIGHLIGHTS_QUERY);
    query.push('\n');

    query.push_str(HIGHLIGHTS_QUERY_BASE);
    query
});




/// The injections query for cpp.
pub const INJECTIONS_QUERY: &str = include_str!("../queries/injections.scm");



/// The locals query for cpp (empty - no locals available).
pub const LOCALS_QUERY: &str = "";



#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_grammar() {
        arborium_test_harness::test_grammar(
            language(),
            "cpp",

            &HIGHLIGHTS_QUERY,

            INJECTIONS_QUERY,
            LOCALS_QUERY,
            env!("CARGO_MANIFEST_DIR"),
        );
    }
}
