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
@@ -0,0 +1,567 @@
1
+ """Jac's Key Elemental Abstractions""" # 0 1
2
+ from __future__ import annotations
3
+ from jaclang import jac_blue_import as __jac_import__ # -1 0
4
+ import traceback as __jac_traceback__ # -1 0
5
+ from jaclang import handle_jac_error as __jac_error__ # -1 0
6
+ from enum import Enum as __jac_Enum__, auto as __jac_auto__ # -1 0
7
+ from datetime import datetime # 0 3
8
+
9
+ from uuid import UUID, uuid4 # 0 4
10
+
11
+ from jaclang.jac.constant import EdgeDir # 0 5
12
+
13
+ __jac_import__(target='impl.memory_impl', base_path=__file__) # 0 7
14
+ from impl.memory_impl import * # 0 7
15
+
16
+ __jac_import__(target='impl.exec_ctx_impl', base_path=__file__) # 0 8
17
+ from impl.exec_ctx_impl import * # 0 8
18
+
19
+ __jac_import__(target='impl.element_impl', base_path=__file__) # 0 9
20
+ from impl.element_impl import * # 0 9
21
+
22
+ __jac_import__(target='impl.arch_impl', base_path=__file__) # 0 10
23
+ from impl.arch_impl import * # 0 10
24
+
25
+ class AccessMode(__jac_Enum__): # 0 13
26
+ READ_ONLY = __jac_auto__() # 3 4
27
+ READ_WRITE = __jac_auto__() # 3 4
28
+ PRIVATE = __jac_auto__() # 3 4
29
+
30
+ class Memory: # 0 15
31
+ def __init__(self, # 0 0
32
+ index = None, # 0 0
33
+ save_queue = None, # 0 0
34
+ *args, **kwargs): # 0 0
35
+ super().__init__(*args, **kwargs) # 0 0
36
+ self.index = index # 0 0
37
+ self.save_queue = save_queue # 0 0
38
+ def get_obj(self,caller_id: UUID, item_id: UUID, override: bool = False) -> Element: # 0 19
39
+ try: # 0 19
40
+ ret = self.index.get(item_id) # 1 6
41
+ if override or (ret.__is_readable(ret is not None and caller_id)): # 1 7
42
+ return ret # 1 8
43
+
44
+ except Exception as e: # 0 19
45
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 19
46
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 19
47
+ 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 19
48
+ raise e # 0 19
49
+
50
+ def has_obj(self,item_id: UUID) -> bool: # 0 21
51
+ try: # 0 21
52
+ return item_id in self.index # 1 14
53
+ except Exception as e: # 0 21
54
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 21
55
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 21
56
+ 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 21
57
+ raise e # 0 21
58
+
59
+ def save_obj(self,caller_id: UUID, item: Element): # 0 22
60
+ try: # 0 22
61
+ if item.is_writable(caller_id): # 1 19
62
+ self.index[item.id] = item # 1 20
63
+ if item._persist: # 1 21
64
+ self.save_obj_list.add(item) # 1 22
65
+
66
+
67
+ self.mem[item.id] = item # 1 19
68
+ if item._persist: # 1 26
69
+ self.save_obj_list.add(item) # 1 27
70
+
71
+ except Exception as e: # 0 22
72
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 22
73
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 22
74
+ 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 22
75
+ raise e # 0 22
76
+
77
+ def del_obj(self,caller_id: UUID, item: Element): # 0 23
78
+ try: # 0 23
79
+ if item.is_writable(caller_id): # 1 33
80
+ self.index.pop(item.id) # 1 34
81
+ if item._persist: # 1 35
82
+ self.save_obj_list.remove(item) # 1 36
83
+
84
+
85
+ except Exception as e: # 0 23
86
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 23
87
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 23
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 23
89
+ raise e # 0 23
90
+
91
+ def get_object_distribution(self,) -> dict: # 0 26
92
+ try: # 0 26
93
+ dist = {} # 1 42
94
+ for i in self.index.keys(): # 1 43
95
+ t = type(self.index[i]) # 1 44
96
+ if t in dist: # 1 45
97
+ dist[t] += 1 # 1 46
98
+
99
+ else: # 1 48
100
+ dist[t] = 1 # 1 49 # 1 43
101
+ return dist # 1 52
102
+ except Exception as e: # 0 26
103
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 26
104
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 26
105
+ 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 26
106
+ raise e # 0 26
107
+
108
+ def get_mem_size(self,) -> float: # 0 27
109
+ try: # 0 27
110
+ return (sys.getsizeof(self.index)) / 1024.0 # 1 56
111
+ except Exception as e: # 0 27
112
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 27
113
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 27
114
+ 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 27
115
+ raise e # 0 27
116
+
117
+
118
+ class ExecutionContext: # 0 30
119
+ def __init__(self, # 0 0
120
+ master = None, # 0 0
121
+ memory = None, # 0 0
122
+ *args, **kwargs): # 0 0
123
+ super().__init__(*args, **kwargs) # 0 0
124
+ self.master = uuid4() if master is None else master # 0 0
125
+ self.memory = Memory() if memory is None else memory # 0 0
126
+ def reset(self,): # 0 34
127
+ try: # 0 34
128
+ self.__init__() # 2 13
129
+ except Exception as e: # 0 34
130
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 34
131
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 34
132
+ 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 34
133
+ raise e # 0 34
134
+
135
+ def get_root(self,) -> Node: # 0 35
136
+ try: # 0 35
137
+ if type(self.master) == UUID: # 2 6
138
+ self.master = Master() # 2 7
139
+
140
+ return self.master.root_node # 2 9
141
+ except Exception as e: # 0 35
142
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 35
143
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 35
144
+ 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 35
145
+ raise e # 0 35
146
+
147
+
148
+ exec_ctx = ExecutionContext() # 0 38
149
+
150
+ class ElementMetaData: # 0 40
151
+ def __init__(self, # 0 0
152
+ jid = None, # 0 0
153
+ timestamp = None, # 0 0
154
+ persist = None, # 0 0
155
+ access_mode = None, # 0 0
156
+ rw_access = None, # 0 0
157
+ ro_access = None, # 0 0
158
+ owner_id = None, # 0 0
159
+ mem = None, # 0 0
160
+ *args, **kwargs): # 0 0
161
+ super().__init__(*args, **kwargs) # 0 0
162
+ self.jid = uuid4() if jid is None else jid # 0 0
163
+ self.timestamp = datetime.now() if timestamp is None else timestamp # 0 0
164
+ self.persist = False if persist is None else persist # 0 0
165
+ self.access_mode = AccessMode.PRIVATE if access_mode is None else access_mode # 0 0
166
+ self.rw_access = set() if rw_access is None else rw_access # 0 0
167
+ self.ro_access = set() if ro_access is None else ro_access # 0 0
168
+ self.owner_id = exec_ctx.master if owner_id is None else owner_id # 0 0
169
+ self.mem = exec_ctx.memory if mem is None else mem # 0 0
170
+
171
+ class Element: # 0 51
172
+ def __init__(self, # 0 0
173
+ _jinfo = None, # 0 0
174
+ exec_ctx: ExecutionContext = None, # 0 0
175
+ *args, **kwargs): # 0 0
176
+ self._jinfo = ElementMetaData() if _jinfo is None else _jinfo # 0 0
177
+ self.__jinfo = ExecutionContext(exec_ctx) # 3 11
178
+
179
+ def _jac_make_public_ro(self,): # 0 55
180
+ try: # 0 55
181
+ self.__jinfo.access_mode = AccessMode.READ_ONLY # 3 15
182
+ except Exception as e: # 0 55
183
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 55
184
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 55
185
+ 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 55
186
+ raise e # 0 55
187
+
188
+ def _jac_make_public_rw(self,): # 0 56
189
+ try: # 0 56
190
+ self.__jinfo.access_mode = AccessMode.READ_WRITE # 3 19
191
+ except Exception as e: # 0 56
192
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 56
193
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 56
194
+ 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 56
195
+ raise e # 0 56
196
+
197
+ def _jac_make_private(self,): # 0 57
198
+ try: # 0 57
199
+ self.__jinfo.access_mode = AccessMode.PRIVATE # 3 23
200
+ except Exception as e: # 0 57
201
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 57
202
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 57
203
+ 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 57
204
+ raise e # 0 57
205
+
206
+ def _jac_is_public_ro(self,) -> bool: # 0 58
207
+ try: # 0 58
208
+ return self.__jinfo.access_mode == AccessMode.READ_ONLY # 3 27
209
+ except Exception as e: # 0 58
210
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 58
211
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 58
212
+ 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 58
213
+ raise e # 0 58
214
+
215
+ def _jac_is_public_rw(self,) -> bool: # 0 59
216
+ try: # 0 59
217
+ return self.__jinfo.access_mode == AccessMode.READ_WRITE # 3 31
218
+ except Exception as e: # 0 59
219
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 59
220
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 59
221
+ 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 59
222
+ raise e # 0 59
223
+
224
+ def _jac_is_private(self,) -> bool: # 0 60
225
+ try: # 0 60
226
+ return self.__jinfo.access_mode == AccessMode.PRIVATE # 3 35
227
+ except Exception as e: # 0 60
228
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 60
229
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 60
230
+ 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 60
231
+ raise e # 0 60
232
+
233
+ def _jac_is_readable(self,caller_id: UUID) -> bool: # 0 61
234
+ try: # 0 61
235
+ return (caller_id == self.owner_id or self.is_public_read() or caller_id in self.ro_access or caller_id in self.rw_access) # 3 40
236
+ except Exception as e: # 0 61
237
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 61
238
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 61
239
+ 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 61
240
+ raise e # 0 61
241
+
242
+ def _jac_is_writable(self,caller_id: UUID) -> bool: # 0 62
243
+ try: # 0 62
244
+ return (caller_id == self.owner_id or self.is_public_write() or caller_id in self.rw_access) # 3 50
245
+ except Exception as e: # 0 62
246
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 62
247
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 62
248
+ 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 62
249
+ raise e # 0 62
250
+
251
+ def _jac_give_access(self,caller_id: UUID, read_write: bool = False): # 0 63
252
+ try: # 0 63
253
+ if read_write: # 3 59
254
+ self.rw_access.add(caller_id) # 3 60
255
+
256
+ else: # 3 62
257
+ self.ro_access.add(caller_id) # 3 63
258
+
259
+ except Exception as e: # 0 63
260
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 63
261
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 63
262
+ 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 63
263
+ raise e # 0 63
264
+
265
+ def _jac_revoke_access(self,caller_id: UUID): # 0 64
266
+ try: # 0 64
267
+ self.ro_access.discard(caller_id) # 3 69
268
+ self.rw_access.discard(caller_id) # 3 69
269
+ except Exception as e: # 0 64
270
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 64
271
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 64
272
+ 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 64
273
+ raise e # 0 64
274
+
275
+
276
+ class Object(Element): # 0 67
277
+ _jac_ds_entry_funcs: list[dict] = [] # 0 68
278
+ _jac_ds_exit_funcs: list[dict] = [] # 0 68
279
+
280
+ def __init__(self, # 0 0
281
+ *args, **kwargs): # 0 0
282
+ super().__init__(*args, **kwargs) # 0 0
283
+ @classmethod # 0 71
284
+ def _jac_on_entry(cls: type, triggers: list[type]): # 0 71
285
+ try: # 0 71
286
+ def decorator(func: callable) -> callable: # 3 75
287
+ try: # 3 75
288
+ cls._jac_ds_entry_funcs.append({'func': func, 'types': triggers}) # 3 76
289
+ def wrapper(*args: list, **kwargs: dict) -> callable: # 3 77
290
+ try: # 3 77
291
+ return func(*args, **kwargs) # 3 78
292
+ except Exception as e: # 3 77
293
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 3 77
294
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 3 77
295
+ e.args = (f'{e.args[0]}\n' + __jac_tmp__,) + e.args[1:] if 'Jac error originates from...' not in str(e) else e.args # 3 77
296
+ raise e # 3 77
297
+ return wrapper # 3 80
298
+ except Exception as e: # 3 75
299
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 3 75
300
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 3 75
301
+ e.args = (f'{e.args[0]}\n' + __jac_tmp__,) + e.args[1:] if 'Jac error originates from...' not in str(e) else e.args # 3 75
302
+ raise e # 3 75
303
+ return decorator # 3 82
304
+ except Exception as e: # 0 71
305
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 71
306
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 71
307
+ 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 71
308
+ raise e # 0 71
309
+
310
+ @classmethod # 0 72
311
+ def _jac_on_exit(cls: type, triggers: list[type]): # 0 72
312
+ try: # 0 72
313
+ def decorator(func: callable) -> callable: # 3 87
314
+ try: # 3 87
315
+ cls._jac_ds_exit_funcs.append({'func': func, 'types': triggers}) # 3 88
316
+ def wrapper(*args: list, **kwargs: dict) -> callable: # 3 89
317
+ try: # 3 89
318
+ return func(*args, **kwargs) # 3 90
319
+ except Exception as e: # 3 89
320
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 3 89
321
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 3 89
322
+ e.args = (f'{e.args[0]}\n' + __jac_tmp__,) + e.args[1:] if 'Jac error originates from...' not in str(e) else e.args # 3 89
323
+ raise e # 3 89
324
+ return wrapper # 3 92
325
+ except Exception as e: # 3 87
326
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 3 87
327
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 3 87
328
+ e.args = (f'{e.args[0]}\n' + __jac_tmp__,) + e.args[1:] if 'Jac error originates from...' not in str(e) else e.args # 3 87
329
+ raise e # 3 87
330
+ return decorator # 3 94
331
+ except Exception as e: # 0 72
332
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 72
333
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 72
334
+ 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 72
335
+ raise e # 0 72
336
+
337
+
338
+ class Node(Object): # 0 75
339
+ def __init__(self, # 0 0
340
+ _jac_edges_ = None, # 0 0
341
+ *args, **kwargs): # 0 0
342
+ super().__init__(*args, **kwargs) # 0 0
343
+ self._jac_edges_ = {EdgeDir.OUT: [], EdgeDir.IN: []} if _jac_edges_ is None else _jac_edges_ # 0 0
344
+ def __call__(self,walk: Walker): # 0 79
345
+ try: # 0 79
346
+ if not isinstance(walk, Walker): # 4 6
347
+ raise TypeError(("Argument must be a Walker instance")) # 4 7
348
+
349
+ walk(self) # 4 6
350
+ except Exception as e: # 0 79
351
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 79
352
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 79
353
+ 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 79
354
+ raise e # 0 79
355
+
356
+ def _jac_connect_node_(self,nd: Node, edg: Edge) -> Node: # 0 80
357
+ try: # 0 80
358
+ edg._jac_attach_(self, nd) # 4 14
359
+ return self # 4 15
360
+ except Exception as e: # 0 80
361
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 80
362
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 80
363
+ 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 80
364
+ raise e # 0 80
365
+
366
+ def _jac_edges_to_nodes_(self,dir: EdgeDir) -> list[Node]: # 0 81
367
+ try: # 0 81
368
+ ret_nodes = [] # 4 20
369
+ if dir in [EdgeDir.OUT, EdgeDir.ANY]: # 4 21
370
+ for i in self._jac_edges_[EdgeDir.OUT]: # 4 22
371
+ ret_nodes.append(i._jac_target_) # 4 23 # 4 22
372
+
373
+ elif dir in [EdgeDir.IN, EdgeDir.ANY]: # 4 25
374
+ for i in self._jac_edges_[EdgeDir.IN]: # 4 26
375
+ ret_nodes.append(i._jac_source_) # 4 27 # 4 26
376
+
377
+ return ret_nodes # 4 31
378
+ except Exception as e: # 0 81
379
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 81
380
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 81
381
+ 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 81
382
+ raise e # 0 81
383
+
384
+
385
+ class Edge(Object): # 0 84
386
+ def __init__(self, # 0 0
387
+ _jac_source_ = None, # 0 0
388
+ _jac_target_ = None, # 0 0
389
+ _jac_dir_ = None, # 0 0
390
+ *args, **kwargs): # 0 0
391
+ super().__init__(*args, **kwargs) # 0 0
392
+ self._jac_source_ = _jac_source_ # 0 0
393
+ self._jac_target_ = _jac_target_ # 0 0
394
+ self._jac_dir_ = _jac_dir_ # 0 0
395
+ def __call__(self,walk: Walker): # 0 89
396
+ try: # 0 89
397
+ if not isinstance(walk, Walker): # 4 36
398
+ raise TypeError(("Argument must be a Walker instance")) # 4 37
399
+
400
+ walk(self._jac_target_) # 4 36
401
+ except Exception as e: # 0 89
402
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 89
403
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 89
404
+ 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 89
405
+ raise e # 0 89
406
+
407
+ def _jac_apply_dir_(self,dir: EdgeDir) -> Edge: # 0 90
408
+ try: # 0 90
409
+ self._jac_dir_ = dir # 4 44
410
+ return self # 4 45
411
+ except Exception as e: # 0 90
412
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 90
413
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 90
414
+ 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 90
415
+ raise e # 0 90
416
+
417
+ def _jac_attach_(self,src: Node, trg: Node) -> Edge: # 0 91
418
+ try: # 0 91
419
+ if self._jac_dir_ == EdgeDir.IN: # 4 50
420
+ self._jac_source_ = trg # 4 51
421
+ self._jac_target_ = src # 4 51
422
+ src._jac_edges_[EdgeDir.IN].append(self) # 4 51
423
+ trg._jac_edges_[EdgeDir.OUT].append(self) # 4 51
424
+
425
+ else: # 4 55
426
+ self._jac_source_ = src # 4 56
427
+ self._jac_target_ = trg # 4 56
428
+ src._jac_edges_[EdgeDir.OUT].append(self) # 4 56
429
+ trg._jac_edges_[EdgeDir.IN].append(self) # 4 56
430
+
431
+ return self # 4 62
432
+ except Exception as e: # 0 91
433
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 91
434
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 91
435
+ 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 91
436
+ raise e # 0 91
437
+
438
+
439
+ class Walker(Object): # 0 94
440
+ def __init__(self, # 0 0
441
+ _jac_path_ = None, # 0 0
442
+ _jac_next_ = None, # 0 0
443
+ _jac_ignores_ = None, # 0 0
444
+ _jac_disengaged_ = None, # 0 0
445
+ *args, **kwargs): # 0 0
446
+ super().__init__(*args, **kwargs) # 0 0
447
+ self._jac_path_ = [] if _jac_path_ is None else _jac_path_ # 0 0
448
+ self._jac_next_ = [] if _jac_next_ is None else _jac_next_ # 0 0
449
+ self._jac_ignores_ = [] if _jac_ignores_ is None else _jac_ignores_ # 0 0
450
+ self._jac_disengaged_ = False if _jac_disengaged_ is None else _jac_disengaged_ # 0 0
451
+ def __call__(self,nd: Node): # 0 100
452
+ try: # 0 100
453
+ self._jac_path_ = [] # 4 67
454
+ self._jac_next_ = [nd] # 4 67
455
+ walker_type = self.__class__.__name__ # 4 67
456
+ while len(self._jac_next_): # 4 70
457
+ nd = self._jac_next_.pop(0) # 4 71
458
+ node_type = nd.__class__.__name__ # 4 71
459
+ for i in nd._jac_ds_entry_funcs: # 4 74
460
+ if i['func'].__qualname__.split(".")[0] == node_type and type(self) in i['types']: # 4 75
461
+ i['func'](nd, self) # 4 77
462
+
463
+ if self._jac_disengaged_: # 4 79
464
+ return # 4 79 # 4 74
465
+ for i in self._jac_ds_entry_funcs: # 4 81
466
+ if i['func'].__qualname__.split(".")[0] == walker_type and (type(nd) in i['types'] or nd in i['types']): # 4 82
467
+ i['func'](self, nd) # 4 84
468
+
469
+ if self._jac_disengaged_: # 4 86
470
+ return # 4 86 # 4 81
471
+ for i in self._jac_ds_exit_funcs: # 4 88
472
+ if i['func'].__qualname__.split(".")[0] == walker_type and (type(nd) in i['types'] or nd in i['types']): # 4 89
473
+ i['func'](self, nd) # 4 91
474
+
475
+ if self._jac_disengaged_: # 4 93
476
+ return # 4 93 # 4 88
477
+ for i in nd._jac_ds_exit_funcs: # 4 95
478
+ if i['func'].__qualname__.split(".")[0] == node_type and type(self) in i['types']: # 4 96
479
+ i['func'](nd, self) # 4 98
480
+
481
+ if self._jac_disengaged_: # 4 100
482
+ return # 4 100 # 4 95
483
+ self._jac_path_.append(nd) # 4 71 # 4 70
484
+ self._jac_ignores_ = [] # 4 67
485
+ except Exception as e: # 0 100
486
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 100
487
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 100
488
+ 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 100
489
+ raise e # 0 100
490
+
491
+ def _jac_visit_(self,nds: list[Node]|list[Edge]|Node|Edge): # 0 101
492
+ try: # 0 101
493
+ if isinstance(nds, list): # 4 109
494
+ for i in nds: # 4 110
495
+ if (i not in self._jac_ignores_): # 4 111
496
+ self._jac_next_.append(i) # 4 111 # 4 110
497
+
498
+ elif nds not in self._jac_ignores_: # 4 113
499
+ self._jac_next_.append(nds) # 4 113
500
+
501
+ return len(nds) if isinstance(nds, list) else 1 # 4 114
502
+ except Exception as e: # 0 101
503
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 101
504
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 101
505
+ 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 101
506
+ raise e # 0 101
507
+
508
+ def _jac_ignore_(self,nds: list[Node]|list[Edge]|Node|Edge): # 0 102
509
+ try: # 0 102
510
+ if isinstance(nds, list): # 4 119
511
+ for i in nds: # 4 120
512
+ self._jac_ignores_.append(i) # 4 121 # 4 120
513
+
514
+ else: # 4 123
515
+ self._jac_ignores_.append(nds) # 4 123
516
+
517
+ except Exception as e: # 0 102
518
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 102
519
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 102
520
+ 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 102
521
+ raise e # 0 102
522
+
523
+ def _jac_disengage_(self,): # 0 103
524
+ try: # 0 103
525
+ self._jac_next_ = [] # 4 127
526
+ self._jac_disengaged_ = True # 4 127
527
+ except Exception as e: # 0 103
528
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 103
529
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 103
530
+ 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 103
531
+ raise e # 0 103
532
+
533
+
534
+ class Master(Element): # 0 106
535
+ def __init__(self, # 0 0
536
+ root_node = None, # 0 0
537
+ *args, **kwargs): # 0 0
538
+ super().__init__(*args, **kwargs) # 0 0
539
+ self.root_node = Node() if root_node is None else root_node # 0 0
540
+
541
+ def make_architype(base_class: type) -> type: # 0 110
542
+ try: # 0 110
543
+ def class_decorator(cls: type) -> type: # 3 98
544
+ try: # 3 98
545
+ if not issubclass(cls, base_class): # 3 100
546
+ cls = type(cls.__name__, (cls, base_class), {}) # 3 102
547
+
548
+ return cls # 3 110
549
+ except Exception as e: # 3 98
550
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 3 98
551
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 3 98
552
+ e.args = (f'{e.args[0]}\n' + __jac_tmp__,) + e.args[1:] if 'Jac error originates from...' not in str(e) else e.args # 3 98
553
+ raise e # 3 98
554
+ return class_decorator # 3 112
555
+ except Exception as e: # 0 110
556
+ tb = __jac_traceback__.extract_tb(e.__traceback__) # 0 110
557
+ __jac_tmp__ = __jac_error__(_jac_pycodestring_, e, tb) # 0 110
558
+ 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 110
559
+ raise e # 0 110
560
+
561
+ r""" JAC DEBUG INFO
562
+ /home/ninja/jaclang/jaclang/core/primitives.jac
563
+ /home/ninja/jaclang/jaclang/core/impl/memory_impl.jac
564
+ /home/ninja/jaclang/jaclang/core/impl/exec_ctx_impl.jac
565
+ /home/ninja/jaclang/jaclang/core/impl/element_impl.jac
566
+ /home/ninja/jaclang/jaclang/core/impl/arch_impl.jac
567
+ JAC DEBUG INFO """
File without changes
@@ -0,0 +1,24 @@
1
+ """Implementation for Jac's Element Abstractions""" # 4 1
2
+ from __future__ import annotations
3
+ from jaclang import jac_blue_import as __jac_import__ # -1 0
4
+ import traceback as __jac_traceback__ # -1 0
5
+ from jaclang import handle_jac_error as __jac_error__ # -1 0
6
+ from jaclang.jac.constant import EdgeDir # 4 2
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+ r""" JAC DEBUG INFO
19
+ /home/ninja/jaclang/jaclang/core/primitives.jac
20
+ /home/ninja/jaclang/jaclang/core/impl/memory_impl.jac
21
+ /home/ninja/jaclang/jaclang/core/impl/exec_ctx_impl.jac
22
+ /home/ninja/jaclang/jaclang/core/impl/element_impl.jac
23
+ /home/ninja/jaclang/jaclang/core/impl/arch_impl.jac
24
+ JAC DEBUG INFO """
@@ -0,0 +1,26 @@
1
+ """Implementation for Jac's Element Abstractions""" # 3 1
2
+ from __future__ import annotations
3
+ from jaclang import jac_blue_import as __jac_import__ # -1 0
4
+ import traceback as __jac_traceback__ # -1 0
5
+ from jaclang import handle_jac_error as __jac_error__ # -1 0
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+ r""" JAC DEBUG INFO
22
+ /home/ninja/jaclang/jaclang/core/primitives.jac
23
+ /home/ninja/jaclang/jaclang/core/impl/memory_impl.jac
24
+ /home/ninja/jaclang/jaclang/core/impl/exec_ctx_impl.jac
25
+ /home/ninja/jaclang/jaclang/core/impl/element_impl.jac
26
+ JAC DEBUG INFO """
@@ -0,0 +1,12 @@
1
+ """Implementation for Jac's Element Abstractions""" # 2 1
2
+ from __future__ import annotations
3
+ from jaclang import jac_blue_import as __jac_import__ # -1 0
4
+ from uuid import UUID, uuid4 # 2 2
5
+
6
+
7
+
8
+ r""" JAC DEBUG INFO
9
+ /home/ninja/jaclang/jaclang/core/primitives.jac
10
+ /home/ninja/jaclang/jaclang/core/impl/memory_impl.jac
11
+ /home/ninja/jaclang/jaclang/core/impl/exec_ctx_impl.jac
12
+ JAC DEBUG INFO """
@@ -0,0 +1,14 @@
1
+ """Implementation for Jac's Element Abstractions""" # 1 1
2
+ from __future__ import annotations
3
+ import sys # 1 2
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+ r""" JAC DEBUG INFO
12
+ /home/ninja/jaclang/jaclang/core/primitives.jac
13
+ /home/ninja/jaclang/jaclang/core/impl/memory_impl.jac
14
+ JAC DEBUG INFO """
@@ -7,8 +7,8 @@
7
7
  }
8
8
 
9
9
  :object:Element:ability:<init>
10
- (_jac_exec_ctx: ExecutionContext) {
11
- <self>.__jinfo = _jac_exec_ctx :> ExecutionContext;
10
+ (exec_ctx: ExecutionContext) {
11
+ <self>.__jinfo = exec_ctx :> ExecutionContext;
12
12
  }
13
13
 
14
14
  :object:Element:ability:_jac_make_public_ro {
@@ -51,6 +51,7 @@ object ElementMetaData {
51
51
  object Element {
52
52
  has _jinfo: ElementMetaData = ElementMetaData();
53
53
 
54
+ can <init>(exec_ctx: ExecutionContext=None);
54
55
  can _jac_make_public_ro;
55
56
  can _jac_make_public_rw;
56
57
  can _jac_make_private;