From 4ae6c052764767f8281576a4ed938e1d6cf7c688 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sun, 5 Nov 2023 16:21:09 +0000 Subject: Current work on preprocessor implementation Lots to refactor and test --- asm/lexer.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'asm/lexer.c') 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; -- cgit v1.2.3-13-gbd6f