Documentation
¶
Index ¶
- func IsTextFile(filename string) bool
- func List() []string
- func MustRegister(processor LanguageProcessor)
- func Register(processor LanguageProcessor) error
- type BaseProcessor
- type FileResult
- type FileTask
- type LanguageProcessor
- type MultiError
- type ProcessOptions
- type Processor
- func (p *Processor) CanProcess(filename string) bool
- func (p *Processor) GetLanguage(filename string) string
- func (p *Processor) GetSupportedExtensions() []string
- func (p *Processor) Process(ctx context.Context, reader io.Reader, filename string) (*ir.DistilledFile, error)
- func (p *Processor) ProcessFile(filename string, opts ProcessOptions) (*ir.DistilledFile, error)
- func (p *Processor) ProcessPath(path string, opts ProcessOptions) (ir.DistilledNode, error)
- type ProcessorError
- type RawProcessor
- func (p *RawProcessor) CanProcessRaw(filename string) bool
- func (p *RawProcessor) Process(ctx context.Context, reader io.Reader, filename string) (*ir.DistilledFile, error)
- func (p *RawProcessor) ProcessWithOptions(ctx context.Context, reader io.Reader, filename string, opts ProcessOptions) (*ir.DistilledFile, error)
- type Registry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsTextFile ¶
IsTextFile checks if a file might be a text file based on extension
func MustRegister ¶
func MustRegister(processor LanguageProcessor)
MustRegister registers a processor and panics on error
func Register ¶
func Register(processor LanguageProcessor) error
Register adds a processor to the default registry
Types ¶
type BaseProcessor ¶
type BaseProcessor struct {
// contains filtered or unexported fields
}
BaseProcessor provides common functionality for language processors
func NewBaseProcessor ¶
func NewBaseProcessor(language, version string, extensions []string) BaseProcessor
NewBaseProcessor creates a new base processor
func (BaseProcessor) CanProcess ¶
func (p BaseProcessor) CanProcess(filename string) bool
CanProcess implements LanguageProcessor
func (BaseProcessor) Language ¶
func (p BaseProcessor) Language() string
Language implements LanguageProcessor
func (BaseProcessor) SupportedExtensions ¶
func (p BaseProcessor) SupportedExtensions() []string
SupportedExtensions implements LanguageProcessor
func (BaseProcessor) Version ¶
func (p BaseProcessor) Version() string
Version implements LanguageProcessor
type FileResult ¶
type FileResult struct {
Index int
Result *ir.DistilledFile
Error error
}
FileResult represents the result of processing a file
type LanguageProcessor ¶
type LanguageProcessor interface {
// Language returns the language identifier (e.g., "go", "python", "javascript")
Language() string
// Version returns the processor version
Version() string
// SupportedExtensions returns file extensions this processor handles
SupportedExtensions() []string
// CanProcess checks if this processor can handle the given file
CanProcess(filename string) bool
// Process parses source code and returns the IR representation
Process(ctx context.Context, reader io.Reader, filename string) (*ir.DistilledFile, error)
// ProcessWithOptions parses with specific options
ProcessWithOptions(ctx context.Context, reader io.Reader, filename string, opts ProcessOptions) (*ir.DistilledFile, error)
}
LanguageProcessor defines the interface for language-specific processors
func Get ¶
func Get(language string) (LanguageProcessor, bool)
Get returns a processor from the default registry
func GetByFilename ¶
func GetByFilename(filename string) (LanguageProcessor, bool)
GetByFilename returns a processor from the default registry
type MultiError ¶
type MultiError struct {
Errors []error
}
MultiError represents multiple processing errors
func (MultiError) Error ¶
func (e MultiError) Error() string
type ProcessOptions ¶
type ProcessOptions struct {
// IncludeImplementation includes function/method bodies
IncludeImplementation bool
// IncludeComments includes comment nodes
IncludeComments bool
// IncludeImports includes import statements
IncludeImports bool
// IncludePrivate includes private/internal declarations (legacy - removes both private and protected)
IncludePrivate bool
// RemovePrivateOnly removes only private members (not protected)
RemovePrivateOnly bool
// RemoveProtectedOnly removes only protected members (not private)
RemoveProtectedOnly bool
// RemoveInternalOnly removes only internal/package-private members
RemoveInternalOnly bool
// IncludeDocstrings includes documentation comments (when false, removes them)
IncludeDocstrings bool
// IncludeAnnotations includes decorators/annotations (when false, removes them)
IncludeAnnotations bool
// MaxDepth limits the depth of nested structures
MaxDepth int
// SymbolResolution enables symbol cross-referencing
SymbolResolution bool
// IncludeLineNumbers adds line number information
IncludeLineNumbers bool
// Workers specifies the number of parallel workers for processing
// 0 = auto (80% of CPU cores), 1 = serial processing
Workers int
// RawMode processes all text files without parsing
RawMode bool
// Recursive controls whether to process directories recursively
Recursive bool
// BasePath is the original path provided by the user (for relative path calculation)
BasePath string
// FilePathType controls how paths appear in output: "relative" or "absolute"
FilePathType string
// RelativePathPrefix is a custom prefix for relative paths (e.g., "src/")
RelativePathPrefix string
// IncludePatterns are file patterns to include (e.g., "*.go", "*.py")
IncludePatterns []string
// ExcludePatterns are file patterns to exclude (e.g., "*test*", "*.json")
ExcludePatterns []string
// ExplicitInclude indicates this file was explicitly included via !pattern
ExplicitInclude bool
}
ProcessOptions configures the processing behavior
func DefaultProcessOptions ¶
func DefaultProcessOptions() ProcessOptions
DefaultProcessOptions returns default processing options
func (ProcessOptions) ToStripperOptions ¶
func (opts ProcessOptions) ToStripperOptions() stripper.Options
ToStripperOptions converts ProcessOptions to stripper.Options
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
Processor processes files and directories
func NewWithContext ¶
NewWithContext creates a new processor with a context
func (*Processor) CanProcess ¶
CanProcess checks if a file can be processed
func (*Processor) GetLanguage ¶
GetLanguage returns the language for a file
func (*Processor) GetSupportedExtensions ¶
GetSupportedExtensions returns all supported file extensions
func (*Processor) Process ¶
func (p *Processor) Process(ctx context.Context, reader io.Reader, filename string) (*ir.DistilledFile, error)
Process processes a reader
func (*Processor) ProcessFile ¶
func (p *Processor) ProcessFile(filename string, opts ProcessOptions) (*ir.DistilledFile, error)
ProcessFile processes a single file
func (*Processor) ProcessPath ¶
func (p *Processor) ProcessPath(path string, opts ProcessOptions) (ir.DistilledNode, error)
ProcessPath processes a file or directory
type ProcessorError ¶
type ProcessorError struct {
File string
Line int
Column int
Message string
Severity string // "error", "warning", "info"
Code string // Error code for tooling
}
ProcessorError represents a processing error with context
func (ProcessorError) Error ¶
func (e ProcessorError) Error() string
type RawProcessor ¶
type RawProcessor struct {
BaseProcessor
}
RawProcessor handles all text files without parsing
func NewRawProcessor ¶
func NewRawProcessor() *RawProcessor
NewRawProcessor creates a new raw processor
func (*RawProcessor) CanProcessRaw ¶
func (p *RawProcessor) CanProcessRaw(filename string) bool
CanProcessRaw checks if a file can be processed as raw text
func (*RawProcessor) Process ¶
func (p *RawProcessor) Process(ctx context.Context, reader io.Reader, filename string) (*ir.DistilledFile, error)
Process implements LanguageProcessor
func (*RawProcessor) ProcessWithOptions ¶
func (p *RawProcessor) ProcessWithOptions(ctx context.Context, reader io.Reader, filename string, opts ProcessOptions) (*ir.DistilledFile, error)
ProcessWithOptions implements LanguageProcessor
type Registry ¶
type Registry interface {
// Register adds a processor to the registry
Register(processor LanguageProcessor) error
// Get returns a processor for the given language
Get(language string) (LanguageProcessor, bool)
// GetByFilename returns a processor that can handle the file
GetByFilename(filename string) (LanguageProcessor, bool)
// List returns all registered language identifiers
List() []string
}
Registry manages language processors