diff options
| author | Carson Fleming <cflems@cflems.net> | 2026-07-30 22:54:31 -0400 |
|---|---|---|
| committer | Carson Fleming <cflems@cflems.net> | 2026-07-30 22:54:31 -0400 |
| commit | 5adb568da4dfda6d5d9699ee4b92fe44b43fc4cf (patch) | |
| tree | 0772ae3bf2f5bacfbeeece4eb69063cd20f92325 /parser.c | |
| parent | 65dd0651eb7d9e0434a88ec4118d64dfb119d74b (diff) | |
| download | ccc-5adb568da4dfda6d5d9699ee4b92fe44b43fc4cf.tar.gz | |
token names
Diffstat (limited to 'parser.c')
| -rw-r--r-- | parser.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -22,7 +22,10 @@ static struct scope* scope; static void unexpected_token(enum token_type expected) { /* TODO: print what token was expected */ - PARSER_PANIC("unexpected token; expected %d", expected); + PARSER_PANIC( + "unexpected token %s; expected %s", + token_labels[tok.type], + token_labels[expected]); } static void peek_or_panic() { @@ -42,7 +45,10 @@ static void expect_kw(const char* kw) { PARSER_PANIC("unexpected EOF, expected %s", kw); if (tok.type != TK_IDENT) - PARSER_PANIC("unexpected token, expected %s", kw); + PARSER_PANIC( + "unexpected token %s, expected %s", + token_labels[tok.type], + kw); if (strcmp(kw, tok.data.ident) != 0) PARSER_PANIC( |
