mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 23:30:20 +00:00
LibCpp: Handle 'struct' prefix before a type
This commit is contained in:
parent
575d6a8ee1
commit
8bcf5daf3f
Notes:
sideshowbarker
2024-07-18 20:41:37 +09:00
Author: https://github.com/itamar8910
Commit: 8bcf5daf3f
Pull-request: https://github.com/SerenityOS/serenity/pull/6009
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