From 75dc36cd197ab47ffd1dbbad887dd7bac88c8add Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Tue, 31 Oct 2023 20:39:26 +0000 Subject: Lexer now returns errors on failure Currently only for invalid character literals, but still a possible problem. --- asm/lexer.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'asm/lexer.h') diff --git a/asm/lexer.h b/asm/lexer.h index d2e0028..1e68d8b 100644 --- a/asm/lexer.h +++ b/asm/lexer.h @@ -30,11 +30,18 @@ typedef struct size_t str_size; } token_t; +typedef enum +{ + LERR_OK = 0, + LERR_INVALID_CHAR_LITERAL, +} lerr_t; +const char *lerr_as_cstr(lerr_t); + typedef darr_t buffer_t; typedef darr_t token_stream_t; #define TOKEN_STREAM_AT(STREAM_DATA, INDEX) (((token_t *)(STREAM_DATA))[INDEX]) const char *token_type_as_cstr(token_type_t type); -token_stream_t tokenise_buffer(buffer_t *); +lerr_t tokenise_buffer(buffer_t *, token_stream_t *); #endif -- cgit v1.2.3-13-gbd6f