diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2019-08-29 15:50:19 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2019-08-29 15:50:19 -0400 |
commit | 7c790561cca382660081dfae3a6fe50fc31ad2a5 (patch) | |
tree | 06888e0b652cbac60abaad82e27b52a5daaeaf62 /eval.c | |
parent | 1dea1f4703b4ec0a990c2b9f6ecc81b99fed6112 (diff) |
Added fixed-size arrays
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -0,0 +1,25 @@ +static bool eval_expr_as_float(Expression *e, FloatLiteral *f) { + switch (e->kind) { + case EXPR_FLOAT_LITERAL: + *f = e->floatl; + return true; + case EXPR_INT_LITERAL: + *f = (FloatLiteral)e->intl; + return true; + } + err_print(e->where, "Not implemented yet"); + return false; +} + +static bool eval_expr_as_int(Expression *e, IntLiteral *i) { + switch (e->kind) { + case EXPR_FLOAT_LITERAL: + err_print(e->where, "Expected integer, but found floating-point literal."); + return false; + case EXPR_INT_LITERAL: + *i = e->intl; + return true; + } + err_print(e->where, "Not implemented yet"); + return false; +} |