Commit 3d55f49e authored by eckhart's avatar eckhart
Browse files

- stub for a compilation-server-module extended

parent e7bf6e42
...@@ -103,7 +103,7 @@ if __name__ == "__main__": ...@@ -103,7 +103,7 @@ if __name__ == "__main__":
file_name, log_dir = sys.argv[1], '' file_name, log_dir = sys.argv[1], ''
if file_name in ['-d', '--debug'] and len(sys.argv) > 2: if file_name in ['-d', '--debug'] and len(sys.argv) > 2:
file_name, log_dir = sys.argv[2], 'LOGS' file_name, log_dir = sys.argv[2], 'LOGS'
result, errors, ast = compile_src(file_name, log_dir) result, errors, _ = compile_src(file_name, log_dir)
if errors: if errors:
cwd = os.getcwd() cwd = os.getcwd()
rel_path = file_name[len(cwd):] if file_name.startswith(cwd) else file_name rel_path = file_name[len(cwd):] if file_name.startswith(cwd) else file_name
...@@ -115,6 +115,7 @@ if __name__ == "__main__": ...@@ -115,6 +115,7 @@ if __name__ == "__main__":
else: else:
print("Usage: {NAME}Compiler.py [FILENAME]") print("Usage: {NAME}Compiler.py [FILENAME]")
''' '''
# TODO: Add support for spawning a compilation server via supprocess.Popen() to DHParser main
class DSLException(Exception): class DSLException(Exception):
......
...@@ -42,8 +42,7 @@ class TestServer: ...@@ -42,8 +42,7 @@ class TestServer:
p = Process(target=cs.run_server) p = Process(target=cs.run_server)
p.start() p.start()
async def compile(src, log_dir): async def compile(src, log_dir):
reader, writer = await asyncio.open_connection( reader, writer = await asyncio.open_connection('127.0.0.1', 8888)
'127.0.0.1', 8888)
writer.write(src.encode()) writer.write(src.encode())
data = await reader.read(100) data = await reader.read(100)
print(f'Received: {data.decode()!r}') print(f'Received: {data.decode()!r}')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment