diff --git a/Libraries/LibJS/Lexer.cpp b/Libraries/LibJS/Lexer.cpp index 78ce72c135..0c4a36e416 100644 --- a/Libraries/LibJS/Lexer.cpp +++ b/Libraries/LibJS/Lexer.cpp @@ -229,7 +229,7 @@ Token Lexer::next() } } else if (isdigit(m_current_char)) { consume(); - while (isdigit(m_current_char)) { + while (m_current_char == '.' || isdigit(m_current_char)) { consume(); } token_type = TokenType::NumericLiteral; diff --git a/Libraries/LibJS/Token.cpp b/Libraries/LibJS/Token.cpp index 4e6ee1bb8b..22d898b3ae 100644 --- a/Libraries/LibJS/Token.cpp +++ b/Libraries/LibJS/Token.cpp @@ -52,9 +52,7 @@ const char* Token::name() const double Token::double_value() const { ASSERT(type() == TokenType::NumericLiteral); - // FIXME: need to parse double instead of int - bool ok; - return m_value.to_int(ok); + return strtod(String(m_value).characters(), nullptr); } String Token::string_value() const