KolasuANTLRParser

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.

You should extend this class to implement the parts that are specific to your language.

Constructors

Link copied to clipboard
constructor(tokenFactory: TokenFactory<T>)

Functions

Link copied to clipboard
open override fun lex(inputStream: InputStream, charset: Charset, onlyFromDefaultChannel: Boolean): LexingResult<T>
open fun lex(file: File): LexingResult<T>
open fun lex(inputStream: InputStream): LexingResult<T>
open fun lex(code: String): LexingResult<T>
open fun lex(inputStream: InputStream, charset: Charset): LexingResult<T>
open fun lex(code: String, onlyFromDefaultChannel: Boolean): LexingResult<T>
Link copied to clipboard
open override fun parse(file: File, charset: Charset, considerRange: Boolean, measureLexingTime: Boolean): ParsingResult<R>
open override fun parse(code: String, considerRange: Boolean, measureLexingTime: Boolean, source: Source?): ParsingResultWithFirstStage<R, C>
fun parse(inputStream: CharStream, considerRange: Boolean = true, measureLexingTime: Boolean = false, source: Source? = null): ParsingResultWithFirstStage<R, C>
open fun parse(code: String, considerRange: Boolean, measureLexingTime: Boolean): ParsingResult<R>
open fun parse(inputStream: InputStream, charset: Charset, considerRange: Boolean, measureLexingTime: Boolean, source: Source?): ParsingResult<R>
Link copied to clipboard
fun parseFirstStage(code: String, measureLexingTime: Boolean = false): FirstStageParsingResult<C>
fun parseFirstStage(file: File, charset: Charset = Charsets.UTF_8, measureLexingTime: Boolean = false): FirstStageParsingResult<C>
fun parseFirstStage(inputStream: InputStream, charset: Charset = Charsets.UTF_8, measureLexingTime: Boolean = false): FirstStageParsingResult<C>

fun parseFirstStage(inputStream: CharStream, measureLexingTime: Boolean = false): FirstStageParsingResult<C>

Executes only the first stage of the parser, i.e., the production of a parse tree. Usually, you'll want to use the parse method, that returns an AST which is simpler to use and query.

Link copied to clipboard
fun processProperties(node: Node, propertyOperation: (PropertyDescription) -> Unit, propertiesToIgnore: Set<String> = emptySet())
Link copied to clipboard
fun walk(node: Node): Sequence<Node>

Properties

Link copied to clipboard