SyntaxNode

A syntax node that provides navigation to parent and siblings.

Properties

Link copied to clipboard
abstract val firstChild: SyntaxNode?
Link copied to clipboard
abstract val from: Int
Link copied to clipboard
abstract val lastChild: SyntaxNode?
Link copied to clipboard
open val name: String
Link copied to clipboard
abstract val nextSibling: SyntaxNode?
Link copied to clipboard
abstract val parent: SyntaxNode?
Link copied to clipboard
abstract val prevSibling: SyntaxNode?
Link copied to clipboard
abstract val to: Int
Link copied to clipboard
abstract val tree: Tree?

Get the tree backing this node, if any.

Link copied to clipboard
abstract val type: NodeType

Functions

Link copied to clipboard
abstract fun childAfter(pos: Int): SyntaxNode?

Navigate to a child after a position.

Link copied to clipboard
abstract fun childBefore(pos: Int): SyntaxNode?

Navigate to a child before a position.

Link copied to clipboard
abstract fun cursor(): TreeCursor

Create a cursor from this node.

Link copied to clipboard
abstract fun enter(pos: Int, side: Int, mode: Int = 0): SyntaxNode?

Enter the node from a position.

Link copied to clipboard

Walk the tree back from a position, finding the innermost unfinished node (an error node) before the position.

Link copied to clipboard
abstract fun getChild(type: String, before: String? = null, after: String? = null): SyntaxNode?

Get a child by name (optionally between before/after).

Link copied to clipboard
abstract fun getChildren(type: String, before: String? = null, after: String? = null): List<SyntaxNode>

Get all children matching a type.

Link copied to clipboard
abstract fun matchContext(context: List<String>): Boolean

Match this node against a list of parent names (innermost last).

Link copied to clipboard
abstract fun resolve(pos: Int, side: Int = 0): SyntaxNode

Resolve to the innermost node at pos, moving up out of this node first when it does not cover pos. Does not enter overlays.

Link copied to clipboard
abstract fun resolveInner(pos: Int, side: Int = 0): SyntaxNode

Like resolve, but enters overlaid nodes to find the innermost node, and climbs back out of overlays that do not cover pos.

Link copied to clipboard
abstract fun toTree(): Tree

Convert this node to a standalone Tree.