|
BFC-Compiler
A C23 Brainfuck compiler
|
Error construction and diagnostic rendering. More...
#include "bfc_error.h"#include <inttypes.h>#include <math.h>#include <stdarg.h>#include <stddef.h>#include <stdio.h>#include <stdlib.h>#include "bfc_io.h"Macros | |
| #define | X(name) |
Functions | |
| bfc_error_t | bfc_make_errorf (bfc_err_code_t error_code, const char *format,...) |
| Builds a formatted error without source-token context. | |
| bfc_error_t | bfc_make_errorf_with_token (bfc_err_code_t error_code, bfc_token_t token, const char *format,...) |
| Builds a formatted error associated with a source token. | |
| bfc_error_t | bfc_make_error (bfc_err_code_t const error_code, char const *msg) |
| Builds an error by copying a plain message. | |
| bfc_error_t | bfc_make_error_with_token (bfc_err_code_t const error_code, char const *msg, bfc_token_t const token) |
| Builds a token-associated error by copying a plain message. | |
| char const * | bfc_get_error_code (bfc_err_code_t const error_code) |
| Maps an error enumeration value to its symbolic name. | |
| void | bfc_log_error (bfc_error_t const err, const struct bfc_program_t *const program) |
| Prints a colourized diagnostic and optional source-line context. | |
Error construction and diagnostic rendering.
Formats compiler errors and prints source-context diagnostics for bracket failures.
| #define X | ( | name | ) |
|
nodiscard |
Maps an error enumeration value to its symbolic name.
Returns the symbolic name of an error code.
Maps an error enumeration value to its symbolic name.
| void bfc_log_error | ( | bfc_error_t | err, |
| const struct bfc_program_t * | program ) |
Prints a colourized diagnostic and optional source-line context.
Prints a user-facing compiler diagnostic to standard error.
Prints a colourized diagnostic and optional source-line context.
| [in] | err | Error to report. |
| [in] | program | Loaded source program, used for source-context diagnostics. |
| bfc_error_t bfc_make_error | ( | bfc_err_code_t const | error_code, |
| char const * | msg ) |
Builds an error by copying a plain message.
Creates an error by copying an existing message string.
Builds an error by copying a plain message.
| bfc_error_t bfc_make_error_with_token | ( | bfc_err_code_t const | error_code, |
| char const * | msg, | ||
| bfc_token_t const | token ) |
Builds a token-associated error by copying a plain message.
Creates a token-associated error by copying an existing message string.
Builds a token-associated error by copying a plain message.
| bfc_error_t bfc_make_errorf | ( | bfc_err_code_t | error_code, |
| const char * | format, | ||
| ... ) |
Builds a formatted error without source-token context.
Creates an error using printf-style formatting.
Builds a formatted error without source-token context.
| [in] | error_code | Error category. |
| [in] | format | Format string followed by matching arguments. |
| bfc_error_t bfc_make_errorf_with_token | ( | bfc_err_code_t | error_code, |
| bfc_token_t | token, | ||
| const char * | format, | ||
| ... ) |
Builds a formatted error associated with a source token.
Creates a source-associated formatted error.
Builds a formatted error associated with a source token.
| [in] | error_code | Error category. |
| [in] | token | Source token associated with the failure. |
| [in] | format | Format string followed by matching arguments. |