MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / json_process_value

Function json_process_value

deps/lua/src/lua_cjson.c:1224–1251  ·  view source on GitHub ↗

Handle the "value" context */

Source from the content-addressed store, hash-verified

1222
1223/* Handle the "value" context */
1224static void json_process_value(lua_State *l, json_parse_t *json,
1225 json_token_t *token)
1226{
1227 switch (token->type) {
1228 case T_STRING:
1229 lua_pushlstring(l, token->value.string, token->string_len);
1230 break;;
1231 case T_NUMBER:
1232 lua_pushnumber(l, token->value.number);
1233 break;;
1234 case T_BOOLEAN:
1235 lua_pushboolean(l, token->value.boolean);
1236 break;;
1237 case T_OBJ_BEGIN:
1238 json_parse_object_context(l, json);
1239 break;;
1240 case T_ARR_BEGIN:
1241 json_parse_array_context(l, json);
1242 break;;
1243 case T_NULL:
1244 /* In Lua, setting "t[k] = nil" will delete k from the table.
1245 * Hence a NULL pointer lightuserdata object is used instead */
1246 lua_pushlightuserdata(l, NULL);
1247 break;;
1248 default:
1249 json_throw_parse_error(l, json, "value", token);
1250 }
1251}
1252
1253static int json_decode(lua_State *l)
1254{

Callers 3

json_parse_array_contextFunction · 0.85
json_decodeFunction · 0.85

Calls 7

lua_pushlstringFunction · 0.85
lua_pushnumberFunction · 0.85
lua_pushbooleanFunction · 0.85
json_parse_array_contextFunction · 0.85
lua_pushlightuserdataFunction · 0.85
json_throw_parse_errorFunction · 0.85

Tested by

no test coverage detected