Skip to main content

ManifestSpec

Struct ManifestSpec 

Source
pub struct ManifestSpec {
    pub filename: &'static str,
    pub name_key: &'static str,
    pub self_names: &'static [&'static str],
    pub normalize: fn(&str) -> String,
}
Expand description

A language is data: a grammar, a capture query, and comment node kinds. The engine consumes only this struct — adding a language adds a row here and a .scm file, never engine code.

Query capture contract (the universal primitives):

  • @def.<kind> whole definition node; <kind> must parse via SymbolKind::from_str_opt. A definition also scopes what it contains.
  • @name the definition’s (or scope’s) name node, same match.
  • @qualifier optional extra scope prefix from the same match (e.g. a Go method receiver type).
  • @scope a node that scopes names but is not itself a symbol (e.g. a Rust impl block); pairs with @name.
  • @ref.<rel> a reference site; <rel> in {call, use} maps to the relation an eventual binding would carry.
  • @import an imported path; quotes are stripped.
  • @import.module + @import.name — from-style imports (from util import helper, import { helper } from "./util"): the engine joins them with the language’s first path separator so the import binds the item, not just the module.
  • @import.alias local rebinding (as clauses, Go dot imports).
  • @import.star glob semantics: with @import.module (Python *) or alongside a plain @import (bash source), every top-level name of the module binds.
  • @local (+ @local.type) — shadowing bindings, optionally typed.
  • @embed embedded/promoted type members (Go).
  • @trait + @trait.impl — an impl block (@trait.impl) naming the trait it implements (@trait): dynamic-dispatch pairing input.
  • @doc a node whose text IS the definition’s doc (Python docstrings): attached to the smallest containing definition, overriding any sibling-comment doc.

Standard tree-sitter text predicates (#eq?, #any-of?, …) are evaluated by the tree-sitter crate itself and may be used freely (bash isolates source from ordinary commands this way). A package manifest declares the mapping between a package’s name (what imports say) and its directory (what module paths say) — a naming root the file tree alone cannot reveal. Reading it is evidence, exactly like reading an import statement. Pure data; the engine never branches on language.

Fields§

§filename: &'static str

Manifest file basename (“Cargo.toml”, “go.mod”).

§name_key: &'static str

Key whose value is the package name (“name” for name = "x", “module” for module x).

§self_names: &'static [&'static str]

Path-head aliases meaning “this package’s root” (“crate”).

§normalize: fn(&str) -> String

Normalizes the declared name to reference form (dashes to underscores for Rust).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.