Skip to main content

brokk_bifrost_cpp/
queries.rs

1//! C++'s bundled tree-sitter query assets.
2//!
3//! The `.scm` files ship inside this crate rather than
4//! `brokk-bifrost-analysis/resources/` and are embedded at compile time, so a
5//! consumer never resolves them from a runtime path. `brokk-bifrost-analysis`
6//! folds [`CPP_QUERY_ASSETS`] into the per-language store epoch exactly as it
7//! folds its own `resources/treesitter/<lang>/` files: the entry paths keep the
8//! historical `treesitter/cpp/` prefix so the epoch's per-language filter is one
9//! rule rather than two.
10
11/// Directory the query assets live in, relative to this crate's root.
12///
13/// Reported by `CppAdapter::query_directory()`. The relocation from the analysis
14/// crate is why the C++ store-epoch salt bumped: the salted content now comes
15/// from this crate's `resources/`, not analysis's.
16pub const CPP_QUERY_DIRECTORY: &str = "resources/treesitter/cpp";
17
18/// Compile-time embedded `.scm` query files as `(relative_path, contents)`.
19pub const CPP_QUERY_ASSETS: &[(&str, &str)] = &[
20    (
21        "treesitter/cpp/definitions.scm",
22        include_str!("../resources/treesitter/cpp/definitions.scm"),
23    ),
24    (
25        "treesitter/cpp/imports.scm",
26        include_str!("../resources/treesitter/cpp/imports.scm"),
27    ),
28    (
29        "treesitter/cpp/identifiers.scm",
30        include_str!("../resources/treesitter/cpp/identifiers.scm"),
31    ),
32];