Skip to content

Commit

Permalink
Use *lexer.describe in parse error message
Browse files Browse the repository at this point in the history
Make error messages for tokens like EOF, Ident, Int or Float easier to
understand.
  • Loading branch information
tapichu committed Mar 22, 2020
1 parent 1e9cbf3 commit 0a23d45
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ch7/eval/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func parsePrimary(lex *lexer) Expr {
lex.next() // consume ','
}
if lex.token != ')' {
msg := fmt.Sprintf("got %q, want ')'", lex.token)
msg := fmt.Sprintf("got %s, want ')'", lex.describe())
panic(lexPanic(msg))
}
}
Expand Down

0 comments on commit 0a23d45

Please sign in to comment.