Quellcode durchsuchen

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 vor 3 Jahren
committed by GitHub
Ursprung
Commit
633a6dfee8
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden GPG-Schlüssel-ID: 4AEE18F83AFDEB23
1 geänderte Dateien mit 1 neuen und 1 gelöschten Zeilen
  1. +1
    -1
      lark/exceptions.py

+ 1
- 1
lark/exceptions.py Datei anzeigen

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


Laden…
Abbrechen
Speichern