diff options
author | David Phillips <david@sighup.nz> | 2019-04-14 20:05:44 +1200 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2019-08-03 12:43:46 +1200 |
commit | 3bf3b2a80ef21ac1ac2e43d07b1680432d66cbaf (patch) | |
tree | e4c3a4ce3d9646f9d78282a0cf8bb4a4cce2575d /lex.c | |
parent | e5eeded02a4abe2729e675203437c79d9ee71a7a (diff) | |
download | toy-cpu-assembler-3bf3b2a80ef21ac1ac2e43d07b1680432d66cbaf.tar.xz |
Remove superfluous printfs, factor reg table lookup
Diffstat (limited to 'lex.c')
-rw-r--r-- | lex.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -50,7 +50,6 @@ static int add_token(struct token t) { } tokens[tokens_count - 1] = t; -// printf("Adding token from (%d,%d ~%d), str %s int %d\n", t.line, t.column, t.span, t.s_val, t.i_val); return 0; } @@ -81,7 +80,8 @@ static int lex_register(struct token *t) { ; } - t->s_val = strndup(&buffer[column], i - column); + /* -1, +1 to include $ */ + t->s_val = strndup(&buffer[column - 1], i - column + 1); if (!t->s_val) { perror("strndup"); return 1; |