Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileStructure ¶
type FileStructure struct {
Imports []string // Import paths (sorted)
Functions []string // Top-level function names (sorted)
Classes []string // Class names (sorted)
Exports []string // Exported symbol names (sorted)
}
FileStructure represents the shallow parsed structure of a source file. It contains only top-level declarations, no nested scopes.
type GoParser ¶
type GoParser struct{}
GoParser implements shallow parsing for .go files. Uses regex patterns — not semantically correct, but deterministic. Only exported symbols (capitalized) are extracted for functions and types, since unexported symbols rarely matter for IR-level codebase orientation.
func (*GoParser) Parse ¶
func (p *GoParser) Parse(source string) (FileStructure, error)
Parse extracts top-level exported structure from Go source. Shallow pass — does not handle multiline constructs, build tags, or cgo.
func (*GoParser) SupportsExtension ¶
SupportsExtension returns true for .go files.
type JSParser ¶
type JSParser struct{}
JSParser implements shallow parsing for .js, .ts, .gs files. Uses regex patterns - not semantically correct, but deterministic.
func NewJSParser ¶
func NewJSParser() *JSParser
NewJSParser creates a new JavaScript/TypeScript parser.
func (*JSParser) Parse ¶
func (p *JSParser) Parse(source string) (FileStructure, error)
Parse extracts top-level structure from JavaScript/TypeScript source. This is a shallow parse - it may miss nested declarations or misparse complex syntax (JSX, template literals, decorators). Best-effort only.
func (*JSParser) SupportsExtension ¶
SupportsExtension returns true for .js, .ts, .gs files.
type Parser ¶
type Parser interface {
// Parse extracts top-level structure from source code.
// Returns partial structure on parse errors (best-effort).
Parse(source string) (FileStructure, error)
// SupportsExtension returns true if this parser handles the file extension.
SupportsExtension(ext string) bool
}
Parser extracts shallow structural information from source files.
type PythonParser ¶
type PythonParser struct{}
PythonParser implements shallow parsing for .py files. Uses regex patterns — not semantically correct, but deterministic. Extracts imports, top-level functions, classes, and __all__ exports.
func NewPythonParser ¶
func NewPythonParser() *PythonParser
func (*PythonParser) Parse ¶
func (p *PythonParser) Parse(source string) (FileStructure, error)
func (*PythonParser) SupportsExtension ¶
func (p *PythonParser) SupportsExtension(ext string) bool