Implement loops #4

Merged
samsonium merged 24 commits from feat-loops into v1.1 2026-10-25 02:01:47 +00:00
Showing only changes of commit 73a2a50a0b - Show all commits
+18 -3
View File
1
@@ -1056,9 +1056,19 @@ fzl_walk_res_t walk(fzl_walker_t *walker, fzl_node_t *node)
if (res != FZL_SYMTABLE_RESULT_OK)
{
fzl_token_t *tok = node->var.identifier->token;
snprintf(wlast_err, sizeof(wlast_err),
"'%s': cannot store '%s' at %ld:%ld", tok->filename,
(char *)tok->value, tok->ln, tok->cn);
if (res == FZL_SYMTABLE_RESULT_EXISTS)
{
snprintf(wlast_err, sizeof(wlast_err),
"'%s': cannot redefine '%s' at %ld:%ld", tok->filename,
(char *)tok->value, tok->ln, tok->cn);
}
else
{
snprintf(wlast_err, sizeof(wlast_err),
"'%s': cannot store '%s' at %ld:%ld", tok->filename,
(char *)tok->value, tok->ln, tok->cn);
}
return (fzl_walk_res_t){.error = true, .error_msg = wlast_err};
}
@@ -1225,6 +1235,11 @@ int fzl_walk(fzl_walker_t *walker)
push_op(walker, FZL_OPCODE_RM_ENVTABLE);
fin_ctx(walker);
if (walker->ctx)
{
while (walker->ctx)
fin_ctx(walker);
}
if (result.error && !wlast_err[0])
snprintf(wlast_err, sizeof(wlast_err), "%s", result.error_msg);