Documentation
¶
Overview ¶
Package symbols extracts declarations and references from source files for richer review context. It is language-pluggable: a registry maps file extensions to Extractor implementations, with a regex fallback for unknown languages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Extractor ¶
type Extractor interface {
Extract(ctx context.Context, path string, src []byte) ([]Symbol, error)
}
Extractor pulls symbols out of a single source file.
type GoASTExtractor ¶
type GoASTExtractor struct{}
GoASTExtractor uses the stdlib go/parser and go/ast to extract Go symbols. It is the high-quality extractor for Go files and does not depend on any external grammar or WASM runtime.
type GrammarExtractor ¶
type GrammarExtractor struct {
// contains filtered or unexported fields
}
GrammarExtractor uses a wazero tree-sitter parser pool for C/C++ symbol extraction. It is the Stage 8 proof-of-concept for grammar-backed context beyond what regex or stdlib AST can offer.
func NewGrammarExtractor ¶
func NewGrammarExtractor(pool *grammar.Pool) *GrammarExtractor
NewGrammarExtractor creates an extractor backed by pool.
type RegexExtractor ¶
type RegexExtractor struct{}
RegexExtractor is a language-agnostic fallback that uses simple heuristics to pull function, class, and method names. It is intentionally low-fidelity: it never fails and gives the model *some* named anchors even for unsupported languages.
type Registry ¶
Registry maps file extensions to extractors. The zero value is usable and falls back to the regex extractor for every language.
func Default ¶
func Default() Registry
Default returns a registry with Go handled by the stdlib go/ast extractor and everything else by the regex fallback.
func DefaultWithGrammar ¶
DefaultWithGrammar returns a registry that uses the grammar-backed tree-sitter extractor for C/C++ files and the same extractors as Default for everything else. Callers must supply a parser pool initialised for the languages they want to enable.
type Symbol ¶
type Symbol struct {
Name string `json:"name"`
Kind Kind `json:"kind"`
Path string `json:"path"`
Line int `json:"line"`
Signature string `json:"signature,omitempty"`
Doc string `json:"doc,omitempty"`
Receiver string `json:"receiver,omitempty"`
Container string `json:"container,omitempty"`
}
Symbol is one extracted declaration or reference.