Implement arrow function parsing. (#2022)

Note: the special this behaviour of arrow functions is not implemented.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2017-09-26 10:40:45 +02:00
committed by Dániel Bátyai
parent 81952f3cd0
commit c6a33dd407
11 changed files with 777 additions and 194 deletions
+13 -1
View File
@@ -115,6 +115,9 @@ typedef enum
LEXER_SEMICOLON, /**< ";" */
LEXER_COLON, /**< ":" */
LEXER_COMMA, /**< "," */
#ifndef CONFIG_DISABLE_ES2015_ARROW_FUNCTION
LEXER_ARROW, /**< "=>" */
#endif /* !CONFIG_DISABLE_ES2015_ARROW_FUNCTION */
LEXER_KEYW_BREAK, /**< break */
LEXER_KEYW_DO, /**< do */
@@ -192,6 +195,15 @@ typedef enum
#define LEXER_BINARY_LVALUE_OP_TOKEN_TO_OPCODE(token_type) \
((cbc_opcode_t) ((((token_type) - LEXER_ASSIGN_ADD) * 2) + CBC_ASSIGN_ADD))
/**
* Lexer newline flags.
*/
typedef enum
{
LEXER_WAS_NEWLINE = (1u << 0), /**< newline was seen */
LEXER_NO_SKIP_SPACES = (1u << 1) /**< ignore skip spaces */
} lexer_newline_flags_t;
/**
* Lexer literal object types.
*/
@@ -243,7 +255,7 @@ typedef struct
uint8_t literal_is_reserved; /**< future reserved keyword
* (when char_literal.type is LEXER_IDENT_LITERAL) */
uint8_t extra_value; /**< helper value for different purposes */
uint8_t was_newline; /**< newline occured before this token */
uint8_t flags; /**< flag bits for the current token */
parser_line_counter_t line; /**< token start line */
parser_line_counter_t column; /**< token start column */
lexer_lit_location_t lit_location; /**< extra data for character literals */