diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-02-18 23:05:50 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-02-18 23:05:50 +0200 |
| commit | b8eb76ef8efb2b000cb53d4d92d0c0df509cbdb8 (patch) | |
| tree | e928c8b6a4117cc5d683f27350866b54d26aba12 /include | |
| parent | c62ce7a940a4d90e2b7bd8699bdfdb79f0331507 (diff) | |
| download | ek-b8eb76ef8efb2b000cb53d4d92d0c0df509cbdb8.tar.gz ek-b8eb76ef8efb2b000cb53d4d92d0c0df509cbdb8.zip | |
implement some basic generic features
Diffstat (limited to 'include')
| -rw-r--r-- | include/ek/ast.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/ek/ast.h b/include/ek/ast.h index 211a6a0..ab727eb 100644 --- a/include/ek/ast.h +++ b/include/ek/ast.h @@ -542,7 +542,7 @@ struct ast_return { }; enum ast_primitive { - AST_VOID, AST_I9, AST_I27 + AST_VOID, AST_BOOL, AST_I9, AST_I27, AST_STR }; /** @@ -579,6 +579,8 @@ struct ast_type { struct { enum ast_primitive type; + struct ast_node *def; // for possible user defined + // member functions } _primitive; /** Array type. */ @@ -1013,7 +1015,7 @@ struct ast_node *gen_switch(struct ast_node *cond, struct ast_node *cases, struc */ struct ast_node *gen_case(struct ast_node *expr, struct ast_node *body, struct src_loc loc); -struct ast_node *gen_primitive(enum ast_primitive type, struct src_loc loc); +struct ast_node *gen_primitive(enum ast_primitive type, struct ast_node *def, struct src_loc loc); /** * Generate Ek type (besides primitive). * @@ -1315,4 +1317,7 @@ int same_id(struct ast_node *id1, struct ast_node *id2); int equiv_nodes(struct ast_node *n1, struct ast_node *n2); int equiv_node_chains(struct ast_node *c1, struct ast_node *c2); +#define foreach_node(iter, nodes)\ + for (struct ast_node *iter = nodes; iter; iter = iter->next) + #endif /* AST_H */ |
