diff options
author | Zoltan Herczeg <zherczeg.u-szeged@partner.samsung.com> | 2021-03-10 09:56:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-10 09:56:48 +0100 |
commit | 546422161e1a10cd9d4d524a56db3105570ab7dc (patch) | |
tree | f915be4c245cce26980168b07d0db6414e75d1d9 /jerry-core/ecma/base/ecma-globals.h | |
parent | 7a2665621bfaedf422652a68eeaad799a9de79ce (diff) |
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
Diffstat (limited to 'jerry-core/ecma/base/ecma-globals.h')
-rw-r--r-- | jerry-core/ecma/base/ecma-globals.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/jerry-core/ecma/base/ecma-globals.h b/jerry-core/ecma/base/ecma-globals.h index f22bd4a5..6d846a12 100644 --- a/jerry-core/ecma/base/ecma-globals.h +++ b/jerry-core/ecma/base/ecma-globals.h @@ -331,6 +331,32 @@ typedef struct ecma_native_pointer_t struct ecma_native_pointer_t *next_p; /**< points to the next ecma_native_pointer_t element */ } ecma_native_pointer_t; +/** + * Option bits for ecma_parse_options_t. + */ +typedef enum +{ + /* bit 0: ECMA_PARSE_STRICT_MODE */ + /* bit 1: ECMA_PARSE_MODULE */ + ECMA_PARSE_HAS_RESOURCE = (1 << 2), /**< resource_name_p and resource_name_length fields are valid */ + ECMA_PARSE_HAS_START = (1 << 3), /**< start_line and start_column fields are valid */ +} ecma_parse_option_feature_t; + +/** + * Variable configuration options for parsing functions such as ecma_parse or ecma_parse_function. + */ +typedef struct +{ + uint32_t options; /**< combination of ecma_parse_option_feature_t values + * which enables parsing features */ + const lit_utf8_byte_t *resource_name_p; /**< resource name (usually a file name) + * if ECMA_PARSE_HAS_RESOURCE is set in options */ + size_t resource_name_length; /**< length of resource name + * if ECMA_PARSE_HAS_RESOURCE is set in options */ + uint32_t start_line; /**< start line of the source code if ECMA_PARSE_HAS_START is set in options */ + uint32_t start_column; /**< start column of the source code if ECMA_PARSE_HAS_START is set in options */ +} ecma_parse_options_t; + #if JERRY_ESNEXT /** |