Ver a proveniência

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 há 3 anos
committed by GitHub
ascendente
cometimento
633a6dfee8
Não foi encontrada uma chave conhecida para esta assinatura, na base de dados ID da chave GPG: 4AEE18F83AFDEB23
1 ficheiros alterados com 1 adições e 1 eliminações
  1. +1
    -1
      lark/exceptions.py

+ 1
- 1
lark/exceptions.py Ver ficheiro

@@ -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
Guardar