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.
- 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/cmds.jac +3 -0
- 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/cmds_impl.jac +17 -3
- 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 +2 -2
- jaclang/core/primitives.jac +1 -0
- jaclang/jac/absyntree.py +65 -42
- jaclang/jac/constant.py +4 -0
- jaclang/jac/importer.py +18 -60
- jaclang/jac/langserve.py +26 -0
- jaclang/jac/lexer.py +9 -1
- jaclang/jac/parser.py +135 -123
- jaclang/jac/passes/blue/ast_build_pass.py +410 -353
- jaclang/jac/passes/blue/blue_pygen_pass.py +15 -0
- jaclang/jac/passes/blue/decl_def_match_pass.py +33 -21
- jaclang/jac/passes/blue/import_pass.py +1 -1
- jaclang/jac/passes/blue/pyout_pass.py +47 -12
- jaclang/jac/passes/blue/sym_tab_build_pass.py +38 -127
- jaclang/jac/passes/blue/tests/test_ast_build_pass.py +2 -2
- jaclang/jac/passes/blue/tests/test_blue_pygen_pass.py +9 -30
- jaclang/jac/passes/blue/tests/test_decl_def_match_pass.py +13 -13
- jaclang/jac/passes/blue/tests/test_sym_tab_build_pass.py +6 -4
- jaclang/jac/passes/ir_pass.py +1 -1
- 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/symtable.py +12 -4
- 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/transform.py +4 -3
- jaclang/jac/transpiler.py +13 -9
- jaclang/utils/fstring_parser.py +2 -2
- jaclang/utils/helpers.py +41 -0
- jaclang/utils/test.py +30 -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.6.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-0.0.6.dist-info/RECORD +0 -76
- /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.6.dist-info → jaclang-0.0.8.dist-info}/WHEEL +0 -0
- {jaclang-0.0.6.dist-info → jaclang-0.0.8.dist-info}/entry_points.txt +0 -0
- {jaclang-0.0.6.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."""
|
|
@@ -94,16 +96,16 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
94
96
|
return p
|
|
95
97
|
|
|
96
98
|
@_(
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
+
"KW_TEST NAME code_block",
|
|
100
|
+
"KW_TEST code_block",
|
|
99
101
|
)
|
|
100
102
|
def test(self, p: YaccProduction) -> YaccProduction:
|
|
101
103
|
"""Test rule."""
|
|
102
104
|
return p
|
|
103
105
|
|
|
104
106
|
@_(
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
+
"KW_WITH KW_ENTRY code_block",
|
|
108
|
+
"KW_WITH KW_ENTRY sub_name code_block",
|
|
107
109
|
)
|
|
108
110
|
def mod_code(self, p: YaccProduction) -> YaccProduction:
|
|
109
111
|
"""Module-level free code rule."""
|
|
@@ -117,6 +119,11 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
117
119
|
"""Doc tag rule."""
|
|
118
120
|
return p
|
|
119
121
|
|
|
122
|
+
@_("PYNLINE")
|
|
123
|
+
def python_code_block(self, p: YaccProduction) -> YaccProduction:
|
|
124
|
+
"""Python code block rule."""
|
|
125
|
+
return p
|
|
126
|
+
|
|
120
127
|
# Import Statements
|
|
121
128
|
# -----------------
|
|
122
129
|
@_(
|
|
@@ -173,25 +180,22 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
173
180
|
@_(
|
|
174
181
|
"architype_decl",
|
|
175
182
|
"architype_def",
|
|
183
|
+
"enum",
|
|
184
|
+
"decorator architype",
|
|
176
185
|
)
|
|
177
186
|
def architype(self, p: YaccProduction) -> YaccProduction:
|
|
178
187
|
"""Architype rule."""
|
|
179
188
|
return p
|
|
180
189
|
|
|
181
190
|
@_(
|
|
182
|
-
"
|
|
183
|
-
"
|
|
184
|
-
"doc_tag arch_type access_tag NAME inherited_archs member_block",
|
|
185
|
-
"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",
|
|
186
193
|
)
|
|
187
194
|
def architype_decl(self, p: YaccProduction) -> YaccProduction:
|
|
188
195
|
"""Architype declaration rule."""
|
|
189
196
|
return p
|
|
190
197
|
|
|
191
|
-
@_(
|
|
192
|
-
"doc_tag strict_arch_ref member_block",
|
|
193
|
-
"doc_tag dotted_name strict_arch_ref member_block",
|
|
194
|
-
)
|
|
198
|
+
@_("abil_to_arch_chain member_block")
|
|
195
199
|
def architype_def(self, p: YaccProduction) -> YaccProduction:
|
|
196
200
|
"""Architype definition rule."""
|
|
197
201
|
return p
|
|
@@ -206,11 +210,8 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
206
210
|
"""Arch type rule."""
|
|
207
211
|
return p
|
|
208
212
|
|
|
209
|
-
@_(
|
|
210
|
-
|
|
211
|
-
"decorators DECOR_OP atom",
|
|
212
|
-
)
|
|
213
|
-
def decorators(self, p: YaccProduction) -> YaccProduction:
|
|
213
|
+
@_("DECOR_OP atom")
|
|
214
|
+
def decorator(self, p: YaccProduction) -> YaccProduction:
|
|
214
215
|
"""Python style decorator rule."""
|
|
215
216
|
return p
|
|
216
217
|
|
|
@@ -258,7 +259,7 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
258
259
|
|
|
259
260
|
@_(
|
|
260
261
|
"esc_name",
|
|
261
|
-
"
|
|
262
|
+
"global_ref",
|
|
262
263
|
)
|
|
263
264
|
def named_refs(self, p: YaccProduction) -> YaccProduction:
|
|
264
265
|
"""All reference rules."""
|
|
@@ -275,53 +276,87 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
275
276
|
"""All reference rules."""
|
|
276
277
|
return p
|
|
277
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
|
+
|
|
278
327
|
# Ability elements
|
|
279
328
|
# ----------------
|
|
280
329
|
@_(
|
|
281
330
|
"ability_decl",
|
|
282
331
|
"KW_ASYNC ability_decl",
|
|
283
332
|
"ability_def",
|
|
333
|
+
"decorator ability",
|
|
284
334
|
)
|
|
285
335
|
def ability(self, p: YaccProduction) -> YaccProduction:
|
|
286
336
|
"""Ability rule."""
|
|
287
337
|
return p
|
|
288
338
|
|
|
289
339
|
@_(
|
|
290
|
-
"
|
|
291
|
-
"
|
|
292
|
-
"
|
|
293
|
-
"
|
|
294
|
-
"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",
|
|
295
344
|
)
|
|
296
345
|
def ability_decl(self, p: YaccProduction) -> YaccProduction:
|
|
297
346
|
"""Ability rule."""
|
|
298
347
|
return p
|
|
299
348
|
|
|
300
349
|
@_(
|
|
301
|
-
"
|
|
302
|
-
"
|
|
303
|
-
"doc_tag decorators static_tag KW_CAN access_tag all_refs event_clause code_block",
|
|
304
|
-
"doc_tag decorators static_tag KW_CAN access_tag all_refs func_decl code_block",
|
|
305
|
-
)
|
|
306
|
-
def ability_decl_decor(self, p: YaccProduction) -> YaccProduction:
|
|
307
|
-
"""Ability declaration rule."""
|
|
308
|
-
return p
|
|
309
|
-
|
|
310
|
-
@_(
|
|
311
|
-
"doc_tag ability_ref event_clause code_block",
|
|
312
|
-
"doc_tag dotted_name ability_ref event_clause code_block",
|
|
313
|
-
"doc_tag ability_ref func_decl code_block",
|
|
314
|
-
"doc_tag dotted_name ability_ref func_decl code_block",
|
|
350
|
+
"arch_to_abil_chain event_clause code_block",
|
|
351
|
+
"arch_to_abil_chain func_decl code_block",
|
|
315
352
|
)
|
|
316
353
|
def ability_def(self, p: YaccProduction) -> YaccProduction:
|
|
317
354
|
"""Ability rule."""
|
|
318
355
|
return p
|
|
319
356
|
|
|
320
357
|
@_(
|
|
321
|
-
"
|
|
322
|
-
"
|
|
323
|
-
"doc_tag decorators static_tag KW_CAN access_tag all_refs event_clause KW_ABSTRACT SEMI",
|
|
324
|
-
"doc_tag decorators static_tag KW_CAN access_tag all_refs func_decl KW_ABSTRACT SEMI",
|
|
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",
|
|
325
360
|
)
|
|
326
361
|
def abstract_ability(self, p: YaccProduction) -> YaccProduction:
|
|
327
362
|
"""Abstract ability rule."""
|
|
@@ -366,59 +401,6 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
366
401
|
"""Parameter variable rule rule."""
|
|
367
402
|
return p
|
|
368
403
|
|
|
369
|
-
# Enum elements
|
|
370
|
-
# ----------------
|
|
371
|
-
@_(
|
|
372
|
-
"enum_decl",
|
|
373
|
-
"enum_def",
|
|
374
|
-
)
|
|
375
|
-
def enum(self, p: YaccProduction) -> YaccProduction:
|
|
376
|
-
"""Enum rule."""
|
|
377
|
-
return p
|
|
378
|
-
|
|
379
|
-
@_(
|
|
380
|
-
"doc_tag KW_ENUM access_tag NAME inherited_archs SEMI",
|
|
381
|
-
"doc_tag KW_ENUM access_tag NAME inherited_archs enum_block",
|
|
382
|
-
"doc_tag decorators KW_ENUM access_tag NAME inherited_archs SEMI",
|
|
383
|
-
"doc_tag decorators KW_ENUM access_tag NAME inherited_archs enum_block",
|
|
384
|
-
)
|
|
385
|
-
def enum_decl(self, p: YaccProduction) -> YaccProduction:
|
|
386
|
-
"""Enum decl rule."""
|
|
387
|
-
return p
|
|
388
|
-
|
|
389
|
-
@_(
|
|
390
|
-
"doc_tag enum_ref enum_block",
|
|
391
|
-
"doc_tag dotted_name enum_ref enum_block",
|
|
392
|
-
)
|
|
393
|
-
def enum_def(self, p: YaccProduction) -> YaccProduction:
|
|
394
|
-
"""Enum def rule."""
|
|
395
|
-
return p
|
|
396
|
-
|
|
397
|
-
@_(
|
|
398
|
-
"LBRACE RBRACE",
|
|
399
|
-
"LBRACE enum_stmt_list RBRACE",
|
|
400
|
-
)
|
|
401
|
-
def enum_block(self, p: YaccProduction) -> YaccProduction:
|
|
402
|
-
"""Enum block rule."""
|
|
403
|
-
return p
|
|
404
|
-
|
|
405
|
-
@_(
|
|
406
|
-
"NAME",
|
|
407
|
-
"enum_op_assign",
|
|
408
|
-
"enum_stmt_list COMMA NAME",
|
|
409
|
-
"enum_stmt_list COMMA enum_op_assign",
|
|
410
|
-
)
|
|
411
|
-
def enum_stmt_list(self, p: YaccProduction) -> YaccProduction:
|
|
412
|
-
"""Enum op list rule."""
|
|
413
|
-
return p
|
|
414
|
-
|
|
415
|
-
@_(
|
|
416
|
-
"NAME EQ expression",
|
|
417
|
-
)
|
|
418
|
-
def enum_op_assign(self, p: YaccProduction) -> YaccProduction:
|
|
419
|
-
"""Enum op assign rule."""
|
|
420
|
-
return p
|
|
421
|
-
|
|
422
404
|
# Attribute blocks
|
|
423
405
|
# ----------------
|
|
424
406
|
@_(
|
|
@@ -438,9 +420,11 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
438
420
|
return p
|
|
439
421
|
|
|
440
422
|
@_(
|
|
441
|
-
"has_stmt",
|
|
442
|
-
"
|
|
443
|
-
"
|
|
423
|
+
"doc_tag has_stmt",
|
|
424
|
+
"doc_tag architype",
|
|
425
|
+
"doc_tag ability",
|
|
426
|
+
"doc_tag abstract_ability",
|
|
427
|
+
"python_code_block",
|
|
444
428
|
)
|
|
445
429
|
def member_stmt(self, p: YaccProduction) -> YaccProduction:
|
|
446
430
|
"""Attribute statement rule."""
|
|
@@ -449,8 +433,8 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
449
433
|
# Has statements
|
|
450
434
|
# --------------
|
|
451
435
|
@_(
|
|
452
|
-
"
|
|
453
|
-
"
|
|
436
|
+
"static_tag KW_HAS access_tag has_assign_clause SEMI",
|
|
437
|
+
"static_tag KW_FREEZE access_tag has_assign_clause SEMI",
|
|
454
438
|
)
|
|
455
439
|
def has_stmt(self, p: YaccProduction) -> YaccProduction:
|
|
456
440
|
"""Has statement rule."""
|
|
@@ -552,8 +536,8 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
552
536
|
|
|
553
537
|
@_(
|
|
554
538
|
"import_stmt",
|
|
555
|
-
"
|
|
556
|
-
"
|
|
539
|
+
"doc_tag architype",
|
|
540
|
+
"doc_tag ability",
|
|
557
541
|
"typed_ctx_block",
|
|
558
542
|
"assignment SEMI",
|
|
559
543
|
"static_assignment",
|
|
@@ -572,6 +556,7 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
572
556
|
"yield_stmt SEMI",
|
|
573
557
|
"await_stmt SEMI",
|
|
574
558
|
"walker_stmt",
|
|
559
|
+
"python_code_block",
|
|
575
560
|
)
|
|
576
561
|
def statement(self, p: YaccProduction) -> YaccProduction:
|
|
577
562
|
"""Statement rule."""
|
|
@@ -1160,7 +1145,6 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
1160
1145
|
"atom DOT_FWD all_refs",
|
|
1161
1146
|
"atom DOT_BKWD all_refs",
|
|
1162
1147
|
"atom index_slice",
|
|
1163
|
-
"atom arch_ref",
|
|
1164
1148
|
"atom edge_op_ref",
|
|
1165
1149
|
"atom filter_compr",
|
|
1166
1150
|
)
|
|
@@ -1173,7 +1157,6 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
1173
1157
|
"atom NULL_OK DOT_FWD all_refs",
|
|
1174
1158
|
"atom NULL_OK DOT_BKWD all_refs",
|
|
1175
1159
|
"atom NULL_OK index_slice",
|
|
1176
|
-
"atom NULL_OK arch_ref",
|
|
1177
1160
|
"atom NULL_OK edge_op_ref",
|
|
1178
1161
|
"atom NULL_OK filter_compr",
|
|
1179
1162
|
)
|
|
@@ -1225,25 +1208,49 @@ class JacParser(Transform, Parser, metaclass=ABCParserMeta):
|
|
|
1225
1208
|
# Architype reference rules
|
|
1226
1209
|
# -------------------------
|
|
1227
1210
|
@_(
|
|
1228
|
-
"
|
|
1229
|
-
"
|
|
1230
|
-
"
|
|
1231
|
-
"
|
|
1211
|
+
"node_ref",
|
|
1212
|
+
"edge_ref",
|
|
1213
|
+
"walker_ref",
|
|
1214
|
+
"object_ref",
|
|
1232
1215
|
)
|
|
1233
1216
|
def arch_ref(self, p: YaccProduction) -> YaccProduction:
|
|
1234
|
-
"""Architype reference rule."""
|
|
1217
|
+
"""Strict Architype reference rule."""
|
|
1235
1218
|
return p
|
|
1236
1219
|
|
|
1237
1220
|
@_(
|
|
1238
|
-
"
|
|
1239
|
-
"
|
|
1240
|
-
"
|
|
1241
|
-
"
|
|
1221
|
+
"arch_ref",
|
|
1222
|
+
"ability_ref",
|
|
1223
|
+
"arch_or_ability_chain arch_ref",
|
|
1224
|
+
"arch_or_ability_chain ability_ref",
|
|
1242
1225
|
)
|
|
1243
|
-
def
|
|
1226
|
+
def arch_or_ability_chain(self, p: YaccProduction) -> YaccProduction:
|
|
1244
1227
|
"""Strict Architype reference rule."""
|
|
1245
1228
|
return p
|
|
1246
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
|
+
|
|
1247
1254
|
@_("NODE_OP NAME")
|
|
1248
1255
|
def node_ref(self, p: YaccProduction) -> YaccProduction:
|
|
1249
1256
|
"""Node reference rule."""
|
|
@@ -1428,7 +1435,7 @@ def parse_tree_to_ast(
|
|
|
1428
1435
|
return result
|
|
1429
1436
|
|
|
1430
1437
|
from jaclang.utils.fstring_parser import FStringLexer, FStringParser
|
|
1431
|
-
from jaclang.
|
|
1438
|
+
from jaclang.vendor.sly.lex import Token as LexToken
|
|
1432
1439
|
|
|
1433
1440
|
ast_tree: ast.AstNode = None
|
|
1434
1441
|
if not isinstance(tree, ast.AstNode):
|
|
@@ -1486,6 +1493,11 @@ def parse_tree_to_ast(
|
|
|
1486
1493
|
ast_tree = ast.Constant(typ=type(None), **meta)
|
|
1487
1494
|
elif tree.type.startswith("TYP_"):
|
|
1488
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
|
+
)
|
|
1489
1501
|
else:
|
|
1490
1502
|
ast_tree = ast.Token(**meta)
|
|
1491
1503
|
else:
|