diff options
author | Unai Martinez-Corral <38422348+umarcor@users.noreply.github.com> | 2021-06-23 16:07:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-23 16:07:10 +0100 |
commit | c6283d9a9b40c3e9afeba912fcb13aa9d56b9c52 (patch) | |
tree | e1706cb19a2439e3d94657e54c688a36c703f048 /pyGHDL/dom/Symbol.py | |
parent | 983236ac3dfd0c455a0ac910a9a468ea2c81e5d9 (diff) | |
parent | 240b4fdd90a9f3ca04e8e168bffdc92bea2ca3f3 (diff) | |
download | ghdl-c6283d9a9b40c3e9afeba912fcb13aa9d56b9c52.tar.gz ghdl-c6283d9a9b40c3e9afeba912fcb13aa9d56b9c52.tar.bz2 ghdl-c6283d9a9b40c3e9afeba912fcb13aa9d56b9c52.zip |
DOM: Functions and types (#1804)
Diffstat (limited to 'pyGHDL/dom/Symbol.py')
-rw-r--r-- | pyGHDL/dom/Symbol.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/pyGHDL/dom/Symbol.py b/pyGHDL/dom/Symbol.py index 1865e4481..d6d348f14 100644 --- a/pyGHDL/dom/Symbol.py +++ b/pyGHDL/dom/Symbol.py @@ -30,13 +30,15 @@ # # SPDX-License-Identifier: GPL-2.0-or-later # ============================================================================ -from typing import List +from typing import List, Iterator from pydecor import export +from pyGHDL.dom.Range import Range from pyVHDLModel.VHDLModel import ( EntitySymbol as VHDLModel_EntitySymbol, SimpleSubTypeSymbol as VHDLModel_SimpleSubTypeSymbol, - ConstrainedSubTypeSymbol as VHDLModel_ConstrainedSubTypeSymbol, + ConstrainedScalarSubTypeSymbol as VHDLModel_ConstrainedScalarSubTypeSymbol, + ConstrainedCompositeSubTypeSymbol as VHDLModel_ConstrainedCompositeSubTypeSymbol, EnumerationLiteralSymbol as VHDLModel_EnumerationLiteralSymbol, SimpleObjectOrFunctionCallSymbol as VHDLModel_SimpleObjectOrFunctionCallSymbol, IndexedObjectOrFunctionCallSymbol as VHDLModel_IndexedObjectOrFunctionCallSymbol, @@ -66,15 +68,24 @@ class EnumerationLiteralSymbol(VHDLModel_EnumerationLiteralSymbol): @export class SimpleSubTypeSymbol(VHDLModel_SimpleSubTypeSymbol): def __init__(self, subTypeName: str): + if isinstance(subTypeName, (List, Iterator)): + subTypeName = ".".join(subTypeName) + super().__init__(subTypeName=subTypeName) + +@export +class ConstrainedScalarSubTypeSymbol(VHDLModel_ConstrainedScalarSubTypeSymbol): + def __init__(self, subTypeName: str, range: Range = None): + super().__init__(subTypeName=subTypeName, range=range) + @classmethod def parse(cls, node): pass @export -class ConstrainedSubTypeSymbol(VHDLModel_ConstrainedSubTypeSymbol): +class ConstrainedCompositeSubTypeSymbol(VHDLModel_ConstrainedCompositeSubTypeSymbol): def __init__(self, subTypeName: str, constraints: List[Constraint] = None): super().__init__(subTypeName=subTypeName, constraints=constraints) |