passing parsing errors to the outside

This commit is contained in:
Julian Hammer
2021-03-05 18:07:36 +01:00
parent f8d53a69d7
commit d7a687909e
2 changed files with 6 additions and 9 deletions

View File

@@ -290,12 +290,10 @@ class ParserAArch64(BaseParser):
if result is None:
try:
result = self.parse_instruction(line)
except (pp.ParseException, KeyError):
print(
'\n\n*-*-*-*-*-*-*-*-*-*-\n{}: {}\n*-*-*-*-*-*-*-*-*-*-\n\n'.format(
line_number, line
)
)
except (pp.ParseException, KeyError) as e:
raise e
raise ValueError(
'Unable to parse {!r} on line {}'.format(line, line_number)) from e
instruction_form[self.INSTRUCTION_ID] = result[self.INSTRUCTION_ID]
instruction_form[self.OPERANDS_ID] = result[self.OPERANDS_ID]
instruction_form[self.COMMENT_ID] = result[self.COMMENT_ID]