macro

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasMacroLike

func HasMacroLike(cmt string) (string, bool)

func IsEnum

func IsEnum(n ast.Node) ([]ast.Spec, bool)

func IsFnDec

func IsFnDec(n ast.Node) (*ast.FuncDecl, bool)

func IsStructDec

func IsStructDec(n ast.Node) (string, *ast.StructType, bool)

func IsTyp

func IsTyp(o interface{}, t interface{}) bool

func MacroCtxsOfWorkingDir

func MacroCtxsOfWorkingDir(wd string, defDir string) ([]*MacroCtx, *ProcCtx, error)

func RecvName

func RecvName(fn *ast.FuncDecl) string

func WalkPkgs

func WalkPkgs(pkgs map[string]*ast.Package, handle WalkPkgHandle, pc *ProcCtx) error

Types

type MacroCtx

type MacroCtx struct {
	ProcCtx *ProcCtx
	File    string        // file being walked through to find out the macros
	Node    ast.Node      // the node being attached with macro
	Name    string        // the name of this macro
	Args    []interface{} // the args defined in the macro expr
}

func MacroCtxsOfFile

func MacroCtxsOfFile(file *ast.File, filename string, procCtx *ProcCtx) ([]*MacroCtx, error)

func ParseMacro

func ParseMacro(file, macro string, targe ast.Node, procCtx *ProcCtx) ([]*MacroCtx, error)

func (*MacroCtx) HasStringArg

func (c *MacroCtx) HasStringArg(name string) bool

type MacroImpl

type MacroImpl = func(MacroCtx)

type ProcCtx

type ProcCtx struct {
	Path string                  // the path to start the entire process
	Fset *token.FileSet          // files been processed by `go/parser/ParseDir`
	Pkgs map[string]*ast.Package // processed results, produced by `go/parser/ParseDir`
}

type WalkPkgHandle

type WalkPkgHandle = func(*ast.File, string, *ProcCtx) error

Jump to

Keyboard shortcuts

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