Ver código fonte

Make `UnexpectedCharacters` print the repr

This is an additional response to #738.

I also often came across this when unexpectedly having a newline, which would previously result in the message being split up across two lines. This PR makes it easier to identify exactly which special character is causing problems.
tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.11.0
MegaIng 3 anos atrás
committed by GitHub
pai
commit
633a6dfee8
Nenhuma chave conhecida encontrada para esta assinatura no banco de dados ID da chave GPG: 4AEE18F83AFDEB23
1 arquivos alterados com 1 adições e 1 exclusões
  1. +1
    -1
      lark/exceptions.py

+ 1
- 1
lark/exceptions.py Ver arquivo

@@ -130,7 +130,7 @@ class UnexpectedCharacters(LexError, UnexpectedInput):
else:
_s = seq[lex_pos]

message = "No terminal defined for '%s' at line %d col %d" % (_s, line, column)
message = "No terminal defined for %r at line %d col %d" % (_s, line, column)
message += '\n\n' + self.get_context(seq)
if allowed:
message += '\nExpecting: %s\n' % allowed


Carregando…
Cancelar
Salvar