EcoreEnabledParser

abstract class EcoreEnabledParser<R : Node, P : Parser, C : ParserRuleContext, T : KolasuToken>(tokenFactory: TokenFactory<T>) : KolasuANTLRParser<R, P, C, T> , EMFMetamodelSupport

A Kolasu parser that supports exporting AST's to EMF/Ecore.

In particular, this parser can generate the metamodel. We can then use Node.toEObject to translate a tree into its EMF representation.

Constructors

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

Functions

Link copied to clipboard
abstract fun doGenerateMetamodel(resource: Resource)

Implement this method to tell the parser how to generate the metamodel. See MetamodelBuilder. It does not actually save the resource.

Link copied to clipboard
open override fun generateMetamodel(resource: Resource, includingKolasuMetamodel: Boolean)

Generates the metamodel. The standard Kolasu metamodel EPackage is included. It does not actually save the resource.

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, measureLexingTime: Boolean, source: Source?): 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): FirstStageParsingResult<C>
fun parseFirstStage(inputStream: CharStream, measureLexingTime: Boolean): FirstStageParsingResult<C>
fun parseFirstStage(file: File, charset: Charset, measureLexingTime: Boolean): FirstStageParsingResult<C>
fun parseFirstStage(inputStream: InputStream, charset: Charset, measureLexingTime: Boolean): FirstStageParsingResult<C>
Link copied to clipboard
fun processProperties(node: Node, propertyOperation: (PropertyDescription) -> Unit, propertiesToIgnore: Set<String>)
Link copied to clipboard
fun EMFMetamodelSupport.saveMetamodel(target: URI, options: Map<String, Boolean> = DEFAULT_OPTIONS_FOR_METAMODEL): Resource
Link copied to clipboard
fun walk(node: Node): Sequence<Node>

Properties

Link copied to clipboard