aboutsummaryrefslogtreecommitdiff
path: root/asm/lexer.h
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-10-31 20:39:26 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-10-31 20:39:26 +0000
commit75dc36cd197ab47ffd1dbbad887dd7bac88c8add (patch)
tree913d6c944dd9be9286fe36e5fe7462efb191b539 /asm/lexer.h
parentfa640f13e8a231ec3a619cc360289828cc4fc114 (diff)
downloadovm-75dc36cd197ab47ffd1dbbad887dd7bac88c8add.tar.gz
ovm-75dc36cd197ab47ffd1dbbad887dd7bac88c8add.tar.bz2
ovm-75dc36cd197ab47ffd1dbbad887dd7bac88c8add.zip
Lexer now returns errors on failure
Currently only for invalid character literals, but still a possible problem.
Diffstat (limited to 'asm/lexer.h')
-rw-r--r--asm/lexer.h9
1 files changed, 8 insertions, 1 deletions
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