Implement binary literal parsing (#3439)
This patch will allow the user to use binary literals starting with 0b or 0B, these literals will be evaluated in parsing time resulting an integer Co-authored-by: Robert Fancsik frobert@inf.u-szeged.hu JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
This commit is contained in:
committed by
Dániel Bátyai
parent
3c0beaf87d
commit
b6f2ff1ba7
@@ -293,6 +293,19 @@ lit_char_is_hex_digit (ecma_char_t c) /**< code unit */
|
||||
&& LEXER_TO_ASCII_LOWERCASE (c) <= LIT_CHAR_ASCII_LOWERCASE_LETTERS_HEX_END));
|
||||
} /* lit_char_is_hex_digit */
|
||||
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
/**
|
||||
* Check if specified character is one of BinaryDigits characters (ECMA-262 v6, 11.8.3)
|
||||
*
|
||||
* @return true / false
|
||||
*/
|
||||
bool
|
||||
lit_char_is_binary_digit (ecma_char_t c) /** code unit */
|
||||
{
|
||||
return (c == LIT_CHAR_0 || c == LIT_CHAR_1);
|
||||
} /* lit_char_is_binary_digit */
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
|
||||
/**
|
||||
* Convert a HexDigit character to its numeric value, as defined in ECMA-262 v5, 7.8.3
|
||||
*
|
||||
|
||||
@@ -212,6 +212,9 @@ bool lit_code_point_is_identifier_part (lit_code_point_t code_point);
|
||||
bool lit_char_is_octal_digit (ecma_char_t c);
|
||||
bool lit_char_is_decimal_digit (ecma_char_t c);
|
||||
bool lit_char_is_hex_digit (ecma_char_t c);
|
||||
#if ENABLED (JERRY_ES2015)
|
||||
bool lit_char_is_binary_digit (ecma_char_t c);
|
||||
#endif /* ENABLED (JERRY_ES2015) */
|
||||
uint32_t lit_char_hex_to_int (ecma_char_t c);
|
||||
size_t lit_code_point_to_cesu8_bytes (uint8_t *dst_p, lit_code_point_t code_point);
|
||||
size_t lit_code_point_get_cesu8_length (lit_code_point_t code_point);
|
||||
|
||||
Reference in New Issue
Block a user