Documentation
¶
Overview ¶
Package taproot is the common front-end harness shared by M31 DSLs that use the gotreesitter runtime. It provides grammar generation + caching, a CST Walker, and one-stop Parse helpers.
The grammar-free core (Walker, blob-only language load, parse-from-blob) lives in the taproot/walk subpackage, which depends only on the gotreesitter runtime — no grammargen, no grammars registry. A DSL that embeds a pre-generated grammar blob should import taproot/walk so it doesn't link the ~200-grammar registry. The functions here add the grammargen DSL fallback (build-from-source when no blob is present) and re-export walk's Walker for backward compatibility.
The Walker error-leaf finder is lifted from elio/parse/tree.go.
Index ¶
- func Language(name string, build func() *grammargen.Grammar) (*gts.Language, error)
- func LanguageFromBlob(name string, blob []byte, build func() *grammargen.Grammar) (*gts.Language, error)
- func NewWalker(lang *gts.Language, src []byte) *walk.Walker
- func Parse(name string, build func() *grammargen.Grammar, src []byte) (*gts.Node, *walk.Walker, error)
- func ParseFromBlob(name string, blob []byte, build func() *grammargen.Grammar, src []byte) (*gts.Node, *walk.Walker, error)
- type Walker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Language ¶
Language generates and caches (once per name) the tree-sitter Language for a grammar. build is called only on a cache miss.
func LanguageFromBlob ¶
func LanguageFromBlob(name string, blob []byte, build func() *grammargen.Grammar) (*gts.Language, error)
LanguageFromBlob loads and caches (once per name) the tree-sitter Language from blob when possible, falling back to build when blob is empty or corrupt. The blob path is grammar-free (delegated to taproot/walk); only the fallback pulls grammargen.
Types ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package diag provides a generic structured diagnostic type and a source-quoting renderer.
|
Package diag provides a generic structured diagnostic type and a source-quoting renderer. |
|
Package walk is the grammar-free core of taproot: load a tree-sitter Language from a pre-generated blob and navigate the CST with a Walker.
|
Package walk is the grammar-free core of taproot: load a tree-sitter Language from a pre-generated blob and navigate the CST with a Walker. |