From c61eaa86a324db2dc1ee50004c1a505ae437b43d Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 29 Jun 2021 14:34:48 +0200 Subject: Added Allocations. --- pyGHDL/dom/Expression.py | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'pyGHDL/dom/Expression.py') diff --git a/pyGHDL/dom/Expression.py b/pyGHDL/dom/Expression.py index 3dc1271f2..91ff19f12 100644 --- a/pyGHDL/dom/Expression.py +++ b/pyGHDL/dom/Expression.py @@ -73,6 +73,8 @@ from pyVHDLModel.VHDLModel import ( ShiftLeftArithmeticExpression as VHDLModel_ShiftLeftArithmeticExpression, RotateRightExpression as VHDLModel_RotateRightExpression, RotateLeftExpression as VHDLModel_RotateLeftExpression, + SubtypeAllocation as VHDLModel_SubtypeAllocation, + QualifiedExpressionAllocation as VHDLModel_QualifiedExpressionAllocation, Aggregate as VHDLModel_Aggregate, Expression, AggregateElement, @@ -444,7 +446,37 @@ class QualifiedExpression(VHDLModel_QualifiedExpression, DOMMixin): typeMarkName = GetNameOfNode(nodes.Get_Type_Mark(node)) subType = SimpleSubTypeSymbol(node, typeMarkName) operand = GetExpressionFromNode(nodes.Get_Expression(node)) - return cls(node, subType, operand) + return cls(node, subtype, operand) + + +@export +class SubtypeAllocation(VHDLModel_SubtypeAllocation, DOMMixin): + def __init__(self, node: Iir, subtype: Symbol): + super().__init__(subtype) + DOMMixin.__init__(self, node) + + @classmethod + def parse(cls, node: Iir) -> "QualifiedExpressionAllocation": + from pyGHDL.dom._Translate import GetSubtypeIndicationFromNode + + subtype = GetSubtypeIndicationFromNode(node, "allocation", "?") + + return cls(node, subtype) + + +@export +class QualifiedExpressionAllocation(VHDLModel_QualifiedExpressionAllocation, DOMMixin): + def __init__(self, node: Iir, qualifiedExpression: QualifiedExpression): + super().__init__(qualifiedExpression) + DOMMixin.__init__(self, node) + + @classmethod + def parse(cls, node: Iir) -> "QualifiedExpressionAllocation": + from pyGHDL.dom._Translate import GetExpressionFromNode + + expression = GetExpressionFromNode(nodes.Get_Expression(node)) + + return cls(node, expression) @export -- cgit v1.2.3