extractor

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractPythonAll

func ExtractPythonAll(result *parser.ParseResult) ([]string, int, bool, error)

ExtractPythonAll parses a Python file and returns static __all__ names and assignment line.

func ResolveCrossPackageCalls

func ResolveCrossPackageCalls(allElements []model.Element, p *parser.Parser, root string) []model.Edge

ResolveCrossPackageCalls re-parses indexed files and resolves cross-file edges against all known elements. It emits CALLS, IMPORTS, and Python EXPORTS edges.

Types

type ExtractionResult

type ExtractionResult struct {
	Elements []model.Element
	Edges    []model.Edge
}

ExtractionResult holds the elements and edges extracted from a parsed file.

type Extractor

type Extractor interface {
	Extract(result *parser.ParseResult) (*ExtractionResult, error)
}

Extractor defines the interface for language-specific code extraction.

func ForLanguage

func ForLanguage(lang string) Extractor

ForLanguage returns the appropriate Extractor for the given language. Returns nil if the language is not supported.

type GoExtractor

type GoExtractor struct{}

GoExtractor extracts elements and edges from Go source files.

func (*GoExtractor) Extract

func (e *GoExtractor) Extract(result *parser.ParseResult) (*ExtractionResult, error)

Extract parses Go source and extracts elements and edges.

type PythonExtractor

type PythonExtractor struct{}

PythonExtractor extracts elements and edges from Python source files.

func (*PythonExtractor) Extract

func (e *PythonExtractor) Extract(result *parser.ParseResult) (*ExtractionResult, error)

Extract parses Python source and extracts elements and edges.

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver performs name resolution for elements using both simple names and fully qualified names. When multiple elements share a name, the last one wins.

func NewResolver

func NewResolver(elements []model.Element) *Resolver

NewResolver creates a Resolver populated with name-to-ID and fqname-to-ID mappings.

func (*Resolver) Resolve

func (r *Resolver) Resolve(name string) (string, bool)

Resolve returns the element ID for the given name, trying exact name match first, then falling back to FQName match.

func (*Resolver) ResolveQualified

func (r *Resolver) ResolveQualified(qualifier, name string) (string, bool)

ResolveQualified tries to resolve a qualified call like pkg.Function, module::function, or module.method using FQName lookups with language-appropriate separators.

type RustExtractor

type RustExtractor struct{}

RustExtractor extracts elements and edges from Rust source files.

func (*RustExtractor) Extract

func (e *RustExtractor) Extract(result *parser.ParseResult) (*ExtractionResult, error)

Extract parses Rust source and extracts elements and edges.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL