1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:37:35 +00:00

LibJS: Add support for hex, octal & binary big integer literals

This commit is contained in:
Idan Horowitz 2021-06-14 02:19:23 +03:00 committed by Linus Groh
parent 2ad2e055e2
commit 690eb3bb8a
3 changed files with 34 additions and 0 deletions

View file

@ -466,12 +466,24 @@ Token Lexer::next()
} else if (m_current_char == 'o' || m_current_char == 'O') {
// octal
is_invalid_numeric_literal = !consume_octal_number();
if (m_current_char == 'n') {
consume();
token_type = TokenType::BigIntLiteral;
}
} else if (m_current_char == 'b' || m_current_char == 'B') {
// binary
is_invalid_numeric_literal = !consume_binary_number();
if (m_current_char == 'n') {
consume();
token_type = TokenType::BigIntLiteral;
}
} else if (m_current_char == 'x' || m_current_char == 'X') {
// hexadecimal
is_invalid_numeric_literal = !consume_hexadecimal_number();
if (m_current_char == 'n') {
consume();
token_type = TokenType::BigIntLiteral;
}
} else if (m_current_char == 'n') {
consume();
token_type = TokenType::BigIntLiteral;