ref: 778de2674cd8f3b2951e367482ef6e56f7382424
parent: 66927662264ccbcdf60396c156d1964d35b41ece
author: Ori Bernstein <[email protected]>
date: Fri Dec 27 21:32:00 EST 2013
Fix hex escape sequences.
--- a/parse/tok.c
+++ b/parse/tok.c
@@ -347,6 +347,10 @@
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 @@
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 @@
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;
}