aboutsummaryrefslogtreecommitdiff
path: root/src/tree.c
diff options
context:
space:
mode:
authorc2024-04-27 09:59:47 -0400
committerc2024-04-27 09:59:47 -0400
commitfc7edb22079845ccd548e2034ff7193ca54f47ea (patch)
treea692c1e8c280186b0a74d73761067341b1886886 /src/tree.c
parent44d1f80279000efddbd8f24108f33297a9d2ad52 (diff)
Doer things.
Diffstat (limited to 'src/tree.c')
-rw-r--r--src/tree.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/tree.c b/src/tree.c
index 35c8a3f..916936d 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -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