From 3bf3b2a80ef21ac1ac2e43d07b1680432d66cbaf Mon Sep 17 00:00:00 2001 From: David Phillips Date: Sun, 14 Apr 2019 20:05:44 +1200 Subject: Remove superfluous printfs, factor reg table lookup --- lex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lex.c') diff --git a/lex.c b/lex.c index 47beb01..41b65c5 100644 --- a/lex.c +++ b/lex.c @@ -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; -- cgit v1.1