lang: ast: implement parsing of break/continue loop-control statements

This commit is contained in:
2025-09-08 15:55:12 +01:00
parent 84e52b1649
commit bf250179da
6 changed files with 85 additions and 1 deletions

View File

@@ -110,6 +110,23 @@ enum ivy_status arith_push_operand(
b_queue_push_back(&state->s_output_queue, &v->n_entry);
break;
}
case IVY_TOK_KEYWORD: {
struct ivy_ast_node *v = NULL;
switch (tok->t_keyword) {
case IVY_KW_BREAK:
v = ast_node_create(IVY_AST_LOOP_BREAK);
break;
case IVY_KW_CONTINUE:
v = ast_node_create(IVY_AST_LOOP_REPEAT);
break;
default:
return IVY_ERR_BAD_SYNTAX;
}
ivy_ast_node_set_bounds_from_token((struct ivy_ast_node *)v, tok);
b_queue_push_back(&state->s_output_queue, &v->n_entry);
break;
}
default:
return IVY_ERR_BAD_SYNTAX;
}