lang: ast: re-factor parser into multiple files

This commit is contained in:
2024-11-24 11:10:42 +00:00
parent a25683ddc9
commit f1ea916155
12 changed files with 423 additions and 276 deletions

30
lang/ast/unit.c Normal file
View File

@@ -0,0 +1,30 @@
#include "ctx.h"
#include "node.h"
#include "unit-package.h"
static enum ivy_status parse_package_keyword(
struct ivy_parser *ctx, struct ivy_token *tok)
{
parser_push_state(
ctx, IVY_AST_UNIT_PACKAGE, struct ivy_ast_unit_package_node,
struct unit_package_parser_state);
return IVY_OK;
}
static enum ivy_status add_child(
struct ivy_ast_node *parent, struct ivy_ast_node *child)
{
return IVY_OK;
}
static void print(struct ivy_ast_node *node)
{
}
struct ast_node_type unit_node_ops = {
.n_add_child = add_child,
.n_print = print,
.n_keyword_parsers = {
[IVY_KW_PACKAGE] = parse_package_keyword,
},
};