lang: add a diag for missing whitespace around a binary op
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
static const struct ivy_diag_class diag_classes[] = {
|
static const struct ivy_diag_class diag_classes[] = {
|
||||||
ERROR_CLASS(IVY_LANG_E_UNRECOGNISED_SYMBOL, "Unrecognised symbol"),
|
ERROR_CLASS(IVY_LANG_E_UNRECOGNISED_SYMBOL, "Unrecognised symbol"),
|
||||||
|
ERROR_CLASS(IVY_LANG_E_MISSING_WHITESPACE, "Missing whitespace"),
|
||||||
ERROR_CLASS(IVY_LANG_E_UNDEFINED_VARIABLE, "Undefined variable"),
|
ERROR_CLASS(IVY_LANG_E_UNDEFINED_VARIABLE, "Undefined variable"),
|
||||||
ERROR_CLASS(
|
ERROR_CLASS(
|
||||||
IVY_LANG_E_INCORRECT_INLINE_FOR_LOOP,
|
IVY_LANG_E_INCORRECT_INLINE_FOR_LOOP,
|
||||||
@@ -18,6 +19,9 @@ static const size_t nr_diag_classes = sizeof diag_classes / sizeof diag_classes[
|
|||||||
static const struct ivy_diag_msg diag_msg[] = {
|
static const struct ivy_diag_msg diag_msg[] = {
|
||||||
MSG(IVY_LANG_MSG_UNKNOWN_SYMBOL_ENCOUNTERED,
|
MSG(IVY_LANG_MSG_UNKNOWN_SYMBOL_ENCOUNTERED,
|
||||||
"encountered a symbol that is not part of the Ivy syntax."),
|
"encountered a symbol that is not part of the Ivy syntax."),
|
||||||
|
MSG(IVY_LANG_MSG_WHITESPACE_REQUIRED_AROUND_BINARY_OP,
|
||||||
|
"There must be a space between a binary operator and its "
|
||||||
|
"operands."),
|
||||||
MSG(IVY_LANG_MSG_ASSIGN_TO_UNDEFINED_VARIABLE,
|
MSG(IVY_LANG_MSG_ASSIGN_TO_UNDEFINED_VARIABLE,
|
||||||
"cannot use modify-and-assign operator on an undefined variable."),
|
"cannot use modify-and-assign operator on an undefined variable."),
|
||||||
MSG(IVY_LANG_MSG_DO_UNEXPECTED_IN_INLINE_FOR,
|
MSG(IVY_LANG_MSG_DO_UNEXPECTED_IN_INLINE_FOR,
|
||||||
|
|||||||
@@ -8,14 +8,16 @@ struct ivy_diag_ctx;
|
|||||||
enum ivy_lang_diag_code {
|
enum ivy_lang_diag_code {
|
||||||
IVY_LANG_E_NONE = 0,
|
IVY_LANG_E_NONE = 0,
|
||||||
IVY_LANG_E_UNRECOGNISED_SYMBOL,
|
IVY_LANG_E_UNRECOGNISED_SYMBOL,
|
||||||
|
IVY_LANG_E_MISSING_WHITESPACE,
|
||||||
IVY_LANG_E_UNDEFINED_VARIABLE,
|
IVY_LANG_E_UNDEFINED_VARIABLE,
|
||||||
IVY_LANG_E_INCORRECT_INLINE_FOR_LOOP,
|
IVY_LANG_E_INCORRECT_INLINE_FOR_LOOP,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ivy_lang_diag_msg {
|
enum ivy_lang_diag_msg {
|
||||||
IVY_LANG_MSG_NONE = 0,
|
IVY_LANG_MSG_NONE = 0,
|
||||||
IVY_LANG_MSG_ASSIGN_TO_UNDEFINED_VARIABLE,
|
|
||||||
IVY_LANG_MSG_UNKNOWN_SYMBOL_ENCOUNTERED,
|
IVY_LANG_MSG_UNKNOWN_SYMBOL_ENCOUNTERED,
|
||||||
|
IVY_LANG_MSG_WHITESPACE_REQUIRED_AROUND_BINARY_OP,
|
||||||
|
IVY_LANG_MSG_ASSIGN_TO_UNDEFINED_VARIABLE,
|
||||||
IVY_LANG_MSG_DO_UNEXPECTED_IN_INLINE_FOR,
|
IVY_LANG_MSG_DO_UNEXPECTED_IN_INLINE_FOR,
|
||||||
IVY_LANG_MSG_PREVIOUS_EXPRESSION_IS_FOR_BODY,
|
IVY_LANG_MSG_PREVIOUS_EXPRESSION_IS_FOR_BODY,
|
||||||
IVY_LANG_MSG_DECLARE_GLOBAL_FOR_ASSIGNMENT,
|
IVY_LANG_MSG_DECLARE_GLOBAL_FOR_ASSIGNMENT,
|
||||||
|
|||||||
Reference in New Issue
Block a user