From c91bb61a430f02367ee28ba55f9ef303318d9ecb Mon Sep 17 00:00:00 2001 From: Erez Shinan Date: Sun, 19 Nov 2017 15:41:07 +0200 Subject: [PATCH] XEarley: Better exception when can't find a solution --- lark/parsers/xearley.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lark/parsers/xearley.py b/lark/parsers/xearley.py index a2aaf24..f603b60 100644 --- a/lark/parsers/xearley.py +++ b/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: