Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Filter ¶
Filter takes a `*uast.Node` and a xpath query and filters the tree, returning the list of nodes that satisfy the given query. Filter is thread-safe but not concurrent by an internal global lock.
func FilterBool ¶
FilterBool takes a `*uast.Node` and a xpath query with a boolean return type (e.g. when using XPath functions returning a boolean type). FilterBool is thread-safe but not concurrent by an internal global lock.
func FilterNumber ¶
FilterBool takes a `*uast.Node` and a xpath query with a float return type (e.g. when using XPath functions returning a float type). FilterNumber is thread-safe but not concurrent by an internal global lock.
Types ¶
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator allows for traversal over a UAST tree.
func NewIterator ¶
NewIterator constructs a new Iterator starting from the given `Node` and iterating with the traversal strategy given by the `order` parameter. Once the iteration have finished or you don't need the iterator anymore you must dispose it with the Dispose() method (or call it with `defer`).
func (*Iterator) Dispose ¶
func (i *Iterator) Dispose()
Dispose must be called once you've finished using the iterator or preventively with `defer` to free the iterator resources. Failing to do so would produce a memory leak.
func (*Iterator) Iterate ¶
Iterate function is similar to Next() but returns the `Node`s in a channel. It's mean to be used with the `for node := range myIter.Iterate() {}` loop.