diff options
author | c | 2024-04-27 09:59:47 -0400 |
---|---|---|
committer | c | 2024-04-27 09:59:47 -0400 |
commit | fc7edb22079845ccd548e2034ff7193ca54f47ea (patch) | |
tree | a692c1e8c280186b0a74d73761067341b1886886 /src/tree.c | |
parent | 44d1f80279000efddbd8f24108f33297a9d2ad52 (diff) |
Doer things.
Diffstat (limited to 'src/tree.c')
-rw-r--r-- | src/tree.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -229,6 +229,28 @@ void tree_swp_call(tree_t* t0, tree_t* t1) { } } +int tree_type_str(tree_type_t tree_type, char* str) { + switch (tree_type) { + case TREE_TYPE_LINT: + return !strcmp("int", str); + case TREE_TYPE_LSTR: + return !strcmp("str", str); + default: + DIE("Invalid primitive type."); + } +} + +char* tree_type2str(tree_type_t tree_type) { + switch (tree_type) { + case TREE_TYPE_LINT: + return "int"; + case TREE_TYPE_LSTR: + return "str"; + default: + DIE("Invalid primitive type."); + } +} + /* Every time I think there's a problem with the parser, it turns out it's just this stupid tree print function. Now it works. Never touching it |