summaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2018-07-01 00:09:17 -0700
committerOri Bernstein <ori@eigenstate.org>2018-07-03 21:27:11 -0700
commitadbf59398978f304071df1e933e0e01a9d6027b7 (patch)
treeaa20987150df2a5765fd963dec4f127a73d56a75 /lib/std
parent6042e40dd30c9e04934e635274a013f989695eb7 (diff)
downloadmc-adbf59398978f304071df1e933e0e01a9d6027b7.tar.gz
Fix escaping of closing '}' in fmt.
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/fmt.myr6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/std/fmt.myr b/lib/std/fmt.myr
index e82aece..6e6ddab 100644
--- a/lib/std/fmt.myr
+++ b/lib/std/fmt.myr
@@ -195,9 +195,11 @@ const sbfmtv = {sb, fmt, ap -> size
nbuf = 0
;;
| (`Copy, '}'):
- if i < fmt.len && (fmt[i] : char) == '}'
- sbputb(sb, ('}' : byte))
+ if i == fmt.len || (fmt[i] : char) != '}'
+ die("unescaped '}'\n")
;;
+ sbputb(sb, ('}' : byte))
+ i++
| (`Copy, _):
sbputb(sb, b)