|
Luma 0.1.0
A low-level compiled alternative to C, C++, and more!
|
Error reporting utilities for lexer and parser diagnostics. More...


Go to the source code of this file.
Classes | |
| struct | ErrorInformation |
| Stores detailed information about an error. More... | |
Functions | |
| 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. | |
| int | error_get_count (void) |
| Gets the current error count. | |
| ErrorInformation * | error_get_at_index (int index) |
| Gets the error at the specified index. | |
| bool | error_has_errors (void) |
| Checks if there are any errors. | |
| void | error_add (ErrorInformation err) |
| Adds a new error to the internal error list. | |
| bool | error_report (void) |
| Reports all accumulated errors to stderr or appropriate output. | |
| void | error_clear (void) |
| Clears all accumulated errors. | |
Error reporting utilities for lexer and parser diagnostics.
This module defines an error information struct and functions to add, report, and clear errors, with support for detailed source location and optional notes and help messages.
| void error_add | ( | ErrorInformation | err | ) |
Adds a new error to the internal error list.
The error information is copied or referenced for later reporting.
| err | The error information struct to add. |
Adds a new error to the internal error list.
| void error_clear | ( | void | ) |
Clears all accumulated errors.
Frees any internal storage and resets the error list.
Clears all accumulated errors.
| ErrorInformation * error_get_at_index | ( | int | index | ) |
Gets the error at the specified index.
| index | Index of the error to retrieve (0-based). |
| int error_get_count | ( | void | ) |
Gets the current error count.
| bool error_has_errors | ( | void | ) |
Checks if there are any errors.
| bool error_report | ( | void | ) |
Reports all accumulated errors to stderr or appropriate output.
Reports all accumulated errors to stderr or appropriate output.
| 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.
Uses the provided tokens and copies the line text into memory allocated from the given arena.
| arena | Arena allocator used for string allocation. |
| tokens | Array of tokens representing the source. |
| token_count | Number of tokens in the array. |
| target_line | The line number for which to generate the line text. |
Generates the source code line text for a given line number.