aboutsummaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-02-17 19:32:30 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-02-17 19:32:30 -0500
commitd46925dbfa8627a6a874545630c2acb6975bfdea (patch)
tree2b726ea50adf91b668a24b25d4d9e6ec7f7c2663 /parse.c
parent7355b2f7fe6f5dda2aee8feca025350146ccd0f5 (diff)
Cleanup of builtins
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/parse.c b/parse.c
index b9d4ef9b..571f5676 100644
--- a/parse.c
+++ b/parse.c
@@ -420,19 +420,19 @@ PARSER(parse_int) {
if (match(&pos, "%")) {
double d = (double)i / 100.;
- return NewAST(ctx->file, start, pos, Num, .n=d, .precision=64);
+ return NewAST(ctx->file, start, pos, Num, .n=d, .bits=64);
}
match(&pos, "_");
- int64_t precision = 64;
- if (match(&pos, "i64")) precision = 64;
- else if (match(&pos, "i32")) precision = 32;
- else if (match(&pos, "i16")) precision = 16;
- else if (match(&pos, "i8")) precision = 8;
+ int64_t bits = 64;
+ 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;
// else if (match(&pos, ".") || match(&pos, "e")) return NULL; // looks like a float
- return NewAST(ctx->file, start, pos, Int, .i=i, .precision=precision);
+ return NewAST(ctx->file, start, pos, Int, .i=i, .bits=bits);
}
type_ast_t *parse_table_type(parse_ctx_t *ctx, const char *pos) {
@@ -558,16 +558,16 @@ PARSER(parse_num) {
if (negative) d *= -1;
- int64_t precision = 64;
+ int64_t bits = 64;
match(&pos, "_");
- if (match(&pos, "f64")) precision = 64;
- else if (match(&pos, "f32")) precision = 32;
+ if (match(&pos, "f64")) bits = 64;
+ else if (match(&pos, "f32")) bits = 32;
if (match(&pos, "%")) {
d /= 100.;
}
- return NewAST(ctx->file, start, pos, Num, .n=d, .precision=precision);
+ return NewAST(ctx->file, start, pos, Num, .n=d, .bits=bits);
}
static inline bool match_separator(const char **pos) { // Either comma or newline
@@ -1606,7 +1606,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, .i=INT64_MAX, .precision=64);
+ if (!cache_ast) cache_ast = NewAST(ctx->file, pos, pos, Int, .i=INT64_MAX, .bits=64);
} else if (match_word(&pos, "cache_size")) {
if (whitespace(&pos), !match(&pos, "="))
parser_err(ctx, flag_start, pos, "I expected a value for 'cache_size'");