Skip to content

Commit

Permalink
Add Scala and Java compile to lib (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
wilmveel authored Apr 19, 2024
1 parent a36ec98 commit fd96d39
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ package community.flock.wirespec.compiler.lib

import community.flock.wirespec.compiler.core.Wirespec
import community.flock.wirespec.compiler.core.compile
import community.flock.wirespec.compiler.core.emit.JavaEmitter
import community.flock.wirespec.compiler.core.emit.KotlinEmitter
import community.flock.wirespec.compiler.core.emit.ScalaEmitter
import community.flock.wirespec.compiler.core.emit.TypeScriptEmitter
import community.flock.wirespec.compiler.core.emit.WirespecEmitter
import community.flock.wirespec.compiler.core.parse.Parser
Expand Down Expand Up @@ -46,6 +48,24 @@ class WsToTypeScript : Compiler() {
}
}

@JsExport
class WsToScala : Compiler() {
fun compile(source: String) = preCompile(source)(typeScriptEmitter).produce()

companion object {
private val typeScriptEmitter = ScalaEmitter(logger = logger)
}
}

@JsExport
class WsToJava : Compiler() {
fun compile(source: String) = preCompile(source)(typeScriptEmitter).produce()

companion object {
private val typeScriptEmitter = JavaEmitter(logger = logger)
}
}

@JsExport
class WsToWirespec : Compiler() {
fun compile(source: String) = preCompile(source)(wirespecEmitter).produce()
Expand Down

0 comments on commit fd96d39

Please sign in to comment.