diff --git a/Userland/Libraries/LibCpp/Parser.cpp b/Userland/Libraries/LibCpp/Parser.cpp index eaedac2b73..5c4ccaa749 100644 --- a/Userland/Libraries/LibCpp/Parser.cpp +++ b/Userland/Libraries/LibCpp/Parser.cpp @@ -455,6 +455,8 @@ bool Parser::match_literal() switch (peek().type()) { case Token::Type::Integer: return true; + case Token::Type::SingleQuotedString: + return true; case Token::Type::DoubleQuotedString: return true; case Token::Type::Float: @@ -516,9 +518,10 @@ NonnullRefPtr Parser::parse_literal(ASTNode& parent) auto token = consume(); return create_ast_node(parent, token.start(), token.end(), text_of_token(token)); } - case Token::Type::DoubleQuotedString: { + case Token::Type::SingleQuotedString: + [[fallthrough]]; + case Token::Type::DoubleQuotedString: return parse_string_literal(parent); - } case Token::Type::Keyword: { if (match_boolean_literal()) return parse_boolean_literal(parent); @@ -935,7 +938,7 @@ NonnullRefPtr Parser::parse_string_literal(ASTNode& parent) Optional end_token_index; while (!eof()) { auto token = peek(); - if (token.type() != Token::Type::DoubleQuotedString && token.type() != Token::Type::EscapeSequence) { + if (token.type() != Token::Type::DoubleQuotedString && token.type() != Token::Type::SingleQuotedString && token.type() != Token::Type::EscapeSequence) { VERIFY(start_token_index.has_value()); end_token_index = m_state.token_index - 1; break;