aboutsummaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/pp.c b/pp.c
index 757492b..f334f07 100644
--- a/pp.c
+++ b/pp.c
@@ -124,10 +124,13 @@ peek(int kind)
char *
expect(int kind, const char *msg)
{
- char *lit;
+ char *lit, want[64], got[64];
- if (tok.kind != kind)
- error(&tok.loc, "expected %d %s, saw %d", kind, msg, tok.kind);
+ if (tok.kind != kind) {
+ tokdesc(want, sizeof(want), kind, NULL);
+ tokdesc(got, sizeof(got), tok.kind, tok.lit);
+ error(&tok.loc, "expected %s %s, saw %s", want, msg, got);
+ }
lit = tok.lit;
next();