xast

package
v0.27.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStop = errors.New("ast stop")

Functions

func Inspect

func Inspect(n ast.Node, f func(n ast.Node) error) (err error)

Inspect is like ast.Inspect but with error handling. Unlike ast.Inspect the function parameter f returns an error and not a bool. The returned error is propagated to the caller, unless it is equal to ErrStop, which in that case indicates the child nodes shouldn't not be inspected (like returning false in the function of ast.Inspect).

func ParseDir

func ParseDir(dir string) (*ast.Package, *token.FileSet, error)

ParseDir invokes ast.ParseDir and returns the first package found that is doesn't has the "_test" suffix.

func ParseFile added in v0.27.0

func ParseFile(filepath string) (*ast.File, *token.FileSet, error)

ParseFile invokes ast.ParseFile and returns the *ast.File.

Types

This section is empty.

Jump to

Keyboard shortcuts

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