tree-sitter-weaveback is a
tree-sitter grammar for the
Weaveback macro language. It gives editors a structural model of
.weaveback source files, enabling syntax highlighting, language injection
into %rhaidef and %pydef bodies, and [source,weaveback] block
highlighting inside AsciiDoc literate documents.
The grammar lives in tree-sitter-weaveback/ at the root of the weaveback
repository. It is a standalone Node.js project and is not part of the Rust
workspace.
Module map
| Document | Contents |
|---|---|
Tree-sitter grammar definition ( |
|
Highlight queries ( |
|
Helix and Neovim installation scripts and configuration files. |
Directory layout
tree-sitter-weaveback/
├── grammar.js ← grammar definition (generated by tangle)
├── package.json ← Node.js metadata; devDep: tree-sitter-cli
├── tree-sitter.json ← grammar metadata (scope, highlights path)
├── weaveback.so ← pre-compiled shared library (checked in)
├── src/
│ ├── parser.c ← generated C parser (do not edit)
│ ├── grammar.json ← grammar in JSON (generated)
│ ├── node-types.json ← node type definitions (generated)
│ └── tree_sitter/ ← tree-sitter C headers
├── queries/
│ ├── highlights.scm ← syntax highlighting queries
│ └── injections.scm ← language injection into %rhaidef/%pydef bodies
├── test/
│ └── corpus/
│ └── basics.txt ← tree-sitter test suite
└── editors/
├── helix/
│ ├── languages.toml ← Helix language + grammar stanza
│ ├── asciidoc-injections.scm← injection of weaveback into AsciiDoc
│ └── install.py ← Helix installation script
└── neovim/
├── weaveback.lua ← nvim-treesitter parser registration
├── asciidoc.lua ← asciidoc + asciidoc_inline parsers
└── install.py ← Neovim installation script
Quick start
Regenerating the parser
When grammar.js changes (after a just tangle run that updates it),
regenerate src/parser.c:
Then reinstall for your editor (see editors.adoc).
A pre-built weaveback.so is checked in so that editor users who have
already run the install script do not need to regenerate after a grammar
update — only after pulling new changes that touch grammar.js.
Running the grammar tests
Tangle integration
just tangle (via scripts/tangle.py) regenerates grammar.js and all
editor-integration files from the literate AsciiDoc sources in this
directory. See grammar.adoc, queries.adoc,
and editors.adoc for the authoritative sources.
Relationship to the weaveback project docs
The combined architecture.adoc describes
the full weaveback pipeline. This tree-sitter grammar provides editor
support for the macro source layer — the .weaveback files that are
processed by weaveback-macro and then tangled by weaveback-tangle.