Refactor Token to use Location struct
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Location handling for error reporting.
|
||||
*/
|
||||
#ifndef LOCATION_H
|
||||
#define LOCATION_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct {
|
||||
/// @brief The name of the file where the token was found.
|
||||
char* filename;
|
||||
|
||||
/// @brief The entire line of text where the token was found.
|
||||
char* line_text;
|
||||
|
||||
/// @brief The length of the `line_text` string.
|
||||
size_t line_text_length;
|
||||
|
||||
/// @brief The line number where the token was found.
|
||||
int line;
|
||||
|
||||
/// @brief The column number where the token was found.
|
||||
int column;
|
||||
} Location;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user