jaclang 0.0.6__py3-none-any.whl → 0.0.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of jaclang might be problematic. Click here for more details.

Files changed (82) hide show
  1. jaclang/__init__.py +2 -1
  2. jaclang/cli/__jac_gen__/__init__.py +0 -0
  3. jaclang/cli/__jac_gen__/cli.py +175 -0
  4. jaclang/cli/__jac_gen__/cmds.py +132 -0
  5. jaclang/cli/cmds.jac +3 -0
  6. jaclang/cli/impl/__jac_gen__/__init__.py +0 -0
  7. jaclang/cli/impl/__jac_gen__/cli_impl.py +16 -0
  8. jaclang/cli/impl/__jac_gen__/cmds_impl.py +26 -0
  9. jaclang/cli/impl/cmds_impl.jac +17 -3
  10. jaclang/core/__jac_gen__/__init__.py +0 -0
  11. jaclang/core/__jac_gen__/primitives.py +567 -0
  12. jaclang/core/impl/__jac_gen__/__init__.py +0 -0
  13. jaclang/core/impl/__jac_gen__/arch_impl.py +24 -0
  14. jaclang/core/impl/__jac_gen__/element_impl.py +26 -0
  15. jaclang/core/impl/__jac_gen__/exec_ctx_impl.py +12 -0
  16. jaclang/core/impl/__jac_gen__/memory_impl.py +14 -0
  17. jaclang/core/impl/element_impl.jac +2 -2
  18. jaclang/core/primitives.jac +1 -0
  19. jaclang/jac/absyntree.py +65 -42
  20. jaclang/jac/constant.py +4 -0
  21. jaclang/jac/importer.py +18 -60
  22. jaclang/jac/langserve.py +26 -0
  23. jaclang/jac/lexer.py +9 -1
  24. jaclang/jac/parser.py +135 -123
  25. jaclang/jac/passes/blue/ast_build_pass.py +410 -353
  26. jaclang/jac/passes/blue/blue_pygen_pass.py +15 -0
  27. jaclang/jac/passes/blue/decl_def_match_pass.py +33 -21
  28. jaclang/jac/passes/blue/import_pass.py +1 -1
  29. jaclang/jac/passes/blue/pyout_pass.py +47 -12
  30. jaclang/jac/passes/blue/sym_tab_build_pass.py +38 -127
  31. jaclang/jac/passes/blue/tests/test_ast_build_pass.py +2 -2
  32. jaclang/jac/passes/blue/tests/test_blue_pygen_pass.py +9 -30
  33. jaclang/jac/passes/blue/tests/test_decl_def_match_pass.py +13 -13
  34. jaclang/jac/passes/blue/tests/test_sym_tab_build_pass.py +6 -4
  35. jaclang/jac/passes/ir_pass.py +1 -1
  36. jaclang/jac/passes/purple/__jac_gen__/__init__.py +0 -0
  37. jaclang/jac/passes/purple/__jac_gen__/analyze_pass.py +37 -0
  38. jaclang/jac/passes/purple/__jac_gen__/purple_pygen_pass.py +305 -0
  39. jaclang/jac/passes/purple/impl/__jac_gen__/__init__.py +0 -0
  40. jaclang/jac/passes/purple/impl/__jac_gen__/purple_pygen_pass_impl.py +23 -0
  41. jaclang/jac/symtable.py +12 -4
  42. jaclang/jac/tests/fixtures/__jac_gen__/__init__.py +0 -0
  43. jaclang/jac/tests/fixtures/__jac_gen__/hello_world.py +16 -0
  44. jaclang/jac/tests/fixtures/fam.jac +7 -8
  45. jaclang/jac/transform.py +4 -3
  46. jaclang/jac/transpiler.py +13 -9
  47. jaclang/utils/fstring_parser.py +2 -2
  48. jaclang/utils/helpers.py +41 -0
  49. jaclang/utils/test.py +30 -0
  50. jaclang/vendor/__init__.py +1 -0
  51. jaclang/vendor/pygls/__init__.py +25 -0
  52. jaclang/vendor/pygls/capabilities.py +502 -0
  53. jaclang/vendor/pygls/client.py +176 -0
  54. jaclang/vendor/pygls/constants.py +26 -0
  55. jaclang/vendor/pygls/exceptions.py +220 -0
  56. jaclang/vendor/pygls/feature_manager.py +241 -0
  57. jaclang/vendor/pygls/lsp/__init__.py +139 -0
  58. jaclang/vendor/pygls/lsp/client.py +2224 -0
  59. jaclang/vendor/pygls/lsprotocol/__init__.py +2 -0
  60. jaclang/vendor/pygls/lsprotocol/_hooks.py +1233 -0
  61. jaclang/vendor/pygls/lsprotocol/converters.py +17 -0
  62. jaclang/vendor/pygls/lsprotocol/types.py +12820 -0
  63. jaclang/vendor/pygls/lsprotocol/validators.py +47 -0
  64. jaclang/vendor/pygls/progress.py +79 -0
  65. jaclang/vendor/pygls/protocol.py +1184 -0
  66. jaclang/vendor/pygls/server.py +620 -0
  67. jaclang/vendor/pygls/uris.py +184 -0
  68. jaclang/vendor/pygls/workspace/__init__.py +81 -0
  69. jaclang/vendor/pygls/workspace/position.py +204 -0
  70. jaclang/vendor/pygls/workspace/text_document.py +234 -0
  71. jaclang/vendor/pygls/workspace/workspace.py +311 -0
  72. {jaclang-0.0.6.dist-info → jaclang-0.0.8.dist-info}/METADATA +1 -1
  73. jaclang-0.0.8.dist-info/RECORD +118 -0
  74. jaclang/core/jaclang.jac +0 -62
  75. jaclang-0.0.6.dist-info/RECORD +0 -76
  76. /jaclang/{utils → vendor}/sly/__init__.py +0 -0
  77. /jaclang/{utils → vendor}/sly/docparse.py +0 -0
  78. /jaclang/{utils → vendor}/sly/lex.py +0 -0
  79. /jaclang/{utils → vendor}/sly/yacc.py +0 -0
  80. {jaclang-0.0.6.dist-info → jaclang-0.0.8.dist-info}/WHEEL +0 -0
  81. {jaclang-0.0.6.dist-info → jaclang-0.0.8.dist-info}/entry_points.txt +0 -0
  82. {jaclang-0.0.6.dist-info → jaclang-0.0.8.dist-info}/top_level.txt +0 -0
jaclang/__init__.py CHANGED
@@ -1,4 +1,5 @@
1
1
  """The Jac Programming Language."""
2
- from jaclang.jac.importer import handle_jac_error, jac_blue_import, jac_purple_import
2
+ from jaclang.jac.importer import jac_blue_import, jac_purple_import
3
+ from jaclang.utils.helpers import handle_jac_error
3
4
 
4
5
  __all__ = ["jac_blue_import", "jac_purple_import", "handle_jac_error"]
File without changes
@@ -0,0 +1,175 @@
1
+ """
2
+ This is the implementation of the command line interface tool for the
3
+ Jac language. It's built with the Jac language via bootstraping and
4
+ represents the first such complete Jac program.
5
+ """ # 0 1
6
+ from __future__ import annotations
7
+ from jaclang import jac_purple_import as __jac_import__ # -1 0
8
+ import traceback as __jac_traceback__ # -1 0
9
+ from jaclang import handle_jac_error as __jac_error__ # -1 0
10
+ from jaclang.core import exec_ctx as _jac_exec_ctx_ # -1 0
11
+ from jaclang.core import Object as _jac_Object_ # -1 0
12
+ from jaclang.core import make_architype as _jac_make_architype_ # -1 0
13
+ import inspect # 0 7
14
+
15
+ import argparse # 0 8
16
+
17
+ import cmd # 0 9
18
+
19
+ __jac_import__(target='impl.cli_impl', base_path=__file__) # 0 10
20
+ from impl.cli_impl import * # 0 10
21
+
22
+ @_jac_make_architype_(_jac_Object_) # 0 13
23
+ class Command: # 0 13
24
+ def __init__(self, # 0 0
25
+ func = None, # 0 0
26
+ sig = None, # 0 0
27
+ *args, **kwargs): # 0 0
28
+ self.func = func # 0 0
29
+ self.sig = sig # 0 0
30
+ self.func = func # 1 4
31
+ self.sig = inspect.signature(func) # 1 4
32
+
33
+ def call(self,*args: list, **kwargs: dict): # 0 18
34
+ try: # 0 18
35
+ return self.func(*args, **kwargs) # 1 9
36
+ except Exception as e: # 0 18
37
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 18
38
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 18
39
+ e.args = (f'{e.args[0]}\n' + __jac_tmp__,) + e.args[1:] if 'Jac error originates from...' not in str(e) else e.args # 0 18
40
+ raise e # 0 18 # 0 13
41
+
42
+ @_jac_make_architype_(_jac_Object_) # 0 22
43
+ class CommandRegistry: # 0 22
44
+ def __init__(self, # 0 0
45
+ registry = None, # 0 0
46
+ sub_parsers = None, # 0 0
47
+ parser = None, # 0 0
48
+ *args, **kwargs): # 0 0
49
+ self.registry = registry # 0 0
50
+ self.sub_parsers = sub_parsers # 0 0
51
+ self.parser = parser # 0 0
52
+ self.registry = {} # 1 13
53
+ self.parser = argparse.ArgumentParser(prog = "CLI") # 1 13
54
+ self.sub_parsers = self.parser.add_subparsers(title = "commands", dest = "command") # 1 13
55
+
56
+ def register(self,func: callable): # 0 28
57
+ try: # 0 28
58
+ name = func.__name__ # 1 20
59
+ cmd = Command(func) # 1 20
60
+ self.registry[name] = cmd # 1 20
61
+ cmd_parser = self.sub_parsers.add_parser(name) # 1 20
62
+ param_items = cmd.sig.parameters.items # 1 20
63
+ first = True # 1 20
64
+ for param_name,param in cmd.sig.parameters.items(): # 1 26
65
+ if param_name == "args": # 1 27
66
+ cmd_parser.add_argument('args', nargs = argparse.REMAINDER) # 1 28
67
+
68
+ elif param.default is param.empty: # 1 31
69
+ if first: # 1 32
70
+ first = False # 1 33
71
+ cmd_parser.add_argument(f"{param_name}", type = eval(param.annotation)) # 1 33
72
+
73
+ else: # 1 37
74
+ cmd_parser.add_argument(f"-{param_name[:1]}", f"--{param_name}", required = True, type = eval(param.annotation)) # 1 38
75
+
76
+
77
+ else: # 1 44
78
+ if first: # 1 45
79
+ first = False # 1 46
80
+ cmd_parser.add_argument(f"{param_name}", default = param.default, type = eval(param.annotation)) # 1 46
81
+
82
+ else: # 1 50
83
+ cmd_parser.add_argument(f"-{param_name[:1]}", f"--{param_name}", default = param.default, type = eval(param.annotation)) # 1 51 # 1 26
84
+ return func # 1 57
85
+ except Exception as e: # 0 28
86
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 28
87
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 28
88
+ e.args = (f'{e.args[0]}\n' + __jac_tmp__,) + e.args[1:] if 'Jac error originates from...' not in str(e) else e.args # 0 28
89
+ raise e # 0 28
90
+
91
+ def get(self,name: str) -> Command: # 0 29
92
+ try: # 0 29
93
+ return self.registry.get(name) # 1 61
94
+ except Exception as e: # 0 29
95
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 29
96
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 29
97
+ e.args = (f'{e.args[0]}\n' + __jac_tmp__,) + e.args[1:] if 'Jac error originates from...' not in str(e) else e.args # 0 29
98
+ raise e # 0 29
99
+
100
+ def items(self,) -> dict[str, Command]: # 0 30
101
+ try: # 0 30
102
+ return self.registry.items() # 1 65
103
+ except Exception as e: # 0 30
104
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 30
105
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 30
106
+ e.args = (f'{e.args[0]}\n' + __jac_tmp__,) + e.args[1:] if 'Jac error originates from...' not in str(e) else e.args # 0 30
107
+ raise e # 0 30 # 0 22
108
+
109
+ @_jac_make_architype_(_jac_Object_) # 0 34
110
+ class CommandShell(cmd.Cmd): # 0 34
111
+ intro: str = "Welcome to the Jac CLI!" # 0 35
112
+ prompt: str = "jac> " # 0 35
113
+
114
+ def __init__(self, # 0 0
115
+ cmd_reg = None, # 0 0
116
+ *args, **kwargs): # 0 0
117
+ self.cmd_reg = cmd_reg # 0 0
118
+ self.cmd_reg = cmd_reg # 1 70
119
+ cmd.Cmd.__init__(self) # 1 70
120
+
121
+ def do_exit(self,arg: list) -> bool: # 0 40
122
+ try: # 0 40
123
+ return True # 1 75
124
+ except Exception as e: # 0 40
125
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 40
126
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 40
127
+ e.args = (f'{e.args[0]}\n' + __jac_tmp__,) + e.args[1:] if 'Jac error originates from...' not in str(e) else e.args # 0 40
128
+ raise e # 0 40
129
+
130
+ def default(self,line: str): # 0 41
131
+ try: # 0 41
132
+ try: # 1 79
133
+ args = vars(self.cmd_reg.parser.parse_args(line.split())) # 1 80
134
+ command = self.cmd_reg.get(args["command"]) # 1 80
135
+ if command: # 1 82
136
+ args.pop("command") # 1 83
137
+ ret = command.call(**args) # 1 83
138
+ if ret: # 1 85
139
+ print(ret) # 1 86 # 1 79
140
+ except Exception as e: # 1 90
141
+ print(e) # 1 91 # 1 90 # 1 90 # 1 79
142
+ except Exception as e: # 0 41
143
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 41
144
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 41
145
+ e.args = (f'{e.args[0]}\n' + __jac_tmp__,) + e.args[1:] if 'Jac error originates from...' not in str(e) else e.args # 0 41
146
+ raise e # 0 41 # 0 34
147
+
148
+ cmd_registry = CommandRegistry() # 0 45
149
+
150
+ def start_cli(): # 0 46
151
+ try: # 0 46
152
+ parser = cmd_registry.parser # 1 96
153
+ args = parser.parse_args() # 1 96
154
+ command = cmd_registry.get(args.command) # 1 96
155
+ if command: # 1 99
156
+ args = vars(args) # 1 100
157
+ args.pop("command") # 1 100
158
+ ret = command.call(**args) # 1 100
159
+ if ret: # 1 103
160
+ print(ret) # 1 104
161
+
162
+
163
+ else: # 1 107
164
+ shell = CommandShell(cmd_registry).cmdloop() # 1 108
165
+
166
+ except Exception as e: # 0 46
167
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 46
168
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 46
169
+ e.args = (f'{e.args[0]}\n' + __jac_tmp__,) + e.args[1:] if 'Jac error originates from...' not in str(e) else e.args # 0 46
170
+ raise e # 0 46
171
+
172
+ r""" JAC DEBUG INFO
173
+ /home/ninja/jaclang/jaclang/cli/cli.jac
174
+ /home/ninja/jaclang/jaclang/cli/impl/cli_impl.jac
175
+ JAC DEBUG INFO """
@@ -0,0 +1,132 @@
1
+ """
2
+ This is the implementation of the command line interface tool for the
3
+ Jac language. It's built with the Jac language via bootstraping and
4
+ represents the first such production Jac program.
5
+ """ # 2 1
6
+ from __future__ import annotations
7
+ from jaclang import jac_purple_import as __jac_import__ # -1 0
8
+ from jaclang.core import exec_ctx as _jac_exec_ctx_ # -1 0
9
+ from jaclang.core import Object as _jac_Object_ # -1 0
10
+ from jaclang.core import make_architype as _jac_make_architype_ # -1 0
11
+ import traceback as __jac_traceback__ # -1 0
12
+ from jaclang import handle_jac_error as __jac_error__ # -1 0
13
+ __jac_import__(target='cli', base_path=__file__) # 2 6
14
+ from cli import cmd_registry as cmd_reg # 2 6
15
+
16
+ __jac_import__(target='impl.cmds_impl', base_path=__file__) # 2 8
17
+ from impl.cmds_impl import * # 2 8
18
+
19
+ @cmd_reg.register # 2 10
20
+ def run(filename: str): # 2 11
21
+ try: # 2 11
22
+ if filename.endswith(".jac"): # 3 10
23
+ [base, mod] = os.path.split(filename) # 3 11
24
+ base = './' if not base else base # 3 11
25
+ mod = mod[:-4] # 3 11
26
+ __jac_import__(target = mod, base_path = base, override_name = "__main__") # 3 11
27
+
28
+ else: # 3 15
29
+ print("Not a .jac file.") # 3 16
30
+
31
+ except Exception as e: # 2 11
32
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 2 11
33
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 2 11
34
+ e.args = (f'{e.args[0]}\n' + __jac_tmp__,) + e.args[1:] if 'Jac error originates from...' not in str(e) else e.args # 2 11
35
+ raise e # 2 11
36
+
37
+ @cmd_reg.register # 2 13
38
+ def enter(filename: str, entrypoint: str, args: list): # 2 14
39
+ try: # 2 14
40
+ if filename.endswith(".jac"): # 3 23
41
+ [base, mod] = os.path.split(filename) # 3 24
42
+ base = './' if not base else base # 3 24
43
+ mod = mod[:-4] # 3 24
44
+ mod = __jac_import__(target = mod, base_path = base) # 3 24
45
+ if not mod: # 3 28
46
+ print('Errors occured while importing the module.') # 3 29
47
+ return # 3 30
48
+
49
+ else: # 3 32
50
+ (getattr(mod, entrypoint))() # 3 33
51
+
52
+
53
+ else: # 3 35
54
+ print("Not a .jac file.") # 3 36
55
+
56
+ except Exception as e: # 2 14
57
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 2 14
58
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 2 14
59
+ e.args = (f'{e.args[0]}\n' + __jac_tmp__,) + e.args[1:] if 'Jac error originates from...' not in str(e) else e.args # 2 14
60
+ raise e # 2 14
61
+
62
+ @cmd_reg.register # 2 16
63
+ def test(filename: str): # 2 17
64
+ try: # 2 17
65
+ if filename.endswith(".jac"): # 3 43
66
+ [base, mod] = os.path.split(filename) # 3 44
67
+ base = './' if not base else base # 3 44
68
+ mod = mod[:-4] # 3 44
69
+ mod = __jac_import__(target = mod, base_path = base) # 3 44
70
+ unittest.TextTestRunner().run(mod.__jac_suite__) # 3 44
71
+
72
+ else: # 3 49
73
+ print("Not a .jac file.") # 3 50
74
+
75
+ except Exception as e: # 2 17
76
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 2 17
77
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 2 17
78
+ e.args = (f'{e.args[0]}\n' + __jac_tmp__,) + e.args[1:] if 'Jac error originates from...' not in str(e) else e.args # 2 17
79
+ raise e # 2 17
80
+
81
+ @cmd_reg.register # 2 19
82
+ def ast_tool(tool: str): # 2 20
83
+ try: # 2 20
84
+ from jaclang.utils.lang_tools import AstTool # 3 56
85
+ if (hasattr(AstTool, tool)): # 3 57
86
+ print(getattr(AstTool(), tool)()) # 3 58
87
+
88
+ else: # 3 59
89
+ print(f"Ast tool {tool} not found.") # 3 60
90
+
91
+ except Exception as e: # 2 20
92
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 2 20
93
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 2 20
94
+ e.args = (f'{e.args[0]}\n' + __jac_tmp__,) + e.args[1:] if 'Jac error originates from...' not in str(e) else e.args # 2 20
95
+ raise e # 2 20
96
+
97
+ @cmd_reg.register # 2 22
98
+ def lsp(): # 2 23
99
+ try: # 2 23
100
+ from jaclang.jac.langserve import server # 3 66
101
+ print("Starting server...") # 3 66
102
+ server.start_io() # 3 66
103
+ except Exception as e: # 2 23
104
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 2 23
105
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 2 23
106
+ e.args = (f'{e.args[0]}\n' + __jac_tmp__,) + e.args[1:] if 'Jac error originates from...' not in str(e) else e.args # 2 23
107
+ raise e # 2 23
108
+
109
+ @cmd_reg.register # 2 25
110
+ def clean(): # 2 26
111
+ try: # 2 26
112
+ current_dir = os.getcwd() # 3 73
113
+ py_cache = "__pycache__" # 3 73
114
+ for root,dirs,files in os.walk(current_dir, topdown = True): # 3 75
115
+ for folder_name in dirs[:]: # 3 76
116
+ if folder_name == C.JAC_GEN_DIR or folder_name == py_cache: # 3 77
117
+ folder_to_remove = os.path.join(root, folder_name) # 3 78
118
+ shutil.rmtree(folder_to_remove) # 3 78
119
+ print(f"Removed folder: {folder_to_remove}") # 3 78 # 3 76 # 3 75
120
+ print("Done cleaning.") # 3 73
121
+ except Exception as e: # 2 26
122
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 2 26
123
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 2 26
124
+ e.args = (f'{e.args[0]}\n' + __jac_tmp__,) + e.args[1:] if 'Jac error originates from...' not in str(e) else e.args # 2 26
125
+ raise e # 2 26
126
+
127
+ r""" JAC DEBUG INFO
128
+ /home/ninja/jaclang/jaclang/cli/cli.jac
129
+ /home/ninja/jaclang/jaclang/cli/impl/cli_impl.jac
130
+ /home/ninja/jaclang/jaclang/cli/cmds.jac
131
+ /home/ninja/jaclang/jaclang/cli/impl/cmds_impl.jac
132
+ JAC DEBUG INFO """
jaclang/cli/cmds.jac CHANGED
@@ -19,5 +19,8 @@ can <>test(filename: str);
19
19
  @cmd_reg.register
20
20
  can ast_tool(tool: str);
21
21
 
22
+ @cmd_reg.register
23
+ can lsp;
24
+
22
25
  @cmd_reg.register
23
26
  can clean;
File without changes
@@ -0,0 +1,16 @@
1
+ """Implemenation for Jac's command line interface.""" # 1 1
2
+ from __future__ import annotations
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+ r""" JAC DEBUG INFO
14
+ /home/ninja/jaclang/jaclang/cli/cli.jac
15
+ /home/ninja/jaclang/jaclang/cli/impl/cli_impl.jac
16
+ JAC DEBUG INFO """
@@ -0,0 +1,26 @@
1
+ """Implementations for the jac command line interface.""" # 3 1
2
+ from __future__ import annotations
3
+ from jaclang import jac_purple_import as __jac_import__ # -1 0
4
+ from jaclang.core import exec_ctx as _jac_exec_ctx_ # -1 0
5
+ from jaclang.core import Object as _jac_Object_ # -1 0
6
+ from jaclang.core import make_architype as _jac_make_architype_ # -1 0
7
+ import os # 3 2
8
+
9
+ import shutil # 3 3
10
+
11
+ import unittest # 3 4
12
+
13
+ from jaclang.jac.constant import Constants as C # 3 5
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+ r""" JAC DEBUG INFO
22
+ /home/ninja/jaclang/jaclang/cli/cli.jac
23
+ /home/ninja/jaclang/jaclang/cli/impl/cli_impl.jac
24
+ /home/ninja/jaclang/jaclang/cli/cmds.jac
25
+ /home/ninja/jaclang/jaclang/cli/impl/cmds_impl.jac
26
+ JAC DEBUG INFO """
@@ -2,6 +2,7 @@
2
2
  import:py os;
3
3
  import:py shutil;
4
4
  import:py unittest;
5
+ import:py from jaclang.jac.constant, Constants as C;
5
6
 
6
7
  """Load a .jac file and return the entrypoint function."""
7
8
  :a:run
@@ -24,7 +25,13 @@ import:py unittest;
24
25
  base = './' if not base else base;
25
26
  mod=mod[:-4];
26
27
  mod = __jac_import__(target=mod, base_path=base);
27
- :> ((mod, entrypoint) :> getattr );
28
+ if not mod {
29
+ print('Errors occured while importing the module.');
30
+ return;
31
+ }
32
+ else {
33
+ :> ((mod, entrypoint) :> getattr );
34
+ }
28
35
  } else {
29
36
  "Not a .jac file." :> print;
30
37
  }
@@ -54,14 +61,20 @@ import:py unittest;
54
61
  }
55
62
  }
56
63
 
64
+ """Run language server for Jac."""
65
+ :a:lsp {
66
+ import:py from jaclang.jac.langserve, server;
67
+ print("Starting server...");
68
+ server.start_io();
69
+ }
70
+
57
71
  """Remove the __jac_gen__ , __pycache__ folders from the current directory recursevely."""
58
72
  :a:clean {
59
73
  current_dir = os.getcwd();
60
- jac_gen = "__jac_gen__";
61
74
  py_cache = "__pycache__";
62
75
  for root, dirs, files in os.walk(current_dir, topdown=True) {
63
76
  for folder_name in dirs[:] {
64
- if folder_name == jac_gen or folder_name == py_cache {
77
+ if folder_name == C.JAC_GEN_DIR or folder_name == py_cache {
65
78
  folder_to_remove = os.path.join(root, folder_name);
66
79
  shutil.rmtree(folder_to_remove);
67
80
  print(f"Removed folder: {folder_to_remove}");
@@ -70,3 +83,4 @@ import:py unittest;
70
83
  }
71
84
  print("Done cleaning.");
72
85
  }
86
+
File without changes