aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-01-04 23:37:17 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-01-04 23:37:17 -0700
commita11d0aaf62e3ebf2f46307d1546b8105792c8dd0 (patch)
tree3dc29343eb5eefa115047b49bf1be23f484aa12c /src/parser.cpp
parent3c551628268e88c6d6dcbe729e1bc756a689dbda (diff)
downloadzig-a11d0aaf62e3ebf2f46307d1546b8105792c8dd0.tar.gz
zig-a11d0aaf62e3ebf2f46307d1546b8105792c8dd0.zip
progress toward compile time constant expression evaluation
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index 5c9d34a3c4..60de2fbab7 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -2750,6 +2750,14 @@ const char *num_lit_str(NumLit num_lit) {
return "u32";
case NumLitU64:
return "u64";
+ case NumLitI8:
+ return "i8";
+ case NumLitI16:
+ return "i16";
+ case NumLitI32:
+ return "i32";
+ case NumLitI64:
+ return "i64";
case NumLitCount:
zig_unreachable();
}
@@ -2761,6 +2769,10 @@ bool is_num_lit_unsigned(NumLit num_lit) {
case NumLitF32:
case NumLitF64:
case NumLitF128:
+ case NumLitI8:
+ case NumLitI16:
+ case NumLitI32:
+ case NumLitI64:
return false;
case NumLitU8:
case NumLitU16:
@@ -2783,6 +2795,10 @@ bool is_num_lit_float(NumLit num_lit) {
case NumLitU16:
case NumLitU32:
case NumLitU64:
+ case NumLitI8:
+ case NumLitI16:
+ case NumLitI32:
+ case NumLitI64:
return false;
case NumLitCount:
zig_unreachable();
@@ -2793,13 +2809,17 @@ bool is_num_lit_float(NumLit num_lit) {
uint64_t num_lit_bit_count(NumLit num_lit) {
switch (num_lit) {
case NumLitU8:
+ case NumLitI8:
return 8;
case NumLitU16:
+ case NumLitI16:
return 16;
case NumLitU32:
+ case NumLitI32:
case NumLitF32:
return 32;
case NumLitU64:
+ case NumLitI64:
case NumLitF64:
return 64;
case NumLitF128: