diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2023-11-29 18:50:46 -0500 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2023-11-29 18:50:46 -0500 |
commit | e14a02dcc1d0ec444d9c667233893431bdf0bdee (patch) | |
tree | a87ef2f3a068c127c218d0e24fa802894a2251d8 | |
parent | 931e67e722e3ec17313a7f78c443eaba066f37b7 (diff) |
define find_closing func (not done)
-rw-r--r-- | compiler.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -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; |