1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:38:11 +00:00

LibCpp: Handle 'struct' prefix before a type

This commit is contained in:
Itamar 2021-04-02 10:36:48 +03:00 committed by Andreas Kling
parent 575d6a8ee1
commit 8bcf5daf3f

View file

@ -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<Type> 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()));