29 lines
584 B
C
29 lines
584 B
C
|
|
#include "ctx.h"
|
||
|
|
#include "node.h"
|
||
|
|
|
||
|
|
#include <blue/object/string.h>
|
||
|
|
#include <ivy/lang/lex.h>
|
||
|
|
|
||
|
|
struct expr_parser_state {
|
||
|
|
struct parser_state s_base;
|
||
|
|
};
|
||
|
|
|
||
|
|
static enum ivy_status add_child(
|
||
|
|
struct ivy_ast_node *parent, struct ivy_ast_node *child)
|
||
|
|
{
|
||
|
|
struct ivy_ast_expr_node *c = (struct ivy_ast_expr_node *)parent;
|
||
|
|
|
||
|
|
if (!c->n_child) {
|
||
|
|
c->n_child = child;
|
||
|
|
return IVY_OK;
|
||
|
|
}
|
||
|
|
|
||
|
|
return IVY_ERR_NOT_SUPPORTED;
|
||
|
|
}
|
||
|
|
|
||
|
|
struct ast_node_type expr_node_ops = {
|
||
|
|
.n_add_child = add_child,
|
||
|
|
.n_state_size = sizeof(struct expr_parser_state),
|
||
|
|
.n_node_size = sizeof(struct ivy_ast_expr_node),
|
||
|
|
};
|