summaryrefslogtreecommitdiff
path: root/compiler.c
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2023-11-29 18:50:46 -0500
committerKyle Gunger <kgunger12@gmail.com>2023-11-29 18:50:46 -0500
commite14a02dcc1d0ec444d9c667233893431bdf0bdee (patch)
treea87ef2f3a068c127c218d0e24fa802894a2251d8 /compiler.c
parent931e67e722e3ec17313a7f78c443eaba066f37b7 (diff)
define find_closing func (not done)
Diffstat (limited to 'compiler.c')
-rw-r--r--compiler.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/compiler.c b/compiler.c
index 37383fa..a5181b1 100644
--- a/compiler.c
+++ b/compiler.c
@@ -819,6 +819,26 @@ bool tnsl_is_boolean() {
return false;
}
+int tnsl_find_closing(Vector *tokens, size_t cur) {
+ char closing = 0;
+
+ Token *check = vect_get(tokens, cur);
+
+ if (tok_str_eq(check, "(")) {
+ closing = ')';
+ } else if (tok_str_eq(check, "[")) {
+ closing = ']';
+ } else if (tok_str_eq(check, "{")) {
+ closing = '}';
+ } else if (tok_str_eq(check, "/;") || tok_str_eq(check, ";;")) {
+ closing = ';';
+ }
+
+ int out = cur;
+
+ return out;
+}
+
// Phase 1 - Module building
bool p1_error = false;