lang: ast: re-write expression parser to support keyword messages

also adjust some parser state callbackss to better support sub-parsers returning
 results to their parents.
This commit is contained in:
2024-12-02 07:56:27 +00:00
parent 1c73e1d37b
commit 1c5b23d968
11 changed files with 605 additions and 613 deletions

View File

@@ -170,24 +170,6 @@ struct ivy_ast_node *ast_node_create(enum ivy_ast_node_type type)
return node;
}
enum ivy_status ast_node_add_child(
struct ivy_ast_node *parent, struct ivy_ast_node *child)
{
const struct ast_node_type *ops = get_ast_node_type(parent->n_type);
if (!ops) {
return IVY_ERR_NOT_SUPPORTED;
}
enum ivy_status (*add_child)(struct ivy_ast_node *, struct ivy_ast_node *)
= ops->n_add_child;
if (!add_child) {
return IVY_ERR_NOT_SUPPORTED;
}
return add_child(parent, child);
}
static enum ivy_status node_print(
struct ivy_ast_node *node, struct ivy_ast_node_iterator *it)
{