9 #define CTU_EVENT(name, ...) const diagnostic_t kEvent_##name = __VA_ARGS__;
15 #define CTU_EVENT(name, ...) &kEvent_##name,
19 #define DIAGNOTSIC_COUNT (sizeof(kDiagnosticTable) / sizeof(diagnostic_t*))
35 msg_notify(logger, &kEvent_ParseFailed, node,
"%s", msg);
53 event_builder_t event =
msg_notify(logger, &kEvent_SymbolShadowed, next,
"symbol `%s` shadows previous declaration", name);
54 msg_append(event, prev,
"previous declaration here");
66 return msg_notify(logger, diagnostic, NULL,
"%s: %s", msg, err);
CT_NODISCARD CT_PUREFN CT_SCAN_API arena_t * scan_get_arena(const scan_t *scan)
get the arena of a scanner
CT_NODISCARD STA_RET_STRING CT_OS_API char * os_error_string(os_error_t error, arena_t *arena)
convert an os error code to a string
#define STA_DECL
sal2 annotation on function implementations to copy annotations from the declaration
STA_DECL void evt_scan_unknown(logger_t *logger, const node_t *node, const char *msg)
signal that a scanner has encountered an unknown token
STA_DECL diagnostic_list_t get_common_diagnostics(void)
get all common diagnostics
STA_DECL event_builder_t evt_os_error(logger_t *logger, const diagnostic_t *diagnostic, os_error_t error, const char *msg)
signal that an os error has occurred
STA_DECL event_builder_t evt_symbol_shadowed(logger_t *logger, const char *name, const node_t *prev, const node_t *next)
signal that a declaration would shadow a previous declaration
STA_DECL void evt_scan_error(logger_t *logger, const node_t *node, const char *msg)
signal that a scan error has occurred
CT_NODISCARD CT_PUREFN CT_SCAN_API const scan_t * node_get_scan(const node_t *node)
get the associated source file of a node
CT_NOTIFY_API event_builder_t msg_notify(INOUT_NOTNULL logger_t *logs, const diagnostic_t *diagnostic, const node_t *node, STA_FORMAT_STRING const char *fmt,...)
notify the logger of a new message
CT_NOTIFY_API void msg_append(event_builder_t builder, const node_t *node, STA_FORMAT_STRING const char *fmt,...)
append additional information to a message
CT_NODISCARD CT_NOTIFY_API arena_t * logger_get_arena(const logger_t *logs)
CT_NODISCARD CT_STD_API char * str_normalize(const char *str, arena_t *arena)
turn a string into a C string literal
const diagnostic_t *const * diagnostics
the list of diagnostics
an event builder handles adding additional information to an event
a position in a source file