diff options
author | Itamar <itamar8910@gmail.com> | 2021-04-02 10:36:48 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-06 21:51:58 +0200 |
commit | 8bcf5daf3f5007838c6c34cc11c81d273bf6ee70 (patch) | |
tree | d38ad23bfc41dae64cdd7d8639b78e13b2dd4534 /Userland/Libraries | |
parent | 575d6a8ee1e964e5158ee14b32e55d497c401484 (diff) | |
download | serenity-8bcf5daf3f5007838c6c34cc11c81d273bf6ee70.zip |
LibCpp: Handle 'struct' prefix before a type
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibCpp/Parser.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
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<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())); |