mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17:35 +00:00
LibJS: Add support for hex, octal & binary big integer literals
This commit is contained in:
parent
2ad2e055e2
commit
690eb3bb8a
3 changed files with 34 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue