aboutsummaryrefslogtreecommitdiffstats
path: root/pyGHDL/dom/_Translate.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyGHDL/dom/_Translate.py')
-rw-r--r--pyGHDL/dom/_Translate.py64
1 files changed, 48 insertions, 16 deletions
diff --git a/pyGHDL/dom/_Translate.py b/pyGHDL/dom/_Translate.py
index 7e21b98bf..a125abfe5 100644
--- a/pyGHDL/dom/_Translate.py
+++ b/pyGHDL/dom/_Translate.py
@@ -216,7 +216,9 @@ def GetAssociations(node: Iir) -> List:
associations.append(expr)
else:
- raise DOMException(f"Unknown association kind '{kind.name}' in array index/slice or function call '{node}'.")
+ raise DOMException(
+ f"Unknown association kind '{kind.name}' in array index/slice or function call '{node}'."
+ )
return associations
@@ -239,7 +241,9 @@ def GetArrayConstraintsFromSubtypeIndication(
constraints.append(GetNameFromNode(constraint))
else:
position = Position.parse(constraint)
- raise DOMException(f"Unknown constraint kind '{constraintKind.name}' for constraint '{constraint}' in subtype indication '{subtypeIndication}' at {position.Filename}:{position.Line}:{position.Column}.")
+ raise DOMException(
+ f"Unknown constraint kind '{constraintKind.name}' for constraint '{constraint}' in subtype indication '{subtypeIndication}' at {position.Filename}:{position.Line}:{position.Column}."
+ )
return constraints
@@ -266,7 +270,9 @@ def GetTypeFromNode(node: Iir) -> BaseType:
return ProtectedType.parse(typeName, typeDefinition)
else:
position = Position.parse(typeDefinition)
- raise DOMException(f"GetTypeFromNode: Unknown type definition kind '{kind.name}' for type '{typeName}' at {position.Filename}:{position.Line}:{position.Column}.")
+ raise DOMException(
+ f"GetTypeFromNode: Unknown type definition kind '{kind.name}' for type '{typeName}' at {position.Filename}:{position.Line}:{position.Column}."
+ )
@export
@@ -294,7 +300,9 @@ def GetAnonymousTypeFromNode(node: Iir) -> BaseType:
return ArrayType(typeDefinition, "????", [], None)
else:
position = Position.parse(typeDefinition)
- raise DOMException(f"GetAnonymousTypeFromNode: Unknown type definition kind '{kind.name}' for type '{typeName}' at {position.Filename}:{position.Line}:{position.Column}.")
+ raise DOMException(
+ f"GetAnonymousTypeFromNode: Unknown type definition kind '{kind.name}' for type '{typeName}' at {position.Filename}:{position.Line}:{position.Column}."
+ )
@export
@@ -438,7 +446,9 @@ def GetExpressionFromNode(node: Iir) -> ExpressionUnion:
cls = __EXPRESSION_TRANSLATION[kind]
except KeyError:
position = Position.parse(node)
- raise DOMException(f"Unknown expression kind '{kind.name}' in expression '{node}' at {position.Filename}:{position.Line}:{position.Column}.")
+ raise DOMException(
+ f"Unknown expression kind '{kind.name}' in expression '{node}' at {position.Filename}:{position.Line}:{position.Column}."
+ )
return cls.parse(node)
@@ -495,7 +505,9 @@ def GetGenericsFromChainedNodes(
yield GenericFunctionInterfaceItem.parse(generic)
else:
position = Position.parse(generic)
- raise DOMException(f"Unknown generic kind '{kind.name}' in generic '{generic}' at {position.Filename}:{position.Line}:{position.Column}.")
+ raise DOMException(
+ f"Unknown generic kind '{kind.name}' in generic '{generic}' at {position.Filename}:{position.Line}:{position.Column}."
+ )
generic = nodes.Get_Chain(generic)
@@ -537,7 +549,9 @@ def GetPortsFromChainedNodes(
continue
else:
position = Position.parse(port)
- raise DOMException(f"Unknown port kind '{kind.name}' in port '{port}' at {position.Filename}:{position.Line}:{position.Column}.")
+ raise DOMException(
+ f"Unknown port kind '{kind.name}' in port '{port}' at {position.Filename}:{position.Line}:{position.Column}."
+ )
@export
@@ -566,7 +580,9 @@ def GetParameterFromChainedNodes(
param = ParameterFileInterfaceItem.parse(parameter)
else:
position = Position.parse(parameter)
- raise DOMException(f"Unknown parameter kind '{kind.name}' in parameter '{parameter}' at {position.Filename}:{position.Line}:{position.Column}.")
+ raise DOMException(
+ f"Unknown parameter kind '{kind.name}' in parameter '{parameter}' at {position.Filename}:{position.Line}:{position.Column}."
+ )
# Lookahead for parameters with multiple identifiers at once
if nodes.Get_Has_Identifier_List(parameter):
@@ -682,7 +698,9 @@ def GetDeclaredItemsFromChainedNodes(nodeChain: Iir, entity: str, name: str) ->
pass
else:
position = Position.parse(item)
- raise DOMException(f"Found unexpected function body '{GetNameOfNode(item)}' in {entity} '{name}' at {position.Filename}:{position.Line}:{position.Column}.")
+ raise DOMException(
+ f"Found unexpected function body '{GetNameOfNode(item)}' in {entity} '{name}' at {position.Filename}:{position.Line}:{position.Column}."
+ )
elif kind == nodes.Iir_Kind.Procedure_Declaration:
if nodes.Get_Has_Body(item):
yield Procedure.parse(item)
@@ -697,7 +715,9 @@ def GetDeclaredItemsFromChainedNodes(nodeChain: Iir, entity: str, name: str) ->
pass
else:
position = Position.parse(item)
- raise DOMException(f"Found unexpected procedure body '{GetNameOfNode(item)}' in {entity} '{name}' at {position.Filename}:{position.Line}:{position.Column}.")
+ raise DOMException(
+ f"Found unexpected procedure body '{GetNameOfNode(item)}' in {entity} '{name}' at {position.Filename}:{position.Line}:{position.Column}."
+ )
elif kind == nodes.Iir_Kind.Protected_Type_Body:
yield ProtectedTypeBody.parse(item)
elif kind == nodes.Iir_Kind.Object_Alias_Declaration:
@@ -748,7 +768,9 @@ def GetDeclaredItemsFromChainedNodes(nodeChain: Iir, entity: str, name: str) ->
print(f"[NOT IMPLEMENTED] Terminal declaration in {name}")
else:
position = Position.parse(item)
- raise DOMException(f"Unknown declared item kind '{kind.name}' in {entity} '{name}' at {position.Filename}:{position.Line}:{position.Column}.")
+ raise DOMException(
+ f"Unknown declared item kind '{kind.name}' in {entity} '{name}' at {position.Filename}:{position.Line}:{position.Column}."
+ )
lastKind = None
item = nodes.Get_Chain(item)
@@ -796,9 +818,13 @@ def GetConcurrentStatementsFromChainedNodes(
elif kind == nodes.Iir_Kind.Concurrent_Simple_Signal_Assignment:
yield ConcurrentSimpleSignalAssignment.parse(statement, label)
elif kind == nodes.Iir_Kind.Concurrent_Conditional_Signal_Assignment:
- print(f"[NOT IMPLEMENTED] Concurrent (conditional) signal assignment (label: '{label}') at line {position.Line}")
+ print(
+ f"[NOT IMPLEMENTED] Concurrent (conditional) signal assignment (label: '{label}') at line {position.Line}"
+ )
elif kind == nodes.Iir_Kind.Concurrent_Selected_Signal_Assignment:
- print(f"[NOT IMPLEMENTED] Concurrent (selected) signal assignment (label: '{label}') at line {position.Line}")
+ print(
+ f"[NOT IMPLEMENTED] Concurrent (selected) signal assignment (label: '{label}') at line {position.Line}"
+ )
elif kind == nodes.Iir_Kind.Concurrent_Procedure_Call_Statement:
yield ConcurrentProcedureCall.parse(statement, label)
elif kind == nodes.Iir_Kind.Component_Instantiation_Statement:
@@ -811,7 +837,9 @@ def GetConcurrentStatementsFromChainedNodes(
elif instantiatedUnitKind == nodes.Iir_Kind.Simple_Name:
yield ComponentInstantiation.parse(statement, instantiatedUnit, label)
else:
- raise DOMException(f"Unknown instantiation kind '{instantiatedUnitKind.name}' in instantiation of label {label} at {position.Filename}:{position.Line}:{position.Column}.")
+ raise DOMException(
+ f"Unknown instantiation kind '{instantiatedUnitKind.name}' in instantiation of label {label} at {position.Filename}:{position.Line}:{position.Column}."
+ )
elif kind == nodes.Iir_Kind.Block_Statement:
yield ConcurrentBlockStatement.parse(statement, label)
elif kind == nodes.Iir_Kind.If_Generate_Statement:
@@ -825,7 +853,9 @@ def GetConcurrentStatementsFromChainedNodes(
elif kind == nodes.Iir_Kind.Simple_Simultaneous_Statement:
print(f"[NOT IMPLEMENTED] Simple simultaneous statement (label: '{label}') at line {position.Line}")
else:
- raise DOMException(f"Unknown statement of kind '{kind.name}' in {entity} '{name}' at {position.Filename}:{position.Line}:{position.Column}.")
+ raise DOMException(
+ f"Unknown statement of kind '{kind.name}' in {entity} '{name}' at {position.Filename}:{position.Line}:{position.Column}."
+ )
def GetSequentialStatementsFromChainedNodes(
@@ -861,7 +891,9 @@ def GetSequentialStatementsFromChainedNodes(
elif kind == nodes.Iir_Kind.Null_Statement:
yield NullStatement(statement, label)
else:
- raise DOMException(f"Unknown statement of kind '{kind.name}' in {entity} '{name}' at {position.Filename}:{position.Line}:{position.Column}.")
+ raise DOMException(
+ f"Unknown statement of kind '{kind.name}' in {entity} '{name}' at {position.Filename}:{position.Line}:{position.Column}."
+ )
def GetAliasFromNode(aliasNode: Iir):