From: Cloudwalk Date: Mon, 10 May 2021 17:54:20 +0000 (-0400) Subject: Stub function to handle escapes X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=389670bd79faf96b610b4a4b85d1a147283dc984;p=xonotic%2Fdarkplaces.git Stub function to handle escapes --- diff --git a/json.c b/json.c index b7ad7cb4..7e7373cb 100644 --- a/json.c +++ b/json.c @@ -84,6 +84,23 @@ static qbool Json_Parse_CheckComment_Multiline_End(struct qparser_state_s *state return false; } +static inline qbool Json_Handle_String_Escape(struct qjson_state_s *json) +{ + switch(*json->state->pos) + { + case '\\': + case '/': + case 'b': + case 'f': + case 'n': + case 'r': + case 't': + case 'u': + return true; // TODO + default: + return false; + } +} // TODO: handle escape sequences static inline void Json_Parse_String(struct qjson_state_s *json) @@ -93,7 +110,9 @@ static inline void Json_Parse_String(struct qjson_state_s *json) if(*json->state->pos == '\\') { Parse_Next(json->state, 1); - continue; + if(Json_Handle_String_Escape(json)) + continue; + Parse_Error(json->state, PARSE_ERR_INVAL, "a valid escape sequence"); } } while(*json->state->pos != '"'); }