astslicer

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SliceReport

type SliceReport struct {
	FilePath         string   `json:"file_path"`
	Language         string   `json:"language"`
	TargetSymbol     string   `json:"target_symbol"`
	OriginalLines    int      `json:"original_lines"`
	SlicedLines      int      `json:"sliced_lines"`
	OriginalBytes    int      `json:"original_bytes"`
	SlicedBytes      int      `json:"sliced_bytes"`
	LineReduction    float64  `json:"line_reduction_percent"`
	ByteReduction    float64  `json:"byte_reduction_percent"`
	ElapsedMicros    int64    `json:"elapsed_microseconds"`
	SourceSHA256     string   `json:"source_sha256"`
	SlicedSHA256     string   `json:"sliced_sha256"`
	RetainedEntities []string `json:"retained_entities"`
	SlicedSource     string   `json:"sliced_source"`
}

SliceReport represents the deterministic receipt and metrics of an AST slice.

func SliceFile

func SliceFile(filePath string, targetSymbol string) (*SliceReport, error)

SliceFile detects the language by file extension and executes structural AST slicing.

func SliceGoFile

func SliceGoFile(filePath string, targetSymbol string) (*SliceReport, error)

SliceGoFile parses a Go file, preserves all structs, interfaces, and signatures, but folds the bodies of functions that do not match the target symbol.

func SlicePythonFile

func SlicePythonFile(filePath string, targetSymbol string) (*SliceReport, error)

SlicePythonFile parses a Python file, preserves classes and the target function, but folds non-target function bodies into minimal 1-line comments and pass statements.

Jump to

Keyboard shortcuts

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