more sensible lexer error message
correctly handling non-printable keypresses