diff --git a/lang/diag.c b/lang/diag.c index 009fcfd..a95a8bb 100644 --- a/lang/diag.c +++ b/lang/diag.c @@ -8,6 +8,7 @@ static const struct ivy_diag_class diag_classes[] = { ERROR_CLASS(IVY_LANG_E_UNRECOGNISED_SYMBOL, "Unrecognised symbol"), + ERROR_CLASS(IVY_LANG_E_UNDEFINED_VARIABLE, "Undefined variable"), ERROR_CLASS( IVY_LANG_E_INCORRECT_INLINE_FOR_LOOP, "Incorrect inline for-loop"), @@ -17,6 +18,8 @@ static const size_t nr_diag_classes = sizeof diag_classes / sizeof diag_classes[ 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_ASSIGN_TO_UNDEFINED_VARIABLE, + "cannot use modify-and-assign operator on an undefined variable."), 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, diff --git a/lang/include/ivy/lang/diag.h b/lang/include/ivy/lang/diag.h index eda974c..e93dc8e 100644 --- a/lang/include/ivy/lang/diag.h +++ b/lang/include/ivy/lang/diag.h @@ -8,14 +8,17 @@ struct ivy_diag_ctx; enum ivy_lang_diag_code { IVY_LANG_E_NONE = 0, IVY_LANG_E_UNRECOGNISED_SYMBOL, + IVY_LANG_E_UNDEFINED_VARIABLE, IVY_LANG_E_INCORRECT_INLINE_FOR_LOOP, }; enum ivy_lang_diag_msg { IVY_LANG_MSG_NONE = 0, + IVY_LANG_MSG_ASSIGN_TO_UNDEFINED_VARIABLE, IVY_LANG_MSG_UNKNOWN_SYMBOL_ENCOUNTERED, IVY_LANG_MSG_DO_UNEXPECTED_IN_INLINE_FOR, IVY_LANG_MSG_PREVIOUS_EXPRESSION_IS_FOR_BODY, + IVY_LANG_MSG_DECLARE_GLOBAL_FOR_ASSIGNMENT, }; IVY_API enum ivy_status ivy_lang_diag_ctx_init(struct ivy_diag_ctx *ctx);