singelton for isa parsers

This commit is contained in:
Julian Hammer
2020-11-09 12:36:14 +01:00
parent a2dd6f752d
commit 979d08358e
3 changed files with 20 additions and 1 deletions

View File

@@ -15,9 +15,12 @@ class BaseParser(object):
SEGMENT_EXT_ID = 'segment_extension'
INSTRUCTION_ID = 'instruction'
OPERANDS_ID = 'operands'
_parser_constructed = False
def __init__(self):
self.construct_parser()
if not self._parser_constructed:
self.construct_parser()
self._parser_constructed = True
@staticmethod
def detect_ISA(file_content):