mirror of
https://github.com/RRZE-HPC/OSACA.git
synced 2026-01-06 19:20:07 +01:00
Separate operand files with inheritance, str and repr classes
This commit is contained in:
@@ -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})"
|
||||
|
||||
Reference in New Issue
Block a user