Documentation ¶
Index ¶
- Variables
- func NameOf(node Node) string
- type Node
- type NodeEnum
- type NodeSet
- func (p NodeSet) Any() (ret NodeSet)
- func (p NodeSet) Cache() NodeSet
- func (p NodeSet) Child() NodeSet
- func (p NodeSet) Collect() (items []Node, err error)
- func (p NodeSet) CollectOne(exactly ...bool) (item Node, err error)
- func (p NodeSet) ConstSpec() NodeSet
- func (p NodeSet) FuncDecl() NodeSet
- func (p NodeSet) GenDecl(tok token.Token) NodeSet
- func (p NodeSet) ImportSpec() NodeSet
- func (p NodeSet) Match(match func(node Node) bool) (ret NodeSet)
- func (p NodeSet) Name() []string
- func (p NodeSet) Ok() bool
- func (p NodeSet) One() NodeSet
- func (p NodeSet) ToString(str func(node Node) string) (items []string)
- func (p NodeSet) TypeSpec() NodeSet
- func (p NodeSet) VarSpec() NodeSet
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type NodeSet ¶
NodeSet - node set
func NewSource ¶
func NewSource( fset *token.FileSet, path string, filter func(os.FileInfo) bool, mode parser.Mode) (doc NodeSet, err error)
NewSource calls ParseFile for all files with names ending in ".gop" in the directory specified by path and returns a map of package name -> package AST with all the packages found.
If filter != nil, only the files with os.FileInfo entries passing through the filter (and ending in ".gop") are considered. The mode bits are passed to ParseFile unchanged. Position information is recorded in fset, which must not be nil.
If the directory couldn't be read, a nil map and the respective error are returned. If a parse error occurred, a non-nil but incomplete map and the first error encountered are returned.
func NewSourceFrom ¶
func NewSourceFrom( fset *token.FileSet, fs parser.FileSystem, path string, filter func(os.FileInfo) bool, mode parser.Mode) (doc NodeSet, err error)
NewSourceFrom calls ParseFile for all files with names ending in ".gop" in the directory specified by path and returns a map of package name -> package AST with all the packages found.
If filter != nil, only the files with os.FileInfo entries passing through the filter (and ending in ".gop") are considered. The mode bits are passed to ParseFile unchanged. Position information is recorded in fset, which must not be nil.
If the directory couldn't be read, a nil map and the respective error are returned. If a parse error occurred, a non-nil but incomplete map and the first error encountered are returned.
func (NodeSet) CollectOne ¶
CollectOne collects one node of a node set. If exactly is true, it returns ErrTooManyNodes when node set is more than one.
func (NodeSet) ImportSpec ¶
ImportSpec returns *ast.ImportSpec node set.