mirror of
https://github.com/RRZE-HPC/OSACA.git
synced 2026-01-08 04:00:05 +01:00
passing parsing errors to the outside
This commit is contained in:
@@ -268,7 +268,7 @@ def inspect(args, output_file=sys.stdout):
|
||||
parser = get_asm_parser(arch)
|
||||
try:
|
||||
parsed_code = parser.parse_file(code)
|
||||
except:
|
||||
except Exception as e:
|
||||
# probably the wrong parser based on heuristic
|
||||
if args.arch is None:
|
||||
# change ISA and try again
|
||||
@@ -277,8 +277,7 @@ def inspect(args, output_file=sys.stdout):
|
||||
parser = get_asm_parser(arch)
|
||||
parsed_code = parser.parse_file(code)
|
||||
else:
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
sys.exit(1)
|
||||
raise e
|
||||
|
||||
# Reduce to marked kernel or chosen section and add semantics
|
||||
if args.lines:
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user