diff options
author | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2021-06-17 13:12:52 +0200 |
---|---|---|
committer | tgingold <tgingold@users.noreply.github.com> | 2021-06-17 21:34:16 +0200 |
commit | 8e2be80f43a2bdc4f4b84bb1ebd022df1bc65673 (patch) | |
tree | f9d2fb5636a8d5618154a08dabed475b95b475e9 /pyGHDL/cli | |
parent | 4ec5cdcd77aa1b6fc384197e1208061d62f16ba2 (diff) | |
download | ghdl-8e2be80f43a2bdc4f4b84bb1ebd022df1bc65673.tar.gz ghdl-8e2be80f43a2bdc4f4b84bb1ebd022df1bc65673.tar.bz2 ghdl-8e2be80f43a2bdc4f4b84bb1ebd022df1bc65673.zip |
Added a simple frontend for testing.
Diffstat (limited to 'pyGHDL/cli')
-rw-r--r-- | pyGHDL/cli/DOM.py | 48 | ||||
-rw-r--r-- | pyGHDL/cli/__init__.py | 20 | ||||
-rw-r--r-- | pyGHDL/cli/lsp.py | 16 |
3 files changed, 66 insertions, 18 deletions
diff --git a/pyGHDL/cli/DOM.py b/pyGHDL/cli/DOM.py new file mode 100644 index 000000000..b8e6a134e --- /dev/null +++ b/pyGHDL/cli/DOM.py @@ -0,0 +1,48 @@ +from pathlib import Path + +from pydecor import export + +from pyGHDL.dom import Misc +from pyGHDL import GHDLBaseException + +__all__ = [] +__api__ = __all__ + +from pyGHDL.dom.formatting.prettyprint import PrettyPrint + + +@export +class Application: + _design: Misc.Design + + def __init__(self): + self._design = Misc.Design() + + def addFile(self, filename: Path, library: str): + document = Misc.Document(filename) + self._design.Documents.append(document) + + def prettyPrint(self): + buffer = [] + + PP = PrettyPrint() + + for doc in self._design.Documents: + for line in PP.formatDocument(doc): + buffer.append(line) + + print("\n".join(buffer)) + + +def main(): + try: + app = Application() + app.addFile(Path("testsuite/pyunit/SimpleEntity.vhdl"), "default_lib") + except GHDLBaseException as ex: + print(ex) + + app.prettyPrint() + + +if __name__ == "__main__": + main() diff --git a/pyGHDL/cli/__init__.py b/pyGHDL/cli/__init__.py index d8973e44c..d9af8fa76 100644 --- a/pyGHDL/cli/__init__.py +++ b/pyGHDL/cli/__init__.py @@ -1,20 +1,20 @@ # ============================================================================= -# ____ _ _ ____ _ _ _ -# _ __ _ _ / ___| | | | _ \| | ___| (_) -# | '_ \| | | | | _| |_| | | | | | / __| | | -# | |_) | |_| | |_| | _ | |_| | |___ | (__| | | -# | .__/ \__, |\____|_| |_|____/|_____(_)___|_|_| -# |_| |___/ +# ____ _ _ ____ _ _ _ +# _ __ _ _ / ___| | | | _ \| | ___| (_) +# | '_ \| | | | | _| |_| | | | | | / __| | | +# | |_) | |_| | |_| | _ | |_| | |___ | (__| | | +# | .__/ \__, |\____|_| |_|____/|_____(_)___|_|_| +# |_| |___/ # ============================================================================= -# Authors: -# Patrick Lehmann -# Unai Martinez-Corral +# Authors: +# Patrick Lehmann +# Unai Martinez-Corral # # Package package: Package for command line interfaces. # # License: # ============================================================================ -# Copyright (C) 2019-2020 Tristan Gingold +# Copyright (C) 2019-2021 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 diff --git a/pyGHDL/cli/lsp.py b/pyGHDL/cli/lsp.py index 055f53251..951c8b82f 100644 --- a/pyGHDL/cli/lsp.py +++ b/pyGHDL/cli/lsp.py @@ -1,20 +1,20 @@ #!/usr/bin/env python # ============================================================================= -# ____ _ _ ____ _ _ _ -# _ __ _ _ / ___| | | | _ \| | ___| (_) -# | '_ \| | | | | _| |_| | | | | | / __| | | -# | |_) | |_| | |_| | _ | |_| | |___ | (__| | | -# | .__/ \__, |\____|_| |_|____/|_____(_)___|_|_| -# |_| |___/ +# ____ _ _ ____ _ _ _ +# _ __ _ _ / ___| | | | _ \| | ___| (_) +# | '_ \| | | | | _| |_| | | | | | / __| | | +# | |_) | |_| | |_| | _ | |_| | |___ | (__| | | +# | .__/ \__, |\____|_| |_|____/|_____(_)___|_|_| +# |_| |___/ # ============================================================================= -# Authors: +# Authors: # Tristan Gingold # # Package module: GHDLs Language Server implementing LSP for VHDL. # # License: # ============================================================================ -# Copyright (C) 2019-2020 Tristan Gingold +# Copyright (C) 2019-2021 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 |