aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2024-06-21 08:42:57 -0400
committerGravatar Peter McGoron 2024-06-21 08:42:57 -0400
commitac04cf78284b61844f03bfb5b96b74de7c14bfa3 (patch)
tree5d6796a4bba5e6c7e8574361e9309940455ebe1f
parentparsing (diff)
tokenizer: fix number tokenizer eating non-number characters
-rw-r--r--main.c12
1 files 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);