1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-11-17 01:07:08 +00:00

Add the {nullchar} escape sequence

This commit is contained in:
Karol Stasiak 2019-09-02 23:22:32 +02:00
parent 1f8ece007b
commit 0be52821d9
2 changed files with 5 additions and 0 deletions

View File

@ -69,6 +69,8 @@ Some escape sequences may expand to multiple characters. For example, in several
* `{program_name_upper}` the same, but uppercased
* `{nullchar}` the null terminator for strings (`"{nullchar}"` is equivalent to `""z`)
##### Available only in some encodings
* `{n}` new line

View File

@ -116,6 +116,9 @@ class TextCodec(val name: String,
if (escSeq == "copyright_year") {
return encode(log, position, LocalDate.now.getYear.toString.toList, options, lenient)
}
if (escSeq == "null" || escSeq == "nullchar") {
return List(stringTerminator)
}
escapeSequences.getOrElse(escSeq, {
if (lenient) {
log.warn(s"Cannot encode escape sequence {$escSeq} in encoding `$name`, skipped it", position)