11.08., 9:00 - 11:00: Due to updates GitLab will be unavailable for some minutes between 09:00 and 11:00.

Commit 98af2bfc authored by di68kap's avatar di68kap

- DHParser/parse.py more meaningful lookahead failuere message

parent 09800c86
...@@ -966,8 +966,8 @@ class Grammar: ...@@ -966,8 +966,8 @@ class Grammar:
result = Node(ZOMBIE_TAG, '').with_pos(0) result = Node(ZOMBIE_TAG, '').with_pos(0)
if lookahead_failure_only(parser): if lookahead_failure_only(parser):
self.tree__.new_error( self.tree__.new_error(
result, 'Parser "%s" did not match empty document except for lookahead' result, 'Parser "%s" only did not match empty document '
% str(parser), 'because of lookahead' % str(parser),
Error.PARSER_LOOKAHEAD_MATCH_ONLY) Error.PARSER_LOOKAHEAD_MATCH_ONLY)
else: else:
self.tree__.new_error( self.tree__.new_error(
...@@ -989,10 +989,11 @@ class Grammar: ...@@ -989,10 +989,11 @@ class Grammar:
# Check if a Lookahead-Parser did match. Needed for testing, because # Check if a Lookahead-Parser did match. Needed for testing, because
# in a test case this is not necessarily an error. # in a test case this is not necessarily an error.
if lookahead_failure_only(parser): if lookahead_failure_only(parser):
error_msg = 'Parser did not match except for lookahead! ' + err_info error_msg = 'Parser "%s" only did not match because of lookahead! ' \
% str(parser) + err_info
error_code = Error.PARSER_LOOKAHEAD_MATCH_ONLY error_code = Error.PARSER_LOOKAHEAD_MATCH_ONLY
else: else:
error_msg = 'Parser did not match!' + err_info error_msg = 'Parser "%s" did not match!' % str(parser) + err_info
error_code = Error.PARSER_DID_NOT_MATCH error_code = Error.PARSER_DID_NOT_MATCH
else: else:
stitches.append(result) stitches.append(result)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment