Skip to content

Commit

Permalink
#18 Renamed Serializer to XstsSerializer
Browse files Browse the repository at this point in the history
  • Loading branch information
arminzavada committed Nov 7, 2024
1 parent c0be153 commit e0aeaf5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.types.file
import hu.bme.mit.semantifyr.oxsts.semantifyr.reader.OxstsReader
import hu.bme.mit.semantifyr.oxsts.semantifyr.reader.prepareOxsts
import hu.bme.mit.semantifyr.oxsts.semantifyr.serialization.Serializer
import hu.bme.mit.semantifyr.oxsts.semantifyr.serialization.XstsSerializer
import hu.bme.mit.semantifyr.oxsts.semantifyr.transformation.XstsTransformer
import hu.bme.mit.semantifyr.oxsts.semantifyr.utils.loggerFactory
import java.io.File
Expand Down Expand Up @@ -35,7 +35,7 @@ class CompileCommand : CliktCommand("compile") {
val transformer = XstsTransformer(reader)

val xsts = transformer.transform(targetName, rewriteChoice = true)
val xstsString = Serializer.serialize(xsts)
val xstsString = XstsSerializer.serialize(xsts)

val outputFile = output ?: File(model.path.replace(".oxsts", ".xsts"))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.github.ajalt.clikt.parameters.arguments.argument
import com.github.ajalt.clikt.parameters.types.file
import hu.bme.mit.semantifyr.oxsts.semantifyr.reader.OxstsReader
import hu.bme.mit.semantifyr.oxsts.semantifyr.reader.prepareOxsts
import hu.bme.mit.semantifyr.oxsts.semantifyr.serialization.Serializer
import hu.bme.mit.semantifyr.oxsts.semantifyr.serialization.XstsSerializer
import hu.bme.mit.semantifyr.oxsts.semantifyr.transformation.XstsTransformer
import hu.bme.mit.semantifyr.oxsts.semantifyr.utils.loggerFactory
import java.io.File
Expand All @@ -31,7 +31,7 @@ class VerifyCommand : BaseVerifyCommand("verify") {
val transformer = XstsTransformer(reader)

val xsts = transformer.transform(targetName, rewriteChoice = true)
val xstsString = Serializer.serialize(xsts)
val xstsString = XstsSerializer.serialize(xsts)

val output = model.path.replace(".oxsts", ".xsts")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,9 @@ import hu.bme.mit.semantifyr.oxsts.model.oxsts.Variable
import hu.bme.mit.semantifyr.oxsts.model.oxsts.XSTS
import hu.bme.mit.semantifyr.oxsts.semantifyr.utils.referencedElement

object Serializer {
fun serializeProperty(xsts: XSTS): String {
val text = indent {
append(xsts.property)
}
object XstsSerializer {

return text
}

fun serialize(xsts: XSTS, includeProperty: Boolean = true): String {
fun serialize(xsts: XSTS): String {
val text = indent {
for (type in xsts.enums) {
append(type)
Expand All @@ -76,11 +69,9 @@ object Serializer {

appendLine("env {}")

if (includeProperty) {
appendLine()
appendLine()

append(xsts.property)
}
append(xsts.property)
}

return text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
package hu.bme.mit.semantifyr.oxsts.semantifyr

import hu.bme.mit.semantifyr.oxsts.semantifyr.reader.OxstsReader
import hu.bme.mit.semantifyr.oxsts.semantifyr.serialization.Serializer
import hu.bme.mit.semantifyr.oxsts.semantifyr.serialization.XstsSerializer
import hu.bme.mit.semantifyr.oxsts.semantifyr.transformation.XstsTransformer
import org.junit.jupiter.api.Assertions
import java.io.File
Expand All @@ -23,7 +23,7 @@ open class CompilationTest {

val transformer = XstsTransformer(reader)
val xsts = transformer.transform("Mission", rewriteChoice)
val serializedXsts = Serializer.serialize(xsts)
val serializedXsts = XstsSerializer.serialize(xsts)

File("$directory/model.xsts").writeText(serializedXsts)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package hu.bme.mit.semantifyr.oxsts.semantifyr

import hu.bme.mit.semantifyr.oxsts.model.oxsts.Target
import hu.bme.mit.semantifyr.oxsts.semantifyr.reader.OxstsReader
import hu.bme.mit.semantifyr.oxsts.semantifyr.serialization.Serializer
import hu.bme.mit.semantifyr.oxsts.semantifyr.serialization.XstsSerializer
import hu.bme.mit.semantifyr.oxsts.semantifyr.theta.ThetaExecutor
import hu.bme.mit.semantifyr.oxsts.semantifyr.transformation.XstsTransformer
import hu.bme.mit.semantifyr.oxsts.semantifyr.utils.EnvVar
Expand Down Expand Up @@ -104,7 +104,7 @@ open class VerificationTest {

val transformer = XstsTransformer(reader)
val xsts = transformer.transform(targetName, true)
val serializedXsts = Serializer.serialize(xsts)
val serializedXsts = XstsSerializer.serialize(xsts)

File("$targetDirectory/$targetName.xsts").writeText(serializedXsts)
}
Expand Down

0 comments on commit e0aeaf5

Please sign in to comment.