All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.piacenti.dslmaker.structures.Production.kt Maven / Gradle / Ivy

Go to download

Kotlin multiplatform library to facilitate creation of DSLs with ANTLR or a simple built in parser

There is a newer version: 1.1.55
Show newest version
package piacenti.dslmaker.structures

import piacenti.dslmaker.interfaces.MatchData


/**
 * @param 
 * @author Piacenti
 */
class Production{
    var action: ((MatchData) -> Unit)? = null
    /**
     * @return
     */
    val expressions = mutableListOf()


    /**
     * @param action
     */
    constructor(action: ((MatchData) -> Unit)? = null) {
        this.action = action
    }

    constructor(action: ((MatchData) -> Unit)? = null, vararg exp: Expression) {
        this.action = action
        expressions.addAll(exp)
    }

    constructor(action: ((MatchData) -> Unit)? = null, exp: List) {
        this.action = action
        expressions.addAll(exp)
    }


    override fun toString(): String {
        val result = StringBuilder()
        for (expression in expressions) {
            result.append(expression.toString()).append(" | ")
        }

        return result.removeSuffix(" | ").toString()
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy