aboutsummaryrefslogtreecommitdiffstats
path: root/python/vhdl_langserver/lsptools.py
diff options
context:
space:
mode:
authorumarcor <unai.martinezcorral@ehu.eus>2020-12-27 22:10:38 +0100
committerumarcor <unai.martinezcorral@ehu.eus>2020-12-27 23:13:21 +0100
commitbf74a0983c2d534e217e7312ab559ca8929ff8a2 (patch)
treefb630d5b83afc2f112996ebb5f1eac44de868132 /python/vhdl_langserver/lsptools.py
parent340fc792bba2ffdb4f930bc427a39ea3a1b659b2 (diff)
downloadghdl-bf74a0983c2d534e217e7312ab559ca8929ff8a2.tar.gz
ghdl-bf74a0983c2d534e217e7312ab559ca8929ff8a2.tar.bz2
ghdl-bf74a0983c2d534e217e7312ab559ca8929ff8a2.zip
rework 'python', rename to 'pyGHDL'
* Rename 'python' to 'pyGHDL'. * Let 'thin' be 'libghdl'. * Move move 'pyutils.py' from 'python/libghdl/vhdl' to a separate package ('pyGHDL/libghdl/utils/'). * Update 'vhdl_langserver' accordingly. * Rename 'vhdl_langserver' to 'lsp'. * Move 'ghdl-ls' to 'pyGHDL/cli'.
Diffstat (limited to 'python/vhdl_langserver/lsptools.py')
-rw-r--r--python/vhdl_langserver/lsptools.py41
1 files changed, 0 insertions, 41 deletions
diff --git a/python/vhdl_langserver/lsptools.py b/python/vhdl_langserver/lsptools.py
deleted file mode 100644
index 648f0a8c0..000000000
--- a/python/vhdl_langserver/lsptools.py
+++ /dev/null
@@ -1,41 +0,0 @@
-import sys
-import argparse
-import json
-from . import lsp
-
-
-def lsp2json():
- "Utility that transforms lsp log file to a JSON list"
- conn = lsp.LSPConn(sys.stdin.buffer, sys.stdout.buffer)
- ls = lsp.LanguageProtocolServer(None, conn)
- res = []
- while True:
- req = ls.read_request()
- if req is None:
- break
- res.append(json.loads(req))
- print(json.dumps(res, indent=2))
-
-
-def json2lsp():
- "Utility that transform a JSON list to an lsp file"
- res = json.load(sys.stdin)
- conn = lsp.LSPConn(sys.stdin.buffer, sys.stdout.buffer)
- ls = lsp.LanguageProtocolServer(None, conn)
- for req in res:
- ls.write_output(req)
-
-
-def main():
- parser = argparse.ArgumentParser()
- subparsers = parser.add_subparsers(help="sub-command help")
- parser_l2j = subparsers.add_parser("lsp2json", help="convert lsp dump to JSON")
- parser_l2j.set_defaults(func=lsp2json)
- parser_j2l = subparsers.add_parser("json2lsp", help="convert JSON to lsp dump")
- parser_j2l.set_defaults(func=json2lsp)
- args = parser.parse_args()
- args.func()
-
-
-if __name__ == "__main__":
- main()