lang: ast: add diag for do keyword in inline for-loop

This commit is contained in:
2025-05-08 22:32:23 +01:00
parent 5f560d28a7
commit b89c3bedc5
3 changed files with 32 additions and 0 deletions

View File

@@ -8,12 +8,20 @@
static const struct ivy_diag_class diag_classes[] = {
ERROR_CLASS(IVY_LANG_E_UNRECOGNISED_SYMBOL, "Unrecognised symbol"),
ERROR_CLASS(
IVY_LANG_E_INCORRECT_INLINE_FOR_LOOP,
"Incorrect inline for-loop"),
};
static const size_t nr_diag_classes = sizeof diag_classes / sizeof diag_classes[0];
static const struct ivy_diag_msg diag_msg[] = {
MSG(IVY_LANG_MSG_UNKNOWN_SYMBOL_ENCOUNTERED,
"encountered a symbol that is not part of the Ivy syntax."),
MSG(IVY_LANG_MSG_DO_UNEXPECTED_IN_INLINE_FOR,
"`[yellow]do[reset]` is not used in inline for-loops."),
MSG(IVY_LANG_MSG_PREVIOUS_EXPRESSION_IS_FOR_BODY,
"the previous expression is used as the for-loop body. perhaps you "
"forgot a [blue]statement separator[reset]?"),
};
static const size_t nr_diag_msg = sizeof diag_msg / sizeof diag_msg[0];