diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-11-05 15:18:32 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-11-05 15:18:32 -0500 |
| commit | b8d7eabc023bf9db0150049d8e909086f6ad91bc (patch) | |
| tree | 5b678c7949638b3f07095affc04611f0422ef8c7 /parse.c | |
| parent | 2fa26e6af3ec1599396d9260ef44b0d035b1f686 (diff) | |
Deprecate bit-width integer/num literals in favor of using type
constructors
Diffstat (limited to 'parse.c')
| -rw-r--r-- | parse.c | 24 |
1 files changed, 5 insertions, 19 deletions
@@ -499,22 +499,13 @@ PARSER(parse_int) { if (match(&pos, "%")) { double n = strtod(str, NULL) / 100.; - return NewAST(ctx->file, start, pos, Num, .n=n, .bits=64); + return NewAST(ctx->file, start, pos, Num, .n=n); } else if (match(&pos, "deg")) { double n = strtod(str, NULL) * RADIANS_PER_DEGREE; - return NewAST(ctx->file, start, pos, Num, .n=n, .bits=64); + return NewAST(ctx->file, start, pos, Num, .n=n); } - auto bits = IBITS_UNSPECIFIED; - if (match(&pos, "[64]")) bits = IBITS64; - else if (match(&pos, "[32]")) bits = IBITS32; - else if (match(&pos, "[16]")) bits = IBITS16; - else if (match(&pos, "[8]")) bits = IBITS8; - else if (match(&pos, "[B]")) bits = IBITS_BYTE; - - // else if (match(&pos, ".") || match(&pos, "e")) return NULL; // looks like a float - - return NewAST(ctx->file, start, pos, Int, .str=str, .bits=bits); + return NewAST(ctx->file, start, pos, Int, .str=str); } PARSER(parse_datetime) { @@ -731,17 +722,12 @@ PARSER(parse_num) { if (negative) d *= -1; - auto bits = NBITS_UNSPECIFIED; - match(&pos, "_"); - if (match(&pos, "f64")) bits = NBITS64; - else if (match(&pos, "f32")) bits = NBITS32; - if (match(&pos, "%")) d /= 100.; else if (match(&pos, "deg")) d *= RADIANS_PER_DEGREE; - return NewAST(ctx->file, start, pos, Num, .n=d, .bits=bits); + return NewAST(ctx->file, start, pos, Num, .n=d); } static INLINE bool match_separator(const char **pos) { // Either comma or newline @@ -2253,7 +2239,7 @@ PARSER(parse_func_def) { if (match_word(&pos, "inline")) { is_inline = true; } else if (match_word(&pos, "cached")) { - if (!cache_ast) cache_ast = NewAST(ctx->file, pos, pos, Int, .str="-1", .bits=0); + if (!cache_ast) cache_ast = NewAST(ctx->file, pos, pos, Int, .str="-1"); } else if (match_word(&pos, "cache_size")) { whitespace(&pos); if (!match(&pos, "=")) |
