diff options
Diffstat (limited to 'asm/lexer.c')
-rw-r--r-- | asm/lexer.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/asm/lexer.c b/asm/lexer.c index 4e92502..dfc4976 100644 --- a/asm/lexer.c +++ b/asm/lexer.c @@ -46,8 +46,12 @@ const char *token_type_as_cstr(token_type_t type) return "MALLOC"; case TOKEN_MSET: return "MSET"; + case TOKEN_MSET_STACK: + return "MSET_STACK"; case TOKEN_MGET: return "MGET"; + case TOKEN_MGET_STACK: + return "MGET_STACK"; case TOKEN_MDELETE: return "MDELETE"; case TOKEN_MSIZE: @@ -127,7 +131,7 @@ bool is_valid_hex_char(char c) token_t tokenise_symbol(buffer_t *buffer, size_t *column) { - static_assert(NUMBER_OF_OPCODES == 84, "tokenise_buffer: Out of date!"); + static_assert(NUMBER_OF_OPCODES == 90, "tokenise_buffer: Out of date!"); size_t sym_size = 0; for (; sym_size < space_left(buffer) && @@ -183,11 +187,21 @@ token_t tokenise_symbol(buffer_t *buffer, size_t *column) offset = 6; type = TOKEN_MALLOC; } + else if (sym_size >= 10 && strncmp(opcode, "MSET.STACK", 10) == 0) + { + offset = 10; + type = TOKEN_MSET_STACK; + } else if (sym_size >= 4 && strncmp(opcode, "MSET", 4) == 0) { offset = 4; type = TOKEN_MSET; } + else if (sym_size >= 10 && strncmp(opcode, "MGET.STACK", 10) == 0) + { + offset = 10; + type = TOKEN_MGET_STACK; + } else if (sym_size >= 4 && strncmp(opcode, "MGET", 4) == 0) { offset = 4; |