summaryrefslogtreecommitdiff
path: root/lex.c
diff options
context:
space:
mode:
Diffstat (limited to 'lex.c')
-rw-r--r--lex.c4
1 files changed, 2 insertions, 2 deletions
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;