From 8bcf5daf3f5007838c6c34cc11c81d273bf6ee70 Mon Sep 17 00:00:00 2001 From: Itamar Date: Fri, 2 Apr 2021 10:36:48 +0300 Subject: LibCpp: Handle 'struct' prefix before a type --- Userland/Libraries/LibCpp/Parser.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Userland/Libraries/LibCpp') diff --git a/Userland/Libraries/LibCpp/Parser.cpp b/Userland/Libraries/LibCpp/Parser.cpp index 49b2f68f80..baef20b692 100644 --- a/Userland/Libraries/LibCpp/Parser.cpp +++ b/Userland/Libraries/LibCpp/Parser.cpp @@ -257,6 +257,9 @@ Parser::TemplatizedMatchResult Parser::match_type() ScopeGuard state_guard = [this] { load_state(); }; parse_type_qualifiers(); + if (match_keyword("struct")) { + consume(Token::Type::Keyword); // Consume struct prefix + } if (!match_name()) return TemplatizedMatchResult::NoMatch; @@ -1163,6 +1166,10 @@ NonnullRefPtr Parser::parse_type(ASTNode& parent) auto qualifiers = parse_type_qualifiers(); type->m_qualifiers = move(qualifiers); + if (match_keyword("struct")) { + consume(Token::Type::Keyword); // Consume struct prefix + } + if (!match_name()) { type->set_end(position()); error(String::formatted("expected name instead of: {}", peek().text())); -- cgit v1.2.3