Package-level declarations

Types

Link copied to clipboard
class FirstStageParsingResult<C : ParserRuleContext>(issues: List<Issue>, val root: C?, code: String? = null, val incompleteNode: Node? = null, val time: Long? = null, val lexingTime: Long? = null) : CodeProcessingResult<C>
Link copied to clipboard
abstract class KolasuANTLRLexer<T : KolasuToken>(val tokenFactory: TokenFactory<T>) : KolasuLexer<T>
Link copied to clipboard
abstract class KolasuANTLRParser<R : Node, P : Parser, C : ParserRuleContext, T : KolasuToken>(tokenFactory: TokenFactory<T>) : KolasuANTLRLexer<T> , ASTParser<R>

A complete description of a multi-stage ANTLR-based parser, from source code to AST.

Link copied to clipboard
data class KolasuANTLRToken(val category: TokenCategory, val token: Token) : KolasuToken

A KolasuToken generated from a Token. The token contains additional information that is specific to ANTLR, such as type and channel.

Link copied to clipboard
sealed class ParseTreeElement

Either a Parse Tree terminal/leaf or non-terminal/node

Link copied to clipboard
class ParseTreeLeaf(val type: String, val text: String) : ParseTreeElement

Representation of the information contained in a Parse Tree terminal or leaf.

Link copied to clipboard

Representation of the information contained in a Parse Tree non-terminal or node.

Link copied to clipboard
class ParseTreeOrigin(val parseTree: ParseTree, var source: Source? = null) : Origin

An Origin corresponding to a ParseTreeNode. This is used to indicate that an AST Node has been obtained by mapping an original ParseTreeNode.

Link copied to clipboard
class ParsingResultWithFirstStage<RootNode : Node, P : ParserRuleContext>(issues: List<Issue>, root: RootNode?, code: String? = null, incompleteNode: Node? = null, time: Long? = null, val firstStage: FirstStageParsingResult<P>) : ParsingResult<RootNode>
Link copied to clipboard

Functions

Link copied to clipboard
inline fun <T : RuleContext> RuleContext.ancestor(): T
fun <T : RuleContext> RuleContext.ancestor(kclass: KClass<T>): T

Find the ancestor of the given element with the given class.

Link copied to clipboard
fun assertParseTreeStr(expectedMultiLineStr: String, root: ParserRuleContext, vocabulary: Vocabulary, printParseTree: Boolean = true)
Link copied to clipboard
fun ParserRuleContext.getOriginalText(): String

Get the original text associated to this non-terminal by querying the inputstream.

fun Token.getOriginalText(): String

Get the original text associated to this token by querying the inputstream.

fun TerminalNode.getOriginalText(): String

Get the original text associated to this terminal by querying the inputstream.

Link copied to clipboard
fun Node.getText(code: String): String?

Given the entire code, this returns the slice covered by this Node.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun ParserRuleContext.processDescendantsAndErrors(operationOnParserRuleContext: (ParserRuleContext) -> Unit, operationOnError: (ErrorNode) -> Unit, includingMe: Boolean = true)

Navigate the parse tree performing the specified operations on the nodes, either real nodes or nodes representing errors.

Link copied to clipboard
fun toParseTreeModel(node: ParserRuleContext, vocabulary: Vocabulary): ParseTreeNode

Given an actual parse-tree produced by ANTLR, it creates a Parse Tree model.

Link copied to clipboard
fun ParserRuleContext.toRange(considerRange: Boolean = true, source: Source? = null): Range?

Returns the range of the receiver parser rule context.

fun Token.toRange(considerRange: Boolean = true, source: Source? = null): Range?
fun ParseTree.toRange(considerRange: Boolean = true, source: Source? = null): Range?
fun TerminalNode.toRange(considerRange: Boolean = true, source: Source? = null): Range?
Link copied to clipboard
fun <T : Node> T.withParseTreeNode(parseTree: ParserRuleContext?, source: Source? = null): T

Set the origin of the AST node as a ParseTreeOrigin, providing the parseTree is not null. If the parseTree is null, no operation is performed.

Properties

Link copied to clipboard
val Token.endPoint: Point
Link copied to clipboard
val RuleContext.firstChild: ParseTree?
Link copied to clipboard
val RuleContext.hasChildren: Boolean
Link copied to clipboard
val RuleContext.lastChild: ParseTree?
Link copied to clipboard
val Token.length: Int
Link copied to clipboard
val ParserRuleContext.range: Range

Returns the range of the receiver parser rule context.

val Token.range: Range
Link copied to clipboard
val Token.startPoint: Point