Documentation
¶
Overview ¶
Package tspool provides pooled tree-sitter parsers for concurrent parsing.
This package centralizes parser pooling logic to:
- Enable reuse across different parser components
- Reduce parser allocation overhead via sync.Pool
- Ensure thread-safe parser sharing
Separate pools are maintained per language (Go, JavaScript, TypeScript) to avoid language switching overhead.
Thread-safety: Parsers returned by Get are NOT safe for concurrent use. Each goroutine must Get its own parser or use the Parse helper.
Index ¶
Constants ¶
const MaxTreeDepth = 1000
MaxTreeDepth is the maximum recursion depth when walking AST trees.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
Get returns a pooled parser for the given language. The returned parser is NOT safe for concurrent use. Use Put to return the parser after use.
func GetLanguage ¶
GetLanguage returns the tree-sitter language for the given domain language.
Types ¶
This section is empty.