aboutsummaryrefslogtreecommitdiff
path: root/asm/lexer.c
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-11-29 15:38:41 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-11-29 15:38:41 +0000
commit1cba5ccd8d3c95198bf5858af2540d3e1aedfb2d (patch)
tree71c7659a5520312e4cebdf1b84ed2a3147fdb298 /asm/lexer.c
parentcad92bf3bab86359914f5248cef6a2b7e8964d83 (diff)
downloadovm-1cba5ccd8d3c95198bf5858af2540d3e1aedfb2d.tar.gz
ovm-1cba5ccd8d3c95198bf5858af2540d3e1aedfb2d.tar.bz2
ovm-1cba5ccd8d3c95198bf5858af2540d3e1aedfb2d.zip
Added TOKEN_PP_USE to lexer with implementation
Diffstat (limited to 'asm/lexer.c')
-rw-r--r--asm/lexer.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/asm/lexer.c b/asm/lexer.c
index 5218d16..6358e95 100644
--- a/asm/lexer.c
+++ b/asm/lexer.c
@@ -24,6 +24,8 @@ const char *token_type_as_cstr(token_type_t type)
{
switch (type)
{
+ case TOKEN_PP_USE:
+ return "PP_USE";
case TOKEN_PP_CONST:
return "PP_CONST";
case TOKEN_PP_END:
@@ -180,6 +182,11 @@ lerr_t tokenise_symbol(buffer_t *buffer, size_t *column, token_t *token)
type = TOKEN_PP_CONST;
offset = 6;
}
+ else if (sym_size == 4 && strncmp(opcode + 1, "USE", 3) == 0)
+ {
+ type = TOKEN_PP_USE;
+ offset = 4;
+ }
else if (sym_size == 4 && strncmp(opcode + 1, "END", 3) == 0)
{
type = TOKEN_PP_END;
@@ -599,8 +606,7 @@ lerr_t tokenise_buffer(buffer_t *buffer, token_stream_t *tokens_ptr)
darr_append_bytes(&tokens, (byte *)&t, sizeof(t));
}
}
- size_t n_tokens = tokens.used / sizeof(token_t);
- tokens.available = n_tokens;
+ tokens.available = tokens.used / sizeof(token_t);
tokens.used = 0;
*tokens_ptr = tokens;
return LERR_OK;