From: Jacob Lifshay Date: Thu, 4 May 2023 04:15:45 +0000 (-0700) Subject: show actual mdwn source location in backtrace when parser raises SyntaxError X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8e0f6ea81295acbf72a14d8310fb3cd48ba01ba5;p=openpower-isa.git show actual mdwn source location in backtrace when parser raises SyntaxError --- diff --git a/src/openpower/decoder/power_pseudo.py b/src/openpower/decoder/power_pseudo.py index f8d87dce..637826bc 100644 --- a/src/openpower/decoder/power_pseudo.py +++ b/src/openpower/decoder/power_pseudo.py @@ -258,21 +258,21 @@ def get_reg_hex(reg): return hex(reg.value) -def convert_to_pure_python(pcode, helper=False): +def convert_to_pure_python(pcode, helper=False, filename="string"): gsc = GardenSnakeCompiler(form=None, incl_carry=False, helper=helper) - tree = gsc.compile(pcode, mode="exec", filename="string") + tree = gsc.compile(pcode, mode="exec", filename=filename) tree = ast.fix_missing_locations(tree) return astor.to_source(tree) -def convert_to_python(pcode, form, incl_carry, helper=False): +def convert_to_python(pcode, form, incl_carry, helper=False, filename="string"): print("form", form) gsc = GardenSnakeCompiler(form=form, incl_carry=incl_carry, helper=helper) - tree = gsc.compile(pcode, mode="exec", filename="string") + tree = gsc.compile(pcode, mode="exec", filename=filename) tree = ast.fix_missing_locations(tree) regsused = {'read_regs': gsc.parser.read_regs, 'write_regs': gsc.parser.write_regs, diff --git a/src/openpower/decoder/pseudo/functionreader.py b/src/openpower/decoder/pseudo/functionreader.py index b87cf53e..4e065239 100644 --- a/src/openpower/decoder/pseudo/functionreader.py +++ b/src/openpower/decoder/pseudo/functionreader.py @@ -54,7 +54,7 @@ class ISAFunctions: # so please put ending of comments on one line: # # - if l.startswith('