Package-level declarations

Types

Link copied to clipboard
open class ParseTreeToASTTransformer(issues: MutableList<Issue> = mutableListOf(), allowGenericNode: Boolean = true, val source: Source? = null) : ASTTransformer

Implements a transformation from an ANTLR parse tree (the output of the parser) to an AST (a higher-level representation of the source code).

Functions

Link copied to clipboard
inline fun <S : RuleContext, T : Node> ParseTreeToASTTransformer.registerTrivialPTtoASTConversion(vararg nameConversions: Pair<KCallable<*>, KCallable<*>>)
inline fun <S : RuleContext, T : Node> ASTTransformer.registerTrivialPTtoASTConversion(vararg nameConversions: Pair<String, String>)
Link copied to clipboard
Link copied to clipboard
fun <T> ParseTreeToASTTransformer.translateCasted(original: ParserRuleContext): T

Translate the given node and ensure a certain type will be obtained.

Link copied to clipboard
fun <T> ParseTreeToASTTransformer.translateList(original: Collection<out ParserRuleContext>?): ObservableList<T>

Translate a whole collection into a mutable list, translating each element and ensuring the list has the expected type.

Link copied to clipboard
fun <T> ParseTreeToASTTransformer.translateOnlyChild(parent: ParserRuleContext): T

Translate the only child (of type ParseRuleContext) and ensure the resulting value as the expected type.

Link copied to clipboard
fun <T> ParseTreeToASTTransformer.translateOptional(original: ParserRuleContext?): T?

Translate the given node and ensure a certain type will be obtained, if the value is not null. If the value is null, null is returned.

Link copied to clipboard
inline fun <S : RuleContext, T : Node> ParseTreeToASTTransformer.unwrap(wrappingMember: KCallable<*>)

Properties

Link copied to clipboard
val ParserRuleContext.onlyChild: ParserRuleContext

It returns the only child (of type ParseRuleContext). If there is no children or more than one child, an exception is thrown.