improve lexing error (#32832)

This commit is contained in:
Chris White 2022-09-26 15:47:45 -07:00 committed by GitHub
parent de9fc038f7
commit 777271da18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,7 +78,9 @@ def lex_word(self, word):
break
if remainder and not remainder_used:
raise LexError("Invalid character", word, word.index(remainder))
msg = "Invalid character, '{0}',".format(remainder[0])
msg += " in '{0}' at index {1}".format(word, word.index(remainder))
raise LexError(msg, word, word.index(remainder))
return tokens