Improve eval call parsing. (#3330)
Eval calls are recognised when the eval identifier is encapsulated in brackets. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
committed by
Robert Fancsik
parent
a1189cfb62
commit
70566a52fb
@@ -145,7 +145,7 @@ lexer_skip_spaces (parser_context_t *context_p) /**< context */
|
||||
|
||||
if (context_p->token.flags & LEXER_NO_SKIP_SPACES)
|
||||
{
|
||||
context_p->token.flags = (uint8_t) (context_p->token.flags & ~LEXER_NO_SKIP_SPACES);
|
||||
context_p->token.flags &= (uint8_t) ~LEXER_NO_SKIP_SPACES;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1428,6 +1428,22 @@ lexer_check_next_characters (parser_context_t *context_p, /**< context */
|
||||
|| context_p->source_p[0] == (uint8_t) character2));
|
||||
} /* lexer_check_next_characters */
|
||||
|
||||
/**
|
||||
* Consumes the next character. The character cannot be a white space.
|
||||
*
|
||||
* @return consumed character
|
||||
*/
|
||||
uint8_t
|
||||
lexer_consume_next_character (parser_context_t *context_p)
|
||||
{
|
||||
JERRY_ASSERT (context_p->source_p < context_p->source_end_p);
|
||||
|
||||
context_p->token.flags &= (uint8_t) ~LEXER_NO_SKIP_SPACES;
|
||||
|
||||
PARSER_PLUS_EQUAL_LC (context_p->column, 1);
|
||||
return *context_p->source_p++;
|
||||
} /* lexer_consume_next_character */
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
|
||||
/**
|
||||
@@ -1450,6 +1466,35 @@ lexer_check_arrow (parser_context_t *context_p) /**< context */
|
||||
&& context_p->source_p[1] == (uint8_t) LIT_CHAR_GREATER_THAN);
|
||||
} /* lexer_check_arrow */
|
||||
|
||||
/**
|
||||
* Checks whether the next token is a comma or equal sign.
|
||||
*
|
||||
* @return true if the next token is a comma or equal sign
|
||||
*/
|
||||
bool
|
||||
lexer_check_arrow_param (parser_context_t *context_p) /**< context */
|
||||
{
|
||||
JERRY_ASSERT (context_p->token.flags & LEXER_NO_SKIP_SPACES);
|
||||
|
||||
if (context_p->source_p >= context_p->source_end_p)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (context_p->source_p[0] == LIT_CHAR_COMMA)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (context_p->source_p[0] != LIT_CHAR_EQUALS)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return (context_p->source_p + 1 >= context_p->source_end_p
|
||||
|| context_p->source_p[1] != LIT_CHAR_EQUALS);
|
||||
} /* lexer_check_arrow_param */
|
||||
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user