浏览代码

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 年前
committed by GitHub
父节点
当前提交
633a6dfee8
找不到此签名对应的密钥 GPG 密钥 ID: 4AEE18F83AFDEB23
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. +1
    -1
      lark/exceptions.py

+ 1
- 1
lark/exceptions.py 查看文件

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


正在加载...
取消
保存