[#73220] fix handling closing brackets in SAIF parsing
This commit is contained in:
parent
98a6e9be18
commit
249d8dadc6
|
|
@ -113,6 +113,7 @@ class SAIFParser:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.top_instances = {}
|
self.top_instances = {}
|
||||||
self.current_instance = None
|
self.current_instance = None
|
||||||
|
self.traversing_nets = False
|
||||||
|
|
||||||
def parse(self, saif_filename):
|
def parse(self, saif_filename):
|
||||||
with open(saif_filename, 'r') as saif_file:
|
with open(saif_filename, 'r') as saif_file:
|
||||||
|
|
@ -135,6 +136,10 @@ class SAIFParser:
|
||||||
instance.parent_instance = self.current_instance
|
instance.parent_instance = self.current_instance
|
||||||
self.current_instance = instance
|
self.current_instance = instance
|
||||||
|
|
||||||
|
match = re.search(r'NET', line)
|
||||||
|
if match:
|
||||||
|
self.traversing_nets = True
|
||||||
|
|
||||||
match = re.search(r'((?:[\w\[\]])+)(?:\\\[(\d+)\\\])*\s+(\(T.+\))+', line)
|
match = re.search(r'((?:[\w\[\]])+)(?:\\\[(\d+)\\\])*\s+(\(T.+\))+', line)
|
||||||
if match:
|
if match:
|
||||||
signal_name, bit_index, bit_values = match.groups()
|
signal_name, bit_index, bit_values = match.groups()
|
||||||
|
|
@ -173,7 +178,10 @@ class SAIFParser:
|
||||||
|
|
||||||
match = re.match(r'\s+\)\s+', line)
|
match = re.match(r'\s+\)\s+', line)
|
||||||
if match:
|
if match:
|
||||||
self.current_instance = self.current_instance.parent_instance
|
if self.traversing_nets:
|
||||||
|
self.traversing_nets = False
|
||||||
|
else:
|
||||||
|
self.current_instance = self.current_instance.parent_instance
|
||||||
|
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue