Add custom configuration to jerry_parse and its variants (#4620)

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2021-03-10 09:56:48 +01:00
committed by GitHub
parent 7a2665621b
commit 546422161e
45 changed files with 658 additions and 596 deletions
@@ -42,7 +42,7 @@ static int load_javascript() {
const jerry_char_t* code = reinterpret_cast<const jerry_char_t*>(js_codes[src].source);
const size_t length = js_codes[src].length;
jerry_value_t parsed_code = jerry_parse(NULL, 0, code, length, JERRY_PARSE_NO_OPTS);
jerry_value_t parsed_code = jerry_parse(code, length, NULL);
if (jerry_value_is_error(parsed_code)) {
LOG_PRINT_ALWAYS("jerry_parse failed [%s]\r\n", js_codes[src].name);
+8 -5
View File
@@ -397,7 +397,7 @@ int jerry_main (int argc, char *argv[])
printf ("No input files, running a hello world demo:\n");
const jerry_char_t script[] = "var str = 'Hello World'; print(str + ' from JerryScript')";
ret_value = jerry_parse (NULL, 0, script, sizeof (script) - 1, JERRY_PARSE_NO_OPTS);
ret_value = jerry_parse (script, sizeof (script) - 1, NULL);
if (!jerry_value_is_error (ret_value))
{
@@ -417,11 +417,14 @@ int jerry_main (int argc, char *argv[])
return JERRY_STANDALONE_EXIT_CODE_FAIL;
}
ret_value = jerry_parse ((jerry_char_t *) file_names[i],
strlen (file_names[i]),
source_p,
jerry_parse_options_t parse_options;
parse_options.options = JERRY_PARSE_HAS_RESOURCE;
parse_options.resource_name_p = (const jerry_char_t *) file_names[i];
parse_options.resource_name_length = strlen (file_names[i]);
ret_value = jerry_parse (source_p,
source_size,
JERRY_PARSE_NO_OPTS);
&parse_options);
free ((void*) source_p);
if (!jerry_value_is_error (ret_value))
+1 -1
View File
@@ -65,7 +65,7 @@ int test_jerry (int argc, char **argv)
register_js_function ("print", jerryx_handler_print);
/* Setup Global scope code */
ret_value = jerry_parse (NULL, 0, script, sizeof (script) - 1, JERRY_PARSE_NO_OPTS);
ret_value = jerry_parse (script, sizeof (script) - 1, NULL);
if (!jerry_value_is_error (ret_value))
{