ast

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadDirOptions

func LoadDirOptions() *loadDirOptions

Types

type File

type File interface {
	// relative to loading root
	RelPath() string
	Ast() *ast.File
	Content() []byte

	// has syntax error
	SyntaxError() error
}

type LoadInfo

type LoadInfo interface {
	FileSet() *token.FileSet
	RangeFiles(handler func(f File) bool)
}

LoadInfo is the core abstraction of an AST load

func LoadCode

func LoadCode(relPath string, code []byte) (LoadInfo, error)

func LoadDir

func LoadDir(dir string) (LoadInfo, error)

LoadDir scans a given directory to specify extra options, one can use:

LoadDirOptions().Exclude("vendor").Load("some/go_project")

func LoadFile added in v0.0.4

func LoadFile(dir string, relFile string) (LoadInfo, error)

func LoadFiles added in v0.0.4

func LoadFiles(dir string, relFiles []string) (LoadInfo, error)

func LoadProject added in v0.0.4

func LoadProject(dir string, args []string) (LoadInfo, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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