aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/all.h
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap/all.h')
-rw-r--r--bootstrap/all.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/bootstrap/all.h b/bootstrap/all.h
index 762e978..cb221da 100644
--- a/bootstrap/all.h
+++ b/bootstrap/all.h
@@ -30,12 +30,14 @@ struct span {
/* must be alpha sorted */
#define LIST_KEYWORDS(_) \
_(and) \
+ _(as) \
_(break) \
_(case) \
_(const) \
_(defmacro) \
_(do) \
_(else) \
+ _(enum) \
_(extern) \
_(fn) \
_(for) \
@@ -45,9 +47,11 @@ struct span {
_(or) \
_(return) \
_(static) \
+ _(struct) \
_(switch) \
_(typedef) \
_(typeof) \
+ _(union) \
_(while)
enum toktype {
@@ -64,7 +68,6 @@ enum toktype {
TKmacident,
TKgensym,
TKeof,
- NUM_LEXTOKENS
};
#define NUM_KEYWORDS TKintlit
@@ -119,6 +122,8 @@ struct parser {
int idx;
} *curexpan; // macro expansions
int expanno;
+ const struct type *targty;
+ bool used_targetty;
};
enum typetype {
@@ -130,6 +135,7 @@ enum typetype {
TYarr,
TYslice,
TYfn,
+ TYenum,
};
struct type {
@@ -147,8 +153,17 @@ struct type {
const struct type *retty;
bool variadic;
} fn;
+ struct {
+ const struct type *intty;
+ const char *name;
+ slice_t(struct enumfield {
+ const char *name;
+ i64 i;
+ }) vals;
+ int id;
+ } enu;
};
- // cgen.c (mutated later, not hashed or involved in equality)
+ // for cgen.c hack (mutated later, not hashed or involved in equality)
const char *_cname;
};
@@ -225,6 +240,8 @@ enum exprtype {
Ecall,
Eindex,
Eblock,
+ Eas,
+ Eenumval,
};
struct blockstmt {
@@ -266,6 +283,11 @@ struct expr {
struct expr *lhs, *rhs;
} index;
struct blockstmt block;
+ struct expr *child; // cast
+ struct {
+ i64 i;
+ const char *vname;
+ } enu;
};
};