Handle the \f escape sequence (the two characters: backslash followed by an f, not a literal formfeed) and extend the test_parse test to check all valid escape sequences.

This commit is contained in:
Eric Haszlakiewicz
2012-07-29 12:31:07 -05:00
parent 8fcfeb63ec
commit 92f31bd99a
3 changed files with 23 additions and 1 deletions

View File

@@ -423,10 +423,12 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok,
case 'n':
case 'r':
case 't':
case 'f':
if(c == 'b') printbuf_memappend_fast(tok->pb, "\b", 1);
else if(c == 'n') printbuf_memappend_fast(tok->pb, "\n", 1);
else if(c == 'r') printbuf_memappend_fast(tok->pb, "\r", 1);
else if(c == 't') printbuf_memappend_fast(tok->pb, "\t", 1);
else if(c == 'f') printbuf_memappend_fast(tok->pb, "\f", 1);
state = saved_state;
break;
case 'u':