From 732c0f6ed6bc072638a66e8ed6802968e18ceb98 Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Tue, 19 May 2020 12:13:05 -0700 Subject: feat: cleaned up character lexing --- sys/cmd/cc/pp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sys/cmd/cc/pp.c') 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; } -- cgit v1.2.1