object literal
This commit is contained in:
@@ -28903,6 +28903,7 @@ static cJSON *ast_parse_primary (ASTParseState *s) {
|
||||
while (s->token_val != '}' && s->token_val != TOK_EOF) {
|
||||
cJSON *pair = cJSON_CreateObject ();
|
||||
/* property name */
|
||||
int is_ident = (s->token_val == TOK_IDENT);
|
||||
if (s->token_val == TOK_IDENT || s->token_val == TOK_STRING || s->token_val == TOK_NUMBER) {
|
||||
cJSON *left = ast_parse_primary (s);
|
||||
cJSON_AddItemToObject (pair, "left", left);
|
||||
@@ -28983,7 +28984,7 @@ static cJSON *ast_parse_primary (ASTParseState *s) {
|
||||
cJSON_AddNumberToObject (fn, "function_nr", s->function_nr++);
|
||||
ast_node_end (s, fn, s->buf_ptr);
|
||||
cJSON_AddItemToObject (pair, "right", fn);
|
||||
} else {
|
||||
} else if (!(is_ident && (s->token_val == ',' || s->token_val == '}'))) {
|
||||
ast_error (s, s->token_ptr, "expected ':' after property name");
|
||||
}
|
||||
cJSON_AddItemToArray (list, pair);
|
||||
|
||||
Reference in New Issue
Block a user