Implement JSON built-in object

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.u-szeged@partner.samsung.com
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg@inf.u-szeged.hu
This commit is contained in:
Zoltan Herczeg
2015-07-07 00:57:21 -07:00
parent cadc8f40d4
commit d1a5f7fc87
10 changed files with 2866 additions and 5 deletions
@@ -64,6 +64,45 @@ extern ecma_number_t ecma_date_make_date (ecma_number_t day, ecma_number_t time)
extern ecma_number_t ecma_date_time_clip (ecma_number_t time);
#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_DATE_BUILTIN */
typedef struct
{
void **block_start_p;
void **block_end_p;
void **current_p;
} list_ctx_t;
typedef struct
{
list_ctx_t property_list;
list_ctx_t occurence_stack;
ecma_string_t *indent_str_p;
ecma_string_t *gap_str_p;
ecma_object_t *replacer_function_p;
} stringify_context_t;
/* ecma-builtin-helper-json.cpp */
extern void **realloc_list (list_ctx_t *ctx);
extern void list_append (list_ctx_t *ctx, void *element);
extern void free_list (list_ctx_t *ctx);
extern bool list_has_element (list_ctx_t *ctx, void *element);
extern bool list_has_ecma_string_element (list_ctx_t *ctx, ecma_string_t *string_p);
extern bool list_is_empty (list_ctx_t *ctx);
extern void list_remove_last_element (list_ctx_t *ctx);
extern void free_list_with_ecma_string_content (list_ctx_t *ctx);
extern ecma_string_t *ecma_builtin_helper_json_create_separated_properties (list_ctx_t *partial_p,
ecma_string_t *separator_p);
extern ecma_completion_value_t ecma_builtin_helper_json_create_formatted_json (ecma_string_t *left_bracket_p,
ecma_string_t *right_bracket_p,
ecma_string_t *stepback_p,
list_ctx_t *partial_p,
stringify_context_t *context_p);
extern ecma_completion_value_t ecma_builtin_helper_json_create_non_formatted_json (ecma_string_t *left_bracket_p,
ecma_string_t *right_bracket_p,
list_ctx_t *partial_p);
extern ecma_string_t *ecma_builtin_helper_json_create_hex_digit_ecma_string (uint8_t value);
/**
* @}
* @}