lang: ast: initial implementation of class parser

This commit is contained in:
2024-11-25 16:50:42 +00:00
parent 19506a299c
commit f9b0096dd7
3 changed files with 160 additions and 0 deletions

View File

@@ -17,6 +17,13 @@ static enum ivy_status parse_use_keyword(
return IVY_OK;
}
static enum ivy_status parse_class_keyword(
struct ivy_parser *ctx, struct ivy_token *tok)
{
parser_push_state(ctx, IVY_AST_CLASS);
return IVY_OK;
}
static enum ivy_status add_child(
struct ivy_ast_node *parent, struct ivy_ast_node *child)
{
@@ -42,6 +49,7 @@ struct ast_node_type unit_node_ops = {
.n_node_size = sizeof(struct ivy_ast_unit_node),
.n_keyword_parsers = {
[IVY_KW_PACKAGE] = parse_package_keyword,
[IVY_KW_CLASS] = parse_class_keyword,
[IVY_KW_USE] = parse_use_keyword,
},
};