mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-09-30 12:11:32 +00:00
16 lines
426 B
Kotlin
16 lines
426 B
Kotlin
package gay.pizza.pork.ast.nodes
|
|
|
|
import gay.pizza.pork.ast.NodeType
|
|
import gay.pizza.pork.ast.Printer
|
|
import gay.pizza.pork.ast.NodeVisitor
|
|
import kotlinx.serialization.Serializable
|
|
|
|
@Serializable
|
|
sealed class Node {
|
|
abstract val type: NodeType
|
|
open fun <T> visitChildren(visitor: NodeVisitor<T>): List<T> = emptyList()
|
|
|
|
override fun toString(): String =
|
|
let { node -> buildString { Printer(this).visit(node) } }
|
|
}
|