Use *lexer.describe in parse error message
Make error messages for tokens like EOF, Ident, Int or Float easier to understand.
This commit is contained in:
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user