Skip to main content

Module engine

Module engine 

Source
Expand description

The structural engine: parse + tag extraction + syntax check, over grammars loaded from the registry as wasm.

Tags are extracted by running the grammar’s tags.scm through the Query engine (interpreting @definition.* / @reference.* / @name captures), because tree-sitter-tags cannot drive a wasm-loaded language. The same path serves every language, static or wasm.

Structs§

Defect
A syntactic defect found by check.
ImportBinding
One name brought into a file by an import statement (ADR 0001 Step 2).
Symbol
A definition or reference extracted from a file.

Functions§

check
Parse a file and report every ERROR / MISSING node.
enclosing_function_at
Name of the function/method enclosing byte, qualified by container.
extract
Extract all tags (definitions + references) from one file’s source.
extract_imports
Extract every import binding from a file, via the grammar’s imports.scm (@import.name / optional @import.source / @import.module). Returns an empty vec when the grammar ships no imports query. Pure single-file parse.
extract_with_tree
Like extract, but also returns the parsed tree so a caller that needs a second pass (e.g. callers’ enclosing-function lookup) can reuse it instead of re-parsing the identical bytes. Parsing dominates tree-sitter cost.
identifier_at
The identifier text at a (row, col) position — for go-to-def.
resolve_local_at
Scope-aware go-to-def: resolve the identifier at (row, col) to its nearest enclosing local binding, using the grammar’s locals.scm.
slice
The full source of a symbol, given its byte range.
with_tree
Run a closure with the parsed tree of source under grammar. The closure receives the root node and the grammar’s profile.