Skip to main content

brokk_bifrost_python/
queries.rs

1//! Python'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 [`PYTHON_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/python/` prefix so the epoch's per-language filter is
9//! one rule rather than two.
10
11/// Directory the query assets live in, relative to this crate's root.
12///
13/// Reported by `PythonAdapter::query_directory()`. The relocation from the
14/// analysis crate is why the Python store-epoch salt bumped: the salted content
15/// now comes from this crate's `resources/`, not analysis's.
16pub const PYTHON_QUERY_DIRECTORY: &str = "resources/treesitter/python";
17
18/// Compile-time embedded `.scm` query files as `(relative_path, contents)`.
19pub const PYTHON_QUERY_ASSETS: &[(&str, &str)] = &[
20    (
21        "treesitter/python/definitions.scm",
22        include_str!("../resources/treesitter/python/definitions.scm"),
23    ),
24    (
25        "treesitter/python/imports.scm",
26        include_str!("../resources/treesitter/python/imports.scm"),
27    ),
28    (
29        "treesitter/python/identifiers.scm",
30        include_str!("../resources/treesitter/python/identifiers.scm"),
31    ),
32];