jaclang 0.2.5__py3-none-any.whl → 0.3.0__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.
- jaclang/__init__.py +3 -3
- jaclang/cli/__init__.py +0 -1
- jaclang/cli/__jac_gen__/cli.py +4 -4
- jaclang/cli/__jac_gen__/cmds.py +1 -1
- jaclang/cli/__jac_gen__/cmds_impl.py +1 -1
- jaclang/core/__init__.py +5 -11
- jaclang/core/__jac_gen__/corelib.py +289 -0
- jaclang/core/__jac_gen__/corelib_impl.py +220 -0
- jaclang/core/corelib.jac +21 -34
- jaclang/core/corelib_impl.jac +317 -0
- jaclang/jac/__init__.py +1 -0
- jaclang/jac/__jac_gen__/jac_parser.py +2 -2
- jaclang/jac/absyntree.py +28 -8
- jaclang/jac/constant.py +3 -7
- jaclang/jac/parser.py +13 -9
- jaclang/jac/passes/main/__init__.py +2 -0
- jaclang/jac/passes/main/def_use_pass.py +3 -2
- jaclang/jac/passes/main/pyast_gen_pass.py +99 -34
- jaclang/jac/passes/main/schedules.py +6 -0
- jaclang/jac/passes/main/sym_tab_build_pass.py +3 -5
- jaclang/jac/passes/main/tests/test_jac_format_pass.py +22 -4
- jaclang/jac/passes/main/tests/test_type_check_pass.py +42 -0
- jaclang/jac/passes/main/type_check_pass.py +103 -0
- jaclang/jac/passes/tool/fuse_comments_pass.py +57 -39
- jaclang/jac/passes/tool/jac_formatter_pass.py +419 -192
- jaclang/jac/passes/transform.py +0 -39
- jaclang/jac/passes/utils/__init__.py +1 -0
- jaclang/jac/passes/utils/mypy_ast_build.py +302 -0
- jaclang/jac/plugin/__init__.py +5 -2
- jaclang/jac/plugin/default.py +20 -4
- jaclang/jac/plugin/feature.py +15 -6
- jaclang/jac/plugin/spec.py +34 -6
- jaclang/jac/tests/test_workspace.py +45 -5
- jaclang/jac/transpiler.py +4 -9
- jaclang/utils/helpers.py +0 -33
- jaclang/utils/lang_tools.py +3 -0
- jaclang/utils/test.py +3 -1
- jaclang/vendor/lark/py.typed +0 -0
- jaclang/vendor/mypy/checker.py +19 -12
- jaclang/vendor/mypy/checkexpr.py +31 -10
- jaclang/vendor/mypy/constraints.py +56 -38
- jaclang/vendor/mypy/expandtype.py +1 -0
- jaclang/vendor/mypy/meet.py +10 -1
- jaclang/vendor/mypy/messages.py +16 -4
- jaclang/vendor/mypy/moduleinspect.py +10 -4
- jaclang/vendor/mypy/py.typed +1 -0
- jaclang/vendor/mypy/semanal.py +18 -17
- jaclang/vendor/mypy/semanal_enum.py +7 -4
- jaclang/vendor/mypy/semanal_namedtuple.py +11 -1
- jaclang/vendor/mypy/semanal_typeddict.py +25 -11
- jaclang/vendor/mypy/stubdoc.py +18 -4
- jaclang/vendor/mypy/stubgen.py +80 -1
- jaclang/vendor/mypy/stubgenc.py +47 -5
- jaclang/vendor/mypy/stubtest.py +53 -3
- jaclang/vendor/mypy/stubutil.py +9 -9
- jaclang/vendor/mypy/test/testipc.py +16 -7
- jaclang/vendor/mypy/test/teststubtest.py +20 -2
- jaclang/vendor/mypy/types.py +1 -1
- jaclang/vendor/mypyc/irbuild/prebuildvisitor.py +2 -1
- jaclang/vendor/mypyc/test/test_run.py +2 -4
- jaclang/vendor/pluggy/py.typed +0 -0
- {jaclang-0.2.5.dist-info → jaclang-0.3.0.dist-info}/METADATA +1 -1
- {jaclang-0.2.5.dist-info → jaclang-0.3.0.dist-info}/RECORD +67 -62
- {jaclang-0.2.5.dist-info → jaclang-0.3.0.dist-info}/WHEEL +1 -1
- {jaclang-0.2.5.dist-info → jaclang-0.3.0.dist-info}/entry_points.txt +3 -0
- jaclang/core/arch_impl.jac +0 -131
- jaclang/core/element_impl.jac +0 -109
- jaclang/core/exec_ctx_impl.jac +0 -14
- jaclang/core/memory_impl.jac +0 -57
- jaclang/jac/tests/fixtures/__jac_gen__/hello_world.py +0 -5
- /jaclang/{jac/tests/fixtures → core}/__jac_gen__/__init__.py +0 -0
- {jaclang-0.2.5.dist-info → jaclang-0.3.0.dist-info}/top_level.txt +0 -0
jaclang/core/corelib.jac
CHANGED
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
import:py from datetime, datetime;
|
|
4
4
|
import:py from uuid, UUID, uuid4;
|
|
5
5
|
import:py from jaclang.jac.constant, EdgeDir;
|
|
6
|
+
import:py from jaclang.jac.plugin, Architype, AbsRootHook, hookimpl;
|
|
6
7
|
|
|
7
|
-
include:jac
|
|
8
|
-
include:jac exec_ctx_impl;
|
|
9
|
-
include:jac element_impl;
|
|
10
|
-
include:jac arch_impl;
|
|
8
|
+
include:jac corelib_impl;
|
|
11
9
|
|
|
12
10
|
|
|
13
11
|
enum AccessMode;
|
|
@@ -61,7 +59,9 @@ obj ElementInterface {
|
|
|
61
59
|
can revoke_access(caller_id: UUID);
|
|
62
60
|
}
|
|
63
61
|
|
|
64
|
-
obj
|
|
62
|
+
obj ObjectInterface:ElementInterface: {}
|
|
63
|
+
|
|
64
|
+
obj DataSpatialInterface:ObjectInterface: {
|
|
65
65
|
static has ds_entry_funcs: list[dict]=[],
|
|
66
66
|
ds_exit_funcs: list[dict]=[];
|
|
67
67
|
|
|
@@ -69,26 +69,26 @@ obj DataSpatialInterface {
|
|
|
69
69
|
static can on_exit(cls: type, triggers: list[type]);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
obj
|
|
73
|
-
|
|
74
|
-
obj NodeInterface:ObjectInterface: {
|
|
72
|
+
obj NodeInterface:DataSpatialInterface: {
|
|
75
73
|
has edges: dict[EdgeDir, list[Edge]]
|
|
76
74
|
= {EdgeDir.IN: [], EdgeDir.OUT: []};
|
|
77
75
|
|
|
78
76
|
can connect_node(nd: Node, edg: Edge) -> Node;
|
|
79
77
|
can edges_to_nodes(dir: EdgeDir) -> list[Node];
|
|
78
|
+
can __call__(walk: Walker);
|
|
80
79
|
}
|
|
81
80
|
|
|
82
|
-
obj EdgeInterface:
|
|
81
|
+
obj EdgeInterface:DataSpatialInterface: {
|
|
83
82
|
has source: Node = None,
|
|
84
83
|
target: Node = None,
|
|
85
84
|
dir: EdgeDir = None;
|
|
86
85
|
|
|
87
86
|
can apply_dir(dir: EdgeDir) -> Edge;
|
|
88
87
|
can attach(src: Node, trg: Node) -> Edge;
|
|
88
|
+
can __call__(walk: Walker);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
obj WalkerInterface:
|
|
91
|
+
obj WalkerInterface:DataSpatialInterface: {
|
|
92
92
|
has path: list[Node] = [],
|
|
93
93
|
next: list[Node] = [],
|
|
94
94
|
ignores: list[Node] = [],
|
|
@@ -97,32 +97,19 @@ obj WalkerInterface:ObjectInterface: {
|
|
|
97
97
|
can visit_node(nds: list[Node]|list[Edge]|Node|Edge);
|
|
98
98
|
can ignore_node(nds: list[Node]|list[Edge]|Node|Edge);
|
|
99
99
|
can disengage_now;
|
|
100
|
+
can __call__(nd: Node);
|
|
100
101
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
has
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
obj Object:Element: {
|
|
107
|
-
has _jac_: ObjectInterface = ObjectInterface();
|
|
108
|
-
static has _jac_ds_: DataSpatialInterface = DataSpatialInterface();
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
obj Node:Object: {
|
|
112
|
-
has _jac_: NodeInterface = NodeInterface();
|
|
113
|
-
can __call__(walk: Walker);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
obj Edge:Object: {
|
|
117
|
-
has _jac_: EdgeInterface = EdgeInterface();
|
|
118
|
-
can __call__(walk: Walker);
|
|
102
|
+
obj Root:AbsRootHook: {
|
|
103
|
+
has _jac_: NodeInterface;
|
|
104
|
+
has RootType: type;
|
|
119
105
|
}
|
|
120
106
|
|
|
121
|
-
obj
|
|
122
|
-
has _jac_:
|
|
123
|
-
|
|
107
|
+
obj Master {
|
|
108
|
+
has _jac_: ElementInterface = ElementInterface();
|
|
109
|
+
has root_node: Root = Root(NodeInterface(), Root);
|
|
124
110
|
}
|
|
125
111
|
|
|
126
|
-
obj
|
|
127
|
-
|
|
128
|
-
can
|
|
112
|
+
obj JacPlugin {
|
|
113
|
+
static can bind_architype(arch: AT, arch_type: str) -> bool;
|
|
114
|
+
static can get_root() -> Architype;
|
|
115
|
+
}
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
"""Jac's Key Elemental Abstractions"""
|
|
2
|
+
|
|
3
|
+
import:py sys;
|
|
4
|
+
import:py from uuid, UUID, uuid4;
|
|
5
|
+
import:py from jaclang.jac.constant, EdgeDir;
|
|
6
|
+
import:py from jaclang.jac.plugin, hookimpl;
|
|
7
|
+
|
|
8
|
+
:obj:Memory:can:get_obj
|
|
9
|
+
(caller_id: UUID, item_id: UUID, override: bool = False) -> Element {
|
|
10
|
+
ret = item_id |> <self>.index.get;
|
|
11
|
+
if override or (ret is not None and caller_id |> ret.__is_readable) {
|
|
12
|
+
return ret;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:obj:Memory:can:has_obj
|
|
17
|
+
(item_id: UUID) -> bool {
|
|
18
|
+
return item_id in <self>.index;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:obj:Memory:can:save_obj
|
|
22
|
+
(caller_id: UUID, item: Element) {
|
|
23
|
+
if caller_id |> item.is_writable {
|
|
24
|
+
<self>.index[item.id] = item;
|
|
25
|
+
if item._persist {
|
|
26
|
+
item |> <self>.save_obj_list.add;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
<self>.mem[item.id] = item;
|
|
30
|
+
if item._persist {
|
|
31
|
+
item |> <self>.save_obj_list.add;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:obj:Memory:can:del_obj
|
|
36
|
+
(caller_id: UUID, item: Element) {
|
|
37
|
+
if caller_id |> item.is_writable {
|
|
38
|
+
<self>.index.pop(item.id);
|
|
39
|
+
if item._persist {
|
|
40
|
+
item |> <self>.save_obj_list.remove;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:obj:Memory:can:get_object_distribution -> dict {
|
|
46
|
+
dist = {};
|
|
47
|
+
for i in |> <self>.index.keys {
|
|
48
|
+
t = <self>.index[i] |> type;
|
|
49
|
+
if t in dist {
|
|
50
|
+
dist[t] += 1;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
dist[t] = 1;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return dist;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
:obj:Memory:can:get_mem_size -> float {
|
|
60
|
+
return (<self>.index |> sys.getsizeof) / 1024.0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
:obj:ExecutionContext:c:get_root
|
|
64
|
+
() {
|
|
65
|
+
if <self>.master :> type == UUID {
|
|
66
|
+
<self>.master = Master();
|
|
67
|
+
}
|
|
68
|
+
return <self>.master.root_node;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
:obj:ExecutionContext:c:reset {
|
|
72
|
+
<self>.<init>();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
"""Implementation for Jac's Element Abstractions"""
|
|
76
|
+
|
|
77
|
+
:enum:AccessMode {
|
|
78
|
+
READ_ONLY,
|
|
79
|
+
READ_WRITE,
|
|
80
|
+
PRIVATE
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
:obj:ElementInterface:can:make_public_ro {
|
|
84
|
+
<self>.__jinfo.access_mode = AccessMode.READ_ONLY;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
:obj:ElementInterface:can:make_public_rw {
|
|
88
|
+
<self>.__jinfo.access_mode = AccessMode.READ_WRITE;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
:obj:ElementInterface:can:make_private {
|
|
92
|
+
<self>.__jinfo.access_mode = AccessMode.PRIVATE;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
:obj:ElementInterface:can:is_public_ro -> bool {
|
|
96
|
+
return <self>.__jinfo.access_mode == AccessMode.READ_ONLY;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
:obj:ElementInterface:can:is_public_rw -> bool {
|
|
100
|
+
return <self>.__jinfo.access_mode == AccessMode.READ_WRITE;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
:obj:ElementInterface:can:is_private -> bool {
|
|
104
|
+
return <self>.__jinfo.access_mode == AccessMode.PRIVATE;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
:obj:ElementInterface:can:is_readable
|
|
108
|
+
(caller_id: UUID) -> bool {
|
|
109
|
+
return (
|
|
110
|
+
caller_id == <self>.owner_id
|
|
111
|
+
or |> <self>.is_public_read
|
|
112
|
+
or caller_id in <self>.ro_access
|
|
113
|
+
or caller_id in <self>.rw_access
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
:obj:ElementInterface:can:is_writable
|
|
118
|
+
(caller_id: UUID) -> bool {
|
|
119
|
+
return (
|
|
120
|
+
caller_id == <self>.owner_id
|
|
121
|
+
or |> <self>.is_public_write
|
|
122
|
+
or caller_id in <self>.rw_access
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
:obj:ElementInterface:can:give_access
|
|
127
|
+
(caller_id: UUID, read_write: bool = False) {
|
|
128
|
+
if read_write {
|
|
129
|
+
caller_id |> <self>.rw_access.add;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
caller_id |> add .> ro_access .> <self>;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
:obj:ElementInterface:can:revoke_access
|
|
137
|
+
(caller_id: UUID) {
|
|
138
|
+
caller_id |> <self>.ro_access.discard;
|
|
139
|
+
caller_id |> <self>.rw_access.discard;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
:obj:DataSpatialInterface:can:on_entry
|
|
144
|
+
(cls: type, triggers: list) {
|
|
145
|
+
can decorator(func: callable) -> callable {
|
|
146
|
+
cls.ds_entry_funcs.append({'types': triggers, 'func': func});
|
|
147
|
+
can wrapper(*args: list, **kwargs: dict) -> callable {
|
|
148
|
+
return func(*args, **kwargs);
|
|
149
|
+
}
|
|
150
|
+
return wrapper;
|
|
151
|
+
}
|
|
152
|
+
return decorator;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
:obj:DataSpatialInterface:can:on_exit
|
|
156
|
+
(cls: type, triggers: list) {
|
|
157
|
+
can decorator(func: callable) -> callable {
|
|
158
|
+
cls.ds_exit_funcs.append({'types': triggers, 'func': func});
|
|
159
|
+
can wrapper(*args: list, **kwargs: dict) -> callable {
|
|
160
|
+
return func(*args, **kwargs);
|
|
161
|
+
}
|
|
162
|
+
return wrapper;
|
|
163
|
+
}
|
|
164
|
+
return decorator;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
:obj:NodeInterface:can:connect_node
|
|
168
|
+
(nd: Node, edg: Edge) -> Node {
|
|
169
|
+
(<self>.py_obj, nd) :> edg.attach;
|
|
170
|
+
return <self>;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
:obj:NodeInterface:can:edges_to_nodes
|
|
174
|
+
(dir: EdgeDir) -> list[Node] {
|
|
175
|
+
ret_nodes = [];
|
|
176
|
+
if dir in [EdgeDir.OUT, EdgeDir.ANY] {
|
|
177
|
+
for i in <self>.edges[EdgeDir.OUT] {
|
|
178
|
+
ret_nodes.append(i.target);
|
|
179
|
+
}
|
|
180
|
+
} elif dir in [EdgeDir.IN, EdgeDir.ANY] {
|
|
181
|
+
for i in <self>.edges[EdgeDir.IN] {
|
|
182
|
+
ret_nodes.append(i.source);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return ret_nodes;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
:obj:EdgeInterface:can:apply_dir
|
|
189
|
+
(dir: EdgeDir) -> Edge {
|
|
190
|
+
<self>.dir = dir;
|
|
191
|
+
return <self>;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
:obj:EdgeInterface:can:attach
|
|
195
|
+
(src: Node, trg: Node) -> Edge {
|
|
196
|
+
if <self>.dir == EdgeDir.IN {
|
|
197
|
+
<self>.source = trg;
|
|
198
|
+
<self>.target = src;
|
|
199
|
+
<self> :> src._jac_.edges[EdgeDir.IN].append;
|
|
200
|
+
<self> :> trg._jac_.edges[EdgeDir.OUT].append;
|
|
201
|
+
} else {
|
|
202
|
+
<self>.source = src;
|
|
203
|
+
<self>.target = trg;
|
|
204
|
+
<self> :> src._jac_.edges[EdgeDir.OUT].append;
|
|
205
|
+
<self> :> trg._jac_.edges[EdgeDir.IN].append;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return <self>;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
:obj:WalkerInterface:can:visit_node
|
|
212
|
+
(nds: list[Node]|list[Edge]|Node|Edge) {
|
|
213
|
+
if isinstance(nds, list) {
|
|
214
|
+
for i in nds {
|
|
215
|
+
if(i not in <self>.ignores) { i :> <self>.next.append; }
|
|
216
|
+
}
|
|
217
|
+
} elif nds not in <self>.ignores { nds :> <self>.next.append; }
|
|
218
|
+
return len(nds) if isinstance(nds, list) else 1;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
:obj:WalkerInterface:can:ignore_node
|
|
222
|
+
(nds: list[Node]|list[Edge]|Node|Edge) {
|
|
223
|
+
if isinstance(nds, list) {
|
|
224
|
+
for i in nds {
|
|
225
|
+
i :> <self>.ignores.append;
|
|
226
|
+
}
|
|
227
|
+
} else { nds :> <self>.ignores.append; }
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
:obj:WalkerInterface:can:disengage_now {
|
|
231
|
+
<self>.next = [];
|
|
232
|
+
<self>.disengaged = True;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
:obj:NodeInterface:can:__call__
|
|
237
|
+
(walk: Walker) {
|
|
238
|
+
if not (walk, Walker) :> isinstance {
|
|
239
|
+
raise ("Argument must be a Walker instance") :> TypeError;
|
|
240
|
+
}
|
|
241
|
+
<self> :> walk;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
:obj:EdgeInterface:can:__call__
|
|
246
|
+
(walk: Walker) {
|
|
247
|
+
if not (walk, Walker) :> isinstance {
|
|
248
|
+
raise ("Argument must be a Walker instance") :> TypeError;
|
|
249
|
+
}
|
|
250
|
+
<self>._jac_.target :> walk;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
:obj:WalkerInterface:can:__call__
|
|
254
|
+
(nd: Node) {
|
|
255
|
+
<self>._jac_.path = [];
|
|
256
|
+
<self>._jac_.next = [nd];
|
|
257
|
+
walker_type = <self>.__class__.__name__;
|
|
258
|
+
while <self>._jac_.next :> len {
|
|
259
|
+
nd = 0 :> <self>._jac_.next.pop;
|
|
260
|
+
node_type = nd.__class__.__name__;
|
|
261
|
+
|
|
262
|
+
for i in nd._jac_ds_.ds_entry_funcs {
|
|
263
|
+
if i['func'].__qualname__.split(".")[0] == node_type and
|
|
264
|
+
<self>:>type in i['types'] {
|
|
265
|
+
(nd, <self>) :> i['func'];
|
|
266
|
+
}
|
|
267
|
+
if <self>._jac_.disengaged {return;}
|
|
268
|
+
}
|
|
269
|
+
for i in <self>._jac_ds_.ds_entry_funcs {
|
|
270
|
+
if i['func'].__qualname__.split(".")[0] == walker_type and
|
|
271
|
+
(nd:>type in i['types'] or nd in i['types']) { # if nd==root direct chec
|
|
272
|
+
(<self>, nd) :> i['func'];
|
|
273
|
+
}
|
|
274
|
+
if <self>._jac_.disengaged {return;}
|
|
275
|
+
}
|
|
276
|
+
for i in <self>._jac_ds_.ds_exit_funcs {
|
|
277
|
+
if i['func'].__qualname__.split(".")[0] == walker_type and
|
|
278
|
+
(nd:>type in i['types'] or nd in i['types']) {
|
|
279
|
+
(<self>, nd) :> i['func'];
|
|
280
|
+
}
|
|
281
|
+
if <self>._jac_.disengaged {return;}
|
|
282
|
+
}
|
|
283
|
+
for i in nd._jac_ds_.ds_exit_funcs {
|
|
284
|
+
if i['func'].__qualname__.split(".")[0] == node_type and
|
|
285
|
+
<self>:>type in i['types'] {
|
|
286
|
+
(nd, <self>) :> i['func'];
|
|
287
|
+
}
|
|
288
|
+
if <self>._jac_.disengaged {return;}
|
|
289
|
+
}
|
|
290
|
+
nd :> <self>._jac_.path.append;
|
|
291
|
+
}
|
|
292
|
+
<self>._jac_.ignores=[];
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
@hookimpl
|
|
296
|
+
:obj:JacPlugin:can:bind_architype
|
|
297
|
+
(arch: AT, arch_type: str) -> bool {
|
|
298
|
+
match arch_type {
|
|
299
|
+
case 'obj':
|
|
300
|
+
arch._jac_ = ObjectInterface();
|
|
301
|
+
case 'node':
|
|
302
|
+
arch._jac_ = NodeInterface();
|
|
303
|
+
case 'edge':
|
|
304
|
+
arch._jac_ = EdgeInterface();
|
|
305
|
+
case 'walker':
|
|
306
|
+
arch._jac_ = WalkerInterface();
|
|
307
|
+
case _:
|
|
308
|
+
raise ("Invalid archetype type") :> TypeError;
|
|
309
|
+
}
|
|
310
|
+
return True;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
@hookimpl
|
|
314
|
+
:obj:JacPlugin:can:get_root
|
|
315
|
+
() -> None {
|
|
316
|
+
return exec_ctx.get_root();
|
|
317
|
+
}
|
jaclang/jac/__init__.py
CHANGED