Documentation
¶
Overview ¶
Package parser provides interfaces and implementations for extracting import dependencies and exported symbols from source files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parser ¶
type Parser interface {
// Language returns the language name (e.g., "go", "typescript", "python").
Language() string
// Extensions returns file extensions this parser handles (e.g., ".go", ".ts").
Extensions() []string
// ParseImports returns the raw import paths found in the file.
ParseImports(filePath string) ([]model.Import, error)
// ParseSymbols returns exported symbols from the file.
// May return nil if the parser doesn't support symbol extraction.
ParseSymbols(filePath string) ([]model.Symbol, error)
}
Parser extracts import/dependency edges from a source file.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds parsers keyed by extension and language.
func DefaultRegistry ¶
func DefaultRegistry() *Registry
DefaultRegistry returns a registry with tree-sitter parsers for all supported languages.
func NewRegistry ¶
NewRegistry creates a registry from the given parsers.
func (*Registry) ForExtension ¶
ForExtension returns the parser registered for the given extension, or nil.
func (*Registry) ForLanguage ¶
ForLanguage returns the parser registered for the given language name, or nil.
func (*Registry) RegisteredExtensions ¶
RegisteredExtensions returns all file extensions the registry handles.
type TreeSitterParser ¶
type TreeSitterParser struct {
// contains filtered or unexported fields
}
TreeSitterParser extracts imports and symbols using tree-sitter grammars.
func (*TreeSitterParser) Extensions ¶
func (p *TreeSitterParser) Extensions() []string
func (*TreeSitterParser) Language ¶
func (p *TreeSitterParser) Language() string
func (*TreeSitterParser) ParseImports ¶
func (p *TreeSitterParser) ParseImports(filePath string) ([]model.Import, error)
func (*TreeSitterParser) ParseSymbols ¶
func (p *TreeSitterParser) ParseSymbols(filePath string) ([]model.Symbol, error)