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 */
| 1130 | * json and token should exist on the stack somewhere. |
| 1131 | * luaL_error() will long_jmp and release the stack */ |
| 1132 | static void json_throw_parse_error(lua_State *l, json_parse_t *json, |
| 1133 | const char *exp, json_token_t *token) |
| 1134 | { |
| 1135 | const char *found; |
| 1136 | |
| 1137 | strbuf_free(json->tmp); |
| 1138 | |
| 1139 | if (token->type == T_ERROR) |
| 1140 | found = token->value.string; |
| 1141 | else |
| 1142 | found = json_token_type_name[token->type]; |
| 1143 | |
| 1144 | /* Note: token->index is 0 based, display starting from 1 */ |
| 1145 | luaL_error(l, "Expected %s but found %s at character %d", |
| 1146 | exp, found, token->index + 1); |
| 1147 | } |
| 1148 | |
| 1149 | static inline void json_decode_ascend(json_parse_t *json) |
| 1150 | { |
no test coverage detected