summaryrefslogtreecommitdiff
path: root/AsmLine.py
diff options
context:
space:
mode:
Diffstat (limited to 'AsmLine.py')
-rw-r--r--AsmLine.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/AsmLine.py b/AsmLine.py
index 4561b30..5a5249f 100644
--- a/AsmLine.py
+++ b/AsmLine.py
@@ -47,25 +47,25 @@ class AsmLine(object):
line = label + ":" + line
parts = self.re_whitespace.split(line, 1)
- instruction = parts[0]
+ self.instruction = parts[0]
- if instruction in Asm.operators_binary:
+ if self.instruction in Asm.operators_binary:
# a label for sure
reg, operand = self.re_whitespace.split(parts[1], 1)
self.register = reg
self.setOperand(operand)
- elif instruction in Asm.operators_branch:
+ elif self.instruction in Asm.operators_branch:
# skip validation of reg for speed
self.register = parts[1]
- elif instruction in Asm.operators_unary:
+ elif self.instruction in Asm.operators_unary:
self.setOperand(parts[1])
- elif instruction in Asm.operators_misc_reg:
+ elif self.instruction in Asm.operators_misc_reg:
self.register = parts[1]
- elif instruction in Asm.operators_misc_noreg:
+ elif self.instruction in Asm.operators_misc_noreg:
# no args
pass
else:
- raise RuntimeError("Unknown instruction '{}'".format(instruction))
+ raise RuntimeError("Unknown instruction '{}'".format(self.instruction))
def setOperand(self, str):
"""Sets the operand for this object either as a string or an identifier
object
@@ -112,3 +112,4 @@ class AsmLine(object):
if self.operand:
# join all operand parts together
line += " " + "".join(str(elm) for elm in self.operand)
+ return line