Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jerry-core/parser/js/byte-code.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ JERRY_STATIC_ASSERT (offsetof (cbc_uint8_arguments_t, script_value) == offsetof
* whenever new bytecodes are introduced or existing ones have been deleted.
*/
JERRY_STATIC_ASSERT (CBC_END == 238, number_of_cbc_opcodes_changed);
JERRY_STATIC_ASSERT (CBC_EXT_END == 167, number_of_cbc_ext_opcodes_changed);
JERRY_STATIC_ASSERT (CBC_EXT_END == 170, number_of_cbc_ext_opcodes_changed);

/** \addtogroup parser Parser
* @{
Expand Down
4 changes: 2 additions & 2 deletions jerry-core/parser/js/byte-code.h
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,9 @@
CBC_FORWARD_BRANCH (CBC_EXT_DEFAULT_INITIALIZER, -1, VM_OC_DEFAULT_INITIALIZER) \
CBC_OPCODE (CBC_EXT_ERROR, CBC_NO_FLAG, 0, VM_OC_ERROR) \
CBC_FORWARD_BRANCH (CBC_EXT_BRANCH_IF_NULLISH, -1, VM_OC_BRANCH_IF_NULLISH) \
\
/* Basic opcodes. */ \
CBC_OPCODE (CBC_EXT_POP_REFERENCE, CBC_NO_FLAG, -2, VM_OC_POP_REFERENCE) \
CBC_FORWARD_BRANCH (CBC_EXT_BRANCH_OPTIONAL_CHAIN, 0, VM_OC_BRANCH_OPTIONAL_CHAIN) \
/* Basic opcodes. */ \
CBC_OPCODE (CBC_EXT_CREATE_ARGUMENTS, CBC_HAS_LITERAL_ARG, 0, VM_OC_CREATE_ARGUMENTS) \
CBC_OPCODE (CBC_EXT_CREATE_VAR_EVAL, CBC_HAS_LITERAL_ARG, 0, VM_OC_EXT_VAR_EVAL) \
CBC_OPCODE (CBC_EXT_CREATE_VAR_FUNC_EVAL, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, VM_OC_EXT_VAR_EVAL) \
Expand Down
30 changes: 30 additions & 0 deletions jerry-core/parser/js/js-lexer.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,29 @@ lexer_skip_spaces (parser_context_t *context_p) /**< context */
}
} /* lexer_skip_spaces */

/**
* Checks the next token start character.
*
* @return LIT_INVALID_CP - if there is no more characters to read
* next byte - otherwise
*/
lit_code_point_t
lexer_peek_next_character (parser_context_t *context_p) /**< context */
{
if (!(context_p->token.flags & LEXER_NO_SKIP_SPACES))
{
lexer_skip_spaces (context_p);
context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);
}

if (context_p->source_p < context_p->source_end_p)
{
return context_p->source_p[0];
}

return LIT_INVALID_CP;
} /* lexer_check_next_character */

/**
* Skip all the continuous empty statements.
*/
Expand Down Expand Up @@ -1738,6 +1761,13 @@ lexer_next_token (parser_context_t *context_p) /**< context */
length = 2;
break;
}
if (context_p->source_p[1] == (uint8_t) LIT_CHAR_DOT
&& (length < 3 || !lit_char_is_decimal_digit (context_p->source_p[2])))
{
context_p->token.type = LEXER_QUESTION_MARK_DOT;
length = 2;
break;
}
}

context_p->token.type = LEXER_QUESTION_MARK;
Expand Down
1 change: 1 addition & 0 deletions jerry-core/parser/js/js-lexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ typedef enum
LEXER_RIGHT_PAREN, /**< ")" */
LEXER_RIGHT_SQUARE, /**< "]" */
LEXER_DOT, /**< "." */
LEXER_QUESTION_MARK_DOT, /**< "?." */
LEXER_SEMICOLON, /**< ";" */
LEXER_COLON, /**< ":" */
LEXER_COMMA, /**< "," */
Expand Down
Loading
Loading