|
|
@@ -72,7 +72,11 @@ class UnexpectedInput(LarkError): |
|
|
|
|
|
|
|
class UnexpectedCharacters(LexError, UnexpectedInput): |
|
|
|
def __init__(self, seq, lex_pos, line, column, allowed=None, considered_tokens=None, state=None, token_history=None): |
|
|
|
message = "No terminal defined for '%s' at line %d col %d" % (seq[lex_pos], line, column) |
|
|
|
|
|
|
|
if isinstance(seq, bytes): |
|
|
|
message = "No terminal defined for '%s' at line %d col %d" % (seq[lex_pos:lex_pos+1].decode("ascii", "backslashreplace"), line, column) |
|
|
|
else: |
|
|
|
message = "No terminal defined for '%s' at line %d col %d" % (seq[lex_pos], line, column) |
|
|
|
|
|
|
|
self.line = line |
|
|
|
self.column = column |
|
|
|