diff options
author | Nicholas Noll <nbnoll@eml.cc> | 2020-05-19 12:13:05 -0700 |
---|---|---|
committer | Nicholas Noll <nbnoll@eml.cc> | 2020-05-19 12:13:05 -0700 |
commit | 732c0f6ed6bc072638a66e8ed6802968e18ceb98 (patch) | |
tree | 8bfc25aff1903f452006f31ff6a2f906303e2017 /sys/cmd/cc/pp.c | |
parent | 5c3114c81477298e9eb78ed3a070752f8d24b8a5 (diff) |
feat: cleaned up character lexing
Diffstat (limited to 'sys/cmd/cc/pp.c')
-rw-r--r-- | sys/cmd/cc/pp.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/cmd/cc/pp.c b/sys/cmd/cc/pp.c index 30bb3d4..8de4792 100644 --- a/sys/cmd/cc/pp.c +++ b/sys/cmd/cc/pp.c @@ -62,7 +62,7 @@ defmacro(Lexer *lx, string name, string macro) { Sym *mac; - printf("DEFINING MACRO %s, ON LINE %d\n", name, lx->pos.line); + printf("DEFINING MACRO %s = %s, ON LINE %d\n", name, macro+1, lx->pos.line); mac = define(&lx->sym, name, Smacro); mac->macro = macro; @@ -108,12 +108,14 @@ opand(Lexer *lx) case Alit: switch (tok.kind & ~Vmask) { - case Vint: + case Vint: case Vlong: case Vvlong: return tok.val.i; + case Vint | Vun: case Vlong | Vun: case Vvlong | Vun: + return tok.val.ui; case Vchar: return tok.val.c; default: - errorat(lx->pos, "invalid literal of type '%d' in conditional macro", tok.kind & ~Vmask); + errorat(lx->pos, "invalid literal of type '%s' in conditional macro", tokens[tok.kind & ~Vmask]); return 0; } |