1
0
mirror of https://github.com/KarolS/millfork.git synced 2025-01-27 11:30:19 +00:00

Fix escape sequences

This commit is contained in:
Karol Stasiak 2019-11-04 02:28:31 +01:00
parent 798c49fd34
commit 4abfab41df
2 changed files with 14 additions and 1 deletions

View File

@ -187,7 +187,7 @@ class TableTextCodec(override val name: String,
val (escSeq, closingBrace) = tail.span(_ != '}')
closingBrace match {
case '}' :: xs =>
encodeEscapeSequence(log, escSeq.mkString(""), position, options, lenient) ++ encode(log, position, xs, options, lenient)
encodeEscapeSequence(log, escSeq.map(_.toChar).mkString(""), position, options, lenient) ++ encode(log, position, xs, options, lenient)
case _ =>
log.error(f"Unclosed escape sequence", position)
Nil

View File

@ -67,4 +67,17 @@ class TextCodecSuite extends FunSuite with Matchers {
| }
""".stripMargin)
}
test("Escape sequences") {
val m = EmuUnoptimizedRun(
"""
| void main() {
| pointer p
| p = "{n}"pet
| output = p[0]
| }
| byte output @$c000
""".stripMargin)
m.readByte(0xc000) should equal(13)
}
}