Package-level declarations

Types

Link copied to clipboard
class FastWalker(val node: Node)

The FastWalker is a walker that implements a cache to speed up subsequent walks. The first walk will take the same time of a normal walk. This walker will ignore any change to the nodes.

Link copied to clipboard
typealias Stack<T> = Deque<T>

Some Kotlinization of Deques used as a stack.

Functions

Link copied to clipboard
fun <T> Node.collectByType(klass: Class<T>, walker: (Node) -> Sequence<Node> = Node::walk): List<T>

T is not forced to be a subtype of Node to support using interfaces.

Link copied to clipboard
fun <T> Node.findAncestorOfType(klass: Class<T>): T?

Note that type T is not strictly forced to be a Node. This is intended to support interfaces like Statement or Expression. However, being an ancestor the returned value is guaranteed to be a Node, as only Node instances can be part of the hierarchy.

Link copied to clipboard
fun Node.findByRange(range: Range, selfContained: Boolean = false): Node?
Link copied to clipboard
fun <T> mutableStackOf(vararg elements: T): Stack<T>
Link copied to clipboard
fun <T> Stack<T>.pushAll(elements: Collection<T>)
Link copied to clipboard
fun Node.searchByRange(range: Range, selfContained: Boolean = false): Sequence<Node>
Link copied to clipboard
fun <T> Node.searchByType(klass: Class<T>, walker: (Node) -> Sequence<Node> = Node::walk): Sequence<T>
Link copied to clipboard

Traverse the entire tree, deep first, starting from this Node.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun Node.walkDescendants(walker: (Node) -> Sequence<Node> = Node::walk): Sequence<Node>
fun <N : Any> Node.walkDescendants(type: KClass<N>, walker: (Node) -> Sequence<Node> = Node::walk): Sequence<N>
Link copied to clipboard

Performs a post-order (or leaves-first) node traversal starting with a given node.

Link copied to clipboard

Properties

Link copied to clipboard