mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:27:44 +00:00
LibCpp: Match and ignore struct/class inheritance
This commit is contained in:
parent
dc68c765b7
commit
c866a56f07
1 changed files with 25 additions and 0 deletions
|
@ -695,6 +695,19 @@ bool Parser::match_class_declaration()
|
||||||
|
|
||||||
consume(Token::Type::Identifier);
|
consume(Token::Type::Identifier);
|
||||||
|
|
||||||
|
if (peek().type() == Token::Type::Colon) {
|
||||||
|
do {
|
||||||
|
consume();
|
||||||
|
|
||||||
|
while (match_keyword("private") || match_keyword("public") || match_keyword("protected") || match_keyword("virtual"))
|
||||||
|
consume();
|
||||||
|
|
||||||
|
if (!match_name())
|
||||||
|
return false;
|
||||||
|
parse_name(get_dummy_node());
|
||||||
|
} while (peek().type() == Token::Type::Comma);
|
||||||
|
}
|
||||||
|
|
||||||
return match(Token::Type::LeftCurly);
|
return match(Token::Type::LeftCurly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1137,6 +1150,18 @@ NonnullRefPtr<StructOrClassDeclaration> Parser::parse_class_declaration(ASTNode&
|
||||||
auto name_token = consume(Token::Type::Identifier);
|
auto name_token = consume(Token::Type::Identifier);
|
||||||
decl->set_name(text_of_token(name_token));
|
decl->set_name(text_of_token(name_token));
|
||||||
|
|
||||||
|
// FIXME: Don't ignore this.
|
||||||
|
if (peek().type() == Token::Type::Colon) {
|
||||||
|
do {
|
||||||
|
consume();
|
||||||
|
|
||||||
|
while (match_keyword("private") || match_keyword("public") || match_keyword("protected") || match_keyword("virtual"))
|
||||||
|
consume();
|
||||||
|
|
||||||
|
parse_name(get_dummy_node());
|
||||||
|
} while (peek().type() == Token::Type::Comma);
|
||||||
|
}
|
||||||
|
|
||||||
consume(Token::Type::LeftCurly);
|
consume(Token::Type::LeftCurly);
|
||||||
|
|
||||||
while (!eof() && peek().type() != Token::Type::RightCurly) {
|
while (!eof() && peek().type() != Token::Type::RightCurly) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue