14#define ANSI_BOLD "\033[1m"
16#define ANSI_RED "\033[38:5:196m"
18#define ANSI_ORANGE "\033[38:5:208m"
20#define ANSI_YELLOW "\033[38:5:178m"
22#define ANSI_RESET "\033[0m"
25#define ERROR_RED ANSI_RED ANSI_BOLD
27#define ERROR_ORANGE ANSI_ORANGE ANSI_BOLD
29#define ERROR_YELLOW ANSI_YELLOW ANSI_BOLD
83 "OK",
"ERROR",
"SYNTAX ERROR",
"MEMORY ERROR",
84 "FILE ERROR",
"COMPILER ERROR",
"IDENTIFIER ERROR",
"ARGUMENT ERROR"};
87void syntax_error(
char* fn,
int line_number,
int char_number,
const char* fmt, ...);
88void identifier_error(
char* fn,
int line_number,
int char_number,
const char* fmt, ...);
void identifier_error(char *fn, int line_number, int char_number, const char *fmt,...)
Raises a fatal identifier error.
Definition: logging.c:84
void fatal(ReturnCode rc, const char *fmt,...)
Raises a fatal error that will exit the compiler.
Definition: logging.c:22
#define ANSI_BOLD
Definition: logging.h:14
static const LogInfo logInfoLevels[]
Collection of LogInfos for standard logging purposes.
Definition: logging.h:59
ReturnCode
Return codes used in different scenarios.
Definition: logging.h:68
@ RC_ARG_ERROR
Definition: logging.h:76
@ RC_IDENTIFIER_ERROR
Definition: logging.h:75
@ RC_FILE_ERROR
Definition: logging.h:73
@ RC_MEMORY_ERROR
Definition: logging.h:72
@ RC_COMPILER_ERROR
Definition: logging.h:74
@ RC_ERROR
Definition: logging.h:70
@ RC_OK
Definition: logging.h:69
@ RC_SYNTAX_ERROR
Definition: logging.h:71
#define ANSI_ORANGE
Definition: logging.h:18
#define ANSI_RED
Definition: logging.h:16
void purple_log(LogLevel level, const char *fmt,...)
Raises a non-fatal logging statement.
Definition: logging.c:118
static const char * returnCodeStrings[]
String representation of return codes.
Definition: logging.h:82
void syntax_error(char *fn, int line_number, int char_number, const char *fmt,...)
Raises a fatal syntax error.
Definition: logging.c:48
LogLevel
Severity levels of logging statements emitted by the compiler.
Definition: logging.h:35
@ 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
Function headers for shutting down the compiler.
Maps LogLevels to text and color for displaying.
Definition: logging.h:47
char * color
Definition: logging.h:53
LogLevel level
Definition: logging.h:49
char * name
Definition: logging.h:51