Add feature to remove parser. (#1476)

Remove the parser so we can save space if we are
only interested in running snapshots.

Removing the parser enables the snapshot execution.

JerryScript-DCO-1.0-Signed-off-by: Sergio Martinez sergio.martinez.rodriguez@intel.com
This commit is contained in:
Sergio Abraham Martinez Rodriguez
2016-12-09 14:38:41 +00:00
committed by Zoltan Herczeg
parent 551aaa58e6
commit db05d85a9a
10 changed files with 56 additions and 1 deletions
+13 -1
View File
@@ -19,6 +19,8 @@
#include "jcontext.h"
#include "js-parser-internal.h"
#ifndef JERRY_DISABLE_PARSER
/** \addtogroup parser Parser
* @{
*
@@ -2228,6 +2230,8 @@ parser_raise_error (parser_context_t *context_p, /**< context */
#define PARSE_ERR_POS_END "]"
#define PARSE_ERR_POS_END_SIZE ((uint32_t) sizeof (PARSE_ERR_POS_END))
#endif /* !JERRY_DISABLE_PARSER */
/**
* Parse EcamScript source code
*
@@ -2243,6 +2247,7 @@ parser_parse_script (const uint8_t *source_p, /**< source code */
bool is_strict, /**< strict mode */
ecma_compiled_code_t **bytecode_data_p) /**< [out] JS bytecode */
{
#ifndef JERRY_DISABLE_PARSER
parser_error_location_t parser_error;
*bytecode_data_p = parser_parse_source (source_p, size, is_strict, &parser_error);
@@ -2305,8 +2310,15 @@ parser_parse_script (const uint8_t *source_p, /**< source code */
return ecma_raise_syntax_error ("");
#endif /* JERRY_ENABLE_ERROR_MESSAGES */
}
return ecma_make_simple_value (ECMA_SIMPLE_VALUE_TRUE);
#else /* !JERRY_DISABLE_PARSER */
JERRY_UNUSED (source_p);
JERRY_UNUSED (size);
JERRY_UNUSED (is_strict);
JERRY_UNUSED (bytecode_data_p);
return ecma_raise_syntax_error (ECMA_ERR_MSG ("The parser has been disabled."));
#endif /* JERRY_DISABLE_PARSER */
} /* parser_parse_script */
/**