From ac04cf78284b61844f03bfb5b96b74de7c14bfa3 Mon Sep 17 00:00:00 2001 From: Peter McGoron Date: Fri, 21 Jun 2024 08:42:57 -0400 Subject: [PATCH] tokenizer: fix number tokenizer eating non-number characters --- main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index b9560b0..1fb1cf0 100644 --- a/main.c +++ b/main.c @@ -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);