From 99077328e663a76bb1571848c8edb4c6b3c6822a Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Wed, 18 Aug 2021 08:18:58 +0200 Subject: [PATCH] Added OpenName. --- pyVHDLModel/SyntaxModel.py | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/pyVHDLModel/SyntaxModel.py b/pyVHDLModel/SyntaxModel.py index bb5745e10..3568a3ec5 100644 --- a/pyVHDLModel/SyntaxModel.py +++ b/pyVHDLModel/SyntaxModel.py @@ -111,8 +111,12 @@ class Name: def __init__(self, identifier: str, prefix: 'Name' = None): self._identifier = identifier - self._prefix = prefix - self._root = prefix._root + if prefix is None: + self._prefix = self + self._root = None + else: + self._prefix = prefix + self._root = prefix._root @property def Identifier(self) -> str: @@ -133,25 +137,8 @@ def Has_Prefix(self) -> bool: @export class SimpleName(Name): - def __init__(self, identifier: str): - self._name = identifier - self._root = self - self._prefix = None - - @property - def Root(self) -> 'Name': - return self - - @property - def Prefix(self) -> Nullable['Name']: - return None - - @property - def Has_Prefix(self) -> bool: - return False - def __str__(self): - return self._name + return self._identifier @export @@ -211,6 +198,15 @@ def __str__(self): return str(self._prefix) + "." + "all" +@export +class OpenName(Name): + def __init__(self): + super().__init__("open") + + def __str__(self): + return "open" + + @export class Symbol(ModelEntity): _symbolName: Name