lang: ast: add new ast node type ids

This commit is contained in:
2025-09-08 16:03:39 +01:00
parent 7d1b7c5d68
commit 3b5f08b1ea

View File

@@ -26,7 +26,7 @@ enum ivy_ast_node_type {
IVY_AST_LAMBDA,
IVY_AST_UNIT_PACKAGE,
IVY_AST_UNIT_IMPORT,
IVY_AST_VAR,
IVY_AST_GLOBAL,
IVY_AST_DISCARD,
IVY_AST_INT,
IVY_AST_DOUBLE,
@@ -36,6 +36,8 @@ enum ivy_ast_node_type {
IVY_AST_IDENT,
IVY_AST_FOR_LOOP,
IVY_AST_WHILE_LOOP,
IVY_AST_LOOP_BREAK,
IVY_AST_LOOP_REPEAT,
IVY_AST_CASCADE,
IVY_AST_MATCH,
IVY_AST_COND_GROUP,
@@ -47,6 +49,10 @@ enum ivy_ast_node_type {
IVY_AST_PKG_ITEM,
IVY_AST_PKG_DYNAMIC,
IVY_AST_C_TRUE,
IVY_AST_C_FALSE,
IVY_AST_C_NULL,
/* these are pseudo-types. a finished AST will never have these nodes in
* it, but they are necessary to identifier AST parsers that will
* produce nodes of other, related types. */
@@ -91,7 +97,7 @@ struct ivy_ast_op_node {
struct ivy_ast_node *n_right;
};
struct ivy_ast_var_node {
struct ivy_ast_global_node {
struct ivy_ast_node n_base;
/* could be a simple ident, a tuple, etc */
struct ivy_ast_node *n_left;
@@ -247,6 +253,14 @@ struct ivy_ast_while_loop_node {
struct ivy_ast_node *n_body;
};
struct ivy_ast_loop_break_node {
struct ivy_ast_node n_base;
};
struct ivy_ast_loop_repeat_node {
struct ivy_ast_node n_base;
};
struct ivy_ast_cascade_node {
struct ivy_ast_node n_base;
struct ivy_ast_node *n_recipient;
@@ -344,6 +358,7 @@ IVY_API struct ivy_ast_node *ivy_parser_dequeue_node(struct ivy_parser *parser);
IVY_API enum ivy_status ivy_parser_push_token(
struct ivy_parser *parser, struct ivy_token *tok);
IVY_API enum ivy_status ivy_parser_push_eof(struct ivy_parser *parser);
IVY_API struct ivy_ast_node *ivy_ast_node_create(enum ivy_ast_node_type type);
IVY_API enum ivy_status ivy_ast_node_iterate(