Package-level declarations

Types

Link copied to clipboard
abstract class ASTCodeGenerator<R : Node>

Transform an AST into code. This can be done on an AST obtained from parsing, or build programmatically. It would work also on AST obtained from parsing and then modified. It should be noted that it does not perform lexical preservation: comments are lost, whitespace is re-organized. It is effectively equivalent to auto-formatting.

Link copied to clipboard
fun interface NodePrinter

Know how to print a single node type.

Link copied to clipboard
class PrinterOutput(nodePrinters: Map<KClass<*>, NodePrinter>, nodePrinterOverrider: (node: Node) -> NodePrinter? = { _ -> null })

This provides a mechanism to generate code tracking indentation, handling lists, and providing other facilities. This is used in the implementation of NodePrinter and in ASTCodeGenerator.