feat: merge labts fixes
This commit is contained in:
@@ -82,9 +82,11 @@ def compile(filename: String, outFile: Option[File] = None)(using
|
|||||||
def main(args: Array[String]): Unit =
|
def main(args: Array[String]): Unit =
|
||||||
OParser.parse(cliParser, args, CliConfig()) match {
|
OParser.parse(cliParser, args, CliConfig()) match {
|
||||||
case Some(config) =>
|
case Some(config) =>
|
||||||
compile(
|
System.exit(
|
||||||
config.file.getAbsolutePath,
|
compile(
|
||||||
outFile = Some(File(".", config.file.getName.stripSuffix(".wacc") + ".s"))
|
config.file.getAbsolutePath,
|
||||||
|
outFile = Some(File(".", config.file.getName.stripSuffix(".wacc") + ".s"))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
case None =>
|
case None =>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,8 +180,8 @@ object typeChecker {
|
|||||||
microWacc.Builtin.Read,
|
microWacc.Builtin.Read,
|
||||||
List(
|
List(
|
||||||
destTy match {
|
destTy match {
|
||||||
case KnownType.Int => "%d".toMicroWaccCharArray
|
case KnownType.Int => " %d".toMicroWaccCharArray
|
||||||
case KnownType.Char | _ => "%c".toMicroWaccCharArray
|
case KnownType.Char | _ => " %c".toMicroWaccCharArray
|
||||||
},
|
},
|
||||||
destTyped
|
destTyped
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -41,23 +41,7 @@ class ParallelExamplesSpec extends AnyFlatSpec with BeforeAndAfterAll {
|
|||||||
val inputLine =
|
val inputLine =
|
||||||
contents
|
contents
|
||||||
.find(_.matches("^# ?[Ii]nput:.*$"))
|
.find(_.matches("^# ?[Ii]nput:.*$"))
|
||||||
.map(line =>
|
.map(_.split(":").last.strip + "\n")
|
||||||
("" :: line.split(":").last.strip.split(" ").toList)
|
|
||||||
.sliding(2)
|
|
||||||
.flatMap { arr =>
|
|
||||||
if (
|
|
||||||
// First entry has no space in front
|
|
||||||
arr(0) == "" ||
|
|
||||||
// int followed by non-digit, space can be removed
|
|
||||||
arr(0).toIntOption.nonEmpty && !arr(1)(0).isDigit ||
|
|
||||||
// non-int followed by int, space can be removed
|
|
||||||
!arr(0).last.isDigit && arr(1).toIntOption.nonEmpty
|
|
||||||
)
|
|
||||||
then List(arr(1))
|
|
||||||
else List(" ", arr(1))
|
|
||||||
}
|
|
||||||
.mkString
|
|
||||||
)
|
|
||||||
.getOrElse("")
|
.getOrElse("")
|
||||||
val outputLineIdx = contents.indexWhere(_.matches("^# ?[Oo]utput:.*$"))
|
val outputLineIdx = contents.indexWhere(_.matches("^# ?[Oo]utput:.*$"))
|
||||||
val expectedOutput =
|
val expectedOutput =
|
||||||
@@ -92,7 +76,13 @@ class ParallelExamplesSpec extends AnyFlatSpec with BeforeAndAfterAll {
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert(process.exitValue == expectedExit)
|
assert(process.exitValue == expectedExit)
|
||||||
assert(stdout.toString.replaceAll("0x[0-9a-f]+", "#addrs#") == expectedOutput)
|
assert(
|
||||||
|
stdout.toString
|
||||||
|
.replaceAll("0x[0-9a-f]+", "#addrs#")
|
||||||
|
.replaceAll("fatal error:.*", "#runtime_error#\n\u0000")
|
||||||
|
.takeWhile(_ != '\u0000')
|
||||||
|
== expectedOutput
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user