commonMain.piacenti.dslmaker.structures.Production.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dsl-maker-js Show documentation
Show all versions of dsl-maker-js Show documentation
Kotlin multiplatform library to facilitate creation of DSLs with ANTLR or a simple built in parser
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