lang: ast: implement caret (return) parsing
This commit is contained in:
19
lang/ast/return.c
Normal file
19
lang/ast/return.c
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "ctx.h"
|
||||
#include "iterate.h"
|
||||
#include "node.h"
|
||||
|
||||
static void collect_children(
|
||||
struct ivy_ast_node *node, struct ivy_ast_node_iterator *iterator)
|
||||
{
|
||||
struct ivy_ast_return_node *ret = (struct ivy_ast_return_node *)node;
|
||||
|
||||
if (ret->n_val) {
|
||||
ast_node_iterator_enqueue_node(iterator, node, ret->n_val);
|
||||
}
|
||||
}
|
||||
|
||||
struct ast_node_type return_node_ops = {
|
||||
.n_collect_children = collect_children,
|
||||
.n_state_size = sizeof(struct parser_state),
|
||||
.n_node_size = sizeof(struct ivy_ast_return_node),
|
||||
};
|
||||
Reference in New Issue
Block a user