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 */
| 1100 | * json and token should exist on the stack somewhere. |
| 1101 | * luaL_error() will long_jmp and release the stack */ |
| 1102 | static void json_throw_parse_error(lua_State *l, json_parse_t *json, |
| 1103 | const char *exp, json_token_t *token) |
| 1104 | { |
| 1105 | const char *found; |
| 1106 | |
| 1107 | strbuf_free(json->tmp); |
| 1108 | |
| 1109 | if (token->type == T_ERROR) |
| 1110 | found = token->value.string; |
| 1111 | else |
| 1112 | found = json_token_type_name[token->type]; |
| 1113 | |
| 1114 | /* Note: token->index is 0 based, display starting from 1 */ |
| 1115 | luaL_error(l, "Expected %s but found %s at character %d", |
| 1116 | exp, found, token->index + 1); |
| 1117 | } |
| 1118 | |
| 1119 | static void json_decode_ascend(json_parse_t *json) |
| 1120 | { |
no test coverage detected