lang: ast: convert RPN expression queue to ast and replace generic EXPR node with it

This commit is contained in:
2024-11-28 22:06:25 +00:00
parent 05ced5d5fc
commit ec24e2c327
8 changed files with 212 additions and 58 deletions

View File

@@ -25,6 +25,13 @@ static struct token_parse_result parse_class_keyword(
return PARSE_RESULT(IVY_OK, 0);
}
static struct token_parse_result parse_expr_begin(
struct ivy_parser *ctx, struct ivy_token *tok)
{
parser_push_state(ctx, IVY_AST_EXPR);
return PARSE_RESULT(IVY_OK, PARSE_REPEAT_TOKEN);
}
static enum ivy_status add_child(
struct ivy_ast_node *parent, struct ivy_ast_node *child)
{
@@ -55,4 +62,7 @@ struct ast_node_type unit_node_ops = {
KW_PARSER(CLASS, parse_class_keyword),
KW_PARSER(USE, parse_use_keyword),
},
.n_expr_parser = {
.expr_begin = parse_expr_begin,
},
};