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:
@@ -10,7 +10,8 @@ struct unit_import_parser_state {
|
||||
int s_prev_token;
|
||||
};
|
||||
|
||||
static struct token_parse_result parse_dot(struct ivy_parser *ctx, struct ivy_token *tok)
|
||||
static struct token_parse_result parse_dot(
|
||||
struct ivy_parser *ctx, struct ivy_token *tok)
|
||||
{
|
||||
struct unit_import_parser_state *state
|
||||
= parser_get_state(ctx, struct unit_import_parser_state);
|
||||
@@ -56,12 +57,6 @@ static struct token_parse_result parse_linefeed(
|
||||
return PARSE_RESULT(IVY_OK, 0);
|
||||
}
|
||||
|
||||
static enum ivy_status add_child(
|
||||
struct ivy_ast_node *parent, struct ivy_ast_node *child)
|
||||
{
|
||||
return IVY_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
static void print(struct ivy_ast_node *node)
|
||||
{
|
||||
struct ivy_ast_unit_import_node *unit_import
|
||||
@@ -93,7 +88,6 @@ static void init_state(struct ivy_parser *ctx, struct parser_state *sp)
|
||||
}
|
||||
|
||||
struct ast_node_type unit_import_node_ops = {
|
||||
.n_add_child = add_child,
|
||||
.n_print = print,
|
||||
.n_init_state = init_state,
|
||||
.n_state_size = sizeof(struct unit_import_parser_state),
|
||||
|
||||
Reference in New Issue
Block a user