summaryrefslogtreecommitdiff
path: root/parse/tok.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2013-12-28 02:32:00 -0500
committerOri Bernstein <ori@eigenstate.org>2013-12-28 02:32:00 -0500
commit778de2674cd8f3b2951e367482ef6e56f7382424 (patch)
tree60e61730fbf6283337829b9112a04ffe0fe5fafe /parse/tok.c
parent66927662264ccbcdf60396c156d1964d35b41ece (diff)
downloadmc-778de2674cd8f3b2951e367482ef6e56f7382424.tar.gz
Fix hex escape sequences.
Diffstat (limited to 'parse/tok.c')
-rw-r--r--parse/tok.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/parse/tok.c b/parse/tok.c
index a514ba8..a8b8f9b 100644
--- a/parse/tok.c
+++ b/parse/tok.c
@@ -347,6 +347,10 @@ static int decode(char **buf, size_t *len, size_t *sz)
c = next();
/* we've already seen the '\' */
switch (c) {
+ case 'u':
+ v = unichar();
+ appendc(buf, len, sz, v);
+ return v;
case 'x': /* arbitrary hex */
c1 = next();
if (!isxdigit(c1))
@@ -356,7 +360,6 @@ static int decode(char **buf, size_t *len, size_t *sz)
fatal(line, "expected hex digit, got %c", c1);
v = 16*hexval(c1) + hexval(c2);
break;
- case 'u': v = unichar(); break;
case 'n': v = '\n'; break;
case 'r': v = '\r'; break;
case 't': v = '\t'; break;
@@ -368,7 +371,7 @@ static int decode(char **buf, size_t *len, size_t *sz)
case '0': v = '\0'; break;
default: fatal(line, "unknown escape code \\%c", c);
}
- appendc(buf, len, sz, v);
+ append(buf, len, sz, v);
return v;
}