diff options
Diffstat (limited to 'parse.c')
-rw-r--r-- | parse.c | 22 |
1 files changed, 8 insertions, 14 deletions
@@ -17,8 +17,8 @@ typedef enum { BUILTIN_U16, BUILTIN_U32, BUILTIN_U64, - BUILTIN_FLOAT, - BUILTIN_DOUBLE, + BUILTIN_F32, + BUILTIN_F64, BUILTIN_TYPE_COUNT } BuiltinType; @@ -192,8 +192,8 @@ static bool type_builtin_is_integer(BuiltinType b) { static bool type_builtin_is_floating(BuiltinType b) { switch (b) { - case BUILTIN_FLOAT: - case BUILTIN_DOUBLE: + case BUILTIN_F32: + case BUILTIN_F64: return true; default: return false; } @@ -216,8 +216,8 @@ static BuiltinType kw_to_builtin_type(Keyword kw) { case KW_U16: return BUILTIN_U16; case KW_U32: return BUILTIN_U32; case KW_U64: return BUILTIN_U64; - case KW_FLOAT: return BUILTIN_FLOAT; - case KW_DOUBLE: return BUILTIN_DOUBLE; + case KW_F32: return BUILTIN_F32; + case KW_F64: return BUILTIN_F64; default: return BUILTIN_TYPE_COUNT; } } @@ -232,8 +232,8 @@ static Keyword builtin_type_to_kw(BuiltinType t) { case BUILTIN_U16: return KW_U16; case BUILTIN_U32: return KW_U32; case BUILTIN_U64: return KW_U64; - case BUILTIN_FLOAT: return KW_FLOAT; - case BUILTIN_DOUBLE: return KW_DOUBLE; + case BUILTIN_F32: return KW_F32; + case BUILTIN_F64: return KW_F64; case BUILTIN_TYPE_COUNT: break; } assert(0); @@ -620,15 +620,9 @@ static bool parse_expr(Parser *p, Expression *e, Token *end) { NumLiteral *num = &t->token->num; switch (num->kind) { case NUM_LITERAL_FLOAT: - e->kind = EXPR_FLOAT_LITERAL; - e->type.kind = TYPE_BUILTIN; - e->type.builtin = BUILTIN_FLOAT; e->floatl = num->floatval; break; case NUM_LITERAL_INT: - e->kind = EXPR_INT_LITERAL; - e->type.kind = TYPE_BUILTIN; - e->type.builtin = BUILTIN_I64; /* TODO: if it's too big, use a u64 instead. */ e->intl = num->intval; break; } |