diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-11-02 20:31:22 +0000 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-11-02 20:31:22 +0000 |
commit | d5e311c9d44793d269e9b8ee5e8c0fa7a1a25a50 (patch) | |
tree | 7bf71c7332453877a432a16adf57e4cf9e48533e /asm/lexer.c | |
parent | d12820cd2526c63c34e2a2f393faff6d79f56898 (diff) | |
download | ovm-d5e311c9d44793d269e9b8ee5e8c0fa7a1a25a50.tar.gz ovm-d5e311c9d44793d269e9b8ee5e8c0fa7a1a25a50.tar.bz2 ovm-d5e311c9d44793d269e9b8ee5e8c0fa7a1a25a50.zip |
Started work on preprocessing jump addresses
Diffstat (limited to 'asm/lexer.c')
-rw-r--r-- | asm/lexer.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/asm/lexer.c b/asm/lexer.c index 0a8a97e..01c2e5d 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_STAR: + return "STAR"; case TOKEN_LITERAL_NUMBER: return "LITERAL_NUMBER"; case TOKEN_LITERAL_CHAR: @@ -124,7 +126,7 @@ char uppercase(char c) bool is_symbol(char c) { - return isalpha(c) || c == '-' || c == '_' || c == '.'; + return isalpha(c) || c == '-' || c == '_' || c == '.' || c == ':'; } bool is_valid_hex_char(char c) @@ -431,6 +433,15 @@ lerr_t tokenise_buffer(buffer_t *buffer, token_stream_t *tokens_ptr) ++buffer->used; is_token = false; } + else if (c == '*') + { + t = (token_t){.type = TOKEN_STAR, + .column = column, + .str = malloc(1), + .str_size = 1}; + t.str[0] = '\0'; + ++buffer->used; + } else if (isdigit(c) || (space_left(buffer) > 1 && c == '-' && isdigit(buffer->data[buffer->used + 1]))) t = tokenise_number_literal(buffer, &column); |