#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "error.h"
#include "frontend/lexer/loc.h"
#include "util/abort.h"
#include "../libtermcolor/include/termcolor.h"
#include "enum/make.h"
#include "error_scope.h"
#include "error_codes.h"
Go to the source code of this file.
|
| bool | ps_is_loc_none (const struct ps_loc *loc) |
| |
| void | ps_error (enum ps_error_scope scope, short code, const char *file_source, struct ps_loc loc, usize length, const char *message, const char *explain, const char *fix) |
| | Reports an error with the given domain scope and error code code to the error reporting system.
|
| |
| void | ps_fprint_error (FILE *stream, struct ps_error *err) |
| | Displays the err on the given output stream stream.
|
| |
| void | ps_fprint_errors (FILE *stream) |
| | Prints all errors in the error-reporting system to the given output stream stream.
|
| |
| usize | ps_error_count (void) |
| | The number of errors that have been reported in the error reporting system.
|
| |
◆ _PRINTF
| #define _PRINTF |
( |
|
... | ) |
tcol_fprintf(stream, __VA_ARGS__) |
◆ _PRINTF_FST
| #define _PRINTF_FST |
( |
|
... | ) |
fprintf(stream, __VA_ARGS__) |
◆ _PUTCHR
| #define _PUTCHR |
( |
|
__c | ) |
fputc(__c, stream) |
◆ ENUM [1/3]
◆ ENUM [2/3]
◆ ENUM [3/3]
◆ N_COLORS_STORABLE
| #define N_COLORS_STORABLE 20 |
◆ N_ESTIMATED_MAX_COLOR_LENGTH
| #define N_ESTIMATED_MAX_COLOR_LENGTH 24 |
◆ ps_error()
| void ps_error |
( |
enum ps_error_scope |
scope, |
|
|
short |
code, |
|
|
const char * |
file_source, |
|
|
struct ps_loc |
loc, |
|
|
usize |
length, |
|
|
const char * |
message, |
|
|
const char * |
explain, |
|
|
const char * |
fix |
|
) |
| |
Reports an error with the given domain scope and error code code to the error reporting system.
- Provide the
file_source, loc and length of the error so that the output is formatted nicely.
message describes the content of the error.
explain provides further information on why the error occured.
fix suggest ways to amend the error. You may redefine these semantics in from the user perspective as desired, but they will always be formatted the same way. - See also
- ps_fprint_errors
Definition at line 82 of file error.c.
◆ ps_error_count()
| usize ps_error_count |
( |
void |
| ) |
|
The number of errors that have been reported in the error reporting system.
Definition at line 240 of file error.c.
◆ ps_fprint_error()
| void ps_fprint_error |
( |
FILE * |
stream, |
|
|
struct ps_error * |
err |
|
) |
| |
Displays the err on the given output stream stream.
Definition at line 208 of file error.c.
◆ ps_fprint_errors()
| void ps_fprint_errors |
( |
FILE * |
stream | ) |
|
Prints all errors in the error-reporting system to the given output stream stream.
There should never be more than PS_MAX_ERRORS reported before a call to ps_fprint_errors is used to flush the error buffer.
Definition at line 215 of file error.c.
◆ ps_is_loc_none()
| bool ps_is_loc_none |
( |
const struct ps_loc * |
loc | ) |
|
Definition at line 20 of file loc.c.