Rename decode_keyword to lexer_parse_reserved_word and change it so that it doesn't return TOK_NAME, but empty token instead.

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
This commit is contained in:
Ruben Ayrapetyan 2015-07-05 23:18:53 +03:00
parent 32318137c3
commit b5d30de4d7

View File

@ -158,16 +158,16 @@ convert_string_to_token (token_type tt, /**< token type */
} }
/** /**
* Try to decode specified string as keyword * Try to decode specified string as ReservedWord (ECMA-262 v5, 7.6.1)
* *
* @return if specified string represents a keyword, return corresponding keyword token, * @return TOK_KEYWORD - for Keyword or FutureReservedWord,
* else if it is 'null' - return TOK_NULL token, * TOK_NULL - for NullLiteral,
* else if it is 'true' or 'false' - return TOK_BOOL with corresponding boolean value, * TOK_BOOL - for BooleanLiteral,
* else - return empty_token. * TOK_EMPTY - for other tokens.
*/ */
static token static token
decode_keyword (const lit_utf8_byte_t *str_p, /**< characters buffer */ lexer_parse_reserved_word (const lit_utf8_byte_t *str_p, /**< characters buffer */
lit_utf8_size_t str_size) /**< string's length */ lit_utf8_size_t str_size) /**< string's length */
{ {
typedef struct typedef struct
{ {
@ -251,7 +251,7 @@ decode_keyword (const lit_utf8_byte_t *str_p, /**< characters buffer */
case KW_STATIC: case KW_STATIC:
case KW_YIELD: case KW_YIELD:
{ {
return convert_string_to_token (TOK_NAME, str_p, (ecma_length_t) str_size); return empty_token;
} }
default: default:
@ -284,7 +284,7 @@ decode_keyword (const lit_utf8_byte_t *str_p, /**< characters buffer */
return empty_token; return empty_token;
} }
} }
} /* decode_keyword */ } /* lexer_parse_reserved_word */
static token static token
convert_seen_num_to_token (ecma_number_t num) convert_seen_num_to_token (ecma_number_t num)
@ -601,7 +601,7 @@ convert_string_to_token_transform_escape_seq (token_type tok_type, /**< type of
{ {
if (every_char_islower) if (every_char_islower)
{ {
ret = decode_keyword (str_buf_p, length); ret = lexer_parse_reserved_word (str_buf_p, length);
} }
else if (!every_char_allowed_in_identifier) else if (!every_char_allowed_in_identifier)
{ {