enhanced parser

This commit is contained in:
JanLJL
2021-09-29 17:26:27 +02:00
parent fcc3475417
commit d181184788
2 changed files with 6 additions and 6 deletions

View File

@@ -22,7 +22,7 @@ class ParserX86ATT(BaseParser):
self.isa = "x86"
def construct_parser(self):
"""Create parser for ARM AArch64 ISA."""
"""Create parser for x86 AT&T ISA."""
decimal_number = pp.Combine(
pp.Optional(pp.Literal("-")) + pp.Word(pp.nums)
).setResultsName("value")
@@ -36,7 +36,7 @@ class ParserX86ATT(BaseParser):
# Define x86 assembly identifier
relocation = pp.Combine(pp.Literal("@") + pp.Word(pp.alphas))
id_offset = pp.Word(pp.nums) + pp.Suppress(pp.Literal("+"))
first = pp.Word(pp.alphas + "_.", exact=1)
first = pp.Word(pp.alphas + "-_.", exact=1)
rest = pp.Word(pp.alphanums + "$_.+-")
identifier = pp.Group(
pp.Optional(id_offset).setResultsName("offset")
@@ -89,7 +89,7 @@ class ParserX86ATT(BaseParser):
).setResultsName(self.IMMEDIATE_ID)
# Memory preparations
offset = pp.Group(identifier | hex_number | decimal_number).setResultsName(
offset = pp.Group(hex_number | decimal_number | identifier).setResultsName(
self.IMMEDIATE_ID
)
scale = pp.Word("1248", exact=1)

View File

@@ -227,7 +227,7 @@ class ISASemantics(object):
Create operand dictionary containing src/dst operands out of the ISA data entry and
the oeprands of an instruction form
If breaks_pedendency_on_equal_operands is True (configuted per instruction in ISA db)
If breaks_dependency_on_equal_operands is True (configuted per instruction in ISA db)
and all operands are equal, place operand into destination only.
:param dict isa_data: ISA DB entry
@@ -240,12 +240,12 @@ class ISASemantics(object):
op_dict["src_dst"] = []
# handle dependency breaking instructions
if "breaks_pedendency_on_equal_operands" in isa_data and operands[1:] == operands[:-1]:
if "breaks_dependency_on_equal_operands" in isa_data and operands[1:] == operands[:-1]:
op_dict["destination"] += operands
if "hidden_operands" in isa_data:
op_dict["destination"] += [
AttrDict.convert_dict(
{hop["class"]: {k: hop[k] for k in ["class", "source", "destination"]}}
{hop["class"]: {k: hop[k] for k in ["name", "class", "source", "destination"]}}
)
for hop in isa_data["hidden_operands"]
]