summaryrefslogtreecommitdiff
path: root/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/parser.c b/parser.c
index 29aea36..bdf266d 100644
--- a/parser.c
+++ b/parser.c
@@ -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(