1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 18:07:35 +00:00

LibCpp: Add TemplatizedName

This type represents templatized names, and replaces our previous use
of 'TemplatizedType' and 'TemplatizedFunctionCall'.

Also, we now parse function calls as secondary expressions.
This commit is contained in:
Itamar 2021-04-06 19:43:43 +03:00 committed by Andreas Kling
parent 510b5073de
commit 9e2e36724d
5 changed files with 96 additions and 184 deletions

View file

@ -93,14 +93,7 @@ private:
bool match_c_style_cast_expression();
bool match_sizeof_expression();
bool match_braced_init_list();
enum class TemplatizedMatchResult {
NoMatch,
Regular,
Templatized,
};
TemplatizedMatchResult match_type();
TemplatizedMatchResult match_function_call();
bool match_type();
Optional<NonnullRefPtrVector<Parameter>> parse_parameter_list(ASTNode& parent);
Optional<Token> consume_whitespace();
@ -165,7 +158,7 @@ private:
create_ast_node(ASTNode& parent, const Position& start, Optional<Position> end, Args&&... args)
{
auto node = adopt(*new T(&parent, start, end, m_filename, forward<Args>(args)...));
if(!parent.is_dummy_node()) {
if (!parent.is_dummy_node()) {
m_state.nodes.append(node);
}
return node;
@ -180,14 +173,12 @@ private:
return node;
}
DummyAstNode& get_dummy_node()
{
static NonnullRefPtr<DummyAstNode> dummy = adopt(*new DummyAstNode(nullptr, {}, {}, {}));
static NonnullRefPtr<DummyAstNode> dummy = adopt(*new DummyAstNode(nullptr, {}, {}, {}));
return dummy;
}
bool match_attribute_specification();
void consume_attribute_specification();
bool match_ellipsis();