Documentation
¶
Overview ¶
Package treesitter provides a shared grammar registry for tree-sitter languages. Both the edit package (BodyExtractor) and repomap package (TagExtractor) consume this registry to avoid duplicating grammar initialization.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GrammarRegistry ¶
type GrammarRegistry struct {
// contains filtered or unexported fields
}
GrammarRegistry holds tree-sitter language grammars keyed by language name. Thread-safe for concurrent reads.
func NewGrammarRegistry ¶
func NewGrammarRegistry() *GrammarRegistry
NewGrammarRegistry creates a GrammarRegistry with Go, Python, TypeScript, TSX, and Rust grammars.
func (*GrammarRegistry) GetLanguage ¶
func (r *GrammarRegistry) GetLanguage(lang string) (*tree_sitter.Language, bool)
GetLanguage returns the tree-sitter language for the given language name. Returns (nil, false) if the language is not registered.
func (*GrammarRegistry) SupportedLanguages ¶
func (r *GrammarRegistry) SupportedLanguages() []string
SupportedLanguages returns a sorted slice of all registered language names.
func (*GrammarRegistry) SupportsLanguage ¶
func (r *GrammarRegistry) SupportsLanguage(lang string) bool
SupportsLanguage returns true if the registry has a grammar for the given language.