mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 12:17:44 +00:00
LibCpp: Handle 'struct' prefix before a type
This commit is contained in:
parent
575d6a8ee1
commit
8bcf5daf3f
1 changed files with 7 additions and 0 deletions
|
@ -257,6 +257,9 @@ Parser::TemplatizedMatchResult Parser::match_type()
|
||||||
ScopeGuard state_guard = [this] { load_state(); };
|
ScopeGuard state_guard = [this] { load_state(); };
|
||||||
|
|
||||||
parse_type_qualifiers();
|
parse_type_qualifiers();
|
||||||
|
if (match_keyword("struct")) {
|
||||||
|
consume(Token::Type::Keyword); // Consume struct prefix
|
||||||
|
}
|
||||||
|
|
||||||
if (!match_name())
|
if (!match_name())
|
||||||
return TemplatizedMatchResult::NoMatch;
|
return TemplatizedMatchResult::NoMatch;
|
||||||
|
@ -1163,6 +1166,10 @@ NonnullRefPtr<Type> Parser::parse_type(ASTNode& parent)
|
||||||
auto qualifiers = parse_type_qualifiers();
|
auto qualifiers = parse_type_qualifiers();
|
||||||
type->m_qualifiers = move(qualifiers);
|
type->m_qualifiers = move(qualifiers);
|
||||||
|
|
||||||
|
if (match_keyword("struct")) {
|
||||||
|
consume(Token::Type::Keyword); // Consume struct prefix
|
||||||
|
}
|
||||||
|
|
||||||
if (!match_name()) {
|
if (!match_name()) {
|
||||||
type->set_end(position());
|
type->set_end(position());
|
||||||
error(String::formatted("expected name instead of: {}", peek().text()));
|
error(String::formatted("expected name instead of: {}", peek().text()));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue