ASTTransformer

open class ASTTransformer(val issues: MutableList<Issue> = mutableListOf(), val allowGenericNode: Boolean = true)

Implementation of a tree-to-tree transformation. For each source node type, we can register a transformer that knows how to produce a transformed node. Then, this transformer can read metadata in the transformed node to recursively transform and assign children. If no node transformer is provided for a source node type, a GenericNode is created, and the processing of the subtree stops there.

Constructors

Link copied to clipboard
constructor(issues: MutableList<Issue> = mutableListOf(), allowGenericNode: Boolean = true)

Functions

Link copied to clipboard
fun addIssue(message: String, severity: IssueSeverity = IssueSeverity.ERROR, range: Range? = null): Issue
Link copied to clipboard
inline fun <S : Any, T : Node> registerNodeTransformer(crossinline transformer: S.(ASTTransformer) -> T?): NodeTransformer<S, T>
fun <S : Any, T : Node> registerNodeTransformer(kclass: KClass<S>, transformer: (S) -> T?): NodeTransformer<S, T>
fun <S : Any, T : Node> registerNodeTransformer(kclass: KClass<S>, transformer: (S, ASTTransformer) -> T?): NodeTransformer<S, T>
fun <S : Any, T : Node> registerNodeTransformer(kclass: KClass<S>, transformer: (S, ASTTransformer, NodeTransformer<S, T>) -> T?): NodeTransformer<S, T>
fun <S : Any, T : Node> registerNodeTransformer(source: KClass<S>, target: KClass<T>, parameterConverters: List<ParameterConverter> = emptyList()): NodeTransformer<S, T>
Link copied to clipboard
open fun transform(source: Any?, parent: Node? = null): Node?

Performs the transformation of a node and, recursively, its descendants.

Properties

Link copied to clipboard
Link copied to clipboard

Additional issues found during the transformation process.

Link copied to clipboard