#include "errors.h" static const char* error_msgs[] = { [ERR_UNKNOWN] = "error: something unexpected happened", [ERR_UNMATCHED_STRING] = "error: unmatched string delimiter", [ERR_UNBALANCED_PAREN] = "error: unbalanced parentheses", [ERR_NOT_IMPLEMENTED] = "error: not implemented", [ERR_EOF_REACHED] = "error: EOF reached", [ERR_UNKNOWN_TOKEN] = "error: unknown token", [ERR_UNKNOWN_OBJ_TYPE] = "error: can't eval unknown object type", [ERR_NOT_A_SYMBOL] = "error: object is not a symbol", [ERR_SYMBOL_NOT_FOUND] = "error: symbol not found", [ERR_OBJ_NOT_CALLABLE] = "error: object is not callable", [ERR_NOT_ENOUGH_ARGS] = "error: not enough arguments", [ERR_TOO_MANY_ARGS] = "error: too many arguments", [ERR_WRONG_ARG_TYPE] = "error: wrong argument type", [ERR_DIVISION_BY_ZERO] = "error: division by zero", }; static Error errors[ERR_MAX_NUMBER]; static size_t errors_n = 0; static bool supress_errors = false; void error_push(Error error) { if (errors_n < ERR_MAX_NUMBER) { errors[errors_n++] = error; } }