Function headers, ANSI defines, and enums for raising internal warnings and errors.
More...
Go to the source code of this file.
|
struct | LogInfo |
| Maps LogLevels to text and color for displaying. More...
|
|
|
enum | LogLevel {
LOG_NONE
, LOG_DEBUG
, LOG_INFO
, LOG_WARNING
,
LOG_ERROR
, LOG_CRITICAL
} |
| Severity levels of logging statements emitted by the compiler. More...
|
|
enum | ReturnCode {
RC_OK
, RC_ERROR
, RC_SYNTAX_ERROR
, RC_MEMORY_ERROR
,
RC_FILE_ERROR
, RC_COMPILER_ERROR
, RC_IDENTIFIER_ERROR
, RC_ARG_ERROR
} |
| Return codes used in different scenarios. More...
|
|
|
void | fatal (ReturnCode rc, const char *fmt,...) |
| Raises a fatal error that will exit the compiler. More...
|
|
void | syntax_error (char *fn, int line_number, int char_number, const char *fmt,...) |
| Raises a fatal syntax error. More...
|
|
void | identifier_error (char *fn, int line_number, int char_number, const char *fmt,...) |
| Raises a fatal identifier error. More...
|
|
void | purple_log (LogLevel level, const char *fmt,...) |
| Raises a non-fatal logging statement. More...
|
|
Function headers, ANSI defines, and enums for raising internal warnings and errors.
- Author
- Charles Averill
- Date
- 08-Sep-2022
◆ ANSI_BOLD
#define ANSI_BOLD "\033[1m" |
◆ ANSI_ORANGE
#define ANSI_ORANGE "\033[38:5:208m" |
ANSI code for orange text
◆ ANSI_RED
#define ANSI_RED "\033[38:5:196m" |
◆ ANSI_RESET
#define ANSI_RESET "\033[0m" |
ANSI code for default text style
◆ ANSI_YELLOW
#define ANSI_YELLOW "\033[38:5:178m" |
ANSI code for yellow text
◆ ERROR_ORANGE
Combination of ANSI codes for orange errors
◆ ERROR_RED
Combination of ANSI codes for red errors
◆ ERROR_YELLOW
Combination of ANSI codes for yellow errors
◆ LogLevel
Severity levels of logging statements emitted by the compiler.
Enumerator |
---|
LOG_NONE | |
LOG_DEBUG | |
LOG_INFO | |
LOG_WARNING | |
LOG_ERROR | |
LOG_CRITICAL | |
◆ ReturnCode
Return codes used in different scenarios.
Enumerator |
---|
RC_OK | |
RC_ERROR | |
RC_SYNTAX_ERROR | |
RC_MEMORY_ERROR | |
RC_FILE_ERROR | |
RC_COMPILER_ERROR | |
RC_IDENTIFIER_ERROR | |
RC_ARG_ERROR | |
◆ fatal()
void fatal |
( |
ReturnCode |
rc, |
|
|
const char * |
fmt, |
|
|
|
... |
|
) |
| |
Raises a fatal error that will exit the compiler.
- Parameters
-
rc | Return code to exit with |
fmt | Format string for printed error |
... | Varargs for printed error |
◆ identifier_error()
void identifier_error |
( |
char * |
fn, |
|
|
int |
line_number, |
|
|
int |
char_number, |
|
|
const char * |
fmt, |
|
|
|
... |
|
) |
| |
Raises a fatal identifier error.
- Parameters
-
fn | Filename in which identifier error occurs |
line_number | Line number on which identifier error occurs |
char_number | Character numbre on which syntax error occurs |
fmt | Format string for details printed before fatal error |
... | Varargs for details printed before fatal error |
◆ purple_log()
void purple_log |
( |
LogLevel |
level, |
|
|
const char * |
fmt, |
|
|
|
... |
|
) |
| |
Raises a non-fatal logging statement.
- Parameters
-
level | Severity of statement |
fmt | Format string for printed statement |
... | Varargs for printed statement |
◆ syntax_error()
void syntax_error |
( |
char * |
fn, |
|
|
int |
line_number, |
|
|
int |
char_number, |
|
|
const char * |
fmt, |
|
|
|
... |
|
) |
| |
Raises a fatal syntax error.
- Parameters
-
fn | Filename in which syntax error occurs |
line_number | Line number on which syntax error occurs |
char_number | Character numbre on which syntax error occurs |
fmt | Format string for details printed before fatal error |
... | Varargs for details printed before fatal error |
◆ logInfoLevels
Initial value:= {
#define ANSI_BOLD
Definition: logging.h:14
#define ANSI_ORANGE
Definition: logging.h:18
#define ANSI_RED
Definition: logging.h:16
@ LOG_CRITICAL
Definition: logging.h:41
@ LOG_ERROR
Definition: logging.h:40
@ LOG_INFO
Definition: logging.h:38
@ LOG_NONE
Definition: logging.h:36
@ LOG_WARNING
Definition: logging.h:39
@ LOG_DEBUG
Definition: logging.h:37
#define ANSI_YELLOW
Definition: logging.h:20
#define ANSI_RESET
Definition: logging.h:22
Collection of LogInfos for standard logging purposes.
◆ returnCodeStrings
const char* returnCodeStrings[] |
|
static |
Initial value:= {
"OK", "ERROR", "SYNTAX ERROR", "MEMORY ERROR",
"FILE ERROR", "COMPILER ERROR", "IDENTIFIER ERROR", "ARGUMENT ERROR"}
String representation of return codes.