In package com.copperleaf.kudzu

class com.copperleaf.kudzu.Node

Fields

var parent: Node?

protected nodeName: String

abstract text: String

name: String

context: NodeContext

Constructors

constructor(name: String, context: NodeContext)

Parameters:

Methods

abstract fun printAst(currentIndent: Int): String

Parameters:
  • currentIndent: Int
protected fun indent(currentIndent: Int): String

Parameters:
  • currentIndent: Int
open fun toString(): String

Parameters:
  • No parameters
fun linkTree()

Parameters:
  • No parameters

Extensions

fun find(nodeClass: KClass<Node>?, nodeName: String? = null): Node

Finds the first matching node by class and name in the immediate children of this node. Throws {@link VisitorException} if this node is a {@link TerminalNode} or if no child nodes match the query.

Parameters:
  • nodeClass: KClass
  • nodeName: String = null
inline fun find(nodeName: String? = null): T

Parameters:
  • nodeName: String = null
fun has(nodeClass: KClass<Node>?, nodeName: String? = null): Boolean

Parameters:
  • nodeClass: KClass
  • nodeName: String = null
fun child(): Node

Parameters:
  • No parameters
fun hasChild(): Boolean

Parameters:
  • No parameters
fun findAnywhere(nodeClass: KClass<Node>?, nodeName: String? = null): Node

Finds the first matching node by class and name in any child of this node. Throws {@link VisitorException} if this node is a {@link TerminalNode} or if no child nodes match the query.

Parameters:
  • nodeClass: KClass
  • nodeName: String = null
inline fun findAnywhere(nodeName: String? = null): T

Parameters:
  • nodeName: String = null
fun hasAnywhere(nodeClass: KClass<Node>?, nodeName: String? = null): Boolean

Parameters:
  • nodeClass: KClass
  • nodeName: String = null
fun visit(context: T, visitors: Visitor<T>): T

Parameters: