Separate operand files with inheritance, str and repr classes

This commit is contained in:
stefandesouza
2023-08-20 12:10:07 +02:00
parent 4c74bb0d46
commit 317816b9d3
9 changed files with 98 additions and 247 deletions

View File

@@ -4,17 +4,8 @@ from osaca.parser.operand import Operand
class LabelOperand(Operand):
def __init__(self, NAME_ID = None, COMMENT_ID = None):
super().__init__()
self._NAME_ID = NAME_ID
super().__init__(NAME_ID)
self._COMMENT_ID = COMMENT_ID
@property
def name(self):
return self._NAME_ID
@name.setter
def name(self, name):
self._NAME_ID = name
@property
def comment(self):
@@ -31,4 +22,10 @@ class LabelOperand(Operand):
if not self._COMMENT_ID:
raise StopIteration
return self._COMMENT_ID.pop(0)
def __str__(self):
return f"LabelOperand(NAME_ID={self._NAME_ID}, COMMENT={self._COMMENT_ID})"
def __repr__(self):
return f"LabelOperand(NAME_ID={self._NAME_ID}, COMMENT={self._COMMENT_ID})"