diff options
author | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2021-06-21 14:34:42 +0200 |
---|---|---|
committer | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2021-06-22 12:26:59 +0200 |
commit | f0796bfab0032e6e7f9c8f52b789bab06ab7e4df (patch) | |
tree | 61fa06ffafc2c6ad3e3865c324517c1b29ea59c6 /pyGHDL/dom/Symbol.py | |
parent | 5303bb777dedfa03bbc3d042bb14c5d9bbae6b52 (diff) | |
download | ghdl-f0796bfab0032e6e7f9c8f52b789bab06ab7e4df.tar.gz ghdl-f0796bfab0032e6e7f9c8f52b789bab06ab7e4df.tar.bz2 ghdl-f0796bfab0032e6e7f9c8f52b789bab06ab7e4df.zip |
Start handling function calls.
Diffstat (limited to 'pyGHDL/dom/Symbol.py')
-rw-r--r-- | pyGHDL/dom/Symbol.py | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/pyGHDL/dom/Symbol.py b/pyGHDL/dom/Symbol.py index af9e59b1d..c82c39729 100644 --- a/pyGHDL/dom/Symbol.py +++ b/pyGHDL/dom/Symbol.py @@ -30,6 +30,10 @@ # # SPDX-License-Identifier: GPL-2.0-or-later # ============================================================================ +from pyGHDL.dom.Common import DOMException +from pyGHDL.libghdl import utils + +from pyGHDL.libghdl.vhdl import nodes from pydecor import export from typing import List @@ -40,7 +44,8 @@ from pyVHDLModel.VHDLModel import ( SimpleSubTypeSymbol as VHDLModel_SimpleSubTypeSymbol, ConstrainedSubTypeSymbol as VHDLModel_ConstrainedSubTypeSymbol, EnumerationLiteralSymbol as VHDLModel_EnumerationLiteralSymbol, - SimpleObjectSymbol as VHDLModel_SimpleObjectSymbol, + SimpleObjectOrFunctionCallSymbol as VHDLModel_SimpleObjectOrFunctionCallSymbol, + IndexedObjectOrFunctionCallSymbol as VHDLModel_IndexedObjectOrFunctionCallSymbol, Constraint, ) @@ -80,8 +85,30 @@ class ConstrainedSubTypeSymbol(VHDLModel_ConstrainedSubTypeSymbol): @export -class SimpleObjectSymbol(VHDLModel_SimpleObjectSymbol): +class SimpleObjectOrFunctionCallSymbol(VHDLModel_SimpleObjectOrFunctionCallSymbol): + @classmethod + def parse(cls, node): + name = GetNameOfNode(node) + return cls(name) + + +@export +class IndexedObjectOrFunctionCallSymbol(VHDLModel_IndexedObjectOrFunctionCallSymbol): @classmethod def parse(cls, node): - name = NodeToName(node) + prefix = nodes.Get_Prefix(node) + name = GetNameOfNode(prefix) + + for item in utils.chain_iter(nodes.Get_Association_Chain(node)): + kind = GetIirKindOfNode(item) + + if kind == nodes.Iir_Kind.Association_Element_By_Expression: + pass + else: + raise DOMException( + "Unknown association kind '{kindName}'({kind}) in array index or function call '{node}'.".format( + kind=kind, kindName=kind.name, node=node + ) + ) + return cls(name) |