Luma 0.1.0
A low-level compiled alternative to C, C++, and more!
Loading...
Searching...
No Matches
error.h
Go to the documentation of this file.
1
10#pragma once
11
12#include <stdbool.h>
13
14#include "../../lexer/lexer.h"
15#include "../memory/memory.h"
16
33typedef struct {
34 const char *error_type;
35 const char *file_path;
36 const char *message;
37
38 int line;
39 int col;
40
41 const char *line_text; // Optional: source line text
43
44 const char *label; // optional
45 const char *note; // optional
46 const char *help; // optional
48
62const char *generate_line(ArenaAllocator *arena, Token *tokens, int token_count,
63 int target_line);
64
70int error_get_count(void);
71
79
85bool error_has_errors(void);
86
95
101bool error_report(void);
102
108void error_clear(void);
ErrorInformation * error_get_at_index(int index)
Gets the error at the specified index.
Definition error.c:343
void error_clear(void)
Clears all accumulated errors.
Definition error.c:78
void error_add(ErrorInformation err)
Adds a new error to the internal error list.
Definition error.c:69
bool error_report(void)
Reports all accumulated errors to stderr or appropriate output.
Definition error.c:250
const char * generate_line(ArenaAllocator *arena, Token *tokens, int token_count, int target_line)
Generates the source code line text for a given line number.
Definition error.c:27
bool error_has_errors(void)
Checks if there are any errors.
Definition error.c:338
int error_get_count(void)
Gets the current error count.
Definition error.c:333
Arena allocator structure.
Definition memory.h:101
Stores detailed information about an error.
Definition error.h:33
int token_length
Definition error.h:42
const char * label
Definition error.h:44
const char * message
Definition error.h:36
const char * note
Definition error.h:45
const char * line_text
Definition error.h:41
const char * error_type
Definition error.h:34
int line
Definition error.h:38
const char * file_path
Definition error.h:35
int col
Definition error.h:39
const char * help
Definition error.h:46
Represents a single token extracted by the lexer.
Definition lexer.h:151