diff options
author | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2022-11-28 23:16:11 +0100 |
---|---|---|
committer | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2022-12-23 23:42:29 +0100 |
commit | 3a3e8e5fded027c1dc6e3566c5ad9a30e8bc5297 (patch) | |
tree | 150f8e74ef2490b930d70f0c32a72a701c9d3730 /pyGHDL/dom/Attribute.py | |
parent | 93bf628dc6178674d01255b2b609245605b0aca4 (diff) | |
download | ghdl-3a3e8e5fded027c1dc6e3566c5ad9a30e8bc5297.tar.gz ghdl-3a3e8e5fded027c1dc6e3566c5ad9a30e8bc5297.tar.bz2 ghdl-3a3e8e5fded027c1dc6e3566c5ad9a30e8bc5297.zip |
Added handling of associated documentation comments.
Diffstat (limited to 'pyGHDL/dom/Attribute.py')
-rw-r--r-- | pyGHDL/dom/Attribute.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/pyGHDL/dom/Attribute.py b/pyGHDL/dom/Attribute.py index 86be400ac..576b05245 100644 --- a/pyGHDL/dom/Attribute.py +++ b/pyGHDL/dom/Attribute.py @@ -13,7 +13,7 @@ # # License: # ============================================================================ -# Copyright (C) 2019-2021 Tristan Gingold +# Copyright (C) 2019-2022 Tristan Gingold # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -46,7 +46,7 @@ from pyGHDL.libghdl._types import Iir from pyGHDL.libghdl.vhdl import nodes from pyGHDL.libghdl.vhdl.tokens import Tok from pyGHDL.dom import DOMMixin, Position, DOMException, Expression -from pyGHDL.dom._Utils import GetNameOfNode, GetIirKindOfNode +from pyGHDL.dom._Utils import GetNameOfNode, GetIirKindOfNode, GetDocumentationOfNode from pyGHDL.dom._Translate import GetNameFromNode, GetExpressionFromNode from pyGHDL.dom.Names import SimpleName from pyGHDL.dom.Symbol import SimpleSubtypeSymbol @@ -54,18 +54,19 @@ from pyGHDL.dom.Symbol import SimpleSubtypeSymbol @export class Attribute(VHDLModel_Attribute, DOMMixin): - def __init__(self, node: Iir, identifier: str, subtype: SubtypeOrSymbol): - super().__init__(identifier, subtype) + def __init__(self, node: Iir, identifier: str, subtype: SubtypeOrSymbol, documentation: str = None): + super().__init__(identifier, subtype, documentation) DOMMixin.__init__(self, node) @classmethod def parse(cls, attributeNode: Iir) -> "Attribute": name = GetNameOfNode(attributeNode) + documentation = GetDocumentationOfNode(attributeNode) subtypeMark = nodes.Get_Type_Mark(attributeNode) subtypeName = GetNameOfNode(subtypeMark) subtype = SimpleSubtypeSymbol(subtypeMark, subtypeName) - return cls(attributeNode, name, subtype) + return cls(attributeNode, name, subtype, documentation) _TOKEN_TRANSLATION = { @@ -102,14 +103,16 @@ class AttributeSpecification(VHDLModel_AttributeSpecification, DOMMixin): attribute: Name, entityClass: EntityClass, expression: Expression, + documentation: str = None ): - super().__init__(identifiers, attribute, entityClass, expression) + super().__init__(identifiers, attribute, entityClass, expression, documentation) DOMMixin.__init__(self, node) @classmethod def parse(cls, attributeNode: Iir) -> "AttributeSpecification": attributeDesignator = nodes.Get_Attribute_Designator(attributeNode) attributeName = GetNameFromNode(attributeDesignator) + documentation = GetDocumentationOfNode(attributeNode) names = [] entityNameList = nodes.Get_Entity_Name_List(attributeNode) @@ -136,4 +139,4 @@ class AttributeSpecification(VHDLModel_AttributeSpecification, DOMMixin): expression = GetExpressionFromNode(nodes.Get_Expression(attributeNode)) - return cls(attributeNode, names, attributeName, entityClass, expression) + return cls(attributeNode, names, attributeName, entityClass, expression, documentation) |