summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/compiler.c b/compiler.c
index 8b67a1e..8aac480 100644
--- a/compiler.c
+++ b/compiler.c
@@ -5035,6 +5035,36 @@ void p2_compile_control(Scope *s, CompData *out, Vector *tokens, size_t *pos, Ve
return;
}
+ *pos += 1;
+ t = vect_get(tokens, *pos);
+
+ if (tok_str_eq(t, "loop")) {
+ } else if (t->type != TT_KEYWORD) {
+ printf("ERROR: Expected control block type ('loop' or 'if'), found \"%s\" (%d:%d)\n", t->data, t->line, t->col);
+ p2_error = true;
+ *pos = end;
+ return;
+ } else {
+ // if block
+ }
+
+ int build = -1;
+ int rep = -1;
+ for (*pos += 1; *pos < end; *pos += 1) {
+ t = vect_get(tokens, *pos);
+
+ if (tok_str_eq(t, "(")) {
+ build = *pos;
+ *pos = tnsl_find_closing(tokens, *pos);
+ } else if (tok_str_eq(t, "[")) {
+ rep = *pos;
+ *pos = tnsl_find_closing(tokens, *pos);
+ } else {
+ break;
+ }
+ }
+
+
}
// Handles the 'self' variable in the case where the function is in a method block.
@@ -5216,6 +5246,9 @@ void p2_compile_function(Module *root, CompData *out, Vector *tokens, size_t *po
vect_push_string(&out->text, "; User insert asm\n");
vect_end(&asm_str);
}
+ } else {
+ printf("ERROR: Keyword not implemented inside functions \"%s\" (%d:%d)\n", t->data, t->line, t->col);
+ p2_error = true;
}
} else if (tnsl_is_def(tokens, *pos)) {
p2_compile_def(&fs, out, tokens, pos, &p_list);