diff options
author | Nicholas Noll <nbnoll@eml.cc> | 2020-05-18 18:22:42 -0700 |
---|---|---|
committer | Nicholas Noll <nbnoll@eml.cc> | 2020-05-18 18:22:42 -0700 |
commit | 73c04db73163d1d2719bb97a6b8c133065df75c3 (patch) | |
tree | 781103cac8053e73aaa81b9aa773ced4093d8d37 /sys/cmd/cc/cc.h | |
parent | 23ac1f4f98accc3bb84e81be264d8408be372028 (diff) |
feat: macro expansion and constant evaluation prototype
Diffstat (limited to 'sys/cmd/cc/cc.h')
-rw-r--r-- | sys/cmd/cc/cc.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/cmd/cc/cc.h b/sys/cmd/cc/cc.h index 9871e99..84f173f 100644 --- a/sys/cmd/cc/cc.h +++ b/sys/cmd/cc/cc.h @@ -100,6 +100,7 @@ void errorat(Pos x, byte *fmt, ...); DIRECTIVE(Ddefine,"define", ppdef) \ DIRECTIVE(Dundef,"undef", ppund) \ DIRECTIVE(Dif,"if", ppif0) \ + DIRECTIVE(Delif,"elif", ppif1) \ DIRECTIVE(Delse, "else", ppif1) \ DIRECTIVE(Difdef,"ifdef", ppif2) \ DIRECTIVE(Difndef,"ifndef", ppif3) \ @@ -184,6 +185,8 @@ enum Vusgn = iota(12), Vfloat = iota(13), Vstr = iota(14), + + Vmask = Vchar - 1, }; #undef TOK @@ -221,6 +224,17 @@ struct Sym }; }; +struct SymTab +{ + int32 n_buckets; + int32 size; + int32 n_occupied; + int32 upper_bound; + int32 *flags; + string *keys; + Sym **vals; +}; + Sym *lookup(SymTab *tab, string ident); Sym *define(SymTab *tab, string ident, int kind); @@ -228,7 +242,7 @@ struct Lexer { Pos pos; Io *io; - SymTab *sym; + SymTab sym; byte *b; byte buf[2*1024]; }; |