From 752ab8212c7556ed714d1272582e57180b50c5a6 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 18 Aug 2024 11:49:51 -0400 Subject: Split BigIntType out of IntType and switch to using enums for the size of ints/nums --- parse.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'parse.c') diff --git a/parse.c b/parse.c index 59e41ec6..f8f1a512 100644 --- a/parse.c +++ b/parse.c @@ -468,11 +468,11 @@ PARSER(parse_int) { } match(&pos, "_"); - int64_t bits = 0; - if (match(&pos, "i64")) bits = 64; - else if (match(&pos, "i32")) bits = 32; - else if (match(&pos, "i16")) bits = 16; - else if (match(&pos, "i8")) bits = 8; + auto bits = IBITS_UNSPECIFIED; + if (match(&pos, "i64")) bits = IBITS64; + else if (match(&pos, "i32")) bits = IBITS32; + else if (match(&pos, "i16")) bits = IBITS16; + else if (match(&pos, "i8")) bits = IBITS8; // else if (match(&pos, ".") || match(&pos, "e")) return NULL; // looks like a float @@ -624,14 +624,13 @@ PARSER(parse_num) { if (negative) d *= -1; - int64_t bits = 64; + auto bits = NBITS_UNSPECIFIED; match(&pos, "_"); - if (match(&pos, "f64")) bits = 64; - else if (match(&pos, "f32")) bits = 32; + if (match(&pos, "f64")) bits = NBITS64; + else if (match(&pos, "f32")) bits = NBITS32; - if (match(&pos, "%")) { + if (match(&pos, "%")) d /= 100.; - } return NewAST(ctx->file, start, pos, Num, .n=d, .bits=bits); } -- cgit v1.2.3