summaryrefslogtreecommitdiff
path: root/src/lexer.h
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2025-09-27 04:21:06 -0400
committerLLLL Colonq <llll@colonq>2025-09-27 04:21:06 -0400
commitab57bc2a6d6ea9c24aa119df6efbd8a38b54c312 (patch)
treebfc7fe32f40804e7808016038a3f2f15ef9e643e /src/lexer.h
parent811f11463851a0f35835ac72ef09b65b1072de20 (diff)
Source location tracking
Diffstat (limited to 'src/lexer.h')
-rw-r--r--src/lexer.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lexer.h b/src/lexer.h
index dabe534..6f48d8f 100644
--- a/src/lexer.h
+++ b/src/lexer.h
@@ -18,10 +18,15 @@ typedef enum {
typedef struct {
char *input;
- i64 start, end, len;
+ i64 len; // length of input
+ i64 start, end; // bounds of the current token
+ i64 line, column; // for error reporting only; current line and column
+ i64 start_line, start_column; // for error reporting only; line and column of token start
+ char *error;
} pit_lexer;
-pit_lexer *pit_lex_file(char *path);
+void pit_lex_bytes(pit_lexer *ret, char *buf, i64 len);
+void pit_lex_file(pit_lexer *ret, char *path);
pit_lex_token pit_lex_next(pit_lexer *st);
const char *pit_lex_token_name(pit_lex_token t);