aboutsummaryrefslogtreecommitdiff
path: root/asm/lexer.c
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-11-05 16:21:09 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-11-05 16:21:09 +0000
commit4ae6c052764767f8281576a4ed938e1d6cf7c688 (patch)
treef47a2b3557858065ce2d96d2d548e0b1216aad56 /asm/lexer.c
parentaadb21853a0defc9aeac55ee2f4d582ba0c52cf4 (diff)
downloadovm-4ae6c052764767f8281576a4ed938e1d6cf7c688.tar.gz
ovm-4ae6c052764767f8281576a4ed938e1d6cf7c688.tar.bz2
ovm-4ae6c052764767f8281576a4ed938e1d6cf7c688.zip
Current work on preprocessor implementation
Lots to refactor and test
Diffstat (limited to 'asm/lexer.c')
-rw-r--r--asm/lexer.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/asm/lexer.c b/asm/lexer.c
index f2b63ba..108cb64 100644
--- a/asm/lexer.c
+++ b/asm/lexer.c
@@ -24,6 +24,10 @@ const char *token_type_as_cstr(token_type_t type)
{
switch (type)
{
+ case TOKEN_PP_CONST:
+ return "PP_CONST";
+ case TOKEN_PP_END:
+ return "PP_END";
case TOKEN_GLOBAL:
return "GLOBAL";
case TOKEN_STAR:
@@ -164,7 +168,12 @@ token_t tokenise_symbol(buffer_t *buffer, size_t *column)
token_type_t type = 0;
size_t offset = 0;
- if (sym_size == 4 && strncmp(opcode, "NOOP", 4) == 0)
+ if (sym_size > 1 && strncmp(opcode, "%", 1) == 0)
+ {
+ // Some kind of preprocessing directive
+ // TODO: Implement tokeniser for preprocessing directive
+ }
+ else if (sym_size == 4 && strncmp(opcode, "NOOP", 4) == 0)
{
offset = 4;
type = TOKEN_NOOP;