MCPcopy Create free account
hub / github.com/defold/defold / json_throw_parse_error

Function json_throw_parse_error

engine/script/src/luacjson/lua_cjson.c:1387–1402  ·  view source on GitHub ↗

This function does not return. * DO NOT CALL WITH DYNAMIC MEMORY ALLOCATED. * The only supported exception is the temporary parser string * json->tmp struct. * json and token should exist on the stack somewhere. * luaL_error() will long_jmp and release the stack */

Source from the content-addressed store, hash-verified

1385 * json and token should exist on the stack somewhere.
1386 * luaL_error() will long_jmp and release the stack */
1387static int json_throw_parse_error(lua_State *l, json_parse_t *json,
1388 const char *exp, json_token_t *token)
1389{
1390 const char *found;
1391
1392 strbuf_free(json->tmp);
1393
1394 if (token->type == T_ERROR)
1395 found = token->value.string;
1396 else
1397 found = json_token_type_name[token->type];
1398
1399 /* Note: token->index is 0 based, display starting from 1 */
1400 return DefoldError(json->cfg, "Expected %s but found %s at character %d",
1401 exp, found, token->index + 1);
1402}
1403
1404static inline void json_decode_ascend(json_parse_t *json)
1405{

Callers 5

json_parse_array_contextFunction · 0.85
json_process_valueFunction · 0.85
json_decodeFunction · 0.85
lua_cjson_decodeFunction · 0.85

Calls 2

strbuf_freeFunction · 0.85
DefoldErrorFunction · 0.85

Tested by

no test coverage detected