tokenizer: fix number tokenizer eating non-number characters

This commit is contained in:
Peter McGoron 2024-06-21 08:42:57 -04:00
parent e300baf0db
commit ac04cf7828
1 changed files with 9 additions and 3 deletions

12
main.c
View File

@ -223,10 +223,12 @@ static void tokenize(FILE *input, struct token *tok)
return;
}
default:
if (tonum(c) >= 0)
if (tonum(c) >= 0) {
ungetc(c, input);
tok_num(input, tok, 1);
else
} else {
tok_ident(input, tok, c);
}
return;
}
}
@ -446,7 +448,10 @@ static void after_gc(struct uns_gc *gc_)
);
gc.next_alloc *= 2;
if (gc.after_collection >= gc.before_collection * 7/10) {
fprintf(stderr, "\tincreasing\n");
gc.next_alloc *= 2;
}
}
static void init_gc(void)
@ -458,6 +463,7 @@ static void init_gc(void)
gc.ctx = malloc(uns_cheney_c89_ctx_size);
if(!gc.ctx || !uns_cheney_c89_init(&gc))
exit(1);
gc.next_alloc *= 2;
uns_root_add(&gc, &empty_list);