jaclang 0.0.5__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.
- jaclang/__init__.py +2 -1
- jaclang/cli/__jac_gen__/__init__.py +0 -0
- jaclang/cli/__jac_gen__/cli.py +175 -0
- jaclang/cli/__jac_gen__/cmds.py +132 -0
- jaclang/cli/cli.jac +2 -2
- jaclang/cli/cmds.jac +8 -2
- jaclang/cli/impl/__jac_gen__/__init__.py +0 -0
- jaclang/cli/impl/__jac_gen__/cli_impl.py +16 -0
- jaclang/cli/impl/__jac_gen__/cmds_impl.py +26 -0
- jaclang/cli/impl/cli_impl.jac +25 -8
- jaclang/cli/impl/cmds_impl.jac +35 -6
- jaclang/core/__jac_gen__/__init__.py +0 -0
- jaclang/core/__jac_gen__/primitives.py +567 -0
- jaclang/core/impl/__jac_gen__/__init__.py +0 -0
- jaclang/core/impl/__jac_gen__/arch_impl.py +24 -0
- jaclang/core/impl/__jac_gen__/element_impl.py +26 -0
- jaclang/core/impl/__jac_gen__/exec_ctx_impl.py +12 -0
- jaclang/core/impl/__jac_gen__/memory_impl.py +14 -0
- jaclang/core/impl/element_impl.jac +3 -3
- jaclang/core/impl/exec_ctx_impl.jac +3 -6
- jaclang/core/primitives.jac +4 -3
- jaclang/jac/absyntree.py +555 -180
- jaclang/jac/constant.py +6 -0
- jaclang/jac/importer.py +34 -56
- jaclang/jac/langserve.py +26 -0
- jaclang/jac/lexer.py +35 -3
- jaclang/jac/parser.py +146 -115
- jaclang/jac/passes/blue/__init__.py +8 -3
- jaclang/jac/passes/blue/ast_build_pass.py +454 -305
- jaclang/jac/passes/blue/blue_pygen_pass.py +112 -74
- jaclang/jac/passes/blue/decl_def_match_pass.py +49 -277
- jaclang/jac/passes/blue/import_pass.py +1 -1
- jaclang/jac/passes/blue/pyout_pass.py +74 -0
- jaclang/jac/passes/blue/semantic_check_pass.py +37 -0
- jaclang/jac/passes/blue/sym_tab_build_pass.py +1045 -0
- jaclang/jac/passes/blue/tests/test_ast_build_pass.py +2 -2
- jaclang/jac/passes/blue/tests/test_blue_pygen_pass.py +9 -28
- jaclang/jac/passes/blue/tests/test_decl_def_match_pass.py +13 -22
- jaclang/jac/passes/blue/tests/test_sym_tab_build_pass.py +22 -0
- jaclang/jac/passes/ir_pass.py +8 -6
- jaclang/jac/passes/purple/__jac_gen__/__init__.py +0 -0
- jaclang/jac/passes/purple/__jac_gen__/analyze_pass.py +37 -0
- jaclang/jac/passes/purple/__jac_gen__/purple_pygen_pass.py +305 -0
- jaclang/jac/passes/purple/impl/__jac_gen__/__init__.py +0 -0
- jaclang/jac/passes/purple/impl/__jac_gen__/purple_pygen_pass_impl.py +23 -0
- jaclang/jac/passes/purple/impl/purple_pygen_pass_impl.jac +2 -5
- jaclang/jac/symtable.py +154 -0
- jaclang/jac/tests/fixtures/__jac_gen__/__init__.py +0 -0
- jaclang/jac/tests/fixtures/__jac_gen__/hello_world.py +16 -0
- jaclang/jac/tests/fixtures/fam.jac +7 -8
- jaclang/jac/tests/fixtures/mod_doc_test.jac +1 -0
- jaclang/jac/tests/test_parser.py +8 -0
- jaclang/jac/transform.py +41 -14
- jaclang/jac/transpiler.py +18 -9
- jaclang/utils/fstring_parser.py +2 -2
- jaclang/utils/helpers.py +41 -0
- jaclang/utils/lang_tools.py +12 -2
- jaclang/utils/test.py +41 -0
- jaclang/vendor/__init__.py +1 -0
- jaclang/vendor/pygls/__init__.py +25 -0
- jaclang/vendor/pygls/capabilities.py +502 -0
- jaclang/vendor/pygls/client.py +176 -0
- jaclang/vendor/pygls/constants.py +26 -0
- jaclang/vendor/pygls/exceptions.py +220 -0
- jaclang/vendor/pygls/feature_manager.py +241 -0
- jaclang/vendor/pygls/lsp/__init__.py +139 -0
- jaclang/vendor/pygls/lsp/client.py +2224 -0
- jaclang/vendor/pygls/lsprotocol/__init__.py +2 -0
- jaclang/vendor/pygls/lsprotocol/_hooks.py +1233 -0
- jaclang/vendor/pygls/lsprotocol/converters.py +17 -0
- jaclang/vendor/pygls/lsprotocol/types.py +12820 -0
- jaclang/vendor/pygls/lsprotocol/validators.py +47 -0
- jaclang/vendor/pygls/progress.py +79 -0
- jaclang/vendor/pygls/protocol.py +1184 -0
- jaclang/vendor/pygls/server.py +620 -0
- jaclang/vendor/pygls/uris.py +184 -0
- jaclang/vendor/pygls/workspace/__init__.py +81 -0
- jaclang/vendor/pygls/workspace/position.py +204 -0
- jaclang/vendor/pygls/workspace/text_document.py +234 -0
- jaclang/vendor/pygls/workspace/workspace.py +311 -0
- {jaclang-0.0.5.dist-info → jaclang-0.0.8.dist-info}/METADATA +1 -1
- jaclang-0.0.8.dist-info/RECORD +118 -0
- jaclang/core/jaclang.jac +0 -62
- jaclang/jac/passes/blue/tests/test_type_analyze_pass.py +0 -53
- jaclang/jac/passes/blue/type_analyze_pass.py +0 -728
- jaclang/jac/sym_table.py +0 -127
- jaclang-0.0.5.dist-info/RECORD +0 -73
- /jaclang/{utils → vendor}/sly/__init__.py +0 -0
- /jaclang/{utils → vendor}/sly/docparse.py +0 -0
- /jaclang/{utils → vendor}/sly/lex.py +0 -0
- /jaclang/{utils → vendor}/sly/yacc.py +0 -0
- {jaclang-0.0.5.dist-info → jaclang-0.0.8.dist-info}/WHEEL +0 -0
- {jaclang-0.0.5.dist-info → jaclang-0.0.8.dist-info}/entry_points.txt +0 -0
- {jaclang-0.0.5.dist-info → jaclang-0.0.8.dist-info}/top_level.txt +0 -0
jaclang/jac/parser.py
CHANGED
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
from typing import Generator, Optional
|
|
4
4
|
|
|
5
5
|
import jaclang.jac.absyntree as ast
|
|
6
|
+
from jaclang.jac.constant import Constants as Con
|
|
6
7
|
from jaclang.jac.lexer import JacLexer
|
|
7
8
|
from jaclang.jac.transform import ABCParserMeta, Transform
|
|
8
|
-
from jaclang.utils.
|
|
9
|
+
from jaclang.utils.helpers import dedent_code_block
|
|
10
|
+
from jaclang.vendor.sly.yacc import Parser, YaccProduction
|
|
9
11
|
|
|
10
12
|
|
|
11
13
|
_ = None # For flake8 linting
|
|
@@ -55,22 +57,22 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
55
57
|
# Element types
|
|
56
58
|
# -------------
|
|
57
59
|
@_(
|
|
58
|
-
"global_var",
|
|
59
|
-
"test",
|
|
60
|
-
"mod_code",
|
|
60
|
+
"doc_tag global_var",
|
|
61
|
+
"doc_tag test",
|
|
62
|
+
"doc_tag mod_code",
|
|
61
63
|
"import_stmt",
|
|
62
64
|
"include_stmt",
|
|
63
|
-
"architype",
|
|
64
|
-
"ability",
|
|
65
|
-
"
|
|
65
|
+
"doc_tag architype",
|
|
66
|
+
"doc_tag ability",
|
|
67
|
+
"python_code_block",
|
|
66
68
|
)
|
|
67
69
|
def element(self, p: YaccProduction) -> YaccProduction:
|
|
68
70
|
"""Element rule."""
|
|
69
71
|
return p
|
|
70
72
|
|
|
71
73
|
@_(
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
+
"KW_GLOBAL access_tag assignment_list SEMI",
|
|
75
|
+
"KW_FREEZE access_tag assignment_list SEMI",
|
|
74
76
|
)
|
|
75
77
|
def global_var(self, p: YaccProduction) -> YaccProduction:
|
|
76
78
|
"""Global variable rule."""
|
|
@@ -93,12 +95,18 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
93
95
|
"""Permission tag rule."""
|
|
94
96
|
return p
|
|
95
97
|
|
|
96
|
-
@_(
|
|
98
|
+
@_(
|
|
99
|
+
"KW_TEST NAME code_block",
|
|
100
|
+
"KW_TEST code_block",
|
|
101
|
+
)
|
|
97
102
|
def test(self, p: YaccProduction) -> YaccProduction:
|
|
98
103
|
"""Test rule."""
|
|
99
104
|
return p
|
|
100
105
|
|
|
101
|
-
@_(
|
|
106
|
+
@_(
|
|
107
|
+
"KW_WITH KW_ENTRY code_block",
|
|
108
|
+
"KW_WITH KW_ENTRY sub_name code_block",
|
|
109
|
+
)
|
|
102
110
|
def mod_code(self, p: YaccProduction) -> YaccProduction:
|
|
103
111
|
"""Module-level free code rule."""
|
|
104
112
|
return p
|
|
@@ -111,6 +119,11 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
111
119
|
"""Doc tag rule."""
|
|
112
120
|
return p
|
|
113
121
|
|
|
122
|
+
@_("PYNLINE")
|
|
123
|
+
def python_code_block(self, p: YaccProduction) -> YaccProduction:
|
|
124
|
+
"""Python code block rule."""
|
|
125
|
+
return p
|
|
126
|
+
|
|
114
127
|
# Import Statements
|
|
115
128
|
# -----------------
|
|
116
129
|
@_(
|
|
@@ -167,25 +180,22 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
167
180
|
@_(
|
|
168
181
|
"architype_decl",
|
|
169
182
|
"architype_def",
|
|
183
|
+
"enum",
|
|
184
|
+
"decorator architype",
|
|
170
185
|
)
|
|
171
186
|
def architype(self, p: YaccProduction) -> YaccProduction:
|
|
172
187
|
"""Architype rule."""
|
|
173
188
|
return p
|
|
174
189
|
|
|
175
190
|
@_(
|
|
176
|
-
"
|
|
177
|
-
"
|
|
178
|
-
"doc_tag arch_type access_tag NAME inherited_archs member_block",
|
|
179
|
-
"doc_tag decorators arch_type access_tag NAME inherited_archs member_block",
|
|
191
|
+
"arch_type access_tag NAME inherited_archs SEMI",
|
|
192
|
+
"arch_type access_tag NAME inherited_archs member_block",
|
|
180
193
|
)
|
|
181
194
|
def architype_decl(self, p: YaccProduction) -> YaccProduction:
|
|
182
195
|
"""Architype declaration rule."""
|
|
183
196
|
return p
|
|
184
197
|
|
|
185
|
-
@_(
|
|
186
|
-
"doc_tag strict_arch_ref member_block",
|
|
187
|
-
"doc_tag dotted_name strict_arch_ref member_block",
|
|
188
|
-
)
|
|
198
|
+
@_("abil_to_arch_chain member_block")
|
|
189
199
|
def architype_def(self, p: YaccProduction) -> YaccProduction:
|
|
190
200
|
"""Architype definition rule."""
|
|
191
201
|
return p
|
|
@@ -200,11 +210,8 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
200
210
|
"""Arch type rule."""
|
|
201
211
|
return p
|
|
202
212
|
|
|
203
|
-
@_(
|
|
204
|
-
|
|
205
|
-
"decorators DECOR_OP atom",
|
|
206
|
-
)
|
|
207
|
-
def decorators(self, p: YaccProduction) -> YaccProduction:
|
|
213
|
+
@_("DECOR_OP atom")
|
|
214
|
+
def decorator(self, p: YaccProduction) -> YaccProduction:
|
|
208
215
|
"""Python style decorator rule."""
|
|
209
216
|
return p
|
|
210
217
|
|
|
@@ -252,7 +259,7 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
252
259
|
|
|
253
260
|
@_(
|
|
254
261
|
"esc_name",
|
|
255
|
-
"
|
|
262
|
+
"global_ref",
|
|
256
263
|
)
|
|
257
264
|
def named_refs(self, p: YaccProduction) -> YaccProduction:
|
|
258
265
|
"""All reference rules."""
|
|
@@ -269,46 +276,90 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
269
276
|
"""All reference rules."""
|
|
270
277
|
return p
|
|
271
278
|
|
|
279
|
+
# Enum elements
|
|
280
|
+
# ----------------
|
|
281
|
+
@_(
|
|
282
|
+
"enum_decl",
|
|
283
|
+
"enum_def",
|
|
284
|
+
)
|
|
285
|
+
def enum(self, p: YaccProduction) -> YaccProduction:
|
|
286
|
+
"""Enum rule."""
|
|
287
|
+
return p
|
|
288
|
+
|
|
289
|
+
@_(
|
|
290
|
+
"KW_ENUM access_tag NAME inherited_archs SEMI",
|
|
291
|
+
"KW_ENUM access_tag NAME inherited_archs enum_block",
|
|
292
|
+
)
|
|
293
|
+
def enum_decl(self, p: YaccProduction) -> YaccProduction:
|
|
294
|
+
"""Enum decl rule."""
|
|
295
|
+
return p
|
|
296
|
+
|
|
297
|
+
@_("arch_to_enum_chain enum_block")
|
|
298
|
+
def enum_def(self, p: YaccProduction) -> YaccProduction:
|
|
299
|
+
"""Enum def rule."""
|
|
300
|
+
return p
|
|
301
|
+
|
|
302
|
+
@_(
|
|
303
|
+
"LBRACE RBRACE",
|
|
304
|
+
"LBRACE enum_stmt_list RBRACE",
|
|
305
|
+
)
|
|
306
|
+
def enum_block(self, p: YaccProduction) -> YaccProduction:
|
|
307
|
+
"""Enum block rule."""
|
|
308
|
+
return p
|
|
309
|
+
|
|
310
|
+
@_(
|
|
311
|
+
"NAME",
|
|
312
|
+
"enum_op_assign",
|
|
313
|
+
"enum_stmt_list COMMA NAME",
|
|
314
|
+
"enum_stmt_list COMMA enum_op_assign",
|
|
315
|
+
)
|
|
316
|
+
def enum_stmt_list(self, p: YaccProduction) -> YaccProduction:
|
|
317
|
+
"""Enum op list rule."""
|
|
318
|
+
return p
|
|
319
|
+
|
|
320
|
+
@_(
|
|
321
|
+
"NAME EQ expression",
|
|
322
|
+
)
|
|
323
|
+
def enum_op_assign(self, p: YaccProduction) -> YaccProduction:
|
|
324
|
+
"""Enum op assign rule."""
|
|
325
|
+
return p
|
|
326
|
+
|
|
272
327
|
# Ability elements
|
|
273
328
|
# ----------------
|
|
274
329
|
@_(
|
|
275
330
|
"ability_decl",
|
|
276
331
|
"KW_ASYNC ability_decl",
|
|
277
332
|
"ability_def",
|
|
333
|
+
"decorator ability",
|
|
278
334
|
)
|
|
279
335
|
def ability(self, p: YaccProduction) -> YaccProduction:
|
|
280
336
|
"""Ability rule."""
|
|
281
337
|
return p
|
|
282
338
|
|
|
283
339
|
@_(
|
|
284
|
-
"
|
|
285
|
-
"
|
|
286
|
-
"
|
|
287
|
-
"
|
|
288
|
-
"ability_decl_decor",
|
|
340
|
+
"static_tag KW_CAN access_tag all_refs event_clause SEMI",
|
|
341
|
+
"static_tag KW_CAN access_tag all_refs func_decl SEMI",
|
|
342
|
+
"static_tag KW_CAN access_tag all_refs event_clause code_block",
|
|
343
|
+
"static_tag KW_CAN access_tag all_refs func_decl code_block",
|
|
289
344
|
)
|
|
290
345
|
def ability_decl(self, p: YaccProduction) -> YaccProduction:
|
|
291
346
|
"""Ability rule."""
|
|
292
347
|
return p
|
|
293
348
|
|
|
294
349
|
@_(
|
|
295
|
-
"
|
|
296
|
-
"
|
|
297
|
-
"doc_tag decorators static_tag KW_CAN access_tag all_refs event_clause code_block",
|
|
298
|
-
"doc_tag decorators static_tag KW_CAN access_tag all_refs func_decl code_block",
|
|
350
|
+
"arch_to_abil_chain event_clause code_block",
|
|
351
|
+
"arch_to_abil_chain func_decl code_block",
|
|
299
352
|
)
|
|
300
|
-
def
|
|
301
|
-
"""Ability
|
|
353
|
+
def ability_def(self, p: YaccProduction) -> YaccProduction:
|
|
354
|
+
"""Ability rule."""
|
|
302
355
|
return p
|
|
303
356
|
|
|
304
357
|
@_(
|
|
305
|
-
"
|
|
306
|
-
"
|
|
307
|
-
"doc_tag ability_ref func_decl code_block",
|
|
308
|
-
"doc_tag dotted_name ability_ref func_decl code_block",
|
|
358
|
+
"static_tag KW_CAN access_tag all_refs event_clause KW_ABSTRACT SEMI",
|
|
359
|
+
"static_tag KW_CAN access_tag all_refs func_decl KW_ABSTRACT SEMI",
|
|
309
360
|
)
|
|
310
|
-
def
|
|
311
|
-
"""
|
|
361
|
+
def abstract_ability(self, p: YaccProduction) -> YaccProduction:
|
|
362
|
+
"""Abstract ability rule."""
|
|
312
363
|
return p
|
|
313
364
|
|
|
314
365
|
@_(
|
|
@@ -350,59 +401,6 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
350
401
|
"""Parameter variable rule rule."""
|
|
351
402
|
return p
|
|
352
403
|
|
|
353
|
-
# Enum elements
|
|
354
|
-
# ----------------
|
|
355
|
-
@_(
|
|
356
|
-
"enum_decl",
|
|
357
|
-
"enum_def",
|
|
358
|
-
)
|
|
359
|
-
def enum(self, p: YaccProduction) -> YaccProduction:
|
|
360
|
-
"""Enum rule."""
|
|
361
|
-
return p
|
|
362
|
-
|
|
363
|
-
@_(
|
|
364
|
-
"doc_tag KW_ENUM access_tag NAME inherited_archs SEMI",
|
|
365
|
-
"doc_tag KW_ENUM access_tag NAME inherited_archs enum_block",
|
|
366
|
-
"doc_tag decorators KW_ENUM access_tag NAME inherited_archs SEMI",
|
|
367
|
-
"doc_tag decorators KW_ENUM access_tag NAME inherited_archs enum_block",
|
|
368
|
-
)
|
|
369
|
-
def enum_decl(self, p: YaccProduction) -> YaccProduction:
|
|
370
|
-
"""Enum decl rule."""
|
|
371
|
-
return p
|
|
372
|
-
|
|
373
|
-
@_(
|
|
374
|
-
"doc_tag enum_ref enum_block",
|
|
375
|
-
"doc_tag dotted_name enum_ref enum_block",
|
|
376
|
-
)
|
|
377
|
-
def enum_def(self, p: YaccProduction) -> YaccProduction:
|
|
378
|
-
"""Enum def rule."""
|
|
379
|
-
return p
|
|
380
|
-
|
|
381
|
-
@_(
|
|
382
|
-
"LBRACE RBRACE",
|
|
383
|
-
"LBRACE enum_stmt_list RBRACE",
|
|
384
|
-
)
|
|
385
|
-
def enum_block(self, p: YaccProduction) -> YaccProduction:
|
|
386
|
-
"""Enum block rule."""
|
|
387
|
-
return p
|
|
388
|
-
|
|
389
|
-
@_(
|
|
390
|
-
"NAME",
|
|
391
|
-
"enum_op_assign",
|
|
392
|
-
"enum_stmt_list COMMA NAME",
|
|
393
|
-
"enum_stmt_list COMMA enum_op_assign",
|
|
394
|
-
)
|
|
395
|
-
def enum_stmt_list(self, p: YaccProduction) -> YaccProduction:
|
|
396
|
-
"""Enum op list rule."""
|
|
397
|
-
return p
|
|
398
|
-
|
|
399
|
-
@_(
|
|
400
|
-
"NAME EQ expression",
|
|
401
|
-
)
|
|
402
|
-
def enum_op_assign(self, p: YaccProduction) -> YaccProduction:
|
|
403
|
-
"""Enum op assign rule."""
|
|
404
|
-
return p
|
|
405
|
-
|
|
406
404
|
# Attribute blocks
|
|
407
405
|
# ----------------
|
|
408
406
|
@_(
|
|
@@ -422,8 +420,11 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
422
420
|
return p
|
|
423
421
|
|
|
424
422
|
@_(
|
|
425
|
-
"has_stmt",
|
|
426
|
-
"
|
|
423
|
+
"doc_tag has_stmt",
|
|
424
|
+
"doc_tag architype",
|
|
425
|
+
"doc_tag ability",
|
|
426
|
+
"doc_tag abstract_ability",
|
|
427
|
+
"python_code_block",
|
|
427
428
|
)
|
|
428
429
|
def member_stmt(self, p: YaccProduction) -> YaccProduction:
|
|
429
430
|
"""Attribute statement rule."""
|
|
@@ -432,8 +433,8 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
432
433
|
# Has statements
|
|
433
434
|
# --------------
|
|
434
435
|
@_(
|
|
435
|
-
"
|
|
436
|
-
"
|
|
436
|
+
"static_tag KW_HAS access_tag has_assign_clause SEMI",
|
|
437
|
+
"static_tag KW_FREEZE access_tag has_assign_clause SEMI",
|
|
437
438
|
)
|
|
438
439
|
def has_stmt(self, p: YaccProduction) -> YaccProduction:
|
|
439
440
|
"""Has statement rule."""
|
|
@@ -535,8 +536,8 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
535
536
|
|
|
536
537
|
@_(
|
|
537
538
|
"import_stmt",
|
|
538
|
-
"
|
|
539
|
-
"
|
|
539
|
+
"doc_tag architype",
|
|
540
|
+
"doc_tag ability",
|
|
540
541
|
"typed_ctx_block",
|
|
541
542
|
"assignment SEMI",
|
|
542
543
|
"static_assignment",
|
|
@@ -555,6 +556,7 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
555
556
|
"yield_stmt SEMI",
|
|
556
557
|
"await_stmt SEMI",
|
|
557
558
|
"walker_stmt",
|
|
559
|
+
"python_code_block",
|
|
558
560
|
)
|
|
559
561
|
def statement(self, p: YaccProduction) -> YaccProduction:
|
|
560
562
|
"""Statement rule."""
|
|
@@ -1143,7 +1145,6 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
1143
1145
|
"atom DOT_FWD all_refs",
|
|
1144
1146
|
"atom DOT_BKWD all_refs",
|
|
1145
1147
|
"atom index_slice",
|
|
1146
|
-
"atom arch_ref",
|
|
1147
1148
|
"atom edge_op_ref",
|
|
1148
1149
|
"atom filter_compr",
|
|
1149
1150
|
)
|
|
@@ -1156,7 +1157,6 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
1156
1157
|
"atom NULL_OK DOT_FWD all_refs",
|
|
1157
1158
|
"atom NULL_OK DOT_BKWD all_refs",
|
|
1158
1159
|
"atom NULL_OK index_slice",
|
|
1159
|
-
"atom NULL_OK arch_ref",
|
|
1160
1160
|
"atom NULL_OK edge_op_ref",
|
|
1161
1161
|
"atom NULL_OK filter_compr",
|
|
1162
1162
|
)
|
|
@@ -1208,25 +1208,49 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
1208
1208
|
# Architype reference rules
|
|
1209
1209
|
# -------------------------
|
|
1210
1210
|
@_(
|
|
1211
|
-
"
|
|
1212
|
-
"
|
|
1213
|
-
"
|
|
1214
|
-
"
|
|
1211
|
+
"node_ref",
|
|
1212
|
+
"edge_ref",
|
|
1213
|
+
"walker_ref",
|
|
1214
|
+
"object_ref",
|
|
1215
1215
|
)
|
|
1216
1216
|
def arch_ref(self, p: YaccProduction) -> YaccProduction:
|
|
1217
|
-
"""Architype reference rule."""
|
|
1217
|
+
"""Strict Architype reference rule."""
|
|
1218
1218
|
return p
|
|
1219
1219
|
|
|
1220
1220
|
@_(
|
|
1221
|
-
"
|
|
1222
|
-
"
|
|
1223
|
-
"
|
|
1224
|
-
"
|
|
1221
|
+
"arch_ref",
|
|
1222
|
+
"ability_ref",
|
|
1223
|
+
"arch_or_ability_chain arch_ref",
|
|
1224
|
+
"arch_or_ability_chain ability_ref",
|
|
1225
1225
|
)
|
|
1226
|
-
def
|
|
1226
|
+
def arch_or_ability_chain(self, p: YaccProduction) -> YaccProduction:
|
|
1227
1227
|
"""Strict Architype reference rule."""
|
|
1228
1228
|
return p
|
|
1229
1229
|
|
|
1230
|
+
@_(
|
|
1231
|
+
"arch_ref",
|
|
1232
|
+
"arch_or_ability_chain arch_ref",
|
|
1233
|
+
)
|
|
1234
|
+
def abil_to_arch_chain(self, p: YaccProduction) -> YaccProduction:
|
|
1235
|
+
"""Strict Architype reference list rule."""
|
|
1236
|
+
return p
|
|
1237
|
+
|
|
1238
|
+
@_(
|
|
1239
|
+
"ability_ref",
|
|
1240
|
+
"arch_or_ability_chain ability_ref",
|
|
1241
|
+
)
|
|
1242
|
+
def arch_to_abil_chain(self, p: YaccProduction) -> YaccProduction:
|
|
1243
|
+
"""Strict Architype reference list rule."""
|
|
1244
|
+
return p
|
|
1245
|
+
|
|
1246
|
+
@_(
|
|
1247
|
+
"enum_ref",
|
|
1248
|
+
"arch_or_ability_chain enum_ref",
|
|
1249
|
+
)
|
|
1250
|
+
def arch_to_enum_chain(self, p: YaccProduction) -> YaccProduction:
|
|
1251
|
+
"""Strict Architype reference list rule."""
|
|
1252
|
+
return p
|
|
1253
|
+
|
|
1230
1254
|
@_("NODE_OP NAME")
|
|
1231
1255
|
def node_ref(self, p: YaccProduction) -> YaccProduction:
|
|
1232
1256
|
"""Node reference rule."""
|
|
@@ -1411,7 +1435,7 @@ def parse_tree_to_ast(
|
|
|
1411
1435
|
return result
|
|
1412
1436
|
|
|
1413
1437
|
from jaclang.utils.fstring_parser import FStringLexer, FStringParser
|
|
1414
|
-
from jaclang.
|
|
1438
|
+
from jaclang.vendor.sly.lex import Token as LexToken
|
|
1415
1439
|
|
|
1416
1440
|
ast_tree: ast.AstNode = None
|
|
1417
1441
|
if not isinstance(tree, ast.AstNode):
|
|
@@ -1420,7 +1444,9 @@ def parse_tree_to_ast(
|
|
|
1420
1444
|
tree = JacParserExpr(
|
|
1421
1445
|
mod_path="",
|
|
1422
1446
|
input_ir=JacLexer(
|
|
1423
|
-
mod_path="",
|
|
1447
|
+
mod_path="",
|
|
1448
|
+
input_ir=find_and_concat_fstr_pieces(tree),
|
|
1449
|
+
fstr_override=True,
|
|
1424
1450
|
).ir,
|
|
1425
1451
|
).ir_tup[2]
|
|
1426
1452
|
kids = tree[2:]
|
|
@@ -1467,6 +1493,11 @@ def parse_tree_to_ast(
|
|
|
1467
1493
|
ast_tree = ast.Constant(typ=type(None), **meta)
|
|
1468
1494
|
elif tree.type.startswith("TYP_"):
|
|
1469
1495
|
ast_tree = ast.Constant(typ=type, **meta)
|
|
1496
|
+
elif tree.type == "PYNLINE":
|
|
1497
|
+
ast_tree = ast.Token(**meta)
|
|
1498
|
+
ast_tree.value = dedent_code_block(
|
|
1499
|
+
ast_tree.value.replace(f"{Con.PYNLINE}", "")
|
|
1500
|
+
)
|
|
1470
1501
|
else:
|
|
1471
1502
|
ast_tree = ast.Token(**meta)
|
|
1472
1503
|
else:
|
|
@@ -2,16 +2,19 @@
|
|
|
2
2
|
from .ast_build_pass import AstBuildPass # noqa: I100
|
|
3
3
|
from .sub_node_tab_pass import SubNodeTabPass
|
|
4
4
|
from .import_pass import ImportPass # noqa: I100
|
|
5
|
+
from .sym_tab_build_pass import SymTabBuildPass # noqa: I100
|
|
5
6
|
from .decl_def_match_pass import DeclDefMatchPass # noqa: I100
|
|
6
|
-
from .
|
|
7
|
+
from .semantic_check_pass import SemanticCheckPass # noqa: I100
|
|
7
8
|
from .blue_pygen_pass import BluePygenPass # noqa: I100
|
|
9
|
+
from .pyout_pass import PyOutPass # noqa: I100
|
|
8
10
|
|
|
9
11
|
pass_schedule = [
|
|
10
12
|
AstBuildPass,
|
|
11
13
|
SubNodeTabPass,
|
|
12
14
|
ImportPass,
|
|
15
|
+
SymTabBuildPass,
|
|
13
16
|
DeclDefMatchPass,
|
|
14
|
-
|
|
17
|
+
SemanticCheckPass,
|
|
15
18
|
BluePygenPass,
|
|
16
19
|
]
|
|
17
20
|
|
|
@@ -19,7 +22,9 @@ __all__ = [
|
|
|
19
22
|
"AstBuildPass",
|
|
20
23
|
"SubNodeTabPass",
|
|
21
24
|
"ImportPass",
|
|
25
|
+
"SymTabBuildPass",
|
|
22
26
|
"DeclDefMatchPass",
|
|
23
|
-
"
|
|
27
|
+
"SemanticCheckPass",
|
|
24
28
|
"BluePygenPass",
|
|
29
|
+
"PyOutPass",
|
|
25
30
|
]
|