|
@@ -135,6 +135,16 @@ static void tParseNumber(int c) {
|
|
|
}
|
|
|
|
|
|
static int32 tUnicode(int32 c) {
|
|
|
+ if(c == '\\') {
|
|
|
+ switch(fRead()) {
|
|
|
+ case '"': c = '"'; break;
|
|
|
+ case '\\': c = '\\'; break;
|
|
|
+ case 'n': c = '\n'; break;
|
|
|
+ case 'r': c = '\r'; break;
|
|
|
+ case 't': c = '\t'; break;
|
|
|
+ default: tError("unknown escaped character at line %d", line);
|
|
|
+ }
|
|
|
+ }
|
|
|
if((c & 0xE0) == 0xC0) {
|
|
|
c = ((c & 0x1F) << 6) | (fRead() & 0x3F);
|
|
|
} else if((c & 0xF0) == 0xE0) {
|
|
@@ -154,12 +164,6 @@ static void tAddString() {
|
|
|
int32 c = fRead();
|
|
|
if(c == '"') {
|
|
|
break;
|
|
|
- } else if(c == '\\') {
|
|
|
- switch(fRead()) {
|
|
|
- case '"': c = '"'; break;
|
|
|
- case '\\': c = '\\'; break;
|
|
|
- default: tError("unknown escaped character at line %d", line);
|
|
|
- }
|
|
|
} else if(c == EOF) {
|
|
|
tError("unclosed string starting at line %d", line);
|
|
|
}
|