mirror of
https://github.com/YosysHQ/sby.git
synced 2025-04-05 14:04:07 +00:00
sby: core: updated the parsing to match the changes in PR #206
This commit is contained in:
parent
e4a7f624c1
commit
2f841e5d55
|
@ -290,6 +290,7 @@ class SbyConfig:
|
||||||
self.error(f"sby file syntax error: '[options]' section does not accept any arguments. got {args}")
|
self.error(f"sby file syntax error: '[options]' section does not accept any arguments. got {args}")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# [engines (MODE)]
|
||||||
if section == "engines":
|
if section == "engines":
|
||||||
mode = "engines"
|
mode = "engines"
|
||||||
if len(entries) > 2:
|
if len(entries) > 2:
|
||||||
|
@ -306,30 +307,36 @@ class SbyConfig:
|
||||||
# self.error(f"Already defined engine block for mode '{entries[1]}'")
|
# self.error(f"Already defined engine block for mode '{entries[1]}'")
|
||||||
|
|
||||||
# [setup]
|
# [setup]
|
||||||
if entries[0] == "setup":
|
if section == "setup":
|
||||||
mode = "setup"
|
mode = "setup"
|
||||||
if len(self.setup) != 0 or len(entries) != 1:
|
if len(self.setup) != 0:
|
||||||
self.error(f"sby file syntax error: {line}")
|
self.error(f"sby file syntax error: '[setup]' section already defined")
|
||||||
continue
|
|
||||||
|
if args is not None:
|
||||||
|
self.error(f"sby file syntax error: '[setup]' section does not accept any arguments. got {args}")
|
||||||
|
|
||||||
# [stage <NAME> (PARENTS,...)]
|
# [stage <NAME> (PARENTS,...)]
|
||||||
if entries[0] == "stage":
|
if section == "stage":
|
||||||
mode = "stage"
|
mode = "stage"
|
||||||
if len(entries) > 3 or len(entries) < 2:
|
|
||||||
self.error(f"sby file syntax error: {line}")
|
|
||||||
|
|
||||||
if len(entries) == 2:
|
if args is None:
|
||||||
parent = None
|
self.error(f"sby file syntax error: '[stage]' section expects arguments, got none")
|
||||||
|
|
||||||
|
section_args = args.split(" ", maxsplit = 1)
|
||||||
|
|
||||||
|
|
||||||
|
if len(section_args) == 1:
|
||||||
|
parents = None
|
||||||
else:
|
else:
|
||||||
parent = entries[2].split(',')
|
parents = list(map(lambda a: a.trim(), section_args[1].split(',')))
|
||||||
|
|
||||||
key = entries[1]
|
stage_name = section_args[0]
|
||||||
|
|
||||||
if key in self.stage:
|
if stage_name in self.stage:
|
||||||
self.error(f"stage {key} already defined")
|
self.error(f"stage {stage_name} already defined")
|
||||||
|
|
||||||
self.stage[key] = {
|
self.stage[stage_name] = {
|
||||||
'parent': parent
|
'parents': parents
|
||||||
}
|
}
|
||||||
|
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue