Просмотр исходного кода

XEarley: Better exception when can't find a solution

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.5.1
Erez Shinan 6 лет назад
Родитель
Сommit
c91bb61a43
1 измененных файлов: 3 добавлений и 1 удалений
  1. +3
    -1
      lark/parsers/xearley.py

+ 3
- 1
lark/parsers/xearley.py Просмотреть файл

@@ -141,7 +141,9 @@ class Parser:
if n.rule.origin==start_symbol and n.start is column0]

if not solutions:
raise ParseError('Incomplete parse: Could not find a solution to input')
expected_tokens = [t.expect.name for t in column.to_scan]
raise ParseError('Unexpected end of input! Expecting a terminal of: %s' % expected_tokens)

elif len(solutions) == 1:
tree = solutions[0]
else:


Загрузка…
Отмена
Сохранить