Remove the ENABLED/DISABLED macros (#4515)

The removal of these macros enabled cppcheck to reveal new errors.
These errors are also fixed by the patch.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2021-02-04 23:47:05 +01:00
committed by GitHub
parent e01c2549d7
commit 0628ae1e7b
337 changed files with 5186 additions and 5191 deletions
+4 -4
View File
@@ -30,7 +30,7 @@ JERRY_STATIC_ASSERT (CBC_END == 238,
JERRY_STATIC_ASSERT (CBC_EXT_END == 147,
number_of_cbc_ext_opcodes_changed);
#if ENABLED (JERRY_PARSER) || ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
#if JERRY_PARSER || JERRY_PARSER_DUMP_BYTE_CODE
/** \addtogroup parser Parser
* @{
@@ -66,9 +66,9 @@ const uint8_t cbc_ext_flags[] =
#undef CBC_OPCODE
#endif /* ENABLED (JERRY_PARSER) || ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#endif /* JERRY_PARSER || JERRY_PARSER_DUMP_BYTE_CODE */
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
#if JERRY_PARSER_DUMP_BYTE_CODE
#define CBC_OPCODE(arg1, arg2, arg3, arg4) #arg1,
@@ -90,7 +90,7 @@ const char * const cbc_ext_names[] =
#undef CBC_OPCODE
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
/**
* @}
+9 -9
View File
@@ -64,19 +64,19 @@
#define CBC_HAS_POP_STACK_BYTE_ARG (CBC_HAS_BYTE_ARG | CBC_POP_STACK_BYTE_ARG)
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* CBC_NO_RESULT_OPERATION for ext opcodes
*/
#define CBC_EXT_NO_RESULT_OPERATION(opcode) \
((opcode) >= PARSER_TO_EXT_OPCODE (CBC_EXT_SUPER_CALL) \
&& (opcode) <= PARSER_TO_EXT_OPCODE (CBC_EXT_SPREAD_CALL_PROP_BLOCK))
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
/**
* CBC_NO_RESULT_OPERATION for ext opcodes
*/
#define CBC_EXT_NO_RESULT_OPERATION(opcode) false
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* Debug macro. */
#define CBC_ARGS_EQ(op, types) \
@@ -854,9 +854,9 @@ typedef struct
uint8_t ident_end; /**< end position of the identifier group */
uint8_t const_literal_end; /**< end position of the const literal group */
uint8_t literal_end; /**< end position of the literal group */
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
ecma_value_t realm_value; /**< realm value */
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
} cbc_uint8_arguments_t;
/**
@@ -872,9 +872,9 @@ typedef struct
uint16_t const_literal_end; /**< end position of the const literal group */
uint16_t literal_end; /**< end position of the literal group */
uint16_t padding; /**< an unused value */
#if ENABLED (JERRY_BUILTIN_REALMS)
#if JERRY_BUILTIN_REALMS
ecma_value_t realm_value; /**< realm value */
#endif /* ENABLED (JERRY_BUILTIN_REALMS) */
#endif /* JERRY_BUILTIN_REALMS */
} cbc_uint16_arguments_t;
/**
@@ -995,7 +995,7 @@ typedef enum
extern const uint8_t cbc_flags[];
extern const uint8_t cbc_ext_flags[];
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
#if JERRY_PARSER_DUMP_BYTE_CODE
/**
* Opcode names for debugging.
@@ -1003,7 +1003,7 @@ extern const uint8_t cbc_ext_flags[];
extern const char * const cbc_names[];
extern const char * const cbc_ext_names[];
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
/**
* @}
+16 -16
View File
@@ -30,7 +30,7 @@
* @{
*/
#if ENABLED (JERRY_PARSER)
#if JERRY_PARSER
/**
* Free literal.
@@ -53,9 +53,9 @@ util_free_literal (lexer_literal_t *literal_p) /**< literal */
}
} /* util_free_literal */
#endif /* ENABLED (JERRY_PARSER) */
#endif /* JERRY_PARSER */
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
#if JERRY_PARSER_DUMP_BYTE_CODE
/**
* Debug utility to print a character sequence.
@@ -83,7 +83,7 @@ util_print_number (ecma_number_t num_p) /**< number to print */
JERRY_DEBUG_MSG ("%s", str_buf);
} /* util_print_number */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
/**
* Debug utility to print a bigint.
@@ -118,7 +118,7 @@ util_print_bigint (ecma_value_t bigint) /**< bigint to print */
jmem_heap_free_block (string_buffer_p, char_size_p);
} /* util_print_bigint */
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
/**
* Print literal
@@ -147,14 +147,14 @@ util_print_literal (lexer_literal_t *literal_p) /**< literal */
}
case LEXER_NUMBER_LITERAL:
{
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
if (ecma_is_value_bigint (literal_p->u.value))
{
JERRY_DEBUG_MSG ("bigint(");
util_print_bigint (literal_p->u.value);
break;
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
JERRY_DEBUG_MSG ("number(");
util_print_number (ecma_get_number_from_value (literal_p->u.value));
break;
@@ -240,13 +240,13 @@ util_print_literal_value (ecma_compiled_code_t *compiled_code_p, /**< compiled c
JERRY_DEBUG_MSG ("number(");
util_print_number (ecma_get_number_from_value (value));
}
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
else if (ecma_is_value_bigint (value))
{
JERRY_DEBUG_MSG ("bigint(");
util_print_bigint (value);
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
else
{
ecma_string_t *literal_p = ecma_get_string_from_value (value);
@@ -347,7 +347,7 @@ util_print_cbc (ecma_compiled_code_t *compiled_code_p) /**< compiled code */
JERRY_DEBUG_MSG (",no_lexical_env");
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
switch (CBC_FUNCTION_GET_TYPE (compiled_code_p->status_flags))
{
case CBC_FUNCTION_CONSTRUCTOR:
@@ -386,7 +386,7 @@ util_print_cbc (ecma_compiled_code_t *compiled_code_p) /**< compiled code */
break;
}
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
JERRY_DEBUG_MSG ("]\n");
@@ -396,7 +396,7 @@ util_print_cbc (ecma_compiled_code_t *compiled_code_p) /**< compiled code */
JERRY_DEBUG_MSG (" Const literal range end: %d\n", (int) const_literal_end);
JERRY_DEBUG_MSG (" Literal range end: %d\n\n", (int) literal_end);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (compiled_code_p->status_flags & CBC_CODE_FLAGS_HAS_EXTENDED_INFO)
{
uint32_t extended_info = ecma_compiled_code_resolve_extended_info (compiled_code_p);
@@ -405,7 +405,7 @@ util_print_cbc (ecma_compiled_code_t *compiled_code_p) /**< compiled code */
size -= sizeof (ecma_value_t);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
byte_code_start_p = (uint8_t *) compiled_code_p;
@@ -463,7 +463,7 @@ util_print_cbc (ecma_compiled_code_t *compiled_code_p) /**< compiled code */
JERRY_DEBUG_MSG (" %3d : %s", (int) cbc_offset, cbc_ext_names[ext_opcode]);
byte_code_p += 2;
#if ENABLED (JERRY_LINE_INFO)
#if JERRY_LINE_INFO
if (ext_opcode == CBC_EXT_LINE)
{
uint32_t value = 0;
@@ -479,7 +479,7 @@ util_print_cbc (ecma_compiled_code_t *compiled_code_p) /**< compiled code */
JERRY_DEBUG_MSG (" %d\n", (int) value);
continue;
}
#endif /* ENABLED (JERRY_LINE_INFO) */
#endif /* JERRY_LINE_INFO */
}
if (flags & (CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2))
@@ -546,7 +546,7 @@ util_print_cbc (ecma_compiled_code_t *compiled_code_p) /**< compiled code */
#undef PARSER_READ_IDENTIFIER_INDEX
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
/**
* @}
+10 -10
View File
@@ -74,19 +74,19 @@ typedef enum
LEXER_FLAG_SOURCE_PTR = (1 << 2), /**< the literal is directly referenced in the source code
* (no need to allocate memory) */
LEXER_FLAG_LATE_INIT = (1 << 3), /**< initialize this variable after the byte code is freed */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
LEXER_FLAG_GLOBAL = (1 << 4), /**< this local identifier is not a let or const declaration */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
} lexer_literal_status_flags_t;
/**
* Type of property length.
*/
#if ENABLED (JERRY_CPOINTER_32_BIT)
#if JERRY_CPOINTER_32_BIT
typedef uint32_t prop_length_t;
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
#else /* !JERRY_CPOINTER_32_BIT */
typedef uint16_t prop_length_t;
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
#endif /* JERRY_CPOINTER_32_BIT */
/**
* Literal data.
@@ -101,11 +101,11 @@ typedef struct
uint32_t source_data; /**< encoded source literal */
} u;
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
#if JERRY_PARSER_DUMP_BYTE_CODE
struct
#else /* !ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#else /* !JERRY_PARSER_DUMP_BYTE_CODE */
union
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
{
prop_length_t length; /**< length of ident / string literal */
uint16_t index; /**< real index during post processing */
@@ -117,9 +117,9 @@ typedef struct
void util_free_literal (lexer_literal_t *literal_p);
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
#if JERRY_PARSER_DUMP_BYTE_CODE
void util_print_literal (lexer_literal_t *);
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
/* TRY/CATCH block */
+142 -142
View File
@@ -22,7 +22,7 @@
#include "lit-char-helpers.h"
#include "jcontext.h"
#if ENABLED (JERRY_PARSER)
#if JERRY_PARSER
/** \addtogroup parser Parser
* @{
@@ -93,7 +93,7 @@ lexer_hex_to_code_point (const uint8_t *source_p, /**< current source position *
return result;
} /* lexer_hex_to_code_point */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Parse hexadecimal character sequence enclosed in braces
@@ -147,7 +147,7 @@ lexer_hex_in_braces_to_code_point (const uint8_t *source_p, /**< current source
return result;
} /* lexer_hex_in_braces_to_code_point */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Parse hexadecimal character sequence
@@ -161,13 +161,13 @@ lexer_unchecked_hex_to_character (const uint8_t **source_p) /**< [in, out] curre
const uint8_t *char_p = *source_p;
uint32_t length = (char_p[-1] == LIT_CHAR_LOWERCASE_U) ? 4 : 2;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (char_p[0] == LIT_CHAR_LEFT_BRACE)
{
length = 0;
char_p++;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
while (true)
{
@@ -189,7 +189,7 @@ lexer_unchecked_hex_to_character (const uint8_t **source_p) /**< [in, out] curre
JERRY_ASSERT (result <= LIT_UNICODE_CODE_POINT_MAX);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (length == 0)
{
if (*char_p != LIT_CHAR_RIGHT_BRACE)
@@ -199,7 +199,7 @@ lexer_unchecked_hex_to_character (const uint8_t **source_p) /**< [in, out] curre
*source_p = char_p + 1;
return result;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (--length == 0)
{
@@ -396,7 +396,7 @@ lexer_skip_spaces (parser_context_t *context_p) /**< context */
}
} /* lexer_skip_spaces */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Skip all the continuous empty statements.
@@ -416,22 +416,22 @@ lexer_skip_empty_statements (parser_context_t *context_p) /**< context */
context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);
} /* lexer_skip_empty_statements */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Checks whether the keyword has escape sequences.
*/
#define LEXER_CHECK_INVALID_KEYWORD(ident_start_p, buffer_p) \
(JERRY_UNLIKELY ((ident_start_p) == (buffer_p)) \
&& !(context_p->global_status_flags & ECMA_PARSE_INTERNAL_PRE_SCANNING))
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
/**
* Checks whether the keyword has escape sequences.
*/
#define LEXER_CHECK_INVALID_KEYWORD(ident_start_p, buffer_p) \
(JERRY_UNLIKELY ((ident_start_p) == (buffer_p)))
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Keyword data.
@@ -503,10 +503,10 @@ static const keyword_string_t keywords_with_length_4[] =
*/
static const keyword_string_t keywords_with_length_5[] =
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
LEXER_KEYWORD ("async", LEXER_KEYW_ASYNC),
LEXER_KEYWORD ("await", LEXER_KEYW_AWAIT),
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
LEXER_KEYWORD ("break", LEXER_KEYW_BREAK),
LEXER_KEYWORD ("catch", LEXER_KEYW_CATCH),
LEXER_KEYWORD ("class", LEXER_KEYW_CLASS),
@@ -659,7 +659,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
has_escape = true;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (source_p + 5 <= source_end_p && source_p[1] == LIT_CHAR_LOWERCASE_U)
{
if (source_p[2] == LIT_CHAR_LEFT_BRACE)
@@ -671,12 +671,12 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
code_point = lexer_hex_to_code_point (source_p + 2, 4);
}
}
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
if (source_p + 6 <= source_end_p && source_p[1] == LIT_CHAR_LOWERCASE_U)
{
code_point = lexer_hex_to_code_point (source_p + 2, 4);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (code_point == UINT32_MAX)
{
@@ -711,7 +711,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
if (JERRY_UNLIKELY (code_point >= LIT_UTF8_2_BYTE_MARKER))
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
utf8_length = lit_read_code_point_from_utf8 (source_p,
(lit_utf8_size_t) (source_end_p - source_p),
&code_point);
@@ -740,7 +740,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
decoded_length = 2 * 3;
has_escape = true;
}
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
if (code_point < LIT_UTF8_4_BYTE_MARKER)
{
utf8_length = lit_read_code_point_from_utf8 (source_p,
@@ -752,7 +752,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
{
code_point = 0;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
}
if (length == 0)
@@ -834,7 +834,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
if (JERRY_LIKELY (keyword_p->type < LEXER_FIRST_NON_RESERVED_KEYWORD))
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (JERRY_UNLIKELY (keyword_p->type == LEXER_KEYW_AWAIT))
{
if (!(context_p->status_flags & PARSER_IS_ASYNC_FUNCTION)
@@ -855,7 +855,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
context_p->token.type = (uint8_t) LEXER_KEYW_AWAIT;
break;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (LEXER_CHECK_INVALID_KEYWORD (ident_start_p, buffer_p))
{
@@ -867,7 +867,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
break;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (keyword_p->type == LEXER_KEYW_LET && (context_p->status_flags & PARSER_IS_STRICT))
{
if (LEXER_CHECK_INVALID_KEYWORD (ident_start_p, buffer_p))
@@ -898,7 +898,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
{
parser_raise_error (context_p, PARSER_ERR_ARGUMENTS_IN_CLASS_FIELD);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (keyword_p->type >= LEXER_FIRST_FUTURE_STRICT_RESERVED_WORD
&& (context_p->status_flags & PARSER_IS_STRICT))
@@ -938,11 +938,11 @@ void
lexer_parse_string (parser_context_t *context_p, /**< context */
lexer_string_options_t opts) /**< options */
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
int32_t raw_length_adjust = 0;
#else /* ENABLED (JERRY_ESNEXT) */
#else /* JERRY_ESNEXT */
JERRY_UNUSED (opts);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
uint8_t str_end_character = context_p->source_p[0];
const uint8_t *source_p = context_p->source_p + 1;
@@ -955,12 +955,12 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
size_t length = 0;
uint8_t has_escape = false;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (str_end_character == LIT_CHAR_RIGHT_BRACE)
{
str_end_character = LIT_CHAR_GRAVE_ACCENT;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
while (true)
{
@@ -995,9 +995,9 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
if (source_p < source_end_p
&& *source_p == LIT_CHAR_LF)
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
raw_length_adjust--;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
source_p++;
}
@@ -1020,7 +1020,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
continue;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (opts & LEXER_STRING_RAW)
{
if ((*source_p == LIT_CHAR_GRAVE_ACCENT) || (*source_p == LIT_CHAR_BACKSLASH))
@@ -1031,7 +1031,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
}
continue;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (*source_p == LIT_CHAR_0
&& source_p + 1 < source_end_p
@@ -1047,7 +1047,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
* converted to a character which has the same byte length. */
if (*source_p >= LIT_CHAR_0 && *source_p <= LIT_CHAR_3)
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (str_end_character == LIT_CHAR_GRAVE_ACCENT)
{
parser_raise_error (context_p, PARSER_ERR_TEMPLATE_STR_OCTAL_ESCAPE);
@@ -1112,7 +1112,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
uint32_t escape_length = (*source_p == LIT_CHAR_LOWERCASE_X) ? 3 : 5;
lit_code_point_t code_point = UINT32_MAX;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (source_p + 4 <= source_end_p
&& source_p[0] == LIT_CHAR_LOWERCASE_U
&& source_p[1] == LIT_CHAR_LEFT_BRACE)
@@ -1122,14 +1122,14 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
}
else
{
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (source_p + escape_length <= source_end_p)
{
code_point = lexer_hex_to_code_point (source_p + 1, escape_length - 1);
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (code_point == UINT32_MAX)
{
@@ -1145,7 +1145,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
continue;
}
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
else if (str_end_character == LIT_CHAR_GRAVE_ACCENT &&
source_p[0] == LIT_CHAR_DOLLAR_SIGN &&
source_p + 1 < source_end_p &&
@@ -1155,7 +1155,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
source_p++;
break;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (*source_p >= LIT_UTF8_4_BYTE_MARKER)
{
@@ -1165,9 +1165,9 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
length += 2 * 3;
has_escape = true;
source_p += 4;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
raw_length_adjust += 2;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
column++;
continue;
}
@@ -1177,7 +1177,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
/* Subtract -1 because column is increased below. */
column--;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
else if (*source_p == LEXER_NEWLINE_LS_PS_BYTE_1 && LEXER_NEWLINE_LS_PS_BYTE_23 (source_p))
{
source_p += 3;
@@ -1214,11 +1214,11 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
continue;
}
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
else if (*source_p == LIT_CHAR_CR
#if !ENABLED (JERRY_ESNEXT)
#if !JERRY_ESNEXT
|| (*source_p == LEXER_NEWLINE_LS_PS_BYTE_1 && LEXER_NEWLINE_LS_PS_BYTE_23 (source_p))
#endif /* !ENABLED (JERRY_ESNEXT) */
#endif /* !JERRY_ESNEXT */
|| *source_p == LIT_CHAR_LF)
{
context_p->token.line = line;
@@ -1238,24 +1238,24 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
}
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (opts & LEXER_STRING_RAW)
{
length = (size_t) ((source_p - string_start_p) + raw_length_adjust);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (length > PARSER_MAXIMUM_STRING_LENGTH)
{
parser_raise_error (context_p, PARSER_ERR_STRING_TOO_LONG);
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
context_p->token.type = ((str_end_character != LIT_CHAR_GRAVE_ACCENT) ? LEXER_LITERAL
: LEXER_TEMPLATE_LITERAL);
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
context_p->token.type = LEXER_LITERAL;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* Fill literal data. */
context_p->token.lit_location.char_p = string_start_p;
@@ -1278,10 +1278,10 @@ lexer_check_numbers (parser_context_t *context_p, /**< context */
const ecma_char_t digit_max, /**< maximum of the number range */
const bool is_legacy) /**< is legacy octal number */
{
#if ENABLED (!JERRY_ESNEXT)
#if !JERRY_ESNEXT
JERRY_UNUSED (context_p);
JERRY_UNUSED (is_legacy);
#endif /* ENABLED (!JERRY_ESNEXT) */
#endif /* !JERRY_ESNEXT */
while (true)
{
while (*source_p < source_end_p
@@ -1290,7 +1290,7 @@ lexer_check_numbers (parser_context_t *context_p, /**< context */
{
*source_p += 1;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (*source_p != source_end_p && *source_p[0] == LIT_CHAR_UNDERSCORE)
{
*source_p += 1;
@@ -1304,7 +1304,7 @@ lexer_check_numbers (parser_context_t *context_p, /**< context */
}
continue;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
break;
}
@@ -1319,9 +1319,9 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
const uint8_t *source_p = context_p->source_p;
const uint8_t *source_end_p = context_p->source_end_p;
bool can_be_float = false;
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
bool can_be_bigint = true;
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
size_t length;
context_p->token.type = LEXER_LITERAL;
@@ -1333,12 +1333,12 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
if (source_p[0] == LIT_CHAR_0
&& source_p + 1 < source_end_p)
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (source_p[1] == LIT_CHAR_UNDERSCORE)
{
parser_raise_error (context_p, PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (LEXER_TO_ASCII_LOWERCASE (source_p[1]) == LIT_CHAR_LOWERCASE_X)
{
context_p->token.extra_value = LEXER_NUMBER_HEXADECIMAL;
@@ -1353,7 +1353,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
do
{
source_p++;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (source_p < source_end_p && source_p[0] == LIT_CHAR_UNDERSCORE)
{
source_p++;
@@ -1362,12 +1362,12 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
parser_raise_error (context_p, PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER);
}
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
}
while (source_p < source_end_p
&& lit_char_is_hex_digit (source_p[0]));
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
else if (LEXER_TO_ASCII_LOWERCASE (source_p[1]) == LIT_CHAR_LOWERCASE_O)
{
context_p->token.extra_value = LEXER_NUMBER_OCTAL;
@@ -1381,14 +1381,14 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
lexer_check_numbers (context_p, &source_p, source_end_p, LIT_CHAR_7, false);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
else if (source_p[1] >= LIT_CHAR_0
&& source_p[1] <= LIT_CHAR_9)
{
context_p->token.extra_value = LEXER_NUMBER_OCTAL;
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
can_be_bigint = false;
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
if (context_p->status_flags & PARSER_IS_STRICT)
{
@@ -1401,15 +1401,15 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
&& source_p[0] >= LIT_CHAR_8
&& source_p[0] <= LIT_CHAR_9)
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
lexer_check_numbers (context_p, &source_p, source_end_p, LIT_CHAR_9, true);
context_p->token.extra_value = LEXER_NUMBER_DECIMAL;
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
parser_raise_error (context_p, PARSER_ERR_INVALID_NUMBER);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
}
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
else if (LEXER_TO_ASCII_LOWERCASE (source_p[1]) == LIT_CHAR_LOWERCASE_B)
{
context_p->token.extra_value = LEXER_NUMBER_BINARY;
@@ -1438,7 +1438,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
while (source_p < source_end_p
&& lit_char_is_binary_digit (source_p[0]));
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
else
{
can_be_float = true;
@@ -1457,16 +1457,16 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
&& source_p[0] == LIT_CHAR_DOT)
{
source_p++;
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
can_be_bigint = false;
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (source_p < source_end_p && source_p[0] == LIT_CHAR_UNDERSCORE)
{
parser_raise_error (context_p, PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
lexer_check_numbers (context_p, &source_p, source_end_p, LIT_CHAR_9, false);
}
@@ -1474,9 +1474,9 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
&& LEXER_TO_ASCII_LOWERCASE (source_p[0]) == LIT_CHAR_LOWERCASE_E)
{
source_p++;
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
can_be_bigint = false;
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
if (source_p < source_end_p
&& (source_p[0] == LIT_CHAR_PLUS || source_p[0] == LIT_CHAR_MINUS))
@@ -1495,7 +1495,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
}
}
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
if (source_p < source_end_p && source_p[0] == LIT_CHAR_LOWERCASE_N)
{
if (!can_be_bigint)
@@ -1505,7 +1505,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
context_p->token.extra_value = LEXER_NUMBER_BIGINT;
source_p++;
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
length = (size_t) (source_p - context_p->source_p);
if (length > PARSER_MAXIMUM_STRING_LENGTH)
@@ -1647,7 +1647,7 @@ lexer_next_token (parser_context_t *context_p) /**< context */
return;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (length >= 3
&& context_p->source_p[1] == LIT_CHAR_DOT
&& context_p->source_p[2] == LIT_CHAR_DOT)
@@ -1656,7 +1656,7 @@ lexer_next_token (parser_context_t *context_p) /**< context */
length = 3;
break;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
context_p->token.type = LEXER_DOT;
length = 1;
@@ -1760,14 +1760,14 @@ lexer_next_token (parser_context_t *context_p) /**< context */
break;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (context_p->source_p[1] == (uint8_t) LIT_CHAR_GREATER_THAN)
{
context_p->token.type = LEXER_ARROW;
length = 2;
break;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
}
context_p->token.type = LEXER_ASSIGN;
@@ -1812,7 +1812,7 @@ lexer_next_token (parser_context_t *context_p) /**< context */
break;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (context_p->source_p[1] == (uint8_t) LIT_CHAR_ASTERISK)
{
if (length >= 3 && context_p->source_p[2] == (uint8_t) LIT_CHAR_EQUALS)
@@ -1826,7 +1826,7 @@ lexer_next_token (parser_context_t *context_p) /**< context */
length = 2;
break;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
}
context_p->token.type = LEXER_MULTIPLY;
@@ -1850,7 +1850,7 @@ lexer_next_token (parser_context_t *context_p) /**< context */
LEXER_TYPE_A_TOKEN (LIT_CHAR_TILDE, LEXER_BIT_NOT);
case (uint8_t) (LIT_CHAR_QUESTION):
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (length >= 2)
{
if (context_p->source_p[1] == (uint8_t) LIT_CHAR_QUESTION)
@@ -1860,7 +1860,7 @@ lexer_next_token (parser_context_t *context_p) /**< context */
break;
}
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
context_p->token.type = LEXER_QUESTION_MARK;
length = 1;
break;
@@ -1870,9 +1870,9 @@ lexer_next_token (parser_context_t *context_p) /**< context */
case LIT_CHAR_SINGLE_QUOTE:
case LIT_CHAR_DOUBLE_QUOTE:
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
case LIT_CHAR_GRAVE_ACCENT:
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
{
lexer_parse_string (context_p, LEXER_STRING_NO_OPTS);
return;
@@ -1979,9 +1979,9 @@ lexer_check_post_primary_exp (parser_context_t *context_p) /**< context */
case LIT_CHAR_DOT:
case LIT_CHAR_LEFT_PAREN:
case LIT_CHAR_LEFT_SQUARE:
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
case LIT_CHAR_GRAVE_ACCENT:
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
{
return true;
}
@@ -1992,19 +1992,19 @@ lexer_check_post_primary_exp (parser_context_t *context_p) /**< context */
&& context_p->source_p + 1 < context_p->source_end_p
&& context_p->source_p[1] == context_p->source_p[0]);
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
case LIT_CHAR_ASTERISK:
{
return (context_p->source_p + 1 < context_p->source_end_p
&& context_p->source_p[1] == (uint8_t) LIT_CHAR_ASTERISK);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
}
return false;
} /* lexer_check_post_primary_exp */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Checks whether the next token is a type used for detecting arrow functions.
@@ -2189,7 +2189,7 @@ lexer_update_await_yield (parser_context_t *context_p, /**< context */
}
} /* lexer_update_await_yield */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Convert an ident with escapes to a utf8 string.
@@ -2213,7 +2213,7 @@ lexer_convert_ident_to_cesu8 (uint8_t *destination_p, /**< destination string */
continue;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (*source_p >= LIT_UTF8_4_BYTE_MARKER)
{
lit_four_byte_utf8_char_to_cesu8 (destination_p, source_p);
@@ -2222,7 +2222,7 @@ lexer_convert_ident_to_cesu8 (uint8_t *destination_p, /**< destination string */
source_p += 4;
continue;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
*destination_p++ = *source_p++;
}
@@ -2268,17 +2268,17 @@ lexer_convert_literal_to_chars (parser_context_t *context_p, /**< context */
uint8_t str_end_character = source_p[-1];
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (str_end_character == LIT_CHAR_RIGHT_BRACE)
{
str_end_character = LIT_CHAR_GRAVE_ACCENT;
}
bool is_raw = (opts & LEXER_STRING_RAW) != 0;
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
JERRY_UNUSED (opts);
bool is_raw = false;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
while (true)
{
@@ -2410,7 +2410,7 @@ lexer_convert_literal_to_chars (parser_context_t *context_p, /**< context */
continue;
}
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
else if (str_end_character == LIT_CHAR_GRAVE_ACCENT)
{
if (source_p[0] == LIT_CHAR_DOLLAR_SIGN
@@ -2442,7 +2442,7 @@ lexer_convert_literal_to_chars (parser_context_t *context_p, /**< context */
}
}
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (*source_p >= LIT_UTF8_4_BYTE_MARKER)
{
@@ -2623,23 +2623,24 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
parser_list_iterator_t literal_iterator;
lexer_literal_t *literal_p;
ecma_value_t lit_value;
ecma_number_t num;
uint32_t literal_index = 0;
prop_length_t length = context_p->token.lit_location.length;
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
if (JERRY_LIKELY (context_p->token.extra_value != LEXER_NUMBER_BIGINT))
{
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
ecma_number_t num;
if (context_p->token.extra_value < LEXER_NUMBER_OCTAL)
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
num = ecma_utf8_string_to_number (context_p->token.lit_location.char_p,
length,
ECMA_CONVERSION_ALLOW_UNDERSCORE);
#else
num = ecma_utf8_string_to_number (context_p->token.lit_location.char_p, length, 0);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
}
else
{
@@ -2649,7 +2650,7 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
JERRY_ASSERT (src_p[0] == LIT_CHAR_0);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (context_p->token.extra_value == LEXER_NUMBER_BINARY)
{
src_p++;
@@ -2659,7 +2660,7 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
{
src_p++;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
num = 0;
do
@@ -2692,7 +2693,7 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
}
lit_value = ecma_find_or_create_literal_number (num);
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
}
else
{
@@ -2719,7 +2720,7 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
lit_value = ecma_find_or_create_literal_bigint (lit_value);
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
parser_list_iterator_init (&context_p->literal_pool, &literal_iterator);
@@ -2860,7 +2861,7 @@ lexer_construct_function_object (parser_context_t *context_p, /**< context */
parser_flush_cbc (context_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (JERRY_LIKELY (!(extra_status_flags & PARSER_IS_ARROW_FUNCTION)))
{
compiled_code_p = parser_parse_function (context_p, extra_status_flags);
@@ -2869,9 +2870,9 @@ lexer_construct_function_object (parser_context_t *context_p, /**< context */
{
compiled_code_p = parser_parse_arrow_function (context_p, extra_status_flags);
}
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
compiled_code_p = parser_parse_function (context_p, extra_status_flags);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
literal_p->u.bytecode_p = compiled_code_p;
literal_p->type = LEXER_FUNCTION_LITERAL;
@@ -2890,7 +2891,7 @@ void
lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
bool parse_only) /**< parse only */
{
#if ENABLED (JERRY_BUILTIN_REGEXP)
#if JERRY_BUILTIN_REGEXP
const uint8_t *source_p = context_p->source_p;
const uint8_t *regex_start_p = context_p->source_p;
const uint8_t *regex_end_p = regex_start_p;
@@ -3003,12 +3004,12 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
{
flag = RE_FLAG_STICKY;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
else if (source_p[0] == LIT_CHAR_LOWERCASE_S)
{
flag = RE_FLAG_DOTALL;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (flag == 0)
{
@@ -3084,10 +3085,10 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
context_p->lit_object.literal_p = literal_p;
context_p->lit_object.index = context_p->literal_count++;
#else /* !ENABLED (JERRY_BUILTIN_REGEXP) */
#else /* !JERRY_BUILTIN_REGEXP */
JERRY_UNUSED (parse_only);
parser_raise_error (context_p, PARSER_ERR_UNSUPPORTED_REGEXP);
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
#endif /* JERRY_BUILTIN_REGEXP */
} /* lexer_construct_regexp_object */
/**
@@ -3133,7 +3134,7 @@ lexer_expect_identifier (parser_context_t *context_p, /**< context */
return;
}
}
#if ENABLED (JERRY_MODULE_SYSTEM)
#if JERRY_MODULE_SYSTEM
else if (context_p->status_flags & PARSER_MODULE_DEFAULT_CLASS_OR_FUNC)
{
/* When parsing default exports for modules, it is not required by functions or classes to have identifiers.
@@ -3144,9 +3145,9 @@ lexer_expect_identifier (parser_context_t *context_p, /**< context */
context_p->status_flags &= (uint32_t) ~(PARSER_MODULE_DEFAULT_CLASS_OR_FUNC);
return;
}
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
#endif /* JERRY_MODULE_SYSTEM */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (context_p->token.type == LEXER_KEYW_YIELD)
{
parser_raise_error (context_p, PARSER_ERR_YIELD_NOT_ALLOWED);
@@ -3155,7 +3156,7 @@ lexer_expect_identifier (parser_context_t *context_p, /**< context */
{
parser_raise_error (context_p, PARSER_ERR_AWAIT_NOT_ALLOWED);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);
} /* lexer_expect_identifier */
@@ -3189,13 +3190,13 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);
if (context_p->source_p < context_p->source_end_p
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
&& context_p->source_p[0] != LIT_CHAR_COMMA
&& context_p->source_p[0] != LIT_CHAR_RIGHT_BRACE
&& context_p->source_p[0] != LIT_CHAR_LEFT_PAREN
&& context_p->source_p[0] != LIT_CHAR_SEMICOLON
&& context_p->source_p[0] != LIT_CHAR_EQUALS
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
&& context_p->source_p[0] != LIT_CHAR_COLON)
{
if (lexer_compare_literal_to_string (context_p, "get", 3))
@@ -3210,7 +3211,7 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
return;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (lexer_compare_literal_to_string (context_p, "async", 5))
{
context_p->token.type = LEXER_KEYW_ASYNC;
@@ -3225,7 +3226,7 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
}
return;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
}
}
@@ -3242,7 +3243,7 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
create_literal_object = true;
break;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
case LIT_CHAR_LEFT_SQUARE:
{
lexer_consume_next_character (context_p);
@@ -3283,7 +3284,7 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
context_p->source_p += 3;
return;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
case LIT_CHAR_RIGHT_BRACE:
{
if (ident_opts & LEXER_OBJ_IDENT_ONLY_IDENTIFIERS)
@@ -3323,12 +3324,12 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
if (create_literal_object)
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (ident_opts & LEXER_OBJ_IDENT_CLASS_IDENTIFIER)
{
return;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
lexer_construct_literal_object (context_p,
&context_p->token.lit_location,
@@ -3377,12 +3378,12 @@ lexer_check_property_modifier (parser_context_t *context_p) /**< context */
context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);
if (context_p->source_p >= context_p->source_end_p
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
|| context_p->source_p[0] == LIT_CHAR_COMMA
|| context_p->source_p[0] == LIT_CHAR_RIGHT_BRACE
|| context_p->source_p[0] == LIT_CHAR_LEFT_PAREN
|| context_p->source_p[0] == LIT_CHAR_EQUALS
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
|| context_p->source_p[0] == LIT_CHAR_COLON)
{
return;
@@ -3400,13 +3401,13 @@ lexer_check_property_modifier (parser_context_t *context_p) /**< context */
return;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (lexer_compare_literal_to_string (context_p, "async", 5))
{
context_p->token.type = LEXER_KEYW_ASYNC;
return;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
} /* lexer_check_property_modifier */
/**
@@ -3527,10 +3528,9 @@ lexer_compare_identifiers (parser_context_t *context_p, /**< context */
return lexer_compare_identifier_to_chars (left_p->char_p, right_p->char_p, length);
}
uint8_t buf_p[64];
if (length <= 64)
{
uint8_t buf_p[64];
lexer_convert_ident_to_cesu8 (buf_p, left_p->char_p, length);
return lexer_compare_identifier_to_chars (right_p->char_p, buf_p, length);
}
@@ -3613,7 +3613,7 @@ lexer_string_is_directive (parser_context_t *context_p) /**< context */
&& context_p->token.type != LEXER_DOT));
} /* lexer_string_is_directive */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Compares the current token to an expected identifier.
@@ -3670,7 +3670,7 @@ lexer_token_is_async (parser_context_t *context_p) /**< context */
&& !context_p->token.lit_location.has_escape);
} /* lexer_token_is_async */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Compares the current identifier or string to an expected string.
@@ -3707,17 +3707,17 @@ lexer_convert_binary_lvalue_token_to_binary (uint8_t token) /**< binary lvalue t
JERRY_ASSERT (LEXER_IS_BINARY_LVALUE_OP_TOKEN (token));
JERRY_ASSERT (token != LEXER_ASSIGN);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (token <= LEXER_ASSIGN_EXPONENTIATION)
{
return (uint8_t) (LEXER_ADD + (token - LEXER_ASSIGN_ADD));
}
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
if (token <= LEXER_ASSIGN_MODULO)
{
return (uint8_t) (LEXER_ADD + (token - LEXER_ASSIGN_ADD));
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (token <= LEXER_ASSIGN_UNS_RIGHT_SHIFT)
{
@@ -3748,4 +3748,4 @@ lexer_convert_binary_lvalue_token_to_binary (uint8_t token) /**< binary lvalue t
* @}
*/
#endif /* ENABLED (JERRY_PARSER) */
#endif /* JERRY_PARSER */
+22 -22
View File
@@ -41,10 +41,10 @@ typedef enum
LEXER_LIT_TRUE, /**< true (not a keyword!) */
LEXER_LIT_FALSE, /**< false (not a keyword!) */
LEXER_LIT_NULL, /**< null (not a keyword!) */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
LEXER_TEMPLATE_LITERAL, /**< multi segment template literal */
LEXER_THREE_DOTS, /**< ... (rest or spread operator) */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* Unary operators
* IMPORTANT: update CBC_UNARY_OP_TOKEN_TO_OPCODE and
@@ -60,9 +60,9 @@ typedef enum
LEXER_BIT_NOT, /**< "~" */
LEXER_KEYW_VOID, /**< void */
LEXER_KEYW_TYPEOF, /**< typeof */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
LEXER_KEYW_AWAIT, /**< await */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
LEXER_KEYW_DELETE, /**< delete */
LEXER_INCREASE, /**< "++" */
LEXER_DECREASE, /**< "--" */
@@ -75,17 +75,17 @@ typedef enum
* Index of first binary operation opcode.
*/
#define LEXER_FIRST_BINARY_OP LEXER_ASSIGN
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Index of last binary operation opcode.
*/
#define LEXER_LAST_BINARY_OP LEXER_EXPONENTIATION
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
/**
* Index of last binary operation opcode.
*/
#define LEXER_LAST_BINARY_OP LEXER_MODULO
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Checks whether the token is a binary operation token.
@@ -109,9 +109,9 @@ typedef enum
LEXER_ASSIGN_MULTIPLY, /**< "*=" (prec: 3) */
LEXER_ASSIGN_DIVIDE, /**< "/=" (prec: 3) */
LEXER_ASSIGN_MODULO, /**< "%=" (prec: 3) */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
LEXER_ASSIGN_EXPONENTIATION, /**< "**=" (prec: 3) */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
LEXER_ASSIGN_LEFT_SHIFT, /**< "<<=" (prec: 3) */
LEXER_ASSIGN_RIGHT_SHIFT, /**< ">>=" (prec: 3) */
LEXER_ASSIGN_UNS_RIGHT_SHIFT, /**< ">>>=" (prec: 3) */
@@ -119,9 +119,9 @@ typedef enum
LEXER_ASSIGN_BIT_OR, /**< "|=" (prec: 3) */
LEXER_ASSIGN_BIT_XOR, /**< "^=" (prec: 3) */
LEXER_QUESTION_MARK, /**< "?" (prec: 4) */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
LEXER_NULLISH_COALESCING, /**< "??" (prec: 5) */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
LEXER_LOGICAL_OR, /**< "||" (prec: 6) */
LEXER_LOGICAL_AND, /**< "&&" (prec: 7) */
LEXER_BIT_OR, /**< "|" (prec: 8) */
@@ -145,9 +145,9 @@ typedef enum
LEXER_MULTIPLY, /**< "*" (prec: 15) */
LEXER_DIVIDE, /**< "/" (prec: 15) */
LEXER_MODULO, /**< "%" (prec: 15) */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
LEXER_EXPONENTIATION, /**< "**" (prec: 16) */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
LEXER_LEFT_BRACE, /**< "{" */
LEXER_LEFT_PAREN, /**< "(" */
@@ -159,9 +159,9 @@ typedef enum
LEXER_SEMICOLON, /**< ";" */
LEXER_COLON, /**< ":" */
LEXER_COMMA, /**< "," */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
LEXER_ARROW, /**< "=>" */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
LEXER_KEYW_BREAK, /**< break */
LEXER_KEYW_DO, /**< do */
@@ -197,20 +197,20 @@ typedef enum
LEXER_PROPERTY_GETTER, /**< property getter function */
LEXER_PROPERTY_SETTER, /**< property setter function */
LEXER_COMMA_SEP_LIST, /**< comma separated bracketed expression list */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
LEXER_ASSIGN_GROUP_EXPR, /**< indetifier for the assignment is located in a group expression */
LEXER_ASSIGN_CONST, /**< a const binding is reassigned */
LEXER_INVALID_PATTERN, /**< special value for invalid destructuring pattern */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/* Keywords which are not keyword tokens. */
#define LEXER_FIRST_NON_RESERVED_KEYWORD LEXER_KEYW_ASYNC
LEXER_KEYW_ASYNC, /**< async */
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
/* Keywords which are not keyword tokens. */
#define LEXER_FIRST_NON_RESERVED_KEYWORD LEXER_KEYW_EVAL
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* Keywords which cannot be assigned in strict mode. */
#define LEXER_FIRST_NON_STRICT_ARGUMENTS LEXER_KEYW_EVAL
@@ -300,9 +300,9 @@ typedef enum
LEXER_NUMBER_HEXADECIMAL, /**< hexadecimal number */
LEXER_NUMBER_OCTAL, /**< octal number */
LEXER_NUMBER_BINARY, /**< binary number */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
LEXER_NUMBER_BIGINT, /**< bigint number */
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
} lexer_number_type_t;
/**
File diff suppressed because it is too large Load Diff
+55 -55
View File
@@ -57,7 +57,7 @@ typedef enum
* after the last byte code */
PARSER_DEBUGGER_BREAKPOINT_APPENDED = (1u << 11), /**< pending (unsent) breakpoint
* info is available */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
PARSER_LEXICAL_BLOCK_NEEDED = (1u << 12), /**< global script: needs a lexical environment for let and const
* function: needs a lexical environment for arguments */
PARSER_IS_ARROW_FUNCTION = (1u << 13), /**< an arrow function is parsed */
@@ -76,11 +76,11 @@ typedef enum
PARSER_INSIDE_CLASS_FIELD = (1u << 23), /**< a class field is being parsed */
PARSER_ALLOW_NEW_TARGET = (1u << 24), /**< allow new.target parsing in the current context */
PARSER_IS_METHOD = (1u << 25), /**< method is parsed */
#endif /* ENABLED (JERRY_ESNEXT) */
#if ENABLED (JERRY_MODULE_SYSTEM)
#endif /* JERRY_ESNEXT */
#if JERRY_MODULE_SYSTEM
PARSER_MODULE_DEFAULT_CLASS_OR_FUNC = (1u << 26), /**< parsing a function or class default export */
PARSER_MODULE_STORE_IDENT = (1u << 27), /**< store identifier of the current export statement */
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
#endif /* JERRY_MODULE_SYSTEM */
PARSER_HAS_LATE_LIT_INIT = (1u << 30), /**< there are identifier or string literals which construction
* is postponed after the local parser data is freed */
#ifndef JERRY_NDEBUG
@@ -125,13 +125,13 @@ typedef enum
typedef enum
{
PARSER_CHECK_BLOCK_CONTEXT, /**< check block context */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
PARSER_CHECK_GLOBAL_CONTEXT, /**< check global context */
PARSER_CHECK_FUNCTION_CONTEXT, /**< check function context */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
} parser_check_context_type_t;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Class field bits.
@@ -144,7 +144,7 @@ typedef enum
PARSER_CLASS_FIELD_STATIC = (1u << 3), /**< static class field */
} parser_class_field_type_t;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Mask for strict mode code
@@ -168,7 +168,7 @@ typedef enum
#define PARSER_MAX_BRANCH_LENGTH 3
#endif /* PARSER_MAXIMUM_CODE_SIZE <= UINT16_MAX */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Offset of PARSER_ALLOW_SUPER
*/
@@ -223,7 +223,7 @@ typedef enum
#define PARSER_IS_NORMAL_ASYNC_FUNCTION(status_flags) \
(((status_flags) & (PARSER_IS_GENERATOR_FUNCTION | PARSER_IS_ASYNC_FUNCTION)) == PARSER_IS_ASYNC_FUNCTION)
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
/**
* All flags that affect exotic arguments object creation.
@@ -231,7 +231,7 @@ typedef enum
#define PARSER_ARGUMENTS_RELATED_FLAGS \
(PARSER_ARGUMENTS_NEEDED | PARSER_IS_STRICT)
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* Checks whether unmapped arguments are needed. */
#define PARSER_NEEDS_MAPPED_ARGUMENTS(status_flags) \
@@ -419,7 +419,7 @@ typedef struct
*/
#define PARSER_SCOPE_STACK_FUNC 0xffff
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Mask for decoding the register index of map_to
@@ -442,7 +442,7 @@ typedef struct
*/
#define PARSER_SCOPE_STACK_IS_LOCAL_CREATED (PARSER_SCOPE_STACK_IS_CONST_REG)
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Starting literal index for registers.
@@ -473,7 +473,7 @@ typedef struct
struct scanner_context_t;
typedef struct scanner_context_t scanner_context_t;
#if ENABLED (JERRY_DEBUGGER)
#if JERRY_DEBUGGER
/**
* Extra information for each breakpoint.
*/
@@ -488,7 +488,7 @@ typedef struct
#define PARSER_MAX_BREAKPOINT_INFO_COUNT \
(JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE / sizeof (parser_breakpoint_info_t))
#endif /* ENABLED (JERRY_DEBUGGER) */
#endif /* JERRY_DEBUGGER */
/**
* Those members of a context which needs
@@ -505,9 +505,9 @@ typedef struct parser_saved_context_t
/* Literal types */
uint16_t argument_count; /**< number of function arguments */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
uint16_t argument_length; /**< length property of arguments */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
uint16_t register_count; /**< number of registers */
uint16_t literal_count; /**< number of literals */
@@ -519,10 +519,10 @@ typedef struct parser_saved_context_t
uint16_t scope_stack_size; /**< size of scope stack */
uint16_t scope_stack_top; /**< preserved top of scope stack */
uint16_t scope_stack_reg_top; /**< preserved top register of scope stack */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
uint16_t scope_stack_global_end; /**< end of global declarations of a function */
ecma_value_t tagged_template_literal_cp; /**< compessed pointer to the tagged template literal collection */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
#ifndef JERRY_NDEBUG
uint16_t context_stack_depth; /**< current context stack depth */
@@ -553,10 +553,10 @@ typedef struct
parser_saved_context_t *last_context_p; /**< last saved context */
parser_stack_iterator_t last_statement; /**< last statement position */
#if ENABLED (JERRY_MODULE_SYSTEM)
#if JERRY_MODULE_SYSTEM
ecma_module_node_t *module_current_node_p; /**< import / export node that is being processed */
lexer_literal_t *module_identifier_lit_p; /**< the literal for the identifier of the current element */
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
#endif /* JERRY_MODULE_SYSTEM */
/* Lexer members. */
lexer_token_t token; /**< current token */
@@ -578,9 +578,9 @@ typedef struct
/* Literal types */
uint16_t argument_count; /**< number of function arguments */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
uint16_t argument_length; /**< length property of arguments */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
uint16_t register_count; /**< number of registers */
uint16_t literal_count; /**< number of literals */
@@ -594,10 +594,10 @@ typedef struct
uint16_t scope_stack_size; /**< size of scope stack */
uint16_t scope_stack_top; /**< current top of scope stack */
uint16_t scope_stack_reg_top; /**< current top register of scope stack */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
uint16_t scope_stack_global_end; /**< end of global declarations of a function */
ecma_value_t tagged_template_literal_cp; /**< compessed pointer to the tagged template literal collection */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
uint8_t stack_top_uint8; /**< top byte stored on the stack */
#ifndef JERRY_NDEBUG
@@ -605,24 +605,24 @@ typedef struct
uint16_t context_stack_depth; /**< current context stack depth */
#endif /* !JERRY_NDEBUG */
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
#if JERRY_PARSER_DUMP_BYTE_CODE
int is_show_opcodes; /**< show opcodes */
uint32_t total_byte_code_size; /**< total byte code size */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
#if ENABLED (JERRY_DEBUGGER)
#if JERRY_DEBUGGER
parser_breakpoint_info_t breakpoint_info[PARSER_MAX_BREAKPOINT_INFO_COUNT]; /**< breakpoint info list */
uint16_t breakpoint_info_count; /**< current breakpoint index */
parser_line_counter_t last_breakpoint_line; /**< last line where breakpoint has been inserted */
#endif /* ENABLED (JERRY_DEBUGGER) */
#endif /* JERRY_DEBUGGER */
#if ENABLED (JERRY_RESOURCE_NAME)
#if JERRY_RESOURCE_NAME
ecma_value_t resource_name; /**< resource name */
#endif /* ENABLED (JERRY_RESOURCE_NAME) */
#endif /* JERRY_RESOURCE_NAME */
#if ENABLED (JERRY_LINE_INFO)
#if JERRY_LINE_INFO
parser_line_counter_t last_line_info_line; /**< last line where line info has been inserted */
#endif /* ENABLED (JERRY_LINE_INFO) */
#endif /* JERRY_LINE_INFO */
} parser_context_t;
/**
@@ -728,9 +728,9 @@ void parser_set_continues_to_current_position (parser_context_t *context_p, pars
#define parser_emit_cbc_ext_backward_branch(context_p, opcode, offset) \
parser_emit_cbc_backward_branch ((context_p), PARSER_TO_EXT_OPCODE (opcode), (offset))
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
void parser_reverse_class_fields (parser_context_t *context_p, size_t fields_size);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* @}
@@ -747,7 +747,7 @@ bool lexer_check_next_characters (parser_context_t *context_p, lit_utf8_byte_t c
lit_utf8_byte_t character2);
uint8_t lexer_consume_next_character (parser_context_t *context_p);
bool lexer_check_post_primary_exp (parser_context_t *context_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
void lexer_skip_empty_statements (parser_context_t *context_p);
bool lexer_check_arrow (parser_context_t *context_p);
bool lexer_check_arrow_param (parser_context_t *context_p);
@@ -755,7 +755,7 @@ bool lexer_check_yield_no_arg (parser_context_t *context_p);
bool lexer_consume_generator (parser_context_t *context_p);
bool lexer_consume_assign (parser_context_t *context_p);
void lexer_update_await_yield (parser_context_t *context_p, uint32_t status_flags);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
void lexer_parse_string (parser_context_t *context_p, lexer_string_options_t opts);
void lexer_expect_identifier (parser_context_t *context_p, uint8_t literal_type);
bool lexer_scan_identifier (parser_context_t *context_p);
@@ -778,12 +778,12 @@ bool lexer_compare_identifiers (parser_context_t *context_p, const lexer_lit_loc
bool lexer_current_is_literal (parser_context_t *context_p, const lexer_lit_location_t *right_ident_p);
bool lexer_string_is_use_strict (parser_context_t *context_p);
bool lexer_string_is_directive (parser_context_t *context_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
bool lexer_token_is_identifier (parser_context_t *context_p, const char *identifier_p,
size_t identifier_length);
bool lexer_token_is_let (parser_context_t *context_p);
bool lexer_token_is_async (parser_context_t *context_p);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
bool lexer_compare_literal_to_string (parser_context_t *context_p, const char *string_p, size_t string_length);
uint8_t lexer_convert_binary_lvalue_token_to_binary (uint8_t token);
@@ -799,11 +799,11 @@ uint8_t lexer_convert_binary_lvalue_token_to_binary (uint8_t token);
void parser_parse_block_expression (parser_context_t *context_p, int options);
void parser_parse_expression_statement (parser_context_t *context_p, int options);
void parser_parse_expression (parser_context_t *context_p, int options);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
void parser_parse_class (parser_context_t *context_p, bool is_statement);
void parser_parse_initializer (parser_context_t *context_p, parser_pattern_flags_t flags);
void parser_parse_initializer_by_next_char (parser_context_t *context_p, parser_pattern_flags_t flags);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* @}
@@ -822,21 +822,21 @@ void scanner_reverse_info_list (parser_context_t *context_p);
void scanner_cleanup (parser_context_t *context_p);
bool scanner_is_context_needed (parser_context_t *context_p, parser_check_context_type_t check_type);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
bool scanner_try_scan_new_target (parser_context_t *context_p);
void scanner_check_variables (parser_context_t *context_p);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
void scanner_create_variables (parser_context_t *context_p, uint32_t option_flags);
void scanner_get_location (scanner_location_t *location_p, parser_context_t *context_p);
void scanner_set_location (parser_context_t *context_p, scanner_location_t *location_p);
uint16_t scanner_decode_map_to (parser_scope_stack_t *stack_item_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
uint16_t scanner_save_literal (parser_context_t *context_p, uint16_t ident_index);
bool scanner_literal_is_const_reg (parser_context_t *context_p, uint16_t literal_index);
bool scanner_literal_is_created (parser_context_t *context_p, uint16_t literal_index);
bool scanner_literal_exists (parser_context_t *context_p, uint16_t literal_index);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
void scanner_scan_all (parser_context_t *context_p, const uint8_t *arg_list_p, const uint8_t *arg_list_end_p,
const uint8_t *source_p, const uint8_t *source_end_p);
@@ -851,7 +851,7 @@ void scanner_scan_all (parser_context_t *context_p, const uint8_t *arg_list_p, c
void parser_parse_statements (parser_context_t *context_p);
void parser_free_jumps (parser_stack_iterator_t iterator);
#if ENABLED (JERRY_MODULE_SYSTEM)
#if JERRY_MODULE_SYSTEM
/**
* @}
*
@@ -877,7 +877,7 @@ void parser_module_add_names_to_node (parser_context_t *context_p,
ecma_string_t *imex_name_p,
ecma_string_t *local_name_p);
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
#endif /* JERRY_MODULE_SYSTEM */
/**
* @}
@@ -887,7 +887,7 @@ void parser_module_add_names_to_node (parser_context_t *context_p,
*/
ecma_compiled_code_t *parser_parse_function (parser_context_t *context_p, uint32_t status_flags);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_compiled_code_t *parser_parse_arrow_function (parser_context_t *context_p, uint32_t status_flags);
ecma_compiled_code_t *parser_parse_class_fields (parser_context_t *context_p);
void parser_set_function_name (parser_context_t *context_p, uint16_t function_literal_index, uint16_t name_index,
@@ -895,7 +895,7 @@ void parser_set_function_name (parser_context_t *context_p, uint16_t function_li
void parser_compiled_code_set_function_name (parser_context_t *context_p, ecma_compiled_code_t *bytecode_p,
uint16_t name_index, uint32_t status_flags);
uint16_t parser_check_anonymous_function_declaration (parser_context_t *context_p);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* Error management. */
@@ -903,21 +903,21 @@ void parser_raise_error (parser_context_t *context_p, parser_error_t error);
/* Debug functions. */
#if ENABLED (JERRY_DEBUGGER)
#if JERRY_DEBUGGER
void parser_append_breakpoint_info (parser_context_t *context_p, jerry_debugger_header_type_t type, uint32_t value);
#endif /* ENABLED (JERRY_DEBUGGER) */
#endif /* JERRY_DEBUGGER */
#if ENABLED (JERRY_LINE_INFO)
#if JERRY_LINE_INFO
void parser_emit_line_info (parser_context_t *context_p, uint32_t line, bool flush_cbc);
#endif /* ENABLED (JERRY_LINE_INFO) */
#endif /* JERRY_LINE_INFO */
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
#if JERRY_PARSER_DUMP_BYTE_CODE
void util_print_cbc (ecma_compiled_code_t *compiled_code_p);
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
/**
* @}
+3 -3
View File
@@ -38,11 +38,11 @@
* Maximum string limit.
* Limit: 2147483647 / 65535.
*/
#if ENABLED (JERRY_CPOINTER_32_BIT)
#if JERRY_CPOINTER_32_BIT
#define PARSER_MAXIMUM_STRING_LIMIT 2147483647
#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */
#else /* !JERRY_CPOINTER_32_BIT */
#define PARSER_MAXIMUM_STRING_LIMIT 65535
#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */
#endif /* JERRY_CPOINTER_32_BIT */
/**
* Maximum string length.
+2 -2
View File
@@ -15,7 +15,7 @@
#include "js-parser-internal.h"
#if ENABLED (JERRY_PARSER)
#if JERRY_PARSER
/** \addtogroup mem Memory allocation
* @{
@@ -753,4 +753,4 @@ parser_stack_iterator_write (parser_stack_iterator_t *iterator, /**< iterator */
* @}
*/
#endif /* ENABLED (JERRY_PARSER) */
#endif /* JERRY_PARSER */
+2 -2
View File
@@ -15,7 +15,7 @@
#include "js-parser-internal.h"
#if ENABLED (JERRY_MODULE_SYSTEM)
#if JERRY_MODULE_SYSTEM
#include "jcontext.h"
#include "jerryscript-port.h"
@@ -574,4 +574,4 @@ module_found:
lexer_next_token (context_p);
} /* parser_module_handle_module_specifier */
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
#endif /* JERRY_MODULE_SYSTEM */
File diff suppressed because it is too large Load Diff
@@ -31,7 +31,7 @@
* @{
*/
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Append the cooked and raw string to the corresponding array
*/
@@ -150,7 +150,7 @@ parser_tagged_template_literal_finalize (ecma_object_t *template_obj_p, /**< tem
parser_tagged_template_literal_freeze_array (template_obj_p);
parser_tagged_template_literal_freeze_array (raw_strings_p);
} /* parser_tagged_template_literal_finalize */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* @}
@@ -30,7 +30,7 @@
#include "ecma-globals.h"
#include "js-parser-internal.h"
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
ecma_object_t *
parser_new_tagged_template_literal (ecma_object_t **raw_strings_p);
@@ -40,7 +40,7 @@ parser_tagged_template_literal_append_strings (parser_context_t *context_p, ecma
void
parser_tagged_template_literal_finalize (ecma_object_t *template_obj_p, ecma_object_t *raw_strings_p);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
#endif /* ECMA_TAGGED_TEMPLATE_LITERAL_H */
+38 -38
View File
@@ -15,11 +15,11 @@
#include "js-parser-internal.h"
#if ENABLED (JERRY_PARSER)
#if JERRY_PARSER
#if ENABLED (JERRY_LINE_INFO)
#if JERRY_LINE_INFO
#include "jcontext.h"
#endif /* ENABLED (JERRY_LINE_INFO) */
#endif /* JERRY_LINE_INFO */
/** \addtogroup parser Parser
* @{
@@ -85,7 +85,7 @@ parser_emit_two_bytes (parser_context_t *context_p, /**< context */
} \
(context_p)->byte_code.last_p->bytes[(context_p)->byte_code.last_position++] = (uint8_t) (byte)
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
#if JERRY_PARSER_DUMP_BYTE_CODE
/**
* Print literal corresponding to the current index
@@ -137,7 +137,7 @@ parser_print_literal (parser_context_t *context_p, /**< context */
util_print_literal (literal_p);
} /* parser_print_literal */
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
/**
* Append the current byte code to the stream
@@ -225,7 +225,7 @@ parser_flush_cbc (parser_context_t *context_p) /**< context */
context_p->byte_code_size++;
}
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
#if JERRY_PARSER_DUMP_BYTE_CODE
if (context_p->is_show_opcodes)
{
JERRY_DEBUG_MSG (" [%3d] %s",
@@ -268,7 +268,7 @@ parser_flush_cbc (parser_context_t *context_p) /**< context */
JERRY_DEBUG_MSG ("\n");
}
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
if (context_p->stack_depth > context_p->stack_limit)
{
@@ -453,7 +453,7 @@ parser_emit_cbc_push_number (parser_context_t *context_p, /**< context */
context_p->last_cbc.value = (uint16_t) (value - 1);
} /* parser_emit_cbc_push_number */
#if ENABLED (JERRY_LINE_INFO)
#if JERRY_LINE_INFO
/**
* Append a line info data
@@ -468,12 +468,12 @@ parser_emit_line_info (parser_context_t *context_p, /**< context */
parser_flush_cbc (context_p);
}
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
#if JERRY_PARSER_DUMP_BYTE_CODE
if (context_p->is_show_opcodes)
{
JERRY_DEBUG_MSG (" [%3d] CBC_EXT_LINE %d\n", (int) context_p->stack_depth, line);
}
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
parser_emit_two_bytes (context_p, CBC_EXT_OPCODE, CBC_EXT_LINE);
context_p->byte_code_size += 2;
@@ -505,7 +505,7 @@ parser_emit_line_info (parser_context_t *context_p, /**< context */
while (shift > 0);
} /* parser_emit_line_info */
#endif /* ENABLED (JERRY_LINE_INFO) */
#endif /* JERRY_LINE_INFO */
/**
* Append a byte code with a branch argument
@@ -550,14 +550,14 @@ parser_emit_cbc_forward_branch (parser_context_t *context_p, /**< context */
|| (CBC_STACK_ADJUST_BASE - (flags >> CBC_STACK_ADJUST_SHIFT)) <= context_p->stack_depth);
PARSER_PLUS_EQUAL_U16 (context_p->stack_depth, CBC_STACK_ADJUST_VALUE (flags));
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
#if JERRY_PARSER_DUMP_BYTE_CODE
if (context_p->is_show_opcodes)
{
JERRY_DEBUG_MSG (" [%3d] %s\n",
(int) context_p->stack_depth,
extra_byte_code_increase == 0 ? cbc_names[opcode] : cbc_ext_names[opcode]);
}
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
PARSER_PLUS_EQUAL_U16 (opcode, PARSER_MAX_BRANCH_LENGTH - 1);
@@ -617,9 +617,9 @@ parser_emit_cbc_backward_branch (parser_context_t *context_p, /**< context */
uint32_t offset) /**< destination offset */
{
uint8_t flags;
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
#if JERRY_PARSER_DUMP_BYTE_CODE
const char *name;
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
if (context_p->last_cbc_opcode != PARSER_CBC_UNAVAILABLE)
{
@@ -634,9 +634,9 @@ parser_emit_cbc_backward_branch (parser_context_t *context_p, /**< context */
JERRY_ASSERT (opcode < CBC_END);
flags = cbc_flags[opcode];
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
#if JERRY_PARSER_DUMP_BYTE_CODE
name = cbc_names[opcode];
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
}
else
{
@@ -647,9 +647,9 @@ parser_emit_cbc_backward_branch (parser_context_t *context_p, /**< context */
flags = cbc_ext_flags[opcode];
context_p->byte_code_size++;
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
#if JERRY_PARSER_DUMP_BYTE_CODE
name = cbc_ext_names[opcode];
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
}
JERRY_ASSERT (flags & CBC_HAS_BRANCH_ARG);
@@ -662,12 +662,12 @@ parser_emit_cbc_backward_branch (parser_context_t *context_p, /**< context */
|| (CBC_STACK_ADJUST_BASE - (flags >> CBC_STACK_ADJUST_SHIFT)) <= context_p->stack_depth);
PARSER_PLUS_EQUAL_U16 (context_p->stack_depth, CBC_STACK_ADJUST_VALUE (flags));
#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE)
#if JERRY_PARSER_DUMP_BYTE_CODE
if (context_p->is_show_opcodes)
{
JERRY_DEBUG_MSG (" [%3d] %s\n", (int) context_p->stack_depth, name);
}
#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
context_p->byte_code_size += 2;
#if PARSER_MAXIMUM_CODE_SIZE > UINT16_MAX
@@ -790,7 +790,7 @@ parser_set_continues_to_current_position (parser_context_t *context_p, /**< cont
}
} /* parser_set_continues_to_current_position */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Return the size of internal record corresponding to a class field
@@ -908,9 +908,9 @@ parser_reverse_class_fields (parser_context_t *context_p, /**< context */
parser_free (data_p, fields_size);
} /* parser_reverse_class_fields */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
#if ENABLED (JERRY_ERROR_MESSAGES)
#if JERRY_ERROR_MESSAGES
/**
* Returns with the string representation of the error
*/
@@ -951,12 +951,12 @@ parser_error_to_string (parser_error_t error) /**< error code */
{
return "Invalid hexadecimal digit";
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
case PARSER_ERR_INVALID_BIN_DIGIT:
{
return "Invalid binary digit";
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
case PARSER_ERR_INVALID_ESCAPE_SEQUENCE:
{
return "Invalid escape sequence";
@@ -993,12 +993,12 @@ parser_error_to_string (parser_error_t error) /**< error code */
{
return "Identifier cannot start after a number";
}
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
case PARSER_ERR_INVALID_BIGINT:
{
return "Number is not a valid BigInt";
}
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
case PARSER_ERR_INVALID_REGEXP:
{
return "Invalid regular expression";
@@ -1055,12 +1055,12 @@ parser_error_to_string (parser_error_t error) /**< error code */
{
return "Octal escape sequences are not allowed in strict mode";
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
case PARSER_ERR_TEMPLATE_STR_OCTAL_ESCAPE:
{
return "Octal escape sequences are not allowed in template strings";
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
case PARSER_ERR_STRICT_IDENT_NOT_ALLOWED:
{
return "Identifier name is reserved in strict mode";
@@ -1073,7 +1073,7 @@ parser_error_to_string (parser_error_t error) /**< error code */
{
return "Arguments is not allowed to be used here in strict mode";
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
case PARSER_ERR_USE_STRICT_NOT_ALLOWED:
{
return "The 'use strict' directive is not allowed for functions with non-simple arguments";
@@ -1114,7 +1114,7 @@ parser_error_to_string (parser_error_t error) /**< error code */
{
return "Invalid left-hand-side in for-loop";
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
case PARSER_ERR_DELETE_IDENT_NOT_ALLOWED:
{
return "Deleting identifier is not allowed in strict mode";
@@ -1271,7 +1271,7 @@ parser_error_to_string (parser_error_t error) /**< error code */
{
return "Non-strict argument definition";
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
case PARSER_ERR_VARIABLE_REDECLARED:
{
return "Local variable is redeclared";
@@ -1372,8 +1372,8 @@ parser_error_to_string (parser_error_t error) /**< error code */
{
return "new.target expression is not allowed here";
}
#endif /* ENABLED (JERRY_ESNEXT) */
#if ENABLED (JERRY_MODULE_SYSTEM)
#endif /* JERRY_ESNEXT */
#if JERRY_MODULE_SYSTEM
case PARSER_ERR_FILE_NOT_FOUND:
{
return "Requested module not found";
@@ -1422,7 +1422,7 @@ parser_error_to_string (parser_error_t error) /**< error code */
{
return "Export not defined in module";
}
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
#endif /* JERRY_MODULE_SYSTEM */
default:
{
@@ -1431,7 +1431,7 @@ parser_error_to_string (parser_error_t error) /**< error code */
}
}
} /* parser_error_to_string */
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
#endif /* JERRY_ERROR_MESSAGES */
/**
* @}
@@ -1439,4 +1439,4 @@ parser_error_to_string (parser_error_t error) /**< error code */
* @}
*/
#endif /* ENABLED (JERRY_PARSER) */
#endif /* JERRY_PARSER */
File diff suppressed because it is too large Load Diff
+14 -14
View File
@@ -44,9 +44,9 @@ typedef enum
PARSER_ERR_INVALID_CHARACTER, /**< unexpected character */
PARSER_ERR_INVALID_OCTAL_DIGIT, /**< invalid octal digit */
PARSER_ERR_INVALID_HEX_DIGIT, /**< invalid hexadecimal digit */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
PARSER_ERR_INVALID_BIN_DIGIT, /**< invalid binary digit */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
PARSER_ERR_INVALID_ESCAPE_SEQUENCE, /**< invalid escape sequence */
PARSER_ERR_INVALID_UNICODE_ESCAPE_SEQUENCE, /**< invalid unicode escape sequence */
PARSER_ERR_INVALID_IDENTIFIER_START, /**< character cannot be start of an identifier */
@@ -57,9 +57,9 @@ typedef enum
PARSER_ERR_MISSING_EXPONENT, /**< missing exponent */
PARSER_ERR_IDENTIFIER_AFTER_NUMBER, /**< identifier start after number */
PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER, /**< invalid use of underscore in number */
#if ENABLED (JERRY_BUILTIN_BIGINT)
#if JERRY_BUILTIN_BIGINT
PARSER_ERR_INVALID_BIGINT, /**< number is not a valid BigInt */
#endif /* ENABLED (JERRY_BUILTIN_BIGINT) */
#endif /* JERRY_BUILTIN_BIGINT */
PARSER_ERR_INVALID_REGEXP, /**< invalid regular expression */
PARSER_ERR_UNKNOWN_REGEXP_FLAG, /**< unknown regexp flag */
@@ -78,13 +78,13 @@ typedef enum
PARSER_ERR_NEWLINE_NOT_ALLOWED, /**< newline is not allowed */
PARSER_ERR_OCTAL_NUMBER_NOT_ALLOWED, /**< octal numbers are not allowed in strict mode */
PARSER_ERR_OCTAL_ESCAPE_NOT_ALLOWED, /**< octal escape sequences are not allowed in strict mode */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
PARSER_ERR_TEMPLATE_STR_OCTAL_ESCAPE, /**< octal escape sequences are not allowed in template strings */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
PARSER_ERR_STRICT_IDENT_NOT_ALLOWED, /**< identifier name is reserved in strict mode */
PARSER_ERR_EVAL_NOT_ALLOWED, /**< eval is not allowed here in strict mode */
PARSER_ERR_ARGUMENTS_NOT_ALLOWED, /**< arguments is not allowed here in strict mode */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
PARSER_ERR_USE_STRICT_NOT_ALLOWED, /**< use strict directive is not allowed */
PARSER_ERR_YIELD_NOT_ALLOWED, /**< yield expression is not allowed */
PARSER_ERR_AWAIT_NOT_ALLOWED, /**< await expression is not allowed */
@@ -95,7 +95,7 @@ typedef enum
PARSER_ERR_INVALID_LHS_ASSIGNMENT, /**< invalid LeftHandSide in assignment */
PARSER_ERR_INVALID_LHS_POSTFIX_OP, /**< invalid LeftHandSide expression in postfix operation */
PARSER_ERR_INVALID_LHS_FOR_LOOP, /**< invalid LeftHandSide in for-loop */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
PARSER_ERR_DELETE_IDENT_NOT_ALLOWED, /**< identifier delete is not allowed in strict mode */
PARSER_ERR_EVAL_CANNOT_ASSIGNED, /**< eval cannot be assigned in strict mode */
PARSER_ERR_ARGUMENTS_CANNOT_ASSIGNED, /**< arguments cannot be assigned in strict mode */
@@ -137,7 +137,7 @@ typedef enum
PARSER_ERR_INVALID_RIGHT_SQUARE, /**< right square must terminate a block */
PARSER_ERR_DUPLICATED_LABEL, /**< duplicated label */
PARSER_ERR_OBJECT_PROPERTY_REDEFINED, /**< property of object literal redefined */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
PARSER_ERR_VARIABLE_REDECLARED, /**< a variable redeclared */
PARSER_ERR_LEXICAL_SINGLE_STATEMENT, /**< lexical declaration in single statement context */
PARSER_ERR_LABELLED_FUNC_NOT_IN_BLOCK, /**< labelled functions are only allowed inside blocks */
@@ -166,8 +166,8 @@ typedef enum
PARSER_ERR_INVALID_NULLISH_COALESCING, /**< Cannot chain nullish with logical AND or OR. */
PARSER_ERR_NEW_TARGET_EXPECTED, /**< expected new.target expression */
PARSER_ERR_NEW_TARGET_NOT_ALLOWED, /**< new.target is not allowed in the given context */
#endif /* ENABLED (JERRY_ESNEXT) */
#if ENABLED (JERRY_MODULE_SYSTEM)
#endif /* JERRY_ESNEXT */
#if JERRY_MODULE_SYSTEM
PARSER_ERR_FILE_NOT_FOUND, /**< file not found*/
PARSER_ERR_FROM_EXPECTED, /**< from expected */
PARSER_ERR_FROM_COMMA_EXPECTED, /**< from or comma expected */
@@ -180,7 +180,7 @@ typedef enum
PARSER_ERR_DUPLICATED_EXPORT_IDENTIFIER, /**< duplicated export identifier name */
PARSER_ERR_DUPLICATED_IMPORT_BINDING, /**< duplicated import binding name */
PARSER_ERR_EXPORT_NOT_DEFINED, /**< export is not defined in module */
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
#endif /* JERRY_MODULE_SYSTEM */
PARSER_ERR_NON_STRICT_ARG_DEFINITION /**< non-strict argument definition */
} parser_error_t;
@@ -209,9 +209,9 @@ parser_parse_script (const uint8_t *arg_list_p,
ecma_value_t resource_name,
uint32_t parse_opts);
#if ENABLED (JERRY_ERROR_MESSAGES)
#if JERRY_ERROR_MESSAGES
const char *parser_error_to_string (parser_error_t);
#endif /* ENABLED (JERRY_ERROR_MESSAGES) */
#endif /* JERRY_ERROR_MESSAGES */
/**
* @}
+51 -51
View File
@@ -41,13 +41,13 @@ typedef enum
SCAN_MODE_VAR_STATEMENT, /**< scanning var statement */
SCAN_MODE_PROPERTY_NAME, /**< scanning property name */
SCAN_MODE_FUNCTION_ARGUMENTS, /**< scanning function arguments */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
SCAN_MODE_CONTINUE_FUNCTION_ARGUMENTS, /**< continue scanning function arguments */
SCAN_MODE_BINDING, /**< array or object binding */
SCAN_MODE_CLASS_DECLARATION, /**< scanning class declaration */
SCAN_MODE_CLASS_BODY, /**< scanning class body */
SCAN_MODE_CLASS_BODY_NO_SCAN, /**< scanning class body without calling lexer_scan_identifier */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
} scan_modes_t;
/**
@@ -61,9 +61,9 @@ typedef enum
SCAN_STACK_FUNCTION_STATEMENT, /**< function statement */
SCAN_STACK_FUNCTION_EXPRESSION, /**< function expression */
SCAN_STACK_FUNCTION_PROPERTY, /**< function expression in an object literal */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
SCAN_STACK_FUNCTION_ARROW, /**< arrow function expression */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
SCAN_STACK_SWITCH_BLOCK, /**< block part of "switch" statement */
SCAN_STACK_IF_STATEMENT, /**< statement part of "if" statements */
SCAN_STACK_WITH_STATEMENT, /**< statement part of "with" statements */
@@ -73,19 +73,19 @@ typedef enum
SCAN_STACK_WHILE_EXPRESSION, /**< expression part of "while" iterator */
SCAN_STACK_PAREN_EXPRESSION, /**< expression in brackets */
SCAN_STACK_STATEMENT_WITH_EXPR, /**< statement which starts with expression enclosed in brackets */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
SCAN_STACK_BINDING_INIT, /**< post processing after a single initializer */
SCAN_STACK_BINDING_LIST_INIT, /**< post processing after an initializer list */
SCAN_STACK_LET, /**< let statement */
SCAN_STACK_CONST, /**< const statement */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* The SCANNER_IS_FOR_START macro needs to be updated when the following constants are reordered. */
SCAN_STACK_VAR, /**< var statement */
SCAN_STACK_FOR_VAR_START, /**< start of "for" iterator with var statement */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
SCAN_STACK_FOR_LET_START, /**< start of "for" iterator with let statement */
SCAN_STACK_FOR_CONST_START, /**< start of "for" iterator with const statement */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
SCAN_STACK_FOR_START, /**< start of "for" iterator */
SCAN_STACK_FOR_CONDITION, /**< condition part of "for" iterator */
SCAN_STACK_FOR_EXPRESSION, /**< expression part of "for" iterator */
@@ -97,7 +97,7 @@ typedef enum
SCAN_STACK_ARRAY_LITERAL, /**< array literal or destructuring assignment or binding */
SCAN_STACK_OBJECT_LITERAL, /**< object literal group */
SCAN_STACK_PROPERTY_ACCESSOR, /**< property accessor in square brackets */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/* These four must be in this order. */
SCAN_STACK_COMPUTED_PROPERTY, /**< computed property name */
SCAN_STACK_COMPUTED_GENERATOR, /**< computed generator function */
@@ -118,10 +118,10 @@ typedef enum
SCAN_STACK_FUNCTION_PARAMETERS, /**< function parameter initializer */
SCAN_STACK_FOR_START_PATTERN, /**< possible assignment pattern for "for" iterator */
SCAN_STACK_USE_ASYNC, /**< an "async" identifier is used */
#endif /* ENABLED (JERRY_ESNEXT) */
#if ENABLED (JERRY_MODULE_SYSTEM)
#endif /* JERRY_ESNEXT */
#if JERRY_MODULE_SYSTEM
SCAN_STACK_EXPORT_DEFAULT, /**< scan primary expression after export default */
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
#endif /* JERRY_MODULE_SYSTEM */
} scan_stack_modes_t;
/**
@@ -130,12 +130,12 @@ typedef enum
typedef enum
{
SCANNER_CONTEXT_NO_FLAGS = 0, /**< no flags are set */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
SCANNER_CONTEXT_THROW_ERR_ASYNC_FUNCTION = (1 << 0), /**< throw async function error */
#endif /* ENABLED (JERRY_ESNEXT) */
#if ENABLED (JERRY_DEBUGGER)
#endif /* JERRY_ESNEXT */
#if JERRY_DEBUGGER
SCANNER_CONTEXT_DEBUGGER_ENABLED = (1 << 1), /**< debugger is enabled */
#endif /* ENABLED (JERRY_DEBUGGER) */
#endif /* JERRY_DEBUGGER */
} scanner_context_flags_t;
/**
@@ -167,24 +167,24 @@ typedef enum
{
SCANNER_LITERAL_IS_ARG = (1 << 0), /**< literal is argument */
SCANNER_LITERAL_IS_VAR = (1 << 1), /**< literal is var */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/** literal is a destructured argument binding of a possible arrow function */
SCANNER_LITERAL_IS_ARROW_DESTRUCTURED_ARG = SCANNER_LITERAL_IS_VAR,
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
SCANNER_LITERAL_IS_FUNC = (1 << 2), /**< literal is function */
SCANNER_LITERAL_NO_REG = (1 << 3), /**< literal cannot be stored in a register */
SCANNER_LITERAL_IS_LET = (1 << 4), /**< literal is let */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/** literal is a function declared in this block (prevents declaring let/const with the same name) */
SCANNER_LITERAL_IS_FUNC_DECLARATION = SCANNER_LITERAL_IS_LET,
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
SCANNER_LITERAL_IS_CONST = (1 << 5), /**< literal is const */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/** literal is a destructured argument binding */
SCANNER_LITERAL_IS_DESTRUCTURED_ARG = SCANNER_LITERAL_IS_CONST,
SCANNER_LITERAL_IS_USED = (1 << 6), /**< literal is used */
SCANNER_LITERAL_EARLY_CREATE = (1 << 7), /**< binding should be created early with ECMA_VALUE_UNINITIALIZED */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
} scanner_literal_type_flags_t;
/*
@@ -233,7 +233,7 @@ typedef struct
scanner_case_info_t **last_case_p; /**< last case info */
} scanner_switch_statement_t;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Types of scanner destructuring bindings.
@@ -274,7 +274,7 @@ typedef struct scanner_binding_list_t
bool is_nested; /**< is nested binding declaration */
} scanner_binding_list_t;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Flags for scanner_literal_pool_t structure.
@@ -282,30 +282,30 @@ typedef struct scanner_binding_list_t
typedef enum
{
SCANNER_LITERAL_POOL_FUNCTION = (1 << 0), /**< literal pool represents a function */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
SCANNER_LITERAL_POOL_CLASS_NAME = (1 << 1), /**< literal pool which contains a class name */
SCANNER_LITERAL_POOL_CLASS_FIELD = (1 << 2), /**< literal pool is created for a class field initializer */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
SCANNER_LITERAL_POOL_IS_STRICT = (1 << 3), /**< literal pool represents a strict mode code block */
SCANNER_LITERAL_POOL_CAN_EVAL = (1 << 4), /**< prepare for executing eval in this block */
SCANNER_LITERAL_POOL_NO_ARGUMENTS = (1 << 5), /**< arguments object must not be constructed,
* or arguments cannot be stored in registers if
* SCANNER_LITERAL_POOL_ARGUMENTS_IN_ARGS is set */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
SCANNER_LITERAL_POOL_ARGUMENTS_IN_ARGS = (1 << 6), /**< arguments is referenced in function args */
SCANNER_LITERAL_POOL_HAS_COMPLEX_ARGUMENT = (1 << 7), /**< function has complex (ES2015+) argument definition */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
SCANNER_LITERAL_POOL_IN_WITH = (1 << 8), /**< literal pool is in a with statement */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
SCANNER_LITERAL_POOL_ARROW = (1 << 9), /**< arrow function */
SCANNER_LITERAL_POOL_GENERATOR = (1 << 10), /**< generator function */
SCANNER_LITERAL_POOL_ASYNC = (1 << 11), /**< async function */
SCANNER_LITERAL_POOL_FUNCTION_STATEMENT = (1 << 12), /**< function statement */
SCANNER_LITERAL_POOL_HAS_SUPER_REFERENCE = (1 << 13), /**< function body contains super reference */
#endif /* ENABLED (JERRY_ESNEXT) */
#if ENABLED (JERRY_MODULE_SYSTEM)
#endif /* JERRY_ESNEXT */
#if JERRY_MODULE_SYSTEM
SCANNER_LITERAL_POOL_IN_EXPORT = (1 << 14), /**< the declared variables are exported by the module system */
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
#endif /* JERRY_MODULE_SYSTEM */
} scanner_literal_pool_flags_t;
/**
@@ -332,7 +332,7 @@ typedef enum
#define SCANNER_FROM_COMPUTED_TO_LITERAL_POOL(mode) \
(((mode) - SCAN_STACK_COMPUTED_PROPERTY) << 10)
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Literal pool which may contains function argument identifiers
@@ -340,14 +340,14 @@ typedef enum
#define SCANNER_LITERAL_POOL_MAY_HAVE_ARGUMENTS(status_flags) \
(!((status_flags) & (SCANNER_LITERAL_POOL_CLASS_NAME | SCANNER_LITERAL_POOL_CLASS_FIELD)))
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
/**
* Literal pool which may contains function argument identifiers
*/
#define SCANNER_LITERAL_POOL_MAY_HAVE_ARGUMENTS(status_flags) true
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Local literal pool.
@@ -368,27 +368,27 @@ struct scanner_context_t
{
uint32_t context_status_flags; /**< original status flags of the context */
uint8_t mode; /**< scanner mode */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
uint8_t binding_type; /**< current destructuring binding type */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
uint16_t status_flags; /**< scanner status flags */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
scanner_binding_list_t *active_binding_list_p; /**< currently active binding list */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
scanner_literal_pool_t *active_literal_pool_p; /**< currently active literal pool */
scanner_switch_statement_t active_switch_statement; /**< currently active switch statement */
scanner_info_t *end_arguments_p; /**< position of end arguments */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
const uint8_t *async_source_p; /**< source position for async functions */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
};
/* Scanner utils. */
void scanner_raise_error (parser_context_t *context_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
void scanner_raise_redeclaration_error (parser_context_t *context_p);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
void *scanner_malloc (parser_context_t *context_p, size_t size);
void scanner_free (void *ptr, size_t size);
@@ -400,23 +400,23 @@ scanner_info_t *scanner_insert_info_before (parser_context_t *context_p, const u
scanner_literal_pool_t *scanner_push_literal_pool (parser_context_t *context_p, scanner_context_t *scanner_context_p,
uint16_t status_flags);
void scanner_pop_literal_pool (parser_context_t *context_p, scanner_context_t *scanner_context_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
void scanner_filter_arguments (parser_context_t *context_p, scanner_context_t *scanner_context_p);
void scanner_construct_global_block (parser_context_t *context_p, scanner_context_t *scanner_context_p);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
lexer_lit_location_t *scanner_add_custom_literal (parser_context_t *context_p, scanner_literal_pool_t *literal_pool_p,
const lexer_lit_location_t *literal_location_p);
lexer_lit_location_t *scanner_add_literal (parser_context_t *context_p, scanner_context_t *scanner_context_p);
void scanner_add_reference (parser_context_t *context_p, scanner_context_t *scanner_context_p);
lexer_lit_location_t *scanner_append_argument (parser_context_t *context_p, scanner_context_t *scanner_context_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
void scanner_detect_invalid_var (parser_context_t *context_p, scanner_context_t *scanner_context_p,
lexer_lit_location_t *var_literal_p);
void scanner_detect_invalid_let (parser_context_t *context_p, lexer_lit_location_t *let_literal_p);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
void scanner_detect_eval_call (parser_context_t *context_p, scanner_context_t *scanner_context_p);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
lexer_lit_location_t *scanner_push_class_declaration (parser_context_t *context_p,
scanner_context_t *scanner_context_p, uint8_t stack_mode);
void scanner_push_class_field_initializer (parser_context_t *context_p, scanner_context_t *scanner_context_p);
@@ -424,11 +424,11 @@ void scanner_push_destructuring_pattern (parser_context_t *context_p, scanner_co
uint8_t binding_type, bool is_nested);
void scanner_pop_binding_list (scanner_context_t *scanner_context_p);
void scanner_append_hole (parser_context_t *context_p, scanner_context_t *scanner_context_p);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* Scanner operations. */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
void scanner_add_async_literal (parser_context_t *context_p, scanner_context_t *scanner_context_p);
void scanner_check_arrow (parser_context_t *context_p, scanner_context_t *scanner_context_p);
void scanner_scan_simple_arrow (parser_context_t *context_p, scanner_context_t *scanner_context_p,
@@ -436,7 +436,7 @@ void scanner_scan_simple_arrow (parser_context_t *context_p, scanner_context_t *
void scanner_check_arrow_arg (parser_context_t *context_p, scanner_context_t *scanner_context_p);
bool scanner_check_async_function (parser_context_t *context_p, scanner_context_t *scanner_context_p);
void scanner_check_function_after_if (parser_context_t *context_p, scanner_context_t *scanner_context_p);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
void scanner_scan_bracket (parser_context_t *context_p, scanner_context_t *scanner_context_p);
void scanner_check_directives (parser_context_t *context_p, scanner_context_t *scanner_context_p);
+27 -27
View File
@@ -17,7 +17,7 @@
#include "js-scanner-internal.h"
#include "lit-char-helpers.h"
#if ENABLED (JERRY_PARSER)
#if JERRY_PARSER
/** \addtogroup parser Parser
* @{
@@ -29,7 +29,7 @@
* @{
*/
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Add the "async" literal to the literal pool.
@@ -245,9 +245,9 @@ scanner_check_arrow_arg (parser_context_t *context_p, /**< context */
if (context_p->token.type == LEXER_LEFT_BRACE)
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
parser_stack_push_uint8 (context_p, 0);
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
parser_stack_push_uint8 (context_p, SCAN_STACK_OBJECT_LITERAL);
scanner_context_p->mode = SCAN_MODE_PROPERTY_NAME;
return;
@@ -367,7 +367,7 @@ typedef enum
SCANNER_SCAN_BRACKET_ARROW_WITH_ONE_ARG, /**< arrow function with one argument */
} scanner_scan_bracket_arrow_type_t;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Scan bracketed expressions.
@@ -377,19 +377,19 @@ scanner_scan_bracket (parser_context_t *context_p, /**< context */
scanner_context_t *scanner_context_p) /**< scanner context */
{
size_t depth = 0;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
const uint8_t *arrow_source_p;
const uint8_t *async_source_p = NULL;
scanner_scan_bracket_arrow_type_t arrow_type = SCANNER_SCAN_BRACKET_NO_ARROW;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
JERRY_ASSERT (context_p->token.type == LEXER_LEFT_PAREN);
do
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
arrow_source_p = context_p->source_p;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
depth++;
lexer_next_token (context_p);
}
@@ -403,13 +403,13 @@ scanner_scan_bracket (parser_context_t *context_p, /**< context */
{
if (context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
arrow_source_p = NULL;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
break;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
const uint8_t *source_p = context_p->source_p;
if (lexer_check_arrow (context_p))
@@ -420,7 +420,7 @@ scanner_scan_bracket (parser_context_t *context_p, /**< context */
}
size_t total_depth = depth;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
while (depth > 0 && lexer_check_next_character (context_p, LIT_CHAR_RIGHT_PAREN))
{
@@ -431,19 +431,19 @@ scanner_scan_bracket (parser_context_t *context_p, /**< context */
if (context_p->token.keyword_type == LEXER_KEYW_EVAL
&& lexer_check_next_character (context_p, LIT_CHAR_LEFT_PAREN))
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/* A function call cannot be an eval function. */
arrow_source_p = NULL;
const uint16_t flags = (uint16_t) (SCANNER_LITERAL_POOL_CAN_EVAL | SCANNER_LITERAL_POOL_HAS_SUPER_REFERENCE);
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
const uint16_t flags = SCANNER_LITERAL_POOL_CAN_EVAL;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
scanner_context_p->active_literal_pool_p->status_flags |= flags;
break;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (total_depth == depth)
{
if (lexer_check_arrow_param (context_p))
@@ -473,10 +473,10 @@ scanner_scan_bracket (parser_context_t *context_p, /**< context */
}
arrow_source_p = NULL;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
break;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
case LEXER_THREE_DOTS:
case LEXER_LEFT_SQUARE:
case LEXER_LEFT_BRACE:
@@ -486,23 +486,23 @@ scanner_scan_bracket (parser_context_t *context_p, /**< context */
depth--;
break;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
default:
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
arrow_source_p = NULL;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
break;
}
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (JERRY_UNLIKELY (scanner_context_p->async_source_p != NULL)
&& (arrow_source_p == NULL || depth > 0))
{
scanner_context_p->async_source_p = NULL;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
while (depth > 0)
{
@@ -510,7 +510,7 @@ scanner_scan_bracket (parser_context_t *context_p, /**< context */
depth--;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (arrow_source_p != NULL)
{
JERRY_ASSERT (async_source_p == NULL);
@@ -558,7 +558,7 @@ scanner_scan_bracket (parser_context_t *context_p, /**< context */
scanner_context_p->async_source_p = async_source_p;
scanner_check_async_function (context_p, scanner_context_p);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
} /* scanner_scan_bracket */
/**
@@ -614,4 +614,4 @@ scanner_check_directives (parser_context_t *context_p, /**< context */
* @}
*/
#endif /* ENABLED (JERRY_PARSER) */
#endif /* JERRY_PARSER */
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+23 -23
View File
@@ -39,12 +39,12 @@ typedef enum
SCANNER_TYPE_WHILE, /**< while statement */
SCANNER_TYPE_FOR, /**< for statement */
SCANNER_TYPE_FOR_IN, /**< for-in statement */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
SCANNER_TYPE_FOR_OF, /**< for-of statement */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
SCANNER_TYPE_SWITCH, /**< switch statement */
SCANNER_TYPE_CASE, /**< case statement */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
SCANNER_TYPE_INITIALIZER, /**< destructuring binding or assignment pattern with initializer */
SCANNER_TYPE_LITERAL_FLAGS, /**< object or array literal with non-zero flags (stored in u8_arg) */
SCANNER_TYPE_CLASS_CONSTRUCTOR, /**< class constructor */
@@ -53,7 +53,7 @@ typedef enum
SCANNER_TYPE_ERR_REDECLARED, /**< syntax error: a variable is redeclared */
SCANNER_TYPE_ERR_ASYNC_FUNCTION, /**< an invalid async function follows */
SCANNER_TYPE_EXPORT_MODULE_SPECIFIER, /**< export with module specifier */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
} scanner_info_type_t;
/**
@@ -147,10 +147,10 @@ typedef enum
SCANNER_STREAM_HAS_ESCAPE = (1 << 6), /**< binding has escape */
SCANNER_STREAM_NO_REG = (1 << 5), /**< binding cannot be stored in register */
SCANNER_STREAM_EARLY_CREATE = (1 << 4), /**< binding must be created with ECMA_VALUE_UNINITIALIZED */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
SCANNER_STREAM_LOCAL_ARGUMENTS = SCANNER_STREAM_EARLY_CREATE, /**< arguments is redeclared
* as let/const binding later */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* Update SCANNER_STREAM_TYPE_MASK macro if more bits are added. */
} scanner_compressed_stream_flags_t;
@@ -162,35 +162,35 @@ typedef enum
SCANNER_STREAM_TYPE_END, /**< end of scanner data */
SCANNER_STREAM_TYPE_HOLE, /**< no name is assigned to this argument */
SCANNER_STREAM_TYPE_ARGUMENTS, /**< arguments object should be created */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
SCANNER_STREAM_TYPE_ARGUMENTS_FUNC, /**< arguments object should be created which
* is later initialized with a function */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
SCANNER_STREAM_TYPE_VAR, /**< var declaration */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
SCANNER_STREAM_TYPE_LET, /**< let declaration */
SCANNER_STREAM_TYPE_CONST, /**< const declaration */
SCANNER_STREAM_TYPE_LOCAL, /**< local declaration (e.g. catch block) */
#endif /* ENABLED (JERRY_ESNEXT) */
#if ENABLED (JERRY_MODULE_SYSTEM)
#endif /* JERRY_ESNEXT */
#if JERRY_MODULE_SYSTEM
SCANNER_STREAM_TYPE_IMPORT, /**< module import */
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */
#endif /* JERRY_MODULE_SYSTEM */
/* The next four types must be in this order (see SCANNER_STREAM_TYPE_IS_ARG). */
SCANNER_STREAM_TYPE_ARG, /**< argument declaration */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
SCANNER_STREAM_TYPE_ARG_VAR, /**< argument declaration which is later copied
* into a variable declared by var statement */
SCANNER_STREAM_TYPE_DESTRUCTURED_ARG, /**< destructuring argument declaration */
SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_VAR, /**< destructuring argument declaration which is later
* copied into a variable declared by var statement */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* Function types should be at the end. See the SCANNER_STREAM_TYPE_IS_FUNCTION macro. */
SCANNER_STREAM_TYPE_ARG_FUNC, /**< argument declaration which
* is later initialized with a function */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_FUNC, /**< destructuring argument declaration which
* is later initialized with a function */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
SCANNER_STREAM_TYPE_FUNC, /**< function declaration */
} scanner_compressed_stream_types_t;
@@ -204,7 +204,7 @@ typedef enum
*/
#define SCANNER_STREAM_TYPE_IS_FUNCTION(type) ((type) >= SCANNER_STREAM_TYPE_ARG_FUNC)
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Checks whether the decoded type represents a function argument.
@@ -224,7 +224,7 @@ typedef enum
#define SCANNER_STREAM_TYPE_IS_ARGUMENTS(type) \
((type) == SCANNER_STREAM_TYPE_ARGUMENTS || (type) == SCANNER_STREAM_TYPE_ARGUMENTS_FUNC)
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
/**
* Checks whether the decoded type represents a function argument.
@@ -242,7 +242,7 @@ typedef enum
#define SCANNER_STREAM_TYPE_IS_ARGUMENTS(type) \
((type) == SCANNER_STREAM_TYPE_ARGUMENTS)
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Constants for u8_arg flags in scanner_function_info_t.
@@ -251,16 +251,16 @@ typedef enum
{
SCANNER_FUNCTION_ARGUMENTS_NEEDED = (1 << 0), /**< arguments object needs to be created */
SCANNER_FUNCTION_HAS_COMPLEX_ARGUMENT = (1 << 1), /**< function has complex (ES2015+) argument definition */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
SCANNER_FUNCTION_LEXICAL_ENV_NEEDED = (1 << 2), /**< lexical environment is needed for the function body */
SCANNER_FUNCTION_STATEMENT = (1 << 3), /**< function is function statement (not arrow expression)
* this flag must be combined with the type of function (e.g. async) */
SCANNER_FUNCTION_ASYNC = (1 << 4), /**< function is async function */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
SCANNER_FUNCTION_IS_STRICT = (1 << 5), /**< function is strict */
} scanner_function_flags_t;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Object or array literal constants for u8_arg flags in scanner_info_t.
@@ -275,7 +275,7 @@ typedef enum
SCANNER_LITERAL_OBJECT_HAS_REST = (1 << 3), /**< the object literal has a member prefixed with three dots */
} scanner_literal_flags_t;
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Option bits for scanner_create_variables function.
+19 -19
View File
@@ -18,7 +18,7 @@
#include "lit-strings.h"
#include "re-bytecode.h"
#if ENABLED (JERRY_BUILTIN_REGEXP)
#if JERRY_BUILTIN_REGEXP
/** \addtogroup parser Parser
* @{
@@ -275,22 +275,22 @@ void
re_append_char (re_compiler_ctx_t *re_ctx_p, /**< RegExp bytecode context */
const lit_code_point_t cp) /**< code point */
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
const size_t size = (re_ctx_p->flags & RE_FLAG_UNICODE) ? sizeof (lit_code_point_t) : sizeof (ecma_char_t);
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
JERRY_UNUSED (re_ctx_p);
const size_t size = sizeof (ecma_char_t);
#endif /* !ENABLED (JERRY_ESNEXT) */
#endif /* !JERRY_ESNEXT */
uint8_t *dest_p = re_bytecode_reserve (re_ctx_p, size);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (re_ctx_p->flags & RE_FLAG_UNICODE)
{
re_encode_u32 (dest_p, cp);
return;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
JERRY_ASSERT (cp <= LIT_UTF16_CODE_UNIT_MAX);
re_encode_u16 (dest_p, (ecma_char_t) cp);
@@ -304,22 +304,22 @@ re_insert_char (re_compiler_ctx_t *re_ctx_p, /**< RegExp bytecode context */
const uint32_t offset, /**< bytecode offset */
const lit_code_point_t cp) /**< code point*/
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
const size_t size = (re_ctx_p->flags & RE_FLAG_UNICODE) ? sizeof (lit_code_point_t) : sizeof (ecma_char_t);
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
JERRY_UNUSED (re_ctx_p);
const size_t size = sizeof (ecma_char_t);
#endif /* !ENABLED (JERRY_ESNEXT) */
#endif /* !JERRY_ESNEXT */
uint8_t *dest_p = re_bytecode_insert (re_ctx_p, offset, size);
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (re_ctx_p->flags & RE_FLAG_UNICODE)
{
re_encode_u32 (dest_p, cp);
return;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
JERRY_ASSERT (cp <= LIT_UTF16_CODE_UNIT_MAX);
re_encode_u16 (dest_p, (ecma_char_t) cp);
@@ -336,16 +336,16 @@ re_get_char (const uint8_t **bc_p, /**< reference to bytecode pointer */
{
lit_code_point_t cp;
#if !ENABLED (JERRY_ESNEXT)
#if !JERRY_ESNEXT
JERRY_UNUSED (unicode);
#else /* ENABLED (JERRY_ESNEXT) */
#else /* JERRY_ESNEXT */
if (unicode)
{
cp = re_decode_u32 (*bc_p);
*bc_p += sizeof (lit_code_point_t);
}
else
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
{
cp = re_decode_u16 (*bc_p);
*bc_p += sizeof (ecma_char_t);
@@ -354,7 +354,7 @@ re_get_char (const uint8_t **bc_p, /**< reference to bytecode pointer */
return cp;
} /* re_get_char */
#if ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE)
#if JERRY_REGEXP_DUMP_BYTE_CODE
static uint32_t
re_get_bytecode_offset (const uint8_t *start_p, /**< bytecode start pointer */
const uint8_t *current_p) /**< current bytecode pointer */
@@ -592,13 +592,13 @@ re_dump_bytecode (re_compiler_ctx_t *re_ctx_p) /**< RegExp bytecode context */
JERRY_DEBUG_MSG ("\n");
break;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
case RE_OP_UNICODE_PERIOD:
{
JERRY_DEBUG_MSG ("UNICODE_PERIOD\n");
break;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
case RE_OP_PERIOD:
{
JERRY_DEBUG_MSG ("PERIOD\n");
@@ -628,7 +628,7 @@ re_dump_bytecode (re_compiler_ctx_t *re_ctx_p) /**< RegExp bytecode context */
}
}
} /* re_dump_bytecode */
#endif /* ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE) */
#endif /* JERRY_REGEXP_DUMP_BYTE_CODE */
/**
* @}
@@ -636,4 +636,4 @@ re_dump_bytecode (re_compiler_ctx_t *re_ctx_p) /**< RegExp bytecode context */
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
#endif /* JERRY_BUILTIN_REGEXP */
+6 -6
View File
@@ -16,7 +16,7 @@
#ifndef RE_BYTECODE_H
#define RE_BYTECODE_H
#if ENABLED (JERRY_BUILTIN_REGEXP)
#if JERRY_BUILTIN_REGEXP
#include "ecma-globals.h"
#include "re-compiler-context.h"
@@ -81,9 +81,9 @@ typedef enum
RE_OP_CLASS_ESCAPE, /**< class escape */
RE_OP_CHAR_CLASS, /**< character class */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
RE_OP_UNICODE_PERIOD, /**< period in full unicode mode */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
RE_OP_PERIOD, /**< period in non-unicode mode */
RE_OP_CHAR, /**< any code point */
RE_OP_BYTE, /**< 1-byte utf8 character */
@@ -118,9 +118,9 @@ uint8_t re_get_byte (const uint8_t **bc_p);
lit_code_point_t re_get_char (const uint8_t **bc_p, bool unicode);
uint32_t re_get_value (const uint8_t **bc_p);
#if ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE)
#if JERRY_REGEXP_DUMP_BYTE_CODE
void re_dump_bytecode (re_compiler_ctx_t *bc_ctx);
#endif /* ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE) */
#endif /* JERRY_REGEXP_DUMP_BYTE_CODE */
/**
* @}
@@ -128,5 +128,5 @@ void re_dump_bytecode (re_compiler_ctx_t *bc_ctx);
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
#endif /* JERRY_BUILTIN_REGEXP */
#endif /* !RE_BYTECODE_H */
@@ -16,7 +16,7 @@
#ifndef RE_COMPILER_CONTEXT_H
#define RE_COMPILER_CONTEXT_H
#if ENABLED (JERRY_BUILTIN_REGEXP)
#if JERRY_BUILTIN_REGEXP
#include "re-token.h"
@@ -56,5 +56,5 @@ typedef struct
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
#endif /* JERRY_BUILTIN_REGEXP */
#endif /* !RE_COMPILER_CONTEXT_H */
+4 -4
View File
@@ -25,7 +25,7 @@
#include "re-compiler-context.h"
#include "re-parser.h"
#if ENABLED (JERRY_BUILTIN_REGEXP)
#if JERRY_BUILTIN_REGEXP
/** \addtogroup parser Parser
* @{
@@ -154,12 +154,12 @@ re_compile_bytecode (ecma_string_t *pattern_str_p, /**< pattern */
re_compiled_code_p->captures_count = re_ctx.captures_count;
re_compiled_code_p->non_captures_count = re_ctx.non_captures_count;
#if ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE)
#if JERRY_REGEXP_DUMP_BYTE_CODE
if (JERRY_CONTEXT (jerry_init_flags) & ECMA_INIT_SHOW_REGEXP_OPCODES)
{
re_dump_bytecode (&re_ctx);
}
#endif /* ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE) */
#endif /* JERRY_REGEXP_DUMP_BYTE_CODE */
uint8_t cache_idx = JERRY_CONTEXT (re_cache_idx);
@@ -180,4 +180,4 @@ re_compile_bytecode (ecma_string_t *pattern_str_p, /**< pattern */
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
#endif /* JERRY_BUILTIN_REGEXP */
+2 -2
View File
@@ -16,7 +16,7 @@
#ifndef RE_COMPILER_H
#define RE_COMPILER_H
#if ENABLED (JERRY_BUILTIN_REGEXP)
#if JERRY_BUILTIN_REGEXP
#include "ecma-globals.h"
#include "re-bytecode.h"
@@ -42,5 +42,5 @@ void re_cache_gc (void);
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
#endif /* JERRY_BUILTIN_REGEXP */
#endif /* !RE_COMPILER_H */
+33 -33
View File
@@ -21,7 +21,7 @@
#include "re-compiler.h"
#include "re-parser.h"
#if ENABLED (JERRY_BUILTIN_REGEXP)
#if JERRY_BUILTIN_REGEXP
/** \addtogroup parser Parser
* @{
@@ -393,7 +393,7 @@ re_count_groups (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context */
}
} /* re_count_groups */
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/**
* Check if a code point is a Syntax character
*
@@ -418,7 +418,7 @@ re_is_syntax_char (lit_code_point_t cp) /**< code point */
|| cp == LIT_CHAR_RIGHT_BRACE
|| cp == LIT_CHAR_VLINE);
} /* re_is_syntax_char */
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/**
* Parse a Character Escape or a Character Class Escape.
@@ -444,12 +444,12 @@ re_parse_char_escape (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context
return ECMA_VALUE_EMPTY;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (re_ctx_p->flags & RE_FLAG_UNICODE)
{
return ecma_raise_syntax_error (ECMA_ERR_MSG ("Invalid escape sequence"));
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* Legacy octal escape sequence */
if (lit_char_is_octal_digit (*re_ctx_p->input_curr_p))
@@ -546,12 +546,12 @@ re_parse_char_escape (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context
}
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (re_ctx_p->flags & RE_FLAG_UNICODE)
{
return ecma_raise_syntax_error (ECMA_ERR_MSG ("Invalid control escape sequence"));
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
re_ctx_p->token.value = LIT_CHAR_BACKSLASH;
re_ctx_p->input_curr_p--;
@@ -569,12 +569,12 @@ re_parse_char_escape (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context
break;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (re_ctx_p->flags & RE_FLAG_UNICODE)
{
return ecma_raise_syntax_error (ECMA_ERR_MSG ("Invalid hex escape sequence"));
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
re_ctx_p->token.value = LIT_CHAR_LOWERCASE_X;
break;
@@ -588,7 +588,7 @@ re_parse_char_escape (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context
re_ctx_p->token.value = hex_value;
re_ctx_p->input_curr_p += 4;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (re_ctx_p->flags & RE_FLAG_UNICODE
&& lit_is_code_point_utf16_high_surrogate (re_ctx_p->token.value)
&& re_ctx_p->input_curr_p + 6 <= re_ctx_p->input_end_p
@@ -603,12 +603,12 @@ re_parse_char_escape (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context
re_ctx_p->input_curr_p += 6;
}
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
break;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (re_ctx_p->flags & RE_FLAG_UNICODE)
{
if (re_ctx_p->input_curr_p + 1 < re_ctx_p->input_end_p
@@ -638,7 +638,7 @@ re_parse_char_escape (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context
return ecma_raise_syntax_error (ECMA_ERR_MSG ("Invalid unicode escape sequence"));
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
re_ctx_p->token.value = LIT_CHAR_LOWERCASE_U;
break;
@@ -646,7 +646,7 @@ re_parse_char_escape (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context
/* Identity escape */
default:
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
/* Must be '/', or one of SyntaxCharacter */
if (re_ctx_p->flags & RE_FLAG_UNICODE
&& ch != LIT_CHAR_SLASH
@@ -654,7 +654,7 @@ re_parse_char_escape (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context
{
return ecma_raise_syntax_error (ECMA_ERR_MSG ("Invalid escape"));
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
re_ctx_p->token.value = ch;
}
}
@@ -831,12 +831,12 @@ re_parse_next_token (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context *
return ecma_raise_syntax_error (ECMA_ERR_MSG ("Nothing to repeat"));
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (re_ctx_p->flags & RE_FLAG_UNICODE)
{
return ecma_raise_syntax_error (ECMA_ERR_MSG ("Lone quantifier bracket"));
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
re_ctx_p->input_curr_p++;
re_ctx_p->token.type = RE_TOK_CHAR;
@@ -845,7 +845,7 @@ re_parse_next_token (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context *
/* Check quantifier */
break;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
case LIT_CHAR_RIGHT_SQUARE:
case LIT_CHAR_RIGHT_BRACE:
{
@@ -856,13 +856,13 @@ re_parse_next_token (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context *
/* FALLTHRU */
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
default:
{
re_ctx_p->token.type = RE_TOK_CHAR;
re_ctx_p->token.value = ch;
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (re_ctx_p->flags & RE_FLAG_UNICODE
&& lit_is_code_point_utf16_high_surrogate (ch)
&& re_ctx_p->input_curr_p < re_ctx_p->input_end_p)
@@ -874,7 +874,7 @@ re_parse_next_token (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context *
re_ctx_p->input_curr_p += LIT_UTF8_MAX_BYTES_IN_CODE_UNIT;
}
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
/* Check quantifier */
break;
@@ -995,13 +995,13 @@ re_parse_char_class (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context *
re_ctx_p->input_curr_p++;
current = LIT_CHAR_BS;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
else if (*re_ctx_p->input_curr_p == LIT_CHAR_MINUS)
{
re_ctx_p->input_curr_p++;
current = LIT_CHAR_MINUS;
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
else if ((re_ctx_p->flags & RE_FLAG_UNICODE) == 0
&& *re_ctx_p->input_curr_p == LIT_CHAR_LOWERCASE_C
&& re_ctx_p->input_curr_p + 1 < re_ctx_p->input_end_p
@@ -1031,12 +1031,12 @@ re_parse_char_class (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context *
}
}
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
else if (re_ctx_p->flags & RE_FLAG_UNICODE)
{
current = ecma_regexp_unicode_advance (&re_ctx_p->input_curr_p, re_ctx_p->input_end_p);
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
else
{
current = lit_cesu8_read_next (&re_ctx_p->input_curr_p);
@@ -1058,12 +1058,12 @@ re_parse_char_class (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context *
continue;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (re_ctx_p->flags & RE_FLAG_UNICODE)
{
return ecma_raise_syntax_error (ECMA_ERR_MSG ("Invalid character class"));
}
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
if (start != RE_INVALID_CP)
{
@@ -1203,11 +1203,11 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context
}
case RE_TOK_PERIOD:
{
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
re_append_opcode (re_ctx_p, (re_ctx_p->flags & RE_FLAG_UNICODE) ? RE_OP_UNICODE_PERIOD : RE_OP_PERIOD);
#else /* !ENABLED (JERRY_ESNEXT) */
#else /* !JERRY_ESNEXT */
re_append_opcode (re_ctx_p, RE_OP_PERIOD);
#endif /* !ENABLED (JERRY_ESNEXT) */
#endif /* !JERRY_ESNEXT */
re_insert_atom_iterator (re_ctx_p, atom_offset);
break;
@@ -1254,7 +1254,7 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context
return result;
}
#if ENABLED (JERRY_ESNEXT)
#if JERRY_ESNEXT
if (re_ctx_p->flags & RE_FLAG_UNICODE)
{
re_ctx_p->token.qmin = 1;
@@ -1262,7 +1262,7 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context
re_ctx_p->token.greedy = true;
}
else
#endif /* ENABLED (JERRY_ESNEXT) */
#endif /* JERRY_ESNEXT */
{
re_parse_quantifier (re_ctx_p);
@@ -1379,4 +1379,4 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
#endif /* JERRY_BUILTIN_REGEXP */
+2 -2
View File
@@ -16,7 +16,7 @@
#ifndef RE_PARSER_H
#define RE_PARSER_H
#if ENABLED (JERRY_BUILTIN_REGEXP)
#if JERRY_BUILTIN_REGEXP
#include "re-compiler-context.h"
@@ -55,5 +55,5 @@ ecma_value_t re_parse_alternative (re_compiler_ctx_t *re_ctx_p, bool expect_eof)
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
#endif /* JERRY_BUILTIN_REGEXP */
#endif /* !RE_PARSER_H */
+2 -2
View File
@@ -16,7 +16,7 @@
#ifndef RE_TOKEN_H
#define RE_TOKEN_H
#if ENABLED (JERRY_BUILTIN_REGEXP)
#if JERRY_BUILTIN_REGEXP
/** \addtogroup parser Parser
* @{
@@ -68,5 +68,5 @@ typedef struct
* @}
*/
#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */
#endif /* JERRY_BUILTIN_REGEXP */
#endif /* !RE_TOKEN_H */