jaclang 0.7.33__py3-none-any.whl → 0.8.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 +7 -414
- jaclang/cli/cli.md +5 -5
- jaclang/cli/cli.py +311 -214
- jaclang/cli/cmdreg.py +188 -31
- jaclang/compiler/__init__.py +10 -15
- jaclang/compiler/{codeloc.py → codeinfo.py} +11 -30
- jaclang/compiler/constant.py +10 -33
- jaclang/compiler/jac.lark +61 -92
- jaclang/compiler/larkparse/jac_parser.py +3444 -0
- jaclang/compiler/parser.py +1054 -1341
- jaclang/compiler/passes/__init__.py +2 -2
- jaclang/compiler/passes/main/__init__.py +33 -14
- jaclang/compiler/passes/main/annex_pass.py +85 -0
- jaclang/compiler/passes/main/cfg_build_pass.py +275 -0
- jaclang/compiler/passes/main/def_impl_match_pass.py +146 -102
- jaclang/compiler/passes/main/def_use_pass.py +64 -269
- jaclang/compiler/passes/main/import_pass.py +175 -360
- jaclang/compiler/passes/main/inheritance_pass.py +107 -105
- jaclang/compiler/passes/main/pyast_gen_pass.py +1129 -1600
- jaclang/compiler/passes/main/pyast_load_pass.py +540 -584
- jaclang/compiler/passes/main/pybc_gen_pass.py +38 -35
- jaclang/compiler/passes/main/pyjac_ast_link_pass.py +46 -160
- jaclang/compiler/passes/main/sym_tab_build_pass.py +113 -1202
- jaclang/compiler/passes/main/sym_tab_link_pass.py +141 -0
- jaclang/{tests → compiler/passes/main/tests}/fixtures/access_modifier.jac +10 -9
- jaclang/compiler/passes/main/tests/fixtures/atest.impl.jac +3 -0
- jaclang/compiler/passes/main/tests/fixtures/atest.jac +11 -0
- jaclang/compiler/passes/main/tests/fixtures/autoimpl.impl/getme.impl.jac +1 -1
- jaclang/compiler/passes/main/tests/fixtures/autoimpl.impl.jac +1 -1
- jaclang/compiler/passes/main/tests/fixtures/autoimpl.jac +3 -3
- jaclang/compiler/passes/main/tests/fixtures/autoimpl.something.else.impl.jac +1 -1
- jaclang/compiler/passes/main/tests/fixtures/base.impl.jac +8 -0
- jaclang/compiler/passes/main/tests/fixtures/base.jac +4 -4
- jaclang/compiler/passes/main/tests/fixtures/base2.impl.jac +8 -0
- jaclang/compiler/passes/main/tests/fixtures/base2.jac +4 -4
- jaclang/compiler/passes/main/tests/fixtures/blip.jac +1 -1
- jaclang/compiler/passes/main/tests/fixtures/cfg_ability_test.jac +23 -0
- jaclang/compiler/passes/main/tests/fixtures/cfg_gen.jac +19 -0
- jaclang/compiler/passes/main/tests/fixtures/circular_import.jac +7 -0
- jaclang/compiler/passes/main/tests/fixtures/data_spatial_types.jac +12 -12
- jaclang/compiler/passes/main/tests/fixtures/decls.jac +4 -4
- jaclang/compiler/passes/main/tests/fixtures/defn_decl_mismatch.jac +4 -4
- jaclang/compiler/passes/main/tests/fixtures/defs_and_uses.jac +6 -6
- jaclang/compiler/passes/main/tests/fixtures/enumerations.jac +13 -0
- jaclang/compiler/passes/main/tests/fixtures/fstrings.jac +1 -1
- jaclang/compiler/passes/main/tests/fixtures/func.jac +2 -2
- jaclang/compiler/passes/main/tests/fixtures/func2.jac +1 -1
- jaclang/compiler/passes/main/tests/fixtures/game1.jac +4 -4
- jaclang/compiler/passes/main/tests/fixtures/impl/defs1.jac +2 -2
- jaclang/compiler/passes/main/tests/fixtures/impl/defs2.jac +2 -2
- jaclang/compiler/passes/main/tests/fixtures/impl/imps.jac +0 -8
- jaclang/compiler/passes/main/tests/fixtures/impl_grab.impl.jac +5 -0
- jaclang/{tests → compiler/passes/main/tests}/fixtures/impl_grab.jac +1 -1
- jaclang/compiler/passes/main/tests/fixtures/incautoimpl.jac +1 -1
- jaclang/compiler/passes/main/tests/fixtures/main_err.impl.jac +6 -0
- jaclang/compiler/passes/main/tests/fixtures/main_err.jac +6 -0
- jaclang/compiler/passes/main/tests/fixtures/mod_type_assign.jac +1 -1
- jaclang/compiler/passes/main/tests/fixtures/mtest.impl.jac +6 -0
- jaclang/{tests → compiler/passes/main/tests}/fixtures/mtest.jac +1 -1
- jaclang/{tests → compiler/passes/main/tests}/fixtures/nested_impls.jac +14 -15
- jaclang/compiler/passes/main/tests/fixtures/py_imp_test.jac +7 -7
- jaclang/compiler/passes/main/tests/fixtures/second_err.jac +4 -0
- jaclang/compiler/passes/main/tests/fixtures/str2doc.py +3 -0
- jaclang/compiler/passes/main/tests/fixtures/symtab_link_tests/action/__init__.py +5 -0
- jaclang/compiler/passes/main/tests/fixtures/symtab_link_tests/action/actions.jac +23 -0
- jaclang/compiler/passes/main/tests/fixtures/symtab_link_tests/main.jac +14 -0
- jaclang/compiler/passes/main/tests/fixtures/symtab_link_tests/no_dupls.jac +35 -0
- jaclang/compiler/passes/main/tests/fixtures/symtab_link_tests/one.jac +8 -0
- jaclang/compiler/passes/main/tests/fixtures/type_info.jac +4 -4
- jaclang/compiler/passes/main/tests/test_cfg_build_pass.py +99 -0
- jaclang/compiler/passes/main/tests/test_decl_impl_match_pass.py +157 -0
- jaclang/compiler/passes/main/tests/test_def_use_pass.py +4 -6
- jaclang/compiler/passes/main/tests/test_import_pass.py +59 -46
- jaclang/compiler/passes/main/tests/test_pyast_build_pass.py +15 -0
- jaclang/compiler/passes/main/tests/test_pyast_gen_pass.py +25 -34
- jaclang/compiler/passes/main/tests/test_pybc_gen_pass.py +3 -3
- jaclang/compiler/passes/main/tests/test_sub_node_pass.py +8 -7
- jaclang/compiler/passes/main/tests/test_sym_tab_build_pass.py +4 -4
- jaclang/compiler/passes/main/tests/test_sym_tab_link_pass.py +62 -0
- jaclang/compiler/passes/tool/__init__.py +2 -0
- jaclang/compiler/passes/tool/doc_ir.py +179 -0
- jaclang/compiler/passes/tool/doc_ir_gen_pass.py +1210 -0
- jaclang/compiler/passes/tool/fuse_comments_pass.py +90 -70
- jaclang/compiler/passes/tool/jac_formatter_pass.py +122 -2554
- jaclang/compiler/passes/tool/tests/fixtures/corelib.jac +249 -97
- jaclang/compiler/passes/tool/tests/fixtures/corelib_fmt.jac +94 -97
- jaclang/compiler/passes/tool/tests/fixtures/doc_string.jac +2 -2
- jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/access_mod_check.jac +5 -5
- jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/archetype_test.jac +13 -0
- jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/decorator_stack.jac +7 -7
- jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/line_spacing.jac +8 -8
- jaclang/compiler/passes/tool/tests/fixtures/multi_def_err.dot +3 -3
- jaclang/compiler/passes/tool/tests/fixtures/multi_def_err.txt +3 -3
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/ability_impl_long_comprehension.jac +1 -1
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/call_with_many_parameters.jac +2 -2
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/simple_walker.jac +3 -3
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/try_block_and_walker_spawn_and_fstrings.jac +1 -1
- jaclang/compiler/passes/tool/tests/fixtures/myca_formatted_code/type_annotation.jac +1 -1
- jaclang/compiler/passes/tool/tests/fixtures/simple_walk.jac +1 -1
- jaclang/compiler/passes/tool/tests/fixtures/simple_walk_fmt.jac +10 -4
- jaclang/compiler/passes/tool/tests/test_doc_ir_gen_pass.py +29 -0
- jaclang/compiler/passes/tool/tests/test_jac_format_pass.py +63 -88
- jaclang/compiler/passes/tool/tests/test_unparse_validate.py +27 -28
- jaclang/compiler/passes/transform.py +56 -16
- jaclang/compiler/passes/{ir_pass.py → uni_pass.py} +35 -52
- jaclang/compiler/program.py +205 -0
- jaclang/compiler/tests/fixtures/codegentext.jac +31 -0
- jaclang/compiler/tests/fixtures/fam.jac +10 -10
- jaclang/compiler/tests/fixtures/hello_world.jac +1 -1
- jaclang/compiler/tests/fixtures/staticcheck.jac +2 -2
- jaclang/compiler/tests/test_importer.py +21 -16
- jaclang/compiler/tests/test_parser.py +38 -17
- jaclang/compiler/{absyntree.py → unitree.py} +1120 -1012
- jaclang/langserve/engine.py +183 -171
- jaclang/langserve/sem_manager.py +26 -22
- jaclang/langserve/server.py +6 -15
- jaclang/langserve/tests/fixtures/base_module_structure.jac +7 -7
- jaclang/langserve/tests/fixtures/circle.jac +6 -6
- jaclang/langserve/tests/fixtures/circle_err.jac +6 -6
- jaclang/langserve/tests/fixtures/circle_pure.impl.jac +5 -5
- jaclang/langserve/tests/fixtures/circle_pure.jac +7 -7
- jaclang/langserve/tests/fixtures/circle_pure_err.impl.jac +2 -2
- jaclang/langserve/tests/fixtures/circle_pure_err.jac +7 -7
- jaclang/langserve/tests/fixtures/import_include_statements.jac +6 -6
- jaclang/langserve/tests/fixtures/rename.jac +6 -6
- jaclang/langserve/tests/server_test/test_lang_serve.py +262 -0
- jaclang/langserve/tests/server_test/utils.py +115 -0
- jaclang/langserve/tests/test_sem_tokens.py +2 -2
- jaclang/langserve/tests/test_server.py +41 -23
- jaclang/langserve/utils.jac +438 -0
- jaclang/runtimelib/{architype.py → archetype.py} +85 -61
- jaclang/runtimelib/builtin.py +92 -0
- jaclang/runtimelib/constructs.py +11 -13
- jaclang/runtimelib/importer.py +63 -51
- jaclang/runtimelib/machine.py +1551 -144
- jaclang/runtimelib/memory.py +6 -6
- jaclang/{plugin → runtimelib}/tests/fixtures/graph_purger.jac +1 -1
- jaclang/{plugin → runtimelib}/tests/fixtures/impl_match.jac +2 -2
- jaclang/runtimelib/tests/fixtures/impl_match_impl.jac +3 -0
- jaclang/{plugin → runtimelib}/tests/fixtures/other_root_access.jac +7 -7
- jaclang/{plugin → runtimelib}/tests/fixtures/savable_object.jac +3 -5
- jaclang/{plugin → runtimelib}/tests/fixtures/simple_node_connection.jac +6 -6
- jaclang/{plugin → runtimelib}/tests/fixtures/simple_persistent.jac +1 -1
- jaclang/runtimelib/tests/test_features.py +72 -0
- jaclang/{plugin → runtimelib}/tests/test_jaseci.py +6 -5
- jaclang/runtimelib/utils.py +31 -63
- jaclang/settings.py +1 -6
- jaclang/tests/fixtures/{abc.jac → abc_check.jac} +6 -6
- jaclang/tests/fixtures/arch_rel_import_creation.jac +4 -4
- jaclang/tests/fixtures/async_ability.jac +18 -0
- jaclang/tests/fixtures/async_walker.jac +23 -0
- jaclang/tests/fixtures/baddy.jac +1 -1
- jaclang/tests/fixtures/base_class1.jac +2 -2
- jaclang/tests/fixtures/base_class2.jac +2 -2
- jaclang/tests/fixtures/base_class_complex_expr.jac +3 -3
- jaclang/tests/fixtures/builtin_dotgen.jac +1 -1
- jaclang/tests/fixtures/builtin_dotgen_json.jac +21 -0
- jaclang/tests/fixtures/byllmissue.jac +1 -1
- jaclang/tests/fixtures/chandra_bugs.jac +1 -1
- jaclang/tests/fixtures/chandra_bugs2.jac +1 -1
- jaclang/tests/fixtures/cls_method.jac +6 -6
- jaclang/tests/fixtures/concurrency.jac +39 -0
- jaclang/tests/fixtures/connect_traverse_syntax.jac +18 -0
- jaclang/tests/fixtures/create_dynamic_archetype.jac +35 -0
- jaclang/tests/fixtures/decl_defn_param_name.jac +4 -4
- jaclang/tests/fixtures/deep/deeper/__init__.jac +1 -0
- jaclang/tests/fixtures/deep/deeper/deep_outer_import.jac +2 -3
- jaclang/tests/fixtures/deep/deeper/deep_outer_import2.jac +3 -3
- jaclang/tests/fixtures/deep/deeper/snd_lev.jac +2 -2
- jaclang/tests/fixtures/deep/mycode.jac +1 -1
- jaclang/tests/fixtures/deep/one_lev.jac +3 -4
- jaclang/tests/fixtures/deep/one_lev_dup.jac +2 -2
- jaclang/tests/fixtures/deep_convert.jac +1 -1
- jaclang/tests/fixtures/deep_import.jac +2 -2
- jaclang/tests/fixtures/deep_import_interp.jac +8 -0
- jaclang/tests/fixtures/deep_import_mods.jac +3 -3
- jaclang/tests/fixtures/deferred_field.jac +1 -1
- jaclang/tests/fixtures/del_clean.jac +7 -0
- jaclang/tests/fixtures/disconn.jac +3 -3
- jaclang/tests/fixtures/dynamic_archetype.jac +34 -0
- jaclang/tests/fixtures/edge_node_walk.jac +12 -12
- jaclang/tests/fixtures/edge_ops.jac +7 -7
- jaclang/tests/fixtures/edges_walk.jac +10 -10
- jaclang/tests/fixtures/edgetypeissue.jac +1 -1
- jaclang/tests/fixtures/enum_inside_archtype.jac +4 -4
- jaclang/tests/fixtures/err.impl.jac +1 -1
- jaclang/tests/fixtures/err.jac +2 -2
- jaclang/tests/fixtures/err_runtime.jac +2 -2
- jaclang/tests/fixtures/foo.jac +7 -7
- jaclang/tests/fixtures/game1.jac +4 -4
- jaclang/tests/fixtures/gendot_bubble_sort.jac +4 -4
- jaclang/tests/fixtures/glob_multivar_statement.jac +1 -1
- jaclang/tests/fixtures/guess_game.jac +5 -5
- jaclang/tests/fixtures/has_goodness.jac +1 -1
- jaclang/tests/fixtures/hash_init_check.jac +3 -3
- jaclang/tests/fixtures/hello.jac +1 -1
- jaclang/tests/fixtures/ignore.jac +3 -3
- jaclang/tests/fixtures/ignore_dup.jac +3 -3
- jaclang/tests/fixtures/impl_match_confused.impl.jac +1 -1
- jaclang/tests/fixtures/import.jac +9 -9
- jaclang/tests/fixtures/import_all.jac +1 -1
- jaclang/tests/fixtures/index_slice.jac +1 -1
- jaclang/tests/fixtures/inherit_check.jac +3 -3
- jaclang/tests/fixtures/jac_from_py.py +4 -0
- jaclang/tests/fixtures/jacsamp.jac +1 -1
- jaclang/tests/fixtures/jactest_main.jac +1 -1
- jaclang/tests/fixtures/jp_importer.jac +7 -8
- jaclang/tests/fixtures/jp_importer_auto.jac +3 -3
- jaclang/tests/fixtures/lambda.jac +2 -2
- jaclang/tests/fixtures/needs_import.jac +6 -6
- jaclang/tests/fixtures/needs_import_1.jac +1 -1
- jaclang/tests/fixtures/needs_import_2.jac +1 -1
- jaclang/tests/fixtures/needs_import_3.jac +1 -1
- jaclang/tests/fixtures/needs_import_dup.jac +6 -6
- jaclang/tests/fixtures/node_del.jac +60 -0
- jaclang/tests/fixtures/nosigself.jac +3 -3
- jaclang/tests/fixtures/py2jac.py +30 -0
- jaclang/tests/fixtures/py_bool_expr.py +7 -0
- jaclang/tests/fixtures/py_namedexpr.py +7 -0
- jaclang/tests/fixtures/pyfunc_3.py +0 -2
- jaclang/tests/fixtures/random_check.jac +5 -5
- jaclang/tests/fixtures/refs_target.jac +17 -0
- jaclang/tests/fixtures/simple_archs.jac +2 -2
- jaclang/tests/fixtures/simple_walk.jac +52 -0
- jaclang/tests/fixtures/slice_vals.jac +3 -3
- jaclang/tests/fixtures/sub_abil_sep.jac +3 -3
- jaclang/tests/fixtures/sub_abil_sep_multilev.jac +3 -3
- jaclang/tests/fixtures/trailing_comma.jac +4 -4
- jaclang/tests/fixtures/type_info.jac +5 -5
- jaclang/{compiler/passes/main/tests → tests}/fixtures/uninitialized_hasvars.jac +1 -1
- jaclang/tests/fixtures/visit_order.jac +4 -4
- jaclang/tests/fixtures/walker_override.jac +2 -2
- jaclang/tests/fixtures/walker_update.jac +5 -5
- jaclang/tests/fixtures/with_context.jac +4 -4
- jaclang/tests/test_bugs.py +2 -2
- jaclang/tests/test_cli.py +118 -223
- jaclang/tests/test_language.py +474 -468
- jaclang/tests/test_man_code.py +2 -2
- jaclang/tests/test_reference.py +4 -4
- jaclang/tests/test_settings.py +16 -16
- jaclang/tests/test_typecheck.py +555 -0
- jaclang/utils/__init__.py +4 -0
- jaclang/utils/helpers.py +12 -27
- jaclang/utils/lang_tools.py +84 -74
- jaclang/utils/module_resolver.py +69 -0
- jaclang/utils/test.py +8 -5
- jaclang/utils/tests/test_lang_tools.py +38 -13
- jaclang/utils/treeprinter.py +177 -40
- jaclang/vendor/__init__.py +1 -2
- jaclang/vendor/attr/__init__.py +14 -44
- jaclang/vendor/attr/__init__.pyi +155 -321
- jaclang/vendor/attr/_cmp.py +25 -15
- jaclang/vendor/attr/_cmp.pyi +7 -7
- jaclang/vendor/attr/_compat.py +15 -8
- jaclang/vendor/attr/_config.py +1 -1
- jaclang/vendor/attr/_funcs.py +148 -163
- jaclang/vendor/attr/_make.py +859 -855
- jaclang/vendor/attr/_next_gen.py +426 -32
- jaclang/vendor/attr/converters.py +67 -49
- jaclang/vendor/attr/converters.pyi +13 -7
- jaclang/vendor/attr/filters.py +17 -11
- jaclang/vendor/attr/filters.pyi +3 -3
- jaclang/vendor/attr/setters.py +11 -5
- jaclang/vendor/attr/setters.pyi +2 -1
- jaclang/vendor/attr/validators.py +191 -162
- jaclang/vendor/attr/validators.pyi +25 -27
- jaclang/vendor/attrs/__init__.py +9 -5
- jaclang/vendor/attrs/__init__.pyi +225 -29
- jaclang/vendor/attrs-25.3.0.dist-info/INSTALLER +1 -0
- jaclang/vendor/{attrs-23.2.0.dist-info → attrs-25.3.0.dist-info}/METADATA +83 -53
- jaclang/vendor/attrs-25.3.0.dist-info/RECORD +56 -0
- jaclang/vendor/{attrs-23.2.0.dist-info → attrs-25.3.0.dist-info}/WHEEL +1 -1
- jaclang/vendor/bin/dmypy +8 -0
- jaclang/vendor/bin/mypy +8 -0
- jaclang/vendor/bin/mypyc +8 -0
- jaclang/vendor/bin/stubgen +8 -0
- jaclang/vendor/bin/stubtest +8 -0
- jaclang/vendor/cattr/gen.py +2 -2
- jaclang/vendor/cattr/preconf/bson.py +1 -0
- jaclang/vendor/cattr/preconf/json.py +1 -0
- jaclang/vendor/cattr/preconf/msgpack.py +1 -0
- jaclang/vendor/cattr/preconf/orjson.py +1 -0
- jaclang/vendor/cattr/preconf/pyyaml.py +1 -0
- jaclang/vendor/cattr/preconf/tomlkit.py +1 -0
- jaclang/vendor/cattr/preconf/ujson.py +1 -0
- jaclang/vendor/cattrs/__init__.py +21 -21
- jaclang/vendor/cattrs/_compat.py +176 -62
- jaclang/vendor/cattrs/_generics.py +5 -3
- jaclang/vendor/cattrs/cols.py +289 -0
- jaclang/vendor/cattrs/converters.py +505 -187
- jaclang/vendor/cattrs/disambiguators.py +118 -45
- jaclang/vendor/cattrs/dispatch.py +66 -36
- jaclang/vendor/cattrs/fns.py +6 -1
- jaclang/vendor/cattrs/gen/__init__.py +365 -202
- jaclang/vendor/cattrs/gen/_generics.py +41 -5
- jaclang/vendor/cattrs/gen/_lc.py +3 -2
- jaclang/vendor/cattrs/gen/_shared.py +39 -32
- jaclang/vendor/cattrs/gen/typeddicts.py +75 -88
- jaclang/vendor/cattrs/preconf/__init__.py +20 -0
- jaclang/vendor/cattrs/preconf/bson.py +7 -8
- jaclang/vendor/cattrs/preconf/cbor2.py +3 -0
- jaclang/vendor/cattrs/preconf/json.py +8 -4
- jaclang/vendor/cattrs/preconf/msgpack.py +3 -0
- jaclang/vendor/cattrs/preconf/msgspec.py +185 -0
- jaclang/vendor/cattrs/preconf/orjson.py +20 -7
- jaclang/vendor/cattrs/preconf/pyyaml.py +15 -3
- jaclang/vendor/cattrs/preconf/tomlkit.py +3 -1
- jaclang/vendor/cattrs/preconf/ujson.py +3 -0
- jaclang/vendor/cattrs/strategies/__init__.py +1 -0
- jaclang/vendor/cattrs/strategies/_class_methods.py +1 -1
- jaclang/vendor/cattrs/strategies/_subclasses.py +43 -29
- jaclang/vendor/cattrs/strategies/_unions.py +47 -24
- jaclang/vendor/cattrs/v.py +1 -0
- jaclang/vendor/cattrs-24.1.3.dist-info/INSTALLER +1 -0
- jaclang/vendor/cattrs-24.1.3.dist-info/METADATA +161 -0
- jaclang/vendor/cattrs-24.1.3.dist-info/RECORD +96 -0
- jaclang/vendor/{cattrs-23.2.3.dist-info → cattrs-24.1.3.dist-info}/WHEEL +1 -1
- jaclang/vendor/lark/__init__.py +38 -38
- jaclang/vendor/lark/__pyinstaller/__init__.py +6 -6
- jaclang/vendor/lark/__pyinstaller/hook-lark.py +14 -14
- jaclang/vendor/lark/ast_utils.py +59 -59
- jaclang/vendor/lark/common.py +86 -89
- jaclang/vendor/lark/exceptions.py +292 -292
- jaclang/vendor/lark/grammar.py +130 -130
- jaclang/vendor/lark/grammars/common.lark +59 -59
- jaclang/vendor/lark/grammars/lark.lark +62 -62
- jaclang/vendor/lark/grammars/python.lark +302 -302
- jaclang/vendor/lark/grammars/unicode.lark +7 -7
- jaclang/vendor/lark/indenter.py +143 -112
- jaclang/vendor/lark/lark.py +658 -661
- jaclang/vendor/lark/lexer.py +678 -678
- jaclang/vendor/lark/load_grammar.py +1428 -1428
- jaclang/vendor/lark/parse_tree_builder.py +391 -391
- jaclang/vendor/lark/parser_frontends.py +257 -257
- jaclang/vendor/lark/parsers/cyk.py +340 -340
- jaclang/vendor/lark/parsers/earley.py +317 -308
- jaclang/vendor/lark/parsers/earley_common.py +42 -42
- jaclang/vendor/lark/parsers/earley_forest.py +802 -810
- jaclang/vendor/lark/parsers/grammar_analysis.py +203 -203
- jaclang/vendor/lark/parsers/lalr_analysis.py +332 -332
- jaclang/vendor/lark/parsers/lalr_interactive_parser.py +158 -157
- jaclang/vendor/lark/parsers/lalr_parser.py +122 -122
- jaclang/vendor/lark/parsers/lalr_parser_state.py +110 -110
- jaclang/vendor/lark/parsers/xearley.py +165 -165
- jaclang/vendor/lark/reconstruct.py +107 -107
- jaclang/vendor/lark/tools/__init__.py +70 -71
- jaclang/vendor/lark/tools/nearley.py +202 -202
- jaclang/vendor/lark/tools/serialize.py +32 -32
- jaclang/vendor/lark/tools/standalone.py +196 -196
- jaclang/vendor/lark/tree.py +267 -272
- jaclang/vendor/lark/tree_matcher.py +186 -186
- jaclang/vendor/lark/utils.py +346 -361
- jaclang/vendor/lark/visitors.py +596 -593
- jaclang/vendor/lark-1.2.2.dist-info/INSTALLER +1 -0
- jaclang/vendor/{lark-1.1.9.dist-info → lark-1.2.2.dist-info}/METADATA +48 -47
- jaclang/vendor/lark-1.2.2.dist-info/RECORD +83 -0
- jaclang/vendor/{mypy_extensions-1.0.0.dist-info → lark-1.2.2.dist-info}/WHEEL +1 -1
- jaclang/vendor/{lark-1.1.9.dist-info → lark-1.2.2.dist-info/licenses}/LICENSE +18 -18
- jaclang/vendor/lsprotocol-2023.0.1.dist-info/INSTALLER +1 -0
- jaclang/vendor/lsprotocol-2023.0.1.dist-info/METADATA +2 -1
- jaclang/vendor/lsprotocol-2023.0.1.dist-info/RECORD +17 -10
- jaclang/vendor/lsprotocol-2023.0.1.dist-info/WHEEL +1 -1
- jaclang/vendor/pluggy/_version.py +7 -2
- jaclang/vendor/pluggy-1.5.0.dist-info/INSTALLER +1 -0
- jaclang/vendor/pluggy-1.5.0.dist-info/METADATA +6 -5
- jaclang/vendor/pluggy-1.5.0.dist-info/RECORD +24 -14
- jaclang/vendor/pluggy-1.5.0.dist-info/WHEEL +1 -1
- jaclang/vendor/pygls-1.3.1.dist-info/INSTALLER +1 -0
- jaclang/vendor/pygls-1.3.1.dist-info/METADATA +2 -2
- jaclang/vendor/pygls-1.3.1.dist-info/RECORD +45 -24
- jaclang/vendor/pygls-1.3.1.dist-info/WHEEL +1 -1
- {jaclang-0.7.33.dist-info → jaclang-0.8.0.dist-info}/METADATA +4 -4
- jaclang-0.8.0.dist-info/RECORD +552 -0
- {jaclang-0.7.33.dist-info → jaclang-0.8.0.dist-info}/WHEEL +1 -1
- jaclang/compiler/.gitignore +0 -1
- jaclang/compiler/compile.py +0 -119
- jaclang/compiler/passes/main/access_modifier_pass.py +0 -130
- jaclang/compiler/passes/main/fuse_typeinfo_pass.py +0 -656
- jaclang/compiler/passes/main/py_collect_dep_pass.py +0 -78
- jaclang/compiler/passes/main/pyout_pass.py +0 -86
- jaclang/compiler/passes/main/registry_pass.py +0 -156
- jaclang/compiler/passes/main/schedules.py +0 -47
- jaclang/compiler/passes/main/sub_node_tab_pass.py +0 -36
- jaclang/compiler/passes/main/tests/fixtures/registry.jac +0 -36
- jaclang/compiler/passes/main/tests/test_decl_def_match_pass.py +0 -114
- jaclang/compiler/passes/main/tests/test_registry_pass.py +0 -31
- jaclang/compiler/passes/main/tests/test_type_check_pass.py +0 -91
- jaclang/compiler/passes/main/tests/test_typeinfo_pass.py +0 -29
- jaclang/compiler/passes/main/type_check_pass.py +0 -128
- jaclang/compiler/passes/tool/schedules.py +0 -18
- jaclang/compiler/passes/tool/tests/fixtures/genai/essay_review.jac +0 -36
- jaclang/compiler/passes/tool/tests/fixtures/genai/expert_answer.jac +0 -17
- jaclang/compiler/passes/tool/tests/fixtures/genai/joke_gen.jac +0 -32
- jaclang/compiler/passes/tool/tests/fixtures/genai/odd_word_out.jac +0 -27
- jaclang/compiler/passes/tool/tests/fixtures/genai/personality_finder.jac +0 -35
- jaclang/compiler/passes/tool/tests/fixtures/genai/text_to_type.jac +0 -25
- jaclang/compiler/passes/tool/tests/fixtures/genai/translator.jac +0 -13
- jaclang/compiler/passes/tool/tests/fixtures/genai/wikipedia.jac +0 -63
- jaclang/compiler/passes/tool/tests/fixtures/general_format_checks/architype_test.jac +0 -13
- jaclang/compiler/passes/utils/mypy_ast_build.py +0 -940
- jaclang/compiler/py_info.py +0 -22
- jaclang/compiler/semtable.py +0 -159
- jaclang/compiler/symtable.py +0 -297
- jaclang/langserve/utils.py +0 -458
- jaclang/plugin/__init__.py +0 -7
- jaclang/plugin/builtin.py +0 -57
- jaclang/plugin/default.py +0 -1443
- jaclang/plugin/feature.py +0 -574
- jaclang/plugin/plugin.md +0 -471
- jaclang/plugin/spec.py +0 -536
- jaclang/plugin/tests/fixtures/impl_match_impl.jac +0 -3
- jaclang/plugin/tests/test_features.py +0 -56
- jaclang/runtimelib/context.py +0 -191
- jaclang/tests/fixtures/create_dynamic_architype.jac +0 -35
- jaclang/tests/fixtures/dynamic_architype.jac +0 -34
- jaclang/tests/fixtures/impl_grab.impl.jac +0 -5
- jaclang/tests/fixtures/mtest.impl.jac +0 -6
- jaclang/tests/fixtures/registry.jac +0 -58
- jaclang/tests/fixtures/semstr.jac +0 -30
- jaclang/tests/main.jac +0 -2
- jaclang/utils/profiler.py +0 -62
- jaclang/vendor/attrs-23.2.0.dist-info/RECORD +0 -35
- jaclang/vendor/cattrs-23.2.3.dist-info/METADATA +0 -221
- jaclang/vendor/cattrs-23.2.3.dist-info/RECORD +0 -48
- jaclang/vendor/lark-1.1.9.dist-info/RECORD +0 -46
- jaclang/vendor/lark-1.1.9.dist-info/WHEEL +0 -5
- jaclang/vendor/mypy/__init__.py +0 -1
- jaclang/vendor/mypy/__main__.py +0 -37
- jaclang/vendor/mypy/api.py +0 -94
- jaclang/vendor/mypy/applytype.py +0 -172
- jaclang/vendor/mypy/argmap.py +0 -268
- jaclang/vendor/mypy/binder.py +0 -538
- jaclang/vendor/mypy/bogus_type.py +0 -27
- jaclang/vendor/mypy/build.py +0 -3562
- jaclang/vendor/mypy/checker.py +0 -8445
- jaclang/vendor/mypy/checkexpr.py +0 -6623
- jaclang/vendor/mypy/checkmember.py +0 -1363
- jaclang/vendor/mypy/checkpattern.py +0 -801
- jaclang/vendor/mypy/checkstrformat.py +0 -1109
- jaclang/vendor/mypy/config_parser.py +0 -670
- jaclang/vendor/mypy/constant_fold.py +0 -187
- jaclang/vendor/mypy/constraints.py +0 -1636
- jaclang/vendor/mypy/copytype.py +0 -133
- jaclang/vendor/mypy/defaults.py +0 -46
- jaclang/vendor/mypy/dmypy/__main__.py +0 -6
- jaclang/vendor/mypy/dmypy/client.py +0 -749
- jaclang/vendor/mypy/dmypy_os.py +0 -42
- jaclang/vendor/mypy/dmypy_server.py +0 -1107
- jaclang/vendor/mypy/dmypy_util.py +0 -117
- jaclang/vendor/mypy/erasetype.py +0 -278
- jaclang/vendor/mypy/errorcodes.py +0 -291
- jaclang/vendor/mypy/errors.py +0 -1280
- jaclang/vendor/mypy/evalexpr.py +0 -205
- jaclang/vendor/mypy/expandtype.py +0 -524
- jaclang/vendor/mypy/exprtotype.py +0 -209
- jaclang/vendor/mypy/fastparse.py +0 -2147
- jaclang/vendor/mypy/find_sources.py +0 -243
- jaclang/vendor/mypy/fixup.py +0 -428
- jaclang/vendor/mypy/freetree.py +0 -23
- jaclang/vendor/mypy/fscache.py +0 -309
- jaclang/vendor/mypy/fswatcher.py +0 -106
- jaclang/vendor/mypy/gclogger.py +0 -47
- jaclang/vendor/mypy/git.py +0 -34
- jaclang/vendor/mypy/graph_utils.py +0 -112
- jaclang/vendor/mypy/indirection.py +0 -121
- jaclang/vendor/mypy/infer.py +0 -75
- jaclang/vendor/mypy/inspections.py +0 -627
- jaclang/vendor/mypy/ipc.py +0 -310
- jaclang/vendor/mypy/join.py +0 -871
- jaclang/vendor/mypy/literals.py +0 -306
- jaclang/vendor/mypy/lookup.py +0 -61
- jaclang/vendor/mypy/main.py +0 -1574
- jaclang/vendor/mypy/maptype.py +0 -106
- jaclang/vendor/mypy/meet.py +0 -1140
- jaclang/vendor/mypy/memprofile.py +0 -121
- jaclang/vendor/mypy/message_registry.py +0 -329
- jaclang/vendor/mypy/messages.py +0 -3186
- jaclang/vendor/mypy/metastore.py +0 -225
- jaclang/vendor/mypy/mixedtraverser.py +0 -112
- jaclang/vendor/mypy/modulefinder.py +0 -875
- jaclang/vendor/mypy/moduleinspect.py +0 -184
- jaclang/vendor/mypy/mro.py +0 -62
- jaclang/vendor/mypy/nodes.py +0 -4115
- jaclang/vendor/mypy/operators.py +0 -126
- jaclang/vendor/mypy/options.py +0 -556
- jaclang/vendor/mypy/parse.py +0 -30
- jaclang/vendor/mypy/partially_defined.py +0 -675
- jaclang/vendor/mypy/patterns.py +0 -150
- jaclang/vendor/mypy/plugin.py +0 -901
- jaclang/vendor/mypy/plugins/attrs.py +0 -1166
- jaclang/vendor/mypy/plugins/common.py +0 -440
- jaclang/vendor/mypy/plugins/ctypes.py +0 -245
- jaclang/vendor/mypy/plugins/dataclasses.py +0 -1108
- jaclang/vendor/mypy/plugins/default.py +0 -531
- jaclang/vendor/mypy/plugins/enums.py +0 -259
- jaclang/vendor/mypy/plugins/functools.py +0 -104
- jaclang/vendor/mypy/plugins/proper_plugin.py +0 -175
- jaclang/vendor/mypy/plugins/singledispatch.py +0 -224
- jaclang/vendor/mypy/py.typed +0 -1
- jaclang/vendor/mypy/pyinfo.py +0 -78
- jaclang/vendor/mypy/reachability.py +0 -362
- jaclang/vendor/mypy/refinfo.py +0 -92
- jaclang/vendor/mypy/renaming.py +0 -568
- jaclang/vendor/mypy/report.py +0 -924
- jaclang/vendor/mypy/scope.py +0 -125
- jaclang/vendor/mypy/semanal.py +0 -7187
- jaclang/vendor/mypy/semanal_classprop.py +0 -187
- jaclang/vendor/mypy/semanal_enum.py +0 -253
- jaclang/vendor/mypy/semanal_infer.py +0 -128
- jaclang/vendor/mypy/semanal_main.py +0 -511
- jaclang/vendor/mypy/semanal_namedtuple.py +0 -670
- jaclang/vendor/mypy/semanal_newtype.py +0 -273
- jaclang/vendor/mypy/semanal_pass1.py +0 -156
- jaclang/vendor/mypy/semanal_shared.py +0 -490
- jaclang/vendor/mypy/semanal_typeargs.py +0 -265
- jaclang/vendor/mypy/semanal_typeddict.py +0 -575
- jaclang/vendor/mypy/server/astdiff.py +0 -518
- jaclang/vendor/mypy/server/astmerge.py +0 -562
- jaclang/vendor/mypy/server/aststrip.py +0 -281
- jaclang/vendor/mypy/server/deps.py +0 -1137
- jaclang/vendor/mypy/server/mergecheck.py +0 -83
- jaclang/vendor/mypy/server/objgraph.py +0 -101
- jaclang/vendor/mypy/server/subexpr.py +0 -198
- jaclang/vendor/mypy/server/target.py +0 -11
- jaclang/vendor/mypy/server/trigger.py +0 -26
- jaclang/vendor/mypy/server/update.py +0 -1339
- jaclang/vendor/mypy/sharedparse.py +0 -112
- jaclang/vendor/mypy/solve.py +0 -562
- jaclang/vendor/mypy/split_namespace.py +0 -35
- jaclang/vendor/mypy/state.py +0 -28
- jaclang/vendor/mypy/stats.py +0 -489
- jaclang/vendor/mypy/strconv.py +0 -641
- jaclang/vendor/mypy/stubdoc.py +0 -491
- jaclang/vendor/mypy/stubgen.py +0 -1886
- jaclang/vendor/mypy/stubgenc.py +0 -993
- jaclang/vendor/mypy/stubinfo.py +0 -173
- jaclang/vendor/mypy/stubtest.py +0 -2079
- jaclang/vendor/mypy/stubutil.py +0 -834
- jaclang/vendor/mypy/subtypes.py +0 -1980
- jaclang/vendor/mypy/suggestions.py +0 -1046
- jaclang/vendor/mypy/test/config.py +0 -28
- jaclang/vendor/mypy/test/data.py +0 -821
- jaclang/vendor/mypy/test/helpers.py +0 -476
- jaclang/vendor/mypy/test/meta/_pytest.py +0 -72
- jaclang/vendor/mypy/test/meta/test_diff_helper.py +0 -47
- jaclang/vendor/mypy/test/meta/test_parse_data.py +0 -73
- jaclang/vendor/mypy/test/meta/test_update_data.py +0 -135
- jaclang/vendor/mypy/test/test_find_sources.py +0 -376
- jaclang/vendor/mypy/test/test_ref_info.py +0 -45
- jaclang/vendor/mypy/test/testapi.py +0 -45
- jaclang/vendor/mypy/test/testargs.py +0 -77
- jaclang/vendor/mypy/test/testcheck.py +0 -322
- jaclang/vendor/mypy/test/testcmdline.py +0 -152
- jaclang/vendor/mypy/test/testconstraints.py +0 -134
- jaclang/vendor/mypy/test/testdaemon.py +0 -132
- jaclang/vendor/mypy/test/testdeps.py +0 -77
- jaclang/vendor/mypy/test/testdiff.py +0 -67
- jaclang/vendor/mypy/test/testerrorstream.py +0 -46
- jaclang/vendor/mypy/test/testfinegrained.py +0 -438
- jaclang/vendor/mypy/test/testfinegrainedcache.py +0 -18
- jaclang/vendor/mypy/test/testformatter.py +0 -85
- jaclang/vendor/mypy/test/testfscache.py +0 -101
- jaclang/vendor/mypy/test/testgraph.py +0 -83
- jaclang/vendor/mypy/test/testinfer.py +0 -373
- jaclang/vendor/mypy/test/testipc.py +0 -119
- jaclang/vendor/mypy/test/testmerge.py +0 -238
- jaclang/vendor/mypy/test/testmodulefinder.py +0 -278
- jaclang/vendor/mypy/test/testmypyc.py +0 -14
- jaclang/vendor/mypy/test/testparse.py +0 -107
- jaclang/vendor/mypy/test/testpep561.py +0 -211
- jaclang/vendor/mypy/test/testpythoneval.py +0 -117
- jaclang/vendor/mypy/test/testreports.py +0 -55
- jaclang/vendor/mypy/test/testsemanal.py +0 -209
- jaclang/vendor/mypy/test/testsolve.py +0 -285
- jaclang/vendor/mypy/test/teststubgen.py +0 -1412
- jaclang/vendor/mypy/test/teststubinfo.py +0 -12
- jaclang/vendor/mypy/test/teststubtest.py +0 -2492
- jaclang/vendor/mypy/test/testsubtypes.py +0 -303
- jaclang/vendor/mypy/test/testtransform.py +0 -64
- jaclang/vendor/mypy/test/testtypegen.py +0 -83
- jaclang/vendor/mypy/test/testtypes.py +0 -1551
- jaclang/vendor/mypy/test/testutil.py +0 -111
- jaclang/vendor/mypy/test/typefixture.py +0 -415
- jaclang/vendor/mypy/test/update_data.py +0 -87
- jaclang/vendor/mypy/test/visitors.py +0 -63
- jaclang/vendor/mypy/traverser.py +0 -961
- jaclang/vendor/mypy/treetransform.py +0 -800
- jaclang/vendor/mypy/tvar_scope.py +0 -169
- jaclang/vendor/mypy/type_visitor.py +0 -564
- jaclang/vendor/mypy/typeanal.py +0 -2596
- jaclang/vendor/mypy/typeops.py +0 -1082
- jaclang/vendor/mypy/types.py +0 -3708
- jaclang/vendor/mypy/types_utils.py +0 -166
- jaclang/vendor/mypy/typeshed/LICENSE +0 -237
- jaclang/vendor/mypy/typeshed/stdlib/VERSIONS +0 -309
- jaclang/vendor/mypy/typeshed/stdlib/__future__.pyi +0 -36
- jaclang/vendor/mypy/typeshed/stdlib/__main__.pyi +0 -3
- jaclang/vendor/mypy/typeshed/stdlib/_ast.pyi +0 -591
- jaclang/vendor/mypy/typeshed/stdlib/_bisect.pyi +0 -84
- jaclang/vendor/mypy/typeshed/stdlib/_bootlocale.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/_codecs.pyi +0 -133
- jaclang/vendor/mypy/typeshed/stdlib/_collections_abc.pyi +0 -94
- jaclang/vendor/mypy/typeshed/stdlib/_compat_pickle.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/_compression.pyi +0 -25
- jaclang/vendor/mypy/typeshed/stdlib/_csv.pyi +0 -90
- jaclang/vendor/mypy/typeshed/stdlib/_ctypes.pyi +0 -207
- jaclang/vendor/mypy/typeshed/stdlib/_curses.pyi +0 -566
- jaclang/vendor/mypy/typeshed/stdlib/_decimal.pyi +0 -281
- jaclang/vendor/mypy/typeshed/stdlib/_dummy_thread.pyi +0 -33
- jaclang/vendor/mypy/typeshed/stdlib/_dummy_threading.pyi +0 -164
- jaclang/vendor/mypy/typeshed/stdlib/_heapq.pyi +0 -11
- jaclang/vendor/mypy/typeshed/stdlib/_imp.pyi +0 -28
- jaclang/vendor/mypy/typeshed/stdlib/_json.pyi +0 -49
- jaclang/vendor/mypy/typeshed/stdlib/_locale.pyi +0 -100
- jaclang/vendor/mypy/typeshed/stdlib/_lsprof.pyi +0 -35
- jaclang/vendor/mypy/typeshed/stdlib/_markupbase.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/_msi.pyi +0 -92
- jaclang/vendor/mypy/typeshed/stdlib/_operator.pyi +0 -147
- jaclang/vendor/mypy/typeshed/stdlib/_osx_support.pyi +0 -34
- jaclang/vendor/mypy/typeshed/stdlib/_posixsubprocess.pyi +0 -33
- jaclang/vendor/mypy/typeshed/stdlib/_py_abc.pyi +0 -14
- jaclang/vendor/mypy/typeshed/stdlib/_pydecimal.pyi +0 -43
- jaclang/vendor/mypy/typeshed/stdlib/_random.pyi +0 -12
- jaclang/vendor/mypy/typeshed/stdlib/_sitebuiltins.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/_socket.pyi +0 -803
- jaclang/vendor/mypy/typeshed/stdlib/_stat.pyi +0 -103
- jaclang/vendor/mypy/typeshed/stdlib/_thread.pyi +0 -59
- jaclang/vendor/mypy/typeshed/stdlib/_threading_local.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/_tkinter.pyi +0 -121
- jaclang/vendor/mypy/typeshed/stdlib/_tracemalloc.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/_typeshed/__init__.pyi +0 -347
- jaclang/vendor/mypy/typeshed/stdlib/_typeshed/dbapi.pyi +0 -37
- jaclang/vendor/mypy/typeshed/stdlib/_typeshed/wsgi.pyi +0 -44
- jaclang/vendor/mypy/typeshed/stdlib/_typeshed/xml.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/_warnings.pyi +0 -55
- jaclang/vendor/mypy/typeshed/stdlib/_weakref.pyi +0 -41
- jaclang/vendor/mypy/typeshed/stdlib/_weakrefset.pyi +0 -51
- jaclang/vendor/mypy/typeshed/stdlib/_winapi.pyi +0 -255
- jaclang/vendor/mypy/typeshed/stdlib/abc.pyi +0 -51
- jaclang/vendor/mypy/typeshed/stdlib/aifc.pyi +0 -91
- jaclang/vendor/mypy/typeshed/stdlib/antigravity.pyi +0 -3
- jaclang/vendor/mypy/typeshed/stdlib/argparse.pyi +0 -595
- jaclang/vendor/mypy/typeshed/stdlib/array.pyi +0 -92
- jaclang/vendor/mypy/typeshed/stdlib/ast.pyi +0 -277
- jaclang/vendor/mypy/typeshed/stdlib/asynchat.pyi +0 -21
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/__init__.pyi +0 -41
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/base_events.pyi +0 -440
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/base_futures.pyi +0 -19
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/base_subprocess.pyi +0 -63
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/base_tasks.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/constants.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/coroutines.pyi +0 -26
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/events.pyi +0 -580
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/exceptions.pyi +0 -43
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/format_helpers.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/futures.pyi +0 -57
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/locks.pyi +0 -121
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/log.pyi +0 -3
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/mixins.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/proactor_events.pyi +0 -64
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/protocols.pyi +0 -34
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/queues.pyi +0 -47
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/runners.pyi +0 -32
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/selector_events.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/sslproto.pyi +0 -165
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/staggered.pyi +0 -10
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/streams.pyi +0 -153
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/subprocess.pyi +0 -229
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/taskgroups.pyi +0 -25
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/tasks.pyi +0 -497
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/threads.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/timeouts.pyi +0 -19
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/transports.pyi +0 -47
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/trsock.pyi +0 -94
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/unix_events.pyi +0 -196
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/windows_events.pyi +0 -85
- jaclang/vendor/mypy/typeshed/stdlib/asyncio/windows_utils.pyi +0 -49
- jaclang/vendor/mypy/typeshed/stdlib/asyncore.pyi +0 -90
- jaclang/vendor/mypy/typeshed/stdlib/atexit.pyi +0 -12
- jaclang/vendor/mypy/typeshed/stdlib/audioop.pyi +0 -43
- jaclang/vendor/mypy/typeshed/stdlib/base64.pyi +0 -59
- jaclang/vendor/mypy/typeshed/stdlib/bdb.pyi +0 -102
- jaclang/vendor/mypy/typeshed/stdlib/binascii.pyi +0 -36
- jaclang/vendor/mypy/typeshed/stdlib/binhex.pyi +0 -45
- jaclang/vendor/mypy/typeshed/stdlib/bisect.pyi +0 -4
- jaclang/vendor/mypy/typeshed/stdlib/builtins.pyi +0 -1936
- jaclang/vendor/mypy/typeshed/stdlib/bz2.pyi +0 -146
- jaclang/vendor/mypy/typeshed/stdlib/cProfile.pyi +0 -31
- jaclang/vendor/mypy/typeshed/stdlib/calendar.pyi +0 -208
- jaclang/vendor/mypy/typeshed/stdlib/cgi.pyi +0 -118
- jaclang/vendor/mypy/typeshed/stdlib/cgitb.pyi +0 -32
- jaclang/vendor/mypy/typeshed/stdlib/chunk.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/cmath.pyi +0 -36
- jaclang/vendor/mypy/typeshed/stdlib/cmd.pyi +0 -45
- jaclang/vendor/mypy/typeshed/stdlib/code.pyi +0 -33
- jaclang/vendor/mypy/typeshed/stdlib/codecs.pyi +0 -285
- jaclang/vendor/mypy/typeshed/stdlib/codeop.pyi +0 -13
- jaclang/vendor/mypy/typeshed/stdlib/collections/__init__.pyi +0 -485
- jaclang/vendor/mypy/typeshed/stdlib/collections/abc.pyi +0 -2
- jaclang/vendor/mypy/typeshed/stdlib/colorsys.pyi +0 -13
- jaclang/vendor/mypy/typeshed/stdlib/compileall.pyi +0 -111
- jaclang/vendor/mypy/typeshed/stdlib/concurrent/futures/__init__.pyi +0 -32
- jaclang/vendor/mypy/typeshed/stdlib/concurrent/futures/_base.pyi +0 -126
- jaclang/vendor/mypy/typeshed/stdlib/concurrent/futures/process.pyi +0 -233
- jaclang/vendor/mypy/typeshed/stdlib/concurrent/futures/thread.pyi +0 -80
- jaclang/vendor/mypy/typeshed/stdlib/configparser.pyi +0 -313
- jaclang/vendor/mypy/typeshed/stdlib/contextlib.pyi +0 -208
- jaclang/vendor/mypy/typeshed/stdlib/contextvars.pyi +0 -63
- jaclang/vendor/mypy/typeshed/stdlib/copy.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/copyreg.pyi +0 -21
- jaclang/vendor/mypy/typeshed/stdlib/crypt.pyi +0 -12
- jaclang/vendor/mypy/typeshed/stdlib/csv.pyi +0 -147
- jaclang/vendor/mypy/typeshed/stdlib/ctypes/__init__.pyi +0 -187
- jaclang/vendor/mypy/typeshed/stdlib/ctypes/_endian.pyi +0 -19
- jaclang/vendor/mypy/typeshed/stdlib/ctypes/util.pyi +0 -6
- jaclang/vendor/mypy/typeshed/stdlib/ctypes/wintypes.pyi +0 -298
- jaclang/vendor/mypy/typeshed/stdlib/curses/__init__.pyi +0 -22
- jaclang/vendor/mypy/typeshed/stdlib/curses/ascii.pyi +0 -62
- jaclang/vendor/mypy/typeshed/stdlib/curses/has_key.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/curses/panel.pyi +0 -22
- jaclang/vendor/mypy/typeshed/stdlib/curses/textpad.pyi +0 -11
- jaclang/vendor/mypy/typeshed/stdlib/dataclasses.pyi +0 -315
- jaclang/vendor/mypy/typeshed/stdlib/datetime.pyi +0 -295
- jaclang/vendor/mypy/typeshed/stdlib/dbm/__init__.pyi +0 -95
- jaclang/vendor/mypy/typeshed/stdlib/dbm/dumb.pyi +0 -31
- jaclang/vendor/mypy/typeshed/stdlib/dbm/gnu.pyi +0 -41
- jaclang/vendor/mypy/typeshed/stdlib/dbm/ndbm.pyi +0 -37
- jaclang/vendor/mypy/typeshed/stdlib/decimal.pyi +0 -2
- jaclang/vendor/mypy/typeshed/stdlib/difflib.pyi +0 -140
- jaclang/vendor/mypy/typeshed/stdlib/dis.pyi +0 -144
- jaclang/vendor/mypy/typeshed/stdlib/distutils/__init__.pyi +0 -5
- jaclang/vendor/mypy/typeshed/stdlib/distutils/archive_util.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/distutils/bcppcompiler.pyi +0 -3
- jaclang/vendor/mypy/typeshed/stdlib/distutils/ccompiler.pyi +0 -152
- jaclang/vendor/mypy/typeshed/stdlib/distutils/cmd.pyi +0 -66
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist.pyi +0 -25
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist_dumb.pyi +0 -21
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist_msi.pyi +0 -45
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist_rpm.pyi +0 -52
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/bdist_wininst.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build.pyi +0 -31
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build_clib.pyi +0 -27
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build_ext.pyi +0 -50
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build_py.pyi +0 -44
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/build_scripts.pyi +0 -24
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/check.pyi +0 -39
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/clean.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/config.pyi +0 -83
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install.pyi +0 -63
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_data.pyi +0 -19
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_egg_info.pyi +0 -18
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_headers.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_lib.pyi +0 -25
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/install_scripts.pyi +0 -18
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/register.pyi +0 -18
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/sdist.pyi +0 -42
- jaclang/vendor/mypy/typeshed/stdlib/distutils/command/upload.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/distutils/config.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/distutils/core.pyi +0 -57
- jaclang/vendor/mypy/typeshed/stdlib/distutils/cygwinccompiler.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/distutils/debug.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/distutils/dep_util.pyi +0 -3
- jaclang/vendor/mypy/typeshed/stdlib/distutils/dir_util.pyi +0 -13
- jaclang/vendor/mypy/typeshed/stdlib/distutils/dist.pyi +0 -146
- jaclang/vendor/mypy/typeshed/stdlib/distutils/errors.pyi +0 -19
- jaclang/vendor/mypy/typeshed/stdlib/distutils/extension.pyi +0 -36
- jaclang/vendor/mypy/typeshed/stdlib/distutils/fancy_getopt.pyi +0 -34
- jaclang/vendor/mypy/typeshed/stdlib/distutils/file_util.pyi +0 -14
- jaclang/vendor/mypy/typeshed/stdlib/distutils/filelist.pyi +0 -50
- jaclang/vendor/mypy/typeshed/stdlib/distutils/log.pyi +0 -25
- jaclang/vendor/mypy/typeshed/stdlib/distutils/msvccompiler.pyi +0 -3
- jaclang/vendor/mypy/typeshed/stdlib/distutils/spawn.pyi +0 -2
- jaclang/vendor/mypy/typeshed/stdlib/distutils/sysconfig.pyi +0 -31
- jaclang/vendor/mypy/typeshed/stdlib/distutils/text_file.pyi +0 -21
- jaclang/vendor/mypy/typeshed/stdlib/distutils/unixccompiler.pyi +0 -3
- jaclang/vendor/mypy/typeshed/stdlib/distutils/util.pyi +0 -46
- jaclang/vendor/mypy/typeshed/stdlib/distutils/version.pyi +0 -36
- jaclang/vendor/mypy/typeshed/stdlib/doctest.pyi +0 -248
- jaclang/vendor/mypy/typeshed/stdlib/dummy_threading.pyi +0 -2
- jaclang/vendor/mypy/typeshed/stdlib/email/__init__.pyi +0 -29
- jaclang/vendor/mypy/typeshed/stdlib/email/_header_value_parser.pyi +0 -392
- jaclang/vendor/mypy/typeshed/stdlib/email/_policybase.pyi +0 -51
- jaclang/vendor/mypy/typeshed/stdlib/email/base64mime.pyi +0 -13
- jaclang/vendor/mypy/typeshed/stdlib/email/charset.pyi +0 -34
- jaclang/vendor/mypy/typeshed/stdlib/email/contentmanager.pyi +0 -11
- jaclang/vendor/mypy/typeshed/stdlib/email/encoders.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/email/errors.pyi +0 -39
- jaclang/vendor/mypy/typeshed/stdlib/email/feedparser.pyi +0 -23
- jaclang/vendor/mypy/typeshed/stdlib/email/generator.pyi +0 -40
- jaclang/vendor/mypy/typeshed/stdlib/email/header.pyi +0 -31
- jaclang/vendor/mypy/typeshed/stdlib/email/headerregistry.pyi +0 -178
- jaclang/vendor/mypy/typeshed/stdlib/email/iterators.pyi +0 -12
- jaclang/vendor/mypy/typeshed/stdlib/email/message.pyi +0 -165
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/application.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/audio.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/base.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/image.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/message.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/multipart.pyi +0 -18
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/nonmultipart.pyi +0 -5
- jaclang/vendor/mypy/typeshed/stdlib/email/mime/text.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/email/parser.pyi +0 -26
- jaclang/vendor/mypy/typeshed/stdlib/email/policy.pyi +0 -38
- jaclang/vendor/mypy/typeshed/stdlib/email/quoprimime.pyi +0 -28
- jaclang/vendor/mypy/typeshed/stdlib/email/utils.pyi +0 -70
- jaclang/vendor/mypy/typeshed/stdlib/encodings/__init__.pyi +0 -10
- jaclang/vendor/mypy/typeshed/stdlib/encodings/utf_8.pyi +0 -21
- jaclang/vendor/mypy/typeshed/stdlib/encodings/utf_8_sig.pyi +0 -22
- jaclang/vendor/mypy/typeshed/stdlib/ensurepip/__init__.pyi +0 -12
- jaclang/vendor/mypy/typeshed/stdlib/enum.pyi +0 -320
- jaclang/vendor/mypy/typeshed/stdlib/errno.pyi +0 -222
- jaclang/vendor/mypy/typeshed/stdlib/faulthandler.pyi +0 -13
- jaclang/vendor/mypy/typeshed/stdlib/fcntl.pyi +0 -127
- jaclang/vendor/mypy/typeshed/stdlib/filecmp.pyi +0 -57
- jaclang/vendor/mypy/typeshed/stdlib/fileinput.pyi +0 -213
- jaclang/vendor/mypy/typeshed/stdlib/fnmatch.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/formatter.pyi +0 -88
- jaclang/vendor/mypy/typeshed/stdlib/fractions.pyi +0 -150
- jaclang/vendor/mypy/typeshed/stdlib/ftplib.pyi +0 -178
- jaclang/vendor/mypy/typeshed/stdlib/functools.pyi +0 -213
- jaclang/vendor/mypy/typeshed/stdlib/gc.pyi +0 -37
- jaclang/vendor/mypy/typeshed/stdlib/genericpath.pyi +0 -52
- jaclang/vendor/mypy/typeshed/stdlib/getopt.pyi +0 -11
- jaclang/vendor/mypy/typeshed/stdlib/getpass.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/gettext.pyi +0 -169
- jaclang/vendor/mypy/typeshed/stdlib/glob.pyi +0 -42
- jaclang/vendor/mypy/typeshed/stdlib/graphlib.pyi +0 -28
- jaclang/vendor/mypy/typeshed/stdlib/grp.pyi +0 -22
- jaclang/vendor/mypy/typeshed/stdlib/gzip.pyi +0 -160
- jaclang/vendor/mypy/typeshed/stdlib/hashlib.pyi +0 -167
- jaclang/vendor/mypy/typeshed/stdlib/heapq.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/hmac.pyi +0 -38
- jaclang/vendor/mypy/typeshed/stdlib/html/__init__.pyi +0 -6
- jaclang/vendor/mypy/typeshed/stdlib/html/entities.pyi +0 -6
- jaclang/vendor/mypy/typeshed/stdlib/html/parser.pyi +0 -34
- jaclang/vendor/mypy/typeshed/stdlib/http/__init__.pyi +0 -105
- jaclang/vendor/mypy/typeshed/stdlib/http/client.pyi +0 -259
- jaclang/vendor/mypy/typeshed/stdlib/http/cookiejar.pyi +0 -159
- jaclang/vendor/mypy/typeshed/stdlib/http/cookies.pyi +0 -60
- jaclang/vendor/mypy/typeshed/stdlib/http/server.pyi +0 -83
- jaclang/vendor/mypy/typeshed/stdlib/imaplib.pyi +0 -168
- jaclang/vendor/mypy/typeshed/stdlib/imghdr.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/imp.pyi +0 -62
- jaclang/vendor/mypy/typeshed/stdlib/importlib/__init__.pyi +0 -24
- jaclang/vendor/mypy/typeshed/stdlib/importlib/_abc.pyi +0 -15
- jaclang/vendor/mypy/typeshed/stdlib/importlib/abc.pyi +0 -172
- jaclang/vendor/mypy/typeshed/stdlib/importlib/machinery.pyi +0 -179
- jaclang/vendor/mypy/typeshed/stdlib/importlib/metadata/__init__.pyi +0 -285
- jaclang/vendor/mypy/typeshed/stdlib/importlib/metadata/_meta.pyi +0 -49
- jaclang/vendor/mypy/typeshed/stdlib/importlib/readers.pyi +0 -68
- jaclang/vendor/mypy/typeshed/stdlib/importlib/resources/__init__.pyi +0 -46
- jaclang/vendor/mypy/typeshed/stdlib/importlib/resources/abc.pyi +0 -12
- jaclang/vendor/mypy/typeshed/stdlib/importlib/resources/readers.pyi +0 -14
- jaclang/vendor/mypy/typeshed/stdlib/importlib/resources/simple.pyi +0 -56
- jaclang/vendor/mypy/typeshed/stdlib/importlib/simple.pyi +0 -11
- jaclang/vendor/mypy/typeshed/stdlib/importlib/util.pyi +0 -43
- jaclang/vendor/mypy/typeshed/stdlib/inspect.pyi +0 -632
- jaclang/vendor/mypy/typeshed/stdlib/io.pyi +0 -238
- jaclang/vendor/mypy/typeshed/stdlib/ipaddress.pyi +0 -208
- jaclang/vendor/mypy/typeshed/stdlib/itertools.pyi +0 -273
- jaclang/vendor/mypy/typeshed/stdlib/json/__init__.pyi +0 -61
- jaclang/vendor/mypy/typeshed/stdlib/json/decoder.pyi +0 -32
- jaclang/vendor/mypy/typeshed/stdlib/json/encoder.pyi +0 -40
- jaclang/vendor/mypy/typeshed/stdlib/json/tool.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/keyword.pyi +0 -21
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/btm_matcher.pyi +0 -28
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixer_base.pyi +0 -42
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_apply.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_asserts.pyi +0 -10
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_basestring.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_buffer.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_dict.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_except.pyi +0 -14
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_exec.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_execfile.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_exitfunc.pyi +0 -13
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_filter.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_funcattrs.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_future.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_getcwdu.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_has_key.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_idioms.pyi +0 -15
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_import.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_imports.pyi +0 -21
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_imports2.pyi +0 -6
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_input.pyi +0 -11
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_intern.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_isinstance.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_itertools.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_itertools_imports.pyi +0 -7
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_long.pyi +0 -7
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_map.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_metaclass.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_methodattrs.pyi +0 -10
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_ne.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_next.pyi +0 -19
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_nonzero.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_numliterals.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_operator.pyi +0 -12
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_paren.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_print.pyi +0 -12
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_raise.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_raw_input.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_reduce.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_reload.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_renames.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_repr.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_set_literal.pyi +0 -7
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_standarderror.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_sys_exc.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_throw.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_tuple_params.pyi +0 -17
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_types.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_unicode.pyi +0 -12
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_urllib.pyi +0 -15
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_ws_comma.pyi +0 -12
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_xrange.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_xreadlines.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/fixes/fix_zip.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/main.pyi +0 -42
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/__init__.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/driver.pyi +0 -27
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/grammar.pyi +0 -24
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/literals.pyi +0 -7
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/parse.pyi +0 -30
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/pgen.pyi +0 -50
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/token.pyi +0 -67
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pgen2/tokenize.pyi +0 -96
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pygram.pyi +0 -114
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/pytree.pyi +0 -117
- jaclang/vendor/mypy/typeshed/stdlib/lib2to3/refactor.pyi +0 -82
- jaclang/vendor/mypy/typeshed/stdlib/linecache.pyi +0 -23
- jaclang/vendor/mypy/typeshed/stdlib/locale.pyi +0 -152
- jaclang/vendor/mypy/typeshed/stdlib/logging/__init__.pyi +0 -658
- jaclang/vendor/mypy/typeshed/stdlib/logging/config.pyi +0 -134
- jaclang/vendor/mypy/typeshed/stdlib/logging/handlers.pyi +0 -275
- jaclang/vendor/mypy/typeshed/stdlib/lzma.pyi +0 -197
- jaclang/vendor/mypy/typeshed/stdlib/mailbox.pyi +0 -256
- jaclang/vendor/mypy/typeshed/stdlib/mailcap.pyi +0 -11
- jaclang/vendor/mypy/typeshed/stdlib/marshal.pyi +0 -33
- jaclang/vendor/mypy/typeshed/stdlib/math.pyi +0 -125
- jaclang/vendor/mypy/typeshed/stdlib/mimetypes.pyi +0 -46
- jaclang/vendor/mypy/typeshed/stdlib/mmap.pyi +0 -113
- jaclang/vendor/mypy/typeshed/stdlib/modulefinder.pyi +0 -66
- jaclang/vendor/mypy/typeshed/stdlib/msilib/__init__.pyi +0 -177
- jaclang/vendor/mypy/typeshed/stdlib/msilib/schema.pyi +0 -94
- jaclang/vendor/mypy/typeshed/stdlib/msilib/sequence.pyi +0 -13
- jaclang/vendor/mypy/typeshed/stdlib/msilib/text.pyi +0 -7
- jaclang/vendor/mypy/typeshed/stdlib/msvcrt.pyi +0 -32
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/__init__.pyi +0 -90
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/connection.pyi +0 -75
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/context.pyi +0 -189
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/dummy/__init__.pyi +0 -77
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/dummy/connection.pyi +0 -39
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/forkserver.pyi +0 -31
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/heap.pyi +0 -36
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/managers.pyi +0 -212
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/pool.pyi +0 -103
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/popen_fork.pyi +0 -23
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/popen_forkserver.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/popen_spawn_posix.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/popen_spawn_win32.pyi +0 -30
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/process.pyi +0 -39
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/queues.pyi +0 -41
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/reduction.pyi +0 -90
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/resource_sharer.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/resource_tracker.pyi +0 -18
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/shared_memory.pyi +0 -40
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/sharedctypes.pyi +0 -107
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/spawn.pyi +0 -32
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/synchronize.pyi +0 -54
- jaclang/vendor/mypy/typeshed/stdlib/multiprocessing/util.pyi +0 -98
- jaclang/vendor/mypy/typeshed/stdlib/netrc.pyi +0 -23
- jaclang/vendor/mypy/typeshed/stdlib/nis.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/nntplib.pyi +0 -125
- jaclang/vendor/mypy/typeshed/stdlib/nt.pyi +0 -111
- jaclang/vendor/mypy/typeshed/stdlib/ntpath.pyi +0 -119
- jaclang/vendor/mypy/typeshed/stdlib/nturl2path.pyi +0 -2
- jaclang/vendor/mypy/typeshed/stdlib/numbers.pyi +0 -209
- jaclang/vendor/mypy/typeshed/stdlib/opcode.pyi +0 -59
- jaclang/vendor/mypy/typeshed/stdlib/operator.pyi +0 -110
- jaclang/vendor/mypy/typeshed/stdlib/optparse.pyi +0 -255
- jaclang/vendor/mypy/typeshed/stdlib/os/__init__.pyi +0 -1157
- jaclang/vendor/mypy/typeshed/stdlib/os/path.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/ossaudiodev.pyi +0 -131
- jaclang/vendor/mypy/typeshed/stdlib/parser.pyi +0 -24
- jaclang/vendor/mypy/typeshed/stdlib/pathlib.pyi +0 -232
- jaclang/vendor/mypy/typeshed/stdlib/pdb.pyi +0 -181
- jaclang/vendor/mypy/typeshed/stdlib/pickle.pyi +0 -271
- jaclang/vendor/mypy/typeshed/stdlib/pickletools.pyi +0 -167
- jaclang/vendor/mypy/typeshed/stdlib/pipes.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/pkgutil.pyi +0 -53
- jaclang/vendor/mypy/typeshed/stdlib/platform.pyi +0 -42
- jaclang/vendor/mypy/typeshed/stdlib/plistlib.pyi +0 -113
- jaclang/vendor/mypy/typeshed/stdlib/poplib.pyi +0 -71
- jaclang/vendor/mypy/typeshed/stdlib/posix.pyi +0 -361
- jaclang/vendor/mypy/typeshed/stdlib/posixpath.pyi +0 -161
- jaclang/vendor/mypy/typeshed/stdlib/pprint.pyi +0 -112
- jaclang/vendor/mypy/typeshed/stdlib/profile.pyi +0 -31
- jaclang/vendor/mypy/typeshed/stdlib/pstats.pyi +0 -80
- jaclang/vendor/mypy/typeshed/stdlib/pty.pyi +0 -19
- jaclang/vendor/mypy/typeshed/stdlib/pwd.pyi +0 -28
- jaclang/vendor/mypy/typeshed/stdlib/py_compile.pyi +0 -34
- jaclang/vendor/mypy/typeshed/stdlib/pyclbr.pyi +0 -74
- jaclang/vendor/mypy/typeshed/stdlib/pydoc.pyi +0 -261
- jaclang/vendor/mypy/typeshed/stdlib/pydoc_data/__init__.pyi +0 -0
- jaclang/vendor/mypy/typeshed/stdlib/pydoc_data/topics.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/pyexpat/__init__.pyi +0 -85
- jaclang/vendor/mypy/typeshed/stdlib/pyexpat/errors.pyi +0 -49
- jaclang/vendor/mypy/typeshed/stdlib/pyexpat/model.pyi +0 -11
- jaclang/vendor/mypy/typeshed/stdlib/queue.pyi +0 -66
- jaclang/vendor/mypy/typeshed/stdlib/quopri.pyi +0 -11
- jaclang/vendor/mypy/typeshed/stdlib/random.pyi +0 -138
- jaclang/vendor/mypy/typeshed/stdlib/re.pyi +0 -290
- jaclang/vendor/mypy/typeshed/stdlib/readline.pyi +0 -36
- jaclang/vendor/mypy/typeshed/stdlib/reprlib.pyi +0 -65
- jaclang/vendor/mypy/typeshed/stdlib/resource.pyi +0 -94
- jaclang/vendor/mypy/typeshed/stdlib/rlcompleter.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/runpy.pyi +0 -24
- jaclang/vendor/mypy/typeshed/stdlib/sched.pyi +0 -42
- jaclang/vendor/mypy/typeshed/stdlib/secrets.pyi +0 -15
- jaclang/vendor/mypy/typeshed/stdlib/select.pyi +0 -155
- jaclang/vendor/mypy/typeshed/stdlib/selectors.pyi +0 -67
- jaclang/vendor/mypy/typeshed/stdlib/shelve.pyi +0 -46
- jaclang/vendor/mypy/typeshed/stdlib/shlex.pyi +0 -63
- jaclang/vendor/mypy/typeshed/stdlib/shutil.pyi +0 -185
- jaclang/vendor/mypy/typeshed/stdlib/signal.pyi +0 -188
- jaclang/vendor/mypy/typeshed/stdlib/site.pyi +0 -27
- jaclang/vendor/mypy/typeshed/stdlib/smtpd.pyi +0 -91
- jaclang/vendor/mypy/typeshed/stdlib/smtplib.pyi +0 -204
- jaclang/vendor/mypy/typeshed/stdlib/sndhdr.pyi +0 -14
- jaclang/vendor/mypy/typeshed/stdlib/socket.pyi +0 -825
- jaclang/vendor/mypy/typeshed/stdlib/socketserver.pyi +0 -168
- jaclang/vendor/mypy/typeshed/stdlib/spwd.pyi +0 -41
- jaclang/vendor/mypy/typeshed/stdlib/sqlite3/__init__.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/sqlite3/dbapi2.pyi +0 -551
- jaclang/vendor/mypy/typeshed/stdlib/sre_compile.pyi +0 -11
- jaclang/vendor/mypy/typeshed/stdlib/sre_constants.pyi +0 -130
- jaclang/vendor/mypy/typeshed/stdlib/sre_parse.pyi +0 -104
- jaclang/vendor/mypy/typeshed/stdlib/ssl.pyi +0 -537
- jaclang/vendor/mypy/typeshed/stdlib/stat.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/statistics.pyi +0 -132
- jaclang/vendor/mypy/typeshed/stdlib/string.pyi +0 -83
- jaclang/vendor/mypy/typeshed/stdlib/stringprep.pyi +0 -27
- jaclang/vendor/mypy/typeshed/stdlib/struct.pyi +0 -26
- jaclang/vendor/mypy/typeshed/stdlib/subprocess.pyi +0 -2615
- jaclang/vendor/mypy/typeshed/stdlib/sunau.pyi +0 -86
- jaclang/vendor/mypy/typeshed/stdlib/symbol.pyi +0 -93
- jaclang/vendor/mypy/typeshed/stdlib/symtable.pyi +0 -58
- jaclang/vendor/mypy/typeshed/stdlib/sys/__init__.pyi +0 -373
- jaclang/vendor/mypy/typeshed/stdlib/sys/_monitoring.pyi +0 -52
- jaclang/vendor/mypy/typeshed/stdlib/sysconfig.pyi +0 -48
- jaclang/vendor/mypy/typeshed/stdlib/syslog.pyi +0 -46
- jaclang/vendor/mypy/typeshed/stdlib/tabnanny.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/tarfile.pyi +0 -441
- jaclang/vendor/mypy/typeshed/stdlib/telnetlib.pyi +0 -122
- jaclang/vendor/mypy/typeshed/stdlib/tempfile.pyi +0 -477
- jaclang/vendor/mypy/typeshed/stdlib/termios.pyi +0 -267
- jaclang/vendor/mypy/typeshed/stdlib/textwrap.pyi +0 -103
- jaclang/vendor/mypy/typeshed/stdlib/this.pyi +0 -2
- jaclang/vendor/mypy/typeshed/stdlib/threading.pyi +0 -187
- jaclang/vendor/mypy/typeshed/stdlib/time.pyi +0 -108
- jaclang/vendor/mypy/typeshed/stdlib/timeit.pyi +0 -32
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/__init__.pyi +0 -3654
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/colorchooser.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/commondialog.pyi +0 -14
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/constants.pyi +0 -80
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/dialog.pyi +0 -16
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/dnd.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/filedialog.pyi +0 -151
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/font.pyi +0 -116
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/messagebox.pyi +0 -44
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/scrolledtext.pyi +0 -9
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/simpledialog.pyi +0 -54
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/tix.pyi +0 -299
- jaclang/vendor/mypy/typeshed/stdlib/tkinter/ttk.pyi +0 -1204
- jaclang/vendor/mypy/typeshed/stdlib/token.pyi +0 -159
- jaclang/vendor/mypy/typeshed/stdlib/tokenize.pyi +0 -177
- jaclang/vendor/mypy/typeshed/stdlib/tomllib.pyi +0 -10
- jaclang/vendor/mypy/typeshed/stdlib/trace.pyi +0 -79
- jaclang/vendor/mypy/typeshed/stdlib/traceback.pyi +0 -262
- jaclang/vendor/mypy/typeshed/stdlib/tracemalloc.pyi +0 -124
- jaclang/vendor/mypy/typeshed/stdlib/tty.pyi +0 -30
- jaclang/vendor/mypy/typeshed/stdlib/turtle.pyi +0 -713
- jaclang/vendor/mypy/typeshed/stdlib/types.pyi +0 -614
- jaclang/vendor/mypy/typeshed/stdlib/typing.pyi +0 -976
- jaclang/vendor/mypy/typeshed/stdlib/typing_extensions.pyi +0 -509
- jaclang/vendor/mypy/typeshed/stdlib/unicodedata.pyi +0 -73
- jaclang/vendor/mypy/typeshed/stdlib/unittest/__init__.pyi +0 -67
- jaclang/vendor/mypy/typeshed/stdlib/unittest/_log.pyi +0 -27
- jaclang/vendor/mypy/typeshed/stdlib/unittest/async_case.pyi +0 -21
- jaclang/vendor/mypy/typeshed/stdlib/unittest/case.pyi +0 -342
- jaclang/vendor/mypy/typeshed/stdlib/unittest/loader.pyi +0 -51
- jaclang/vendor/mypy/typeshed/stdlib/unittest/main.pyi +0 -69
- jaclang/vendor/mypy/typeshed/stdlib/unittest/mock.pyi +0 -430
- jaclang/vendor/mypy/typeshed/stdlib/unittest/result.pyi +0 -47
- jaclang/vendor/mypy/typeshed/stdlib/unittest/runner.pyi +0 -72
- jaclang/vendor/mypy/typeshed/stdlib/unittest/signals.pyi +0 -15
- jaclang/vendor/mypy/typeshed/stdlib/unittest/suite.pyi +0 -22
- jaclang/vendor/mypy/typeshed/stdlib/unittest/util.pyi +0 -23
- jaclang/vendor/mypy/typeshed/stdlib/urllib/__init__.pyi +0 -0
- jaclang/vendor/mypy/typeshed/stdlib/urllib/error.pyi +0 -23
- jaclang/vendor/mypy/typeshed/stdlib/urllib/parse.pyi +0 -210
- jaclang/vendor/mypy/typeshed/stdlib/urllib/request.pyi +0 -400
- jaclang/vendor/mypy/typeshed/stdlib/urllib/response.pyi +0 -43
- jaclang/vendor/mypy/typeshed/stdlib/urllib/robotparser.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/uu.pyi +0 -13
- jaclang/vendor/mypy/typeshed/stdlib/uuid.pyi +0 -100
- jaclang/vendor/mypy/typeshed/stdlib/warnings.pyi +0 -112
- jaclang/vendor/mypy/typeshed/stdlib/wave.pyi +0 -85
- jaclang/vendor/mypy/typeshed/stdlib/weakref.pyi +0 -149
- jaclang/vendor/mypy/typeshed/stdlib/webbrowser.pyi +0 -74
- jaclang/vendor/mypy/typeshed/stdlib/winreg.pyi +0 -132
- jaclang/vendor/mypy/typeshed/stdlib/winsound.pyi +0 -28
- jaclang/vendor/mypy/typeshed/stdlib/wsgiref/__init__.pyi +0 -0
- jaclang/vendor/mypy/typeshed/stdlib/wsgiref/handlers.pyi +0 -91
- jaclang/vendor/mypy/typeshed/stdlib/wsgiref/headers.pyi +0 -26
- jaclang/vendor/mypy/typeshed/stdlib/wsgiref/simple_server.pyi +0 -37
- jaclang/vendor/mypy/typeshed/stdlib/wsgiref/types.pyi +0 -32
- jaclang/vendor/mypy/typeshed/stdlib/wsgiref/util.pyi +0 -24
- jaclang/vendor/mypy/typeshed/stdlib/wsgiref/validate.pyi +0 -50
- jaclang/vendor/mypy/typeshed/stdlib/xdrlib.pyi +0 -57
- jaclang/vendor/mypy/typeshed/stdlib/xml/__init__.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/NodeFilter.pyi +0 -19
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/__init__.pyi +0 -69
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/domreg.pyi +0 -8
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/expatbuilder.pyi +0 -100
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/minicompat.pyi +0 -22
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/minidom.pyi +0 -404
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/pulldom.pyi +0 -94
- jaclang/vendor/mypy/typeshed/stdlib/xml/dom/xmlbuilder.pyi +0 -108
- jaclang/vendor/mypy/typeshed/stdlib/xml/etree/ElementInclude.pyi +0 -28
- jaclang/vendor/mypy/typeshed/stdlib/xml/etree/ElementPath.pyi +0 -34
- jaclang/vendor/mypy/typeshed/stdlib/xml/etree/ElementTree.pyi +0 -327
- jaclang/vendor/mypy/typeshed/stdlib/xml/etree/__init__.pyi +0 -0
- jaclang/vendor/mypy/typeshed/stdlib/xml/etree/cElementTree.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/xml/parsers/__init__.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/xml/parsers/expat/__init__.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/xml/parsers/expat/errors.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/xml/parsers/expat/model.pyi +0 -1
- jaclang/vendor/mypy/typeshed/stdlib/xml/sax/__init__.pyi +0 -25
- jaclang/vendor/mypy/typeshed/stdlib/xml/sax/_exceptions.pyi +0 -19
- jaclang/vendor/mypy/typeshed/stdlib/xml/sax/handler.pyi +0 -55
- jaclang/vendor/mypy/typeshed/stdlib/xml/sax/saxutils.pyi +0 -60
- jaclang/vendor/mypy/typeshed/stdlib/xml/sax/xmlreader.pyi +0 -87
- jaclang/vendor/mypy/typeshed/stdlib/xmlrpc/__init__.pyi +0 -0
- jaclang/vendor/mypy/typeshed/stdlib/xmlrpc/client.pyi +0 -296
- jaclang/vendor/mypy/typeshed/stdlib/xmlrpc/server.pyi +0 -143
- jaclang/vendor/mypy/typeshed/stdlib/xxlimited.pyi +0 -22
- jaclang/vendor/mypy/typeshed/stdlib/zipapp.pyi +0 -20
- jaclang/vendor/mypy/typeshed/stdlib/zipfile/__init__.pyi +0 -306
- jaclang/vendor/mypy/typeshed/stdlib/zipfile/_path.pyi +0 -95
- jaclang/vendor/mypy/typeshed/stdlib/zipimport.pyi +0 -32
- jaclang/vendor/mypy/typeshed/stdlib/zlib.pyi +0 -56
- jaclang/vendor/mypy/typeshed/stdlib/zoneinfo/__init__.pyi +0 -38
- jaclang/vendor/mypy/typeshed/stubs/mypy-extensions/mypy_extensions.pyi +0 -218
- jaclang/vendor/mypy/typestate.py +0 -323
- jaclang/vendor/mypy/typetraverser.py +0 -148
- jaclang/vendor/mypy/typevars.py +0 -93
- jaclang/vendor/mypy/typevartuples.py +0 -32
- jaclang/vendor/mypy/util.py +0 -869
- jaclang/vendor/mypy/version.py +0 -1
- jaclang/vendor/mypy/visitor.py +0 -621
- jaclang/vendor/mypy/xml/mypy-html.css +0 -104
- jaclang/vendor/mypy/xml/mypy-html.xslt +0 -81
- jaclang/vendor/mypy/xml/mypy-txt.xslt +0 -100
- jaclang/vendor/mypy/xml/mypy.xsd +0 -50
- jaclang/vendor/mypy-1.10.0.dist-info/LICENSE +0 -229
- jaclang/vendor/mypy-1.10.0.dist-info/METADATA +0 -48
- jaclang/vendor/mypy-1.10.0.dist-info/RECORD +0 -1241
- jaclang/vendor/mypy-1.10.0.dist-info/WHEEL +0 -6
- jaclang/vendor/mypy-1.10.0.dist-info/entry_points.txt +0 -6
- jaclang/vendor/mypy-1.10.0.dist-info/top_level.txt +0 -3
- jaclang/vendor/mypy_extensions-1.0.0.dist-info/LICENSE +0 -27
- jaclang/vendor/mypy_extensions-1.0.0.dist-info/METADATA +0 -29
- jaclang/vendor/mypy_extensions-1.0.0.dist-info/RECORD +0 -6
- jaclang/vendor/mypy_extensions-1.0.0.dist-info/top_level.txt +0 -1
- jaclang/vendor/mypy_extensions.py +0 -213
- jaclang/vendor/mypyc/README.md +0 -133
- jaclang/vendor/mypyc/__init__.py +0 -0
- jaclang/vendor/mypyc/__main__.py +0 -57
- jaclang/vendor/mypyc/analysis/__init__.py +0 -0
- jaclang/vendor/mypyc/analysis/attrdefined.py +0 -436
- jaclang/vendor/mypyc/analysis/blockfreq.py +0 -32
- jaclang/vendor/mypyc/analysis/dataflow.py +0 -628
- jaclang/vendor/mypyc/analysis/ircheck.py +0 -433
- jaclang/vendor/mypyc/analysis/selfleaks.py +0 -211
- jaclang/vendor/mypyc/build.py +0 -616
- jaclang/vendor/mypyc/codegen/__init__.py +0 -0
- jaclang/vendor/mypyc/codegen/cstring.py +0 -54
- jaclang/vendor/mypyc/codegen/emit.py +0 -1193
- jaclang/vendor/mypyc/codegen/emitclass.py +0 -1060
- jaclang/vendor/mypyc/codegen/emitfunc.py +0 -852
- jaclang/vendor/mypyc/codegen/emitmodule.py +0 -1136
- jaclang/vendor/mypyc/codegen/emitwrapper.py +0 -979
- jaclang/vendor/mypyc/codegen/literals.py +0 -302
- jaclang/vendor/mypyc/common.py +0 -136
- jaclang/vendor/mypyc/crash.py +0 -31
- jaclang/vendor/mypyc/doc/Makefile +0 -20
- jaclang/vendor/mypyc/doc/bool_operations.rst +0 -27
- jaclang/vendor/mypyc/doc/compilation_units.rst +0 -20
- jaclang/vendor/mypyc/doc/conf.py +0 -59
- jaclang/vendor/mypyc/doc/cpython-timings.md +0 -25
- jaclang/vendor/mypyc/doc/dev-intro.md +0 -548
- jaclang/vendor/mypyc/doc/dict_operations.rst +0 -59
- jaclang/vendor/mypyc/doc/differences_from_python.rst +0 -332
- jaclang/vendor/mypyc/doc/float_operations.rst +0 -50
- jaclang/vendor/mypyc/doc/future.md +0 -42
- jaclang/vendor/mypyc/doc/getting_started.rst +0 -240
- jaclang/vendor/mypyc/doc/index.rst +0 -61
- jaclang/vendor/mypyc/doc/int_operations.rst +0 -162
- jaclang/vendor/mypyc/doc/introduction.rst +0 -150
- jaclang/vendor/mypyc/doc/list_operations.rst +0 -65
- jaclang/vendor/mypyc/doc/make.bat +0 -35
- jaclang/vendor/mypyc/doc/native_classes.rst +0 -206
- jaclang/vendor/mypyc/doc/native_operations.rst +0 -55
- jaclang/vendor/mypyc/doc/performance_tips_and_tricks.rst +0 -244
- jaclang/vendor/mypyc/doc/set_operations.rst +0 -47
- jaclang/vendor/mypyc/doc/str_operations.rst +0 -35
- jaclang/vendor/mypyc/doc/tuple_operations.rst +0 -33
- jaclang/vendor/mypyc/doc/using_type_annotations.rst +0 -398
- jaclang/vendor/mypyc/errors.py +0 -29
- jaclang/vendor/mypyc/external/googletest/LICENSE +0 -28
- jaclang/vendor/mypyc/external/googletest/README.md +0 -280
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-death-test.h +0 -294
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-message.h +0 -250
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-param-test.h +0 -1444
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-param-test.h.pump +0 -510
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-printers.h +0 -993
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-spi.h +0 -232
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-test-part.h +0 -179
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest-typed-test.h +0 -263
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest.h +0 -2236
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest_pred_impl.h +0 -358
- jaclang/vendor/mypyc/external/googletest/include/gtest/gtest_prod.h +0 -58
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/custom/gtest-port.h +0 -69
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/custom/gtest-printers.h +0 -42
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/custom/gtest.h +0 -41
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-death-test-internal.h +0 -319
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-filepath.h +0 -206
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-internal.h +0 -1238
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-linked_ptr.h +0 -243
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-param-util-generated.h +0 -5146
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-param-util-generated.h.pump +0 -286
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-param-util.h +0 -731
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-port-arch.h +0 -93
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-port.h +0 -2560
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-string.h +0 -167
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-tuple.h +0 -1020
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-tuple.h.pump +0 -347
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-type-util.h +0 -3331
- jaclang/vendor/mypyc/external/googletest/include/gtest/internal/gtest-type-util.h.pump +0 -297
- jaclang/vendor/mypyc/external/googletest/make/Makefile +0 -61
- jaclang/vendor/mypyc/external/googletest/src/gtest-all.cc +0 -48
- jaclang/vendor/mypyc/external/googletest/src/gtest-death-test.cc +0 -1342
- jaclang/vendor/mypyc/external/googletest/src/gtest-filepath.cc +0 -387
- jaclang/vendor/mypyc/external/googletest/src/gtest-internal-inl.h +0 -1183
- jaclang/vendor/mypyc/external/googletest/src/gtest-port.cc +0 -1259
- jaclang/vendor/mypyc/external/googletest/src/gtest-printers.cc +0 -373
- jaclang/vendor/mypyc/external/googletest/src/gtest-test-part.cc +0 -110
- jaclang/vendor/mypyc/external/googletest/src/gtest-typed-test.cc +0 -118
- jaclang/vendor/mypyc/external/googletest/src/gtest.cc +0 -5388
- jaclang/vendor/mypyc/external/googletest/src/gtest_main.cc +0 -38
- jaclang/vendor/mypyc/ir/__init__.py +0 -0
- jaclang/vendor/mypyc/ir/class_ir.py +0 -499
- jaclang/vendor/mypyc/ir/func_ir.py +0 -370
- jaclang/vendor/mypyc/ir/module_ir.py +0 -88
- jaclang/vendor/mypyc/ir/ops.py +0 -1727
- jaclang/vendor/mypyc/ir/pprint.py +0 -516
- jaclang/vendor/mypyc/ir/rtypes.py +0 -1038
- jaclang/vendor/mypyc/irbuild/__init__.py +0 -0
- jaclang/vendor/mypyc/irbuild/ast_helpers.py +0 -123
- jaclang/vendor/mypyc/irbuild/builder.py +0 -1394
- jaclang/vendor/mypyc/irbuild/callable_class.py +0 -173
- jaclang/vendor/mypyc/irbuild/classdef.py +0 -850
- jaclang/vendor/mypyc/irbuild/constant_fold.py +0 -95
- jaclang/vendor/mypyc/irbuild/context.py +0 -186
- jaclang/vendor/mypyc/irbuild/env_class.py +0 -223
- jaclang/vendor/mypyc/irbuild/expression.py +0 -1070
- jaclang/vendor/mypyc/irbuild/for_helpers.py +0 -1075
- jaclang/vendor/mypyc/irbuild/format_str_tokenizer.py +0 -250
- jaclang/vendor/mypyc/irbuild/function.py +0 -1088
- jaclang/vendor/mypyc/irbuild/generator.py +0 -346
- jaclang/vendor/mypyc/irbuild/ll_builder.py +0 -2389
- jaclang/vendor/mypyc/irbuild/main.py +0 -153
- jaclang/vendor/mypyc/irbuild/mapper.py +0 -221
- jaclang/vendor/mypyc/irbuild/match.py +0 -355
- jaclang/vendor/mypyc/irbuild/nonlocalcontrol.py +0 -197
- jaclang/vendor/mypyc/irbuild/prebuildvisitor.py +0 -203
- jaclang/vendor/mypyc/irbuild/prepare.py +0 -609
- jaclang/vendor/mypyc/irbuild/specialize.py +0 -822
- jaclang/vendor/mypyc/irbuild/statement.py +0 -1017
- jaclang/vendor/mypyc/irbuild/targets.py +0 -57
- jaclang/vendor/mypyc/irbuild/util.py +0 -189
- jaclang/vendor/mypyc/irbuild/visitor.py +0 -401
- jaclang/vendor/mypyc/irbuild/vtable.py +0 -82
- jaclang/vendor/mypyc/lib-rt/CPy.h +0 -638
- jaclang/vendor/mypyc/lib-rt/bytes_ops.c +0 -143
- jaclang/vendor/mypyc/lib-rt/dict_ops.c +0 -446
- jaclang/vendor/mypyc/lib-rt/exc_ops.c +0 -259
- jaclang/vendor/mypyc/lib-rt/float_ops.c +0 -192
- jaclang/vendor/mypyc/lib-rt/generic_ops.c +0 -64
- jaclang/vendor/mypyc/lib-rt/getargs.c +0 -450
- jaclang/vendor/mypyc/lib-rt/getargsfast.c +0 -569
- jaclang/vendor/mypyc/lib-rt/init.c +0 -13
- jaclang/vendor/mypyc/lib-rt/int_ops.c +0 -803
- jaclang/vendor/mypyc/lib-rt/list_ops.c +0 -335
- jaclang/vendor/mypyc/lib-rt/misc_ops.c +0 -942
- jaclang/vendor/mypyc/lib-rt/module_shim.tmpl +0 -18
- jaclang/vendor/mypyc/lib-rt/mypyc_util.h +0 -118
- jaclang/vendor/mypyc/lib-rt/pythoncapi_compat.h +0 -497
- jaclang/vendor/mypyc/lib-rt/pythonsupport.h +0 -533
- jaclang/vendor/mypyc/lib-rt/set_ops.c +0 -17
- jaclang/vendor/mypyc/lib-rt/setup.py +0 -70
- jaclang/vendor/mypyc/lib-rt/str_ops.c +0 -241
- jaclang/vendor/mypyc/lib-rt/test_capi.cc +0 -585
- jaclang/vendor/mypyc/lib-rt/tuple_ops.c +0 -61
- jaclang/vendor/mypyc/lower/__init__.py +0 -0
- jaclang/vendor/mypyc/lower/int_ops.py +0 -113
- jaclang/vendor/mypyc/lower/list_ops.py +0 -45
- jaclang/vendor/mypyc/lower/misc_ops.py +0 -12
- jaclang/vendor/mypyc/lower/registry.py +0 -26
- jaclang/vendor/mypyc/namegen.py +0 -115
- jaclang/vendor/mypyc/options.py +0 -32
- jaclang/vendor/mypyc/primitives/__init__.py +0 -0
- jaclang/vendor/mypyc/primitives/bytes_ops.py +0 -101
- jaclang/vendor/mypyc/primitives/dict_ops.py +0 -325
- jaclang/vendor/mypyc/primitives/exc_ops.py +0 -101
- jaclang/vendor/mypyc/primitives/float_ops.py +0 -168
- jaclang/vendor/mypyc/primitives/generic_ops.py +0 -384
- jaclang/vendor/mypyc/primitives/int_ops.py +0 -303
- jaclang/vendor/mypyc/primitives/list_ops.py +0 -310
- jaclang/vendor/mypyc/primitives/misc_ops.py +0 -267
- jaclang/vendor/mypyc/primitives/registry.py +0 -360
- jaclang/vendor/mypyc/primitives/set_ops.py +0 -121
- jaclang/vendor/mypyc/primitives/str_ops.py +0 -229
- jaclang/vendor/mypyc/primitives/tuple_ops.py +0 -83
- jaclang/vendor/mypyc/rt_subtype.py +0 -77
- jaclang/vendor/mypyc/sametype.py +0 -83
- jaclang/vendor/mypyc/subtype.py +0 -88
- jaclang/vendor/mypyc/test/__init__.py +0 -0
- jaclang/vendor/mypyc/test/config.py +0 -13
- jaclang/vendor/mypyc/test/test_alwaysdefined.py +0 -46
- jaclang/vendor/mypyc/test/test_analysis.py +0 -77
- jaclang/vendor/mypyc/test/test_cheader.py +0 -53
- jaclang/vendor/mypyc/test/test_commandline.py +0 -82
- jaclang/vendor/mypyc/test/test_emit.py +0 -69
- jaclang/vendor/mypyc/test/test_emitclass.py +0 -35
- jaclang/vendor/mypyc/test/test_emitfunc.py +0 -928
- jaclang/vendor/mypyc/test/test_emitwrapper.py +0 -60
- jaclang/vendor/mypyc/test/test_exceptions.py +0 -56
- jaclang/vendor/mypyc/test/test_external.py +0 -49
- jaclang/vendor/mypyc/test/test_irbuild.py +0 -87
- jaclang/vendor/mypyc/test/test_ircheck.py +0 -199
- jaclang/vendor/mypyc/test/test_literals.py +0 -90
- jaclang/vendor/mypyc/test/test_lowering.py +0 -56
- jaclang/vendor/mypyc/test/test_namegen.py +0 -48
- jaclang/vendor/mypyc/test/test_optimizations.py +0 -68
- jaclang/vendor/mypyc/test/test_pprint.py +0 -42
- jaclang/vendor/mypyc/test/test_rarray.py +0 -48
- jaclang/vendor/mypyc/test/test_refcount.py +0 -59
- jaclang/vendor/mypyc/test/test_run.py +0 -426
- jaclang/vendor/mypyc/test/test_serialization.py +0 -108
- jaclang/vendor/mypyc/test/test_struct.py +0 -112
- jaclang/vendor/mypyc/test/test_tuplename.py +0 -33
- jaclang/vendor/mypyc/test/test_typeops.py +0 -97
- jaclang/vendor/mypyc/test/testutil.py +0 -283
- jaclang/vendor/mypyc/test-data/alwaysdefined.test +0 -732
- jaclang/vendor/mypyc/test-data/analysis.test +0 -470
- jaclang/vendor/mypyc/test-data/commandline.test +0 -245
- jaclang/vendor/mypyc/test-data/driver/driver.py +0 -48
- jaclang/vendor/mypyc/test-data/exceptions-freq.test +0 -125
- jaclang/vendor/mypyc/test-data/exceptions.test +0 -699
- jaclang/vendor/mypyc/test-data/fixtures/ir.py +0 -373
- jaclang/vendor/mypyc/test-data/fixtures/testutil.py +0 -103
- jaclang/vendor/mypyc/test-data/fixtures/typing-full.pyi +0 -169
- jaclang/vendor/mypyc/test-data/irbuild-any.test +0 -236
- jaclang/vendor/mypyc/test-data/irbuild-basic.test +0 -3399
- jaclang/vendor/mypyc/test-data/irbuild-bool.test +0 -424
- jaclang/vendor/mypyc/test-data/irbuild-bytes.test +0 -181
- jaclang/vendor/mypyc/test-data/irbuild-classes.test +0 -1302
- jaclang/vendor/mypyc/test-data/irbuild-constant-fold.test +0 -480
- jaclang/vendor/mypyc/test-data/irbuild-dict.test +0 -584
- jaclang/vendor/mypyc/test-data/irbuild-dunders.test +0 -215
- jaclang/vendor/mypyc/test-data/irbuild-float.test +0 -497
- jaclang/vendor/mypyc/test-data/irbuild-generics.test +0 -150
- jaclang/vendor/mypyc/test-data/irbuild-glue-methods.test +0 -437
- jaclang/vendor/mypyc/test-data/irbuild-i16.test +0 -526
- jaclang/vendor/mypyc/test-data/irbuild-i32.test +0 -598
- jaclang/vendor/mypyc/test-data/irbuild-i64.test +0 -2144
- jaclang/vendor/mypyc/test-data/irbuild-int.test +0 -194
- jaclang/vendor/mypyc/test-data/irbuild-isinstance.test +0 -109
- jaclang/vendor/mypyc/test-data/irbuild-lists.test +0 -513
- jaclang/vendor/mypyc/test-data/irbuild-match.test +0 -1717
- jaclang/vendor/mypyc/test-data/irbuild-math.test +0 -64
- jaclang/vendor/mypyc/test-data/irbuild-nested.test +0 -807
- jaclang/vendor/mypyc/test-data/irbuild-optional.test +0 -536
- jaclang/vendor/mypyc/test-data/irbuild-set.test +0 -806
- jaclang/vendor/mypyc/test-data/irbuild-singledispatch.test +0 -257
- jaclang/vendor/mypyc/test-data/irbuild-statements.test +0 -1060
- jaclang/vendor/mypyc/test-data/irbuild-str.test +0 -312
- jaclang/vendor/mypyc/test-data/irbuild-strip-asserts.test +0 -12
- jaclang/vendor/mypyc/test-data/irbuild-try.test +0 -523
- jaclang/vendor/mypyc/test-data/irbuild-tuple.test +0 -386
- jaclang/vendor/mypyc/test-data/irbuild-u8.test +0 -543
- jaclang/vendor/mypyc/test-data/irbuild-unreachable.test +0 -241
- jaclang/vendor/mypyc/test-data/irbuild-vectorcall.test +0 -153
- jaclang/vendor/mypyc/test-data/lowering-int.test +0 -377
- jaclang/vendor/mypyc/test-data/lowering-list.test +0 -33
- jaclang/vendor/mypyc/test-data/opt-copy-propagation.test +0 -400
- jaclang/vendor/mypyc/test-data/opt-flag-elimination.test +0 -296
- jaclang/vendor/mypyc/test-data/refcount.test +0 -1482
- jaclang/vendor/mypyc/test-data/run-async.test +0 -173
- jaclang/vendor/mypyc/test-data/run-attrs.test +0 -318
- jaclang/vendor/mypyc/test-data/run-bench.test +0 -196
- jaclang/vendor/mypyc/test-data/run-bools.test +0 -229
- jaclang/vendor/mypyc/test-data/run-bytes.test +0 -302
- jaclang/vendor/mypyc/test-data/run-classes.test +0 -2505
- jaclang/vendor/mypyc/test-data/run-dicts.test +0 -334
- jaclang/vendor/mypyc/test-data/run-dunders.test +0 -945
- jaclang/vendor/mypyc/test-data/run-exceptions.test +0 -448
- jaclang/vendor/mypyc/test-data/run-floats.test +0 -516
- jaclang/vendor/mypyc/test-data/run-functions.test +0 -1310
- jaclang/vendor/mypyc/test-data/run-generators.test +0 -682
- jaclang/vendor/mypyc/test-data/run-i16.test +0 -338
- jaclang/vendor/mypyc/test-data/run-i32.test +0 -336
- jaclang/vendor/mypyc/test-data/run-i64.test +0 -1519
- jaclang/vendor/mypyc/test-data/run-imports.test +0 -265
- jaclang/vendor/mypyc/test-data/run-integers.test +0 -540
- jaclang/vendor/mypyc/test-data/run-lists.test +0 -411
- jaclang/vendor/mypyc/test-data/run-loops.test +0 -485
- jaclang/vendor/mypyc/test-data/run-match.test +0 -283
- jaclang/vendor/mypyc/test-data/run-math.test +0 -106
- jaclang/vendor/mypyc/test-data/run-misc.test +0 -1170
- jaclang/vendor/mypyc/test-data/run-multimodule.test +0 -887
- jaclang/vendor/mypyc/test-data/run-mypy-sim.test +0 -138
- jaclang/vendor/mypyc/test-data/run-primitives.test +0 -375
- jaclang/vendor/mypyc/test-data/run-python37.test +0 -159
- jaclang/vendor/mypyc/test-data/run-python38.test +0 -88
- jaclang/vendor/mypyc/test-data/run-sets.test +0 -150
- jaclang/vendor/mypyc/test-data/run-singledispatch.test +0 -698
- jaclang/vendor/mypyc/test-data/run-strings.test +0 -641
- jaclang/vendor/mypyc/test-data/run-traits.test +0 -411
- jaclang/vendor/mypyc/test-data/run-tuples.test +0 -258
- jaclang/vendor/mypyc/test-data/run-u8.test +0 -303
- jaclang/vendor/mypyc/transform/__init__.py +0 -0
- jaclang/vendor/mypyc/transform/copy_propagation.py +0 -94
- jaclang/vendor/mypyc/transform/exceptions.py +0 -182
- jaclang/vendor/mypyc/transform/flag_elimination.py +0 -108
- jaclang/vendor/mypyc/transform/ir_transform.py +0 -368
- jaclang/vendor/mypyc/transform/lower.py +0 -33
- jaclang/vendor/mypyc/transform/refcount.py +0 -294
- jaclang/vendor/mypyc/transform/uninit.py +0 -190
- jaclang/vendor/typing_extensions-4.12.2.dist-info/LICENSE +0 -279
- jaclang/vendor/typing_extensions-4.12.2.dist-info/METADATA +0 -67
- jaclang/vendor/typing_extensions-4.12.2.dist-info/RECORD +0 -5
- jaclang/vendor/typing_extensions-4.12.2.dist-info/WHEEL +0 -4
- jaclang/vendor/typing_extensions.py +0 -3641
- jaclang-0.7.33.dist-info/RECORD +0 -1562
- /jaclang/{vendor/mypy/dmypy → compiler/larkparse}/__init__.py +0 -0
- /jaclang/{tests → compiler/passes/main/tests}/fixtures/access_checker.jac +0 -0
- /jaclang/{vendor/mypy/plugins/__init__.py → langserve/tests/fixtures/deep_check_crash.jac} +0 -0
- /jaclang/{vendor/mypy/server/__init__.py → langserve/tests/server_test/code_test.py} +0 -0
- /jaclang/{plugin → runtimelib}/tests/__init__.py +0 -0
- /jaclang/{plugin → runtimelib}/tests/fixtures/traversing_save.jac +0 -0
- /jaclang/{vendor/mypy/test → tests}/__init__.py +0 -0
- /jaclang/{vendor/mypy/test/meta → tests/fixtures}/__init__.py +0 -0
- /jaclang/tests/fixtures/{architype_def_bug.jac → archetype_def_bug.jac} +0 -0
- /jaclang/vendor/{mypy/typeshed/stdlib/concurrent/__init__.pyi → attrs-25.3.0.dist-info/REQUESTED} +0 -0
- /jaclang/vendor/{attrs-23.2.0.dist-info → attrs-25.3.0.dist-info}/licenses/LICENSE +0 -0
- /jaclang/vendor/{mypy/typeshed/stdlib/distutils/command/__init__.pyi → cattrs-24.1.3.dist-info/REQUESTED} +0 -0
- /jaclang/vendor/{cattrs-23.2.3.dist-info → cattrs-24.1.3.dist-info}/licenses/LICENSE +0 -0
- /jaclang/vendor/{mypy/typeshed/stdlib/distutils/command/bdist_packager.pyi → lark-1.2.2.dist-info/REQUESTED} +0 -0
- /jaclang/vendor/{lark-1.1.9.dist-info → lark-1.2.2.dist-info}/entry_points.txt +0 -0
- /jaclang/vendor/{lark-1.1.9.dist-info → lark-1.2.2.dist-info}/top_level.txt +0 -0
- /jaclang/vendor/{mypy/typeshed/stdlib/email/mime/__init__.pyi → lsprotocol-2023.0.1.dist-info/REQUESTED} +0 -0
- /jaclang/vendor/lsprotocol-2023.0.1.dist-info/{LICENSE → licenses/LICENSE} +0 -0
- /jaclang/vendor/{mypy/typeshed/stdlib/lib2to3/__init__.pyi → pluggy-1.5.0.dist-info/REQUESTED} +0 -0
- /jaclang/vendor/pluggy-1.5.0.dist-info/{LICENSE → licenses/LICENSE} +0 -0
- /jaclang/vendor/{mypy/typeshed/stdlib/lib2to3/fixes/__init__.pyi → pygls-1.3.1.dist-info/REQUESTED} +0 -0
- {jaclang-0.7.33.dist-info → jaclang-0.8.0.dist-info}/entry_points.txt +0 -0
jaclang/compiler/parser.py
CHANGED
|
@@ -5,47 +5,47 @@ from __future__ import annotations
|
|
|
5
5
|
import keyword
|
|
6
6
|
import logging
|
|
7
7
|
import os
|
|
8
|
-
from typing import Callable, TypeAlias, TypeVar
|
|
8
|
+
from typing import Callable, TYPE_CHECKING, TypeAlias, TypeVar
|
|
9
9
|
|
|
10
|
-
import jaclang.compiler.
|
|
10
|
+
import jaclang.compiler.unitree as uni
|
|
11
11
|
from jaclang.compiler import jac_lark as jl # type: ignore
|
|
12
12
|
from jaclang.compiler.constant import EdgeDir, Tokens as Tok
|
|
13
|
-
from jaclang.compiler.passes.
|
|
13
|
+
from jaclang.compiler.passes.main import Transform
|
|
14
14
|
from jaclang.vendor.lark import Lark, Transformer, Tree, logger
|
|
15
15
|
|
|
16
|
+
if TYPE_CHECKING:
|
|
17
|
+
from jaclang.compiler.program import JacProgram
|
|
16
18
|
|
|
17
|
-
T = TypeVar("T", bound=
|
|
19
|
+
T = TypeVar("T", bound=uni.UniNode)
|
|
18
20
|
|
|
19
21
|
|
|
20
|
-
class JacParser(
|
|
22
|
+
class JacParser(Transform[uni.Source, uni.Module]):
|
|
21
23
|
"""Jac Parser."""
|
|
22
24
|
|
|
23
25
|
dev_mode = False
|
|
24
26
|
|
|
25
|
-
def __init__(self,
|
|
27
|
+
def __init__(self, root_ir: uni.Source, prog: JacProgram) -> None:
|
|
26
28
|
"""Initialize parser."""
|
|
27
|
-
self.
|
|
28
|
-
self.
|
|
29
|
-
self.node_list: list[ast.AstNode] = []
|
|
29
|
+
self.mod_path = root_ir.loc.mod_path
|
|
30
|
+
self.node_list: list[uni.UniNode] = []
|
|
30
31
|
if JacParser.dev_mode:
|
|
31
32
|
JacParser.make_dev()
|
|
32
|
-
|
|
33
|
+
Transform.__init__(self, ir_in=root_ir, prog=prog)
|
|
33
34
|
|
|
34
|
-
def transform(self,
|
|
35
|
+
def transform(self, ir_in: uni.Source) -> uni.Module:
|
|
35
36
|
"""Transform input IR."""
|
|
36
37
|
try:
|
|
37
|
-
tree, comments = JacParser.parse(
|
|
38
|
-
self.source.value, on_error=self.error_callback
|
|
39
|
-
)
|
|
38
|
+
tree, comments = JacParser.parse(ir_in.value, on_error=self.error_callback)
|
|
40
39
|
mod = JacParser.TreeToAST(parser=self).transform(tree)
|
|
41
|
-
|
|
42
|
-
if isinstance(mod,
|
|
40
|
+
ir_in.comments = [self.proc_comment(i, mod) for i in comments]
|
|
41
|
+
if isinstance(mod, uni.Module):
|
|
42
|
+
self.ir_out = mod
|
|
43
43
|
return mod
|
|
44
44
|
else:
|
|
45
45
|
raise self.ice()
|
|
46
46
|
except jl.UnexpectedInput as e:
|
|
47
|
-
catch_error =
|
|
48
|
-
catch_error.orig_src =
|
|
47
|
+
catch_error = uni.EmptyToken()
|
|
48
|
+
catch_error.orig_src = ir_in
|
|
49
49
|
catch_error.line_no = e.line
|
|
50
50
|
catch_error.end_line = e.line
|
|
51
51
|
catch_error.c_start = e.column
|
|
@@ -56,25 +56,17 @@ class JacParser(Pass):
|
|
|
56
56
|
error_msg = "Syntax Error"
|
|
57
57
|
if len(e.args) >= 1 and isinstance(e.args[0], str):
|
|
58
58
|
error_msg += e.args[0]
|
|
59
|
-
self.
|
|
59
|
+
self.log_error(error_msg, node_override=catch_error)
|
|
60
60
|
|
|
61
61
|
except Exception as e:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return
|
|
65
|
-
name="",
|
|
66
|
-
source=self.source,
|
|
67
|
-
doc=None,
|
|
68
|
-
body=[],
|
|
69
|
-
terminals=[],
|
|
70
|
-
is_imported=False,
|
|
71
|
-
kid=[ast.EmptyToken()],
|
|
72
|
-
)
|
|
62
|
+
raise e
|
|
63
|
+
|
|
64
|
+
return uni.Module.make_stub(inject_src=ir_in)
|
|
73
65
|
|
|
74
66
|
@staticmethod
|
|
75
|
-
def proc_comment(token: jl.Token, mod:
|
|
67
|
+
def proc_comment(token: jl.Token, mod: uni.UniNode) -> uni.CommentToken:
|
|
76
68
|
"""Process comment."""
|
|
77
|
-
return
|
|
69
|
+
return uni.CommentToken(
|
|
78
70
|
orig_src=mod.loc.orig_src,
|
|
79
71
|
name=token.type,
|
|
80
72
|
value=token.value,
|
|
@@ -116,13 +108,13 @@ class JacParser(Pass):
|
|
|
116
108
|
debug=True,
|
|
117
109
|
lexer_callbacks={"COMMENT": JacParser._comment_callback},
|
|
118
110
|
)
|
|
119
|
-
JacParser.JacTransformer = Transformer[Tree[str],
|
|
111
|
+
JacParser.JacTransformer = Transformer[Tree[str], uni.UniNode] # type: ignore
|
|
120
112
|
logger.setLevel(logging.DEBUG)
|
|
121
113
|
|
|
122
114
|
comment_cache: list[jl.Token] = []
|
|
123
115
|
|
|
124
116
|
parser = jl.Lark_StandAlone(lexer_callbacks={"COMMENT": _comment_callback}) # type: ignore
|
|
125
|
-
JacTransformer: TypeAlias = jl.Transformer[jl.Tree[str],
|
|
117
|
+
JacTransformer: TypeAlias = jl.Transformer[jl.Tree[str], uni.UniNode]
|
|
126
118
|
|
|
127
119
|
class TreeToAST(JacTransformer):
|
|
128
120
|
"""Transform parse tree to AST."""
|
|
@@ -131,15 +123,15 @@ class JacParser(Pass):
|
|
|
131
123
|
"""Initialize transformer."""
|
|
132
124
|
super().__init__(*args, **kwargs)
|
|
133
125
|
self.parse_ref = parser
|
|
134
|
-
self.terminals: list[
|
|
126
|
+
self.terminals: list[uni.Token] = []
|
|
135
127
|
# TODO: Once the kid is removed from the ast, we can get rid of this
|
|
136
128
|
# node_idx and directly pop(0) kid as we process the nodes.
|
|
137
129
|
self.node_idx = 0
|
|
138
|
-
self.cur_nodes: list[
|
|
130
|
+
self.cur_nodes: list[uni.UniNode] = []
|
|
139
131
|
|
|
140
132
|
def ice(self) -> Exception:
|
|
141
133
|
"""Raise internal compiler error."""
|
|
142
|
-
self.parse_ref.
|
|
134
|
+
self.parse_ref.log_error("Internal Compiler Error, Invalid Parse Tree!")
|
|
143
135
|
return RuntimeError(
|
|
144
136
|
f"{self.parse_ref.__class__.__name__} - Internal Compiler Error, Invalid Parse Tree!"
|
|
145
137
|
)
|
|
@@ -151,8 +143,8 @@ class JacParser(Pass):
|
|
|
151
143
|
return node
|
|
152
144
|
|
|
153
145
|
def _call_userfunc(
|
|
154
|
-
self, tree: jl.Tree, new_children: None | list[
|
|
155
|
-
) ->
|
|
146
|
+
self, tree: jl.Tree, new_children: None | list[uni.UniNode] = None
|
|
147
|
+
) -> uni.UniNode:
|
|
156
148
|
self.cur_nodes = new_children or tree.children # type: ignore[assignment]
|
|
157
149
|
try:
|
|
158
150
|
return self._node_update(super()._call_userfunc(tree, new_children))
|
|
@@ -160,21 +152,21 @@ class JacParser(Pass):
|
|
|
160
152
|
self.cur_nodes = []
|
|
161
153
|
self.node_idx = 0
|
|
162
154
|
|
|
163
|
-
def _call_userfunc_token(self, token: jl.Token) ->
|
|
155
|
+
def _call_userfunc_token(self, token: jl.Token) -> uni.UniNode:
|
|
164
156
|
return self._node_update(super()._call_userfunc_token(token))
|
|
165
157
|
|
|
166
|
-
def _binary_expr_unwind(self, kid: list[
|
|
158
|
+
def _binary_expr_unwind(self, kid: list[uni.UniNode]) -> uni.Expr:
|
|
167
159
|
"""Binary expression helper."""
|
|
168
160
|
if len(kid) > 1:
|
|
169
161
|
if (
|
|
170
|
-
isinstance(kid[0],
|
|
162
|
+
isinstance(kid[0], uni.Expr)
|
|
171
163
|
and isinstance(
|
|
172
164
|
kid[1],
|
|
173
|
-
(
|
|
165
|
+
(uni.Token, uni.DisconnectOp, uni.ConnectOp),
|
|
174
166
|
)
|
|
175
|
-
and isinstance(kid[2],
|
|
167
|
+
and isinstance(kid[2], uni.Expr)
|
|
176
168
|
):
|
|
177
|
-
return
|
|
169
|
+
return uni.BinaryExpr(
|
|
178
170
|
left=kid[0],
|
|
179
171
|
op=kid[1],
|
|
180
172
|
right=kid[2],
|
|
@@ -182,7 +174,7 @@ class JacParser(Pass):
|
|
|
182
174
|
)
|
|
183
175
|
else:
|
|
184
176
|
raise self.ice()
|
|
185
|
-
elif isinstance(kid[0],
|
|
177
|
+
elif isinstance(kid[0], uni.Expr):
|
|
186
178
|
return kid[0]
|
|
187
179
|
else:
|
|
188
180
|
raise self.ice()
|
|
@@ -206,9 +198,9 @@ class JacParser(Pass):
|
|
|
206
198
|
return node
|
|
207
199
|
raise self.ice()
|
|
208
200
|
|
|
209
|
-
def match_token(self, tok: Tok) ->
|
|
201
|
+
def match_token(self, tok: Tok) -> uni.Token | None:
|
|
210
202
|
"""Match a token with the given type and return it."""
|
|
211
|
-
if token := self.match(
|
|
203
|
+
if token := self.match(uni.Token):
|
|
212
204
|
if token.name == tok.name:
|
|
213
205
|
return token
|
|
214
206
|
self.node_idx -= (
|
|
@@ -216,7 +208,7 @@ class JacParser(Pass):
|
|
|
216
208
|
)
|
|
217
209
|
return None
|
|
218
210
|
|
|
219
|
-
def consume_token(self, tok: Tok) ->
|
|
211
|
+
def consume_token(self, tok: Tok) -> uni.Token:
|
|
220
212
|
"""Consume a token with the given type and return it."""
|
|
221
213
|
if token := self.match_token(tok):
|
|
222
214
|
return token
|
|
@@ -224,14 +216,14 @@ class JacParser(Pass):
|
|
|
224
216
|
|
|
225
217
|
def match_many(self, ty: type[T]) -> list[T]:
|
|
226
218
|
"""Match 0 or more of the given type and return the list."""
|
|
227
|
-
nodes: list[
|
|
219
|
+
nodes: list[uni.UniNode] = []
|
|
228
220
|
while node := self.match(ty):
|
|
229
221
|
nodes.append(node)
|
|
230
222
|
return nodes # type: ignore[return-value]
|
|
231
223
|
|
|
232
224
|
def consume_many(self, ty: type[T]) -> list[T]:
|
|
233
225
|
"""Match 1 or more of the given type and return the list."""
|
|
234
|
-
nodes: list[
|
|
226
|
+
nodes: list[uni.UniNode] = [self.consume(ty)]
|
|
235
227
|
while node := self.match(ty):
|
|
236
228
|
nodes.append(node)
|
|
237
229
|
return nodes # type: ignore[return-value]
|
|
@@ -240,175 +232,186 @@ class JacParser(Pass):
|
|
|
240
232
|
# Parsing Rules #
|
|
241
233
|
# ******************************************************************* #
|
|
242
234
|
|
|
243
|
-
def start(self, _: None) ->
|
|
235
|
+
def start(self, _: None) -> uni.Module:
|
|
244
236
|
"""Grammar rule.
|
|
245
237
|
|
|
246
238
|
start: module
|
|
247
239
|
"""
|
|
248
|
-
module = self.consume(
|
|
240
|
+
module = self.consume(uni.Module)
|
|
249
241
|
module._in_mod_nodes = self.parse_ref.node_list
|
|
250
242
|
return module
|
|
251
243
|
|
|
252
|
-
def module(self, _: None) ->
|
|
244
|
+
def module(self, _: None) -> uni.Module:
|
|
253
245
|
"""Grammar rule.
|
|
254
246
|
|
|
255
247
|
module: (toplevel_stmt (tl_stmt_with_doc | toplevel_stmt)*)?
|
|
256
248
|
| STRING (tl_stmt_with_doc | toplevel_stmt)*
|
|
257
249
|
"""
|
|
258
|
-
doc = self.match(
|
|
259
|
-
body = self.match_many(
|
|
260
|
-
mod =
|
|
250
|
+
doc = self.match(uni.String)
|
|
251
|
+
body = self.match_many(uni.ElementStmt)
|
|
252
|
+
mod = uni.Module(
|
|
261
253
|
name=self.parse_ref.mod_path.split(os.path.sep)[-1].rstrip(".jac"),
|
|
262
|
-
source=self.parse_ref.
|
|
254
|
+
source=self.parse_ref.ir_in,
|
|
263
255
|
doc=doc,
|
|
264
256
|
body=body,
|
|
265
|
-
is_imported=False,
|
|
266
257
|
terminals=self.terminals,
|
|
267
258
|
kid=(
|
|
268
259
|
self.cur_nodes
|
|
269
|
-
or [
|
|
260
|
+
or [uni.EmptyToken(uni.Source("", self.parse_ref.mod_path))]
|
|
270
261
|
),
|
|
271
262
|
)
|
|
272
263
|
return mod
|
|
273
264
|
|
|
274
|
-
def tl_stmt_with_doc(self, _: None) ->
|
|
265
|
+
def tl_stmt_with_doc(self, _: None) -> uni.ElementStmt:
|
|
275
266
|
"""Grammar rule.
|
|
276
267
|
|
|
277
|
-
tl_stmt_with_doc:
|
|
268
|
+
tl_stmt_with_doc: STRING toplevel_stmt
|
|
278
269
|
"""
|
|
279
|
-
doc = self.consume(
|
|
280
|
-
element = self.consume(
|
|
270
|
+
doc = self.consume(uni.String)
|
|
271
|
+
element = self.consume(uni.ElementStmt)
|
|
281
272
|
element.doc = doc
|
|
282
273
|
element.add_kids_left([doc])
|
|
283
274
|
return element
|
|
284
275
|
|
|
285
|
-
def toplevel_stmt(self, _: None) ->
|
|
276
|
+
def toplevel_stmt(self, _: None) -> uni.ElementStmt:
|
|
286
277
|
"""Grammar rule.
|
|
287
278
|
|
|
288
|
-
|
|
289
|
-
|
|
|
279
|
+
toplevel_stmt: import_stmt
|
|
280
|
+
| archetype
|
|
290
281
|
| ability
|
|
291
|
-
|
|
|
282
|
+
| global_var
|
|
292
283
|
| free_code
|
|
284
|
+
| py_code_block
|
|
293
285
|
| test
|
|
294
|
-
| global_var
|
|
295
286
|
"""
|
|
296
|
-
return self.consume(
|
|
287
|
+
return self.consume(uni.ElementStmt)
|
|
297
288
|
|
|
298
|
-
def global_var(self, _: None) ->
|
|
289
|
+
def global_var(self, _: None) -> uni.GlobalVars:
|
|
299
290
|
"""Grammar rule.
|
|
300
291
|
|
|
301
292
|
global_var: (KW_LET | KW_GLOBAL) access_tag? assignment_list SEMI
|
|
302
293
|
"""
|
|
303
|
-
is_frozen = self.consume(
|
|
304
|
-
access_tag = self.match(
|
|
305
|
-
assignments = self.consume(
|
|
306
|
-
return
|
|
294
|
+
is_frozen = self.consume(uni.Token).name == Tok.KW_LET
|
|
295
|
+
access_tag = self.match(uni.SubTag)
|
|
296
|
+
assignments = self.consume(uni.SubNodeList)
|
|
297
|
+
return uni.GlobalVars(
|
|
307
298
|
access=access_tag,
|
|
308
299
|
assignments=assignments,
|
|
309
300
|
is_frozen=is_frozen,
|
|
310
301
|
kid=self.cur_nodes,
|
|
311
302
|
)
|
|
312
303
|
|
|
313
|
-
def access_tag(self, _: None) ->
|
|
304
|
+
def access_tag(self, _: None) -> uni.SubTag[uni.Token]:
|
|
314
305
|
"""Grammar rule.
|
|
315
306
|
|
|
316
307
|
access_tag: COLON ( KW_PROT | KW_PUB | KW_PRIV )
|
|
317
308
|
"""
|
|
318
309
|
self.consume_token(Tok.COLON)
|
|
319
|
-
access = self.consume(
|
|
320
|
-
return
|
|
310
|
+
access = self.consume(uni.Token)
|
|
311
|
+
return uni.SubTag[uni.Token](tag=access, kid=self.cur_nodes)
|
|
321
312
|
|
|
322
|
-
def test(self, _: None) ->
|
|
313
|
+
def test(self, _: None) -> uni.Test:
|
|
323
314
|
"""Grammar rule.
|
|
324
315
|
|
|
325
316
|
test: KW_TEST NAME? code_block
|
|
326
317
|
"""
|
|
327
318
|
# Q(thakee): Why the name should be KW_TEST if no name present?
|
|
328
319
|
test_tok = self.consume_token(Tok.KW_TEST)
|
|
329
|
-
name = self.match(
|
|
330
|
-
codeblock = self.consume(
|
|
331
|
-
return
|
|
320
|
+
name = self.match(uni.Name) or test_tok
|
|
321
|
+
codeblock = self.consume(uni.SubNodeList)
|
|
322
|
+
return uni.Test(
|
|
332
323
|
name=name,
|
|
333
324
|
body=codeblock,
|
|
334
325
|
kid=self.cur_nodes,
|
|
335
326
|
)
|
|
336
327
|
|
|
337
|
-
def free_code(self, _: None) ->
|
|
328
|
+
def free_code(self, _: None) -> uni.ModuleCode:
|
|
338
329
|
"""Grammar rule.
|
|
339
330
|
|
|
340
|
-
free_code: KW_WITH KW_ENTRY
|
|
331
|
+
free_code: KW_WITH KW_ENTRY (COLON NAME)? code_block
|
|
341
332
|
"""
|
|
342
333
|
self.consume_token(Tok.KW_WITH)
|
|
343
334
|
self.consume_token(Tok.KW_ENTRY)
|
|
344
|
-
name =
|
|
345
|
-
|
|
346
|
-
|
|
335
|
+
name = None
|
|
336
|
+
if self.match_token(Tok.COLON):
|
|
337
|
+
name = self.consume(uni.Name)
|
|
338
|
+
codeblock = self.consume(uni.SubNodeList)
|
|
339
|
+
return uni.ModuleCode(
|
|
347
340
|
name=name,
|
|
348
341
|
body=codeblock,
|
|
349
342
|
kid=self.cur_nodes,
|
|
350
343
|
)
|
|
351
344
|
|
|
352
|
-
def py_code_block(self, _: None) ->
|
|
345
|
+
def py_code_block(self, _: None) -> uni.PyInlineCode:
|
|
353
346
|
"""Grammar rule.
|
|
354
347
|
|
|
355
348
|
py_code_block: PYNLINE
|
|
356
349
|
"""
|
|
357
350
|
pyinline = self.consume_token(Tok.PYNLINE)
|
|
358
|
-
return
|
|
351
|
+
return uni.PyInlineCode(
|
|
359
352
|
code=pyinline,
|
|
360
353
|
kid=self.cur_nodes,
|
|
361
354
|
)
|
|
362
355
|
|
|
363
|
-
def import_stmt(self, _: None) ->
|
|
356
|
+
def import_stmt(self, _: None) -> uni.Import:
|
|
364
357
|
"""Grammar rule.
|
|
365
358
|
|
|
366
|
-
import_stmt: KW_IMPORT
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
359
|
+
import_stmt: KW_IMPORT KW_FROM from_path LBRACE import_items RBRACE
|
|
360
|
+
| KW_IMPORT KW_FROM from_path COMMA import_items SEMI //Deprecated
|
|
361
|
+
| KW_IMPORT import_path (COMMA import_path)* SEMI
|
|
362
|
+
| KW_INCLUDE import_path SEMI
|
|
370
363
|
"""
|
|
371
|
-
if import_stmt := self.match(ast.Import): # Include Statement.
|
|
372
|
-
return import_stmt
|
|
373
|
-
|
|
374
364
|
# TODO: kid will be removed so let's keep as it is for now.
|
|
375
365
|
kid = self.cur_nodes
|
|
376
366
|
|
|
377
|
-
|
|
367
|
+
if self.match_token(Tok.KW_INCLUDE):
|
|
368
|
+
# Handle include statement
|
|
369
|
+
import_path_obj = self.consume(uni.ModulePath)
|
|
370
|
+
items = uni.SubNodeList[uni.ModulePath](
|
|
371
|
+
items=[import_path_obj], delim=Tok.COMMA, kid=[import_path_obj]
|
|
372
|
+
)
|
|
373
|
+
kid = (kid[:1]) + [items] + kid[-1:] # TODO: Will be removed.
|
|
374
|
+
self.consume_token(Tok.SEMI)
|
|
375
|
+
return uni.Import(
|
|
376
|
+
from_loc=None,
|
|
377
|
+
items=items,
|
|
378
|
+
is_absorb=True,
|
|
379
|
+
kid=kid,
|
|
380
|
+
)
|
|
381
|
+
|
|
382
|
+
from_path: uni.ModulePath | None = None
|
|
378
383
|
self.consume_token(Tok.KW_IMPORT)
|
|
379
|
-
lang = self.match(ast.SubTag)
|
|
380
384
|
|
|
381
385
|
if self.match_token(Tok.KW_FROM):
|
|
382
|
-
from_path = self.consume(
|
|
383
|
-
self.consume(
|
|
384
|
-
items = self.consume(
|
|
385
|
-
if self.consume(
|
|
386
|
-
self.parse_ref.
|
|
386
|
+
from_path = self.consume(uni.ModulePath)
|
|
387
|
+
self.consume(uni.Token) # LBRACE or COMMA
|
|
388
|
+
items = self.consume(uni.SubNodeList)
|
|
389
|
+
if self.consume(uni.Token).name == Tok.SEMI: # RBRACE or SEMI
|
|
390
|
+
self.parse_ref.log_warning(
|
|
387
391
|
"Deprecated syntax, use braces for multiple imports (e.g, import from mymod {a, b, c})",
|
|
388
392
|
)
|
|
389
393
|
else:
|
|
390
|
-
paths = [self.consume(
|
|
394
|
+
paths = [self.consume(uni.ModulePath)]
|
|
391
395
|
while self.match_token(Tok.COMMA):
|
|
392
|
-
paths.append(self.consume(
|
|
396
|
+
paths.append(self.consume(uni.ModulePath))
|
|
393
397
|
self.consume_token(Tok.SEMI)
|
|
394
|
-
items =
|
|
398
|
+
items = uni.SubNodeList[uni.ModulePath](
|
|
395
399
|
items=paths,
|
|
396
400
|
delim=Tok.COMMA,
|
|
397
401
|
# TODO: kid will be removed so let's keep as it is for now.
|
|
398
|
-
kid=self.cur_nodes[
|
|
402
|
+
kid=self.cur_nodes[1:-1],
|
|
399
403
|
)
|
|
400
|
-
kid =
|
|
404
|
+
kid = kid[:1] + [items] + kid[-1:]
|
|
401
405
|
|
|
402
406
|
is_absorb = False
|
|
403
|
-
return
|
|
404
|
-
hint=lang,
|
|
407
|
+
return uni.Import(
|
|
405
408
|
from_loc=from_path,
|
|
406
409
|
items=items,
|
|
407
410
|
is_absorb=is_absorb,
|
|
408
411
|
kid=kid,
|
|
409
412
|
)
|
|
410
413
|
|
|
411
|
-
def from_path(self, _: None) ->
|
|
414
|
+
def from_path(self, _: None) -> uni.ModulePath:
|
|
412
415
|
"""Grammar rule.
|
|
413
416
|
|
|
414
417
|
from_path: (DOT | ELLIPSIS)* import_path
|
|
@@ -422,124 +425,168 @@ class JacParser(Pass):
|
|
|
422
425
|
level += 3
|
|
423
426
|
else:
|
|
424
427
|
break
|
|
425
|
-
if import_path := self.match(
|
|
426
|
-
kids = [i for i in self.cur_nodes if isinstance(i,
|
|
428
|
+
if import_path := self.match(uni.ModulePath):
|
|
429
|
+
kids = [i for i in self.cur_nodes if isinstance(i, uni.Token)]
|
|
427
430
|
import_path.level = level
|
|
428
431
|
import_path.add_kids_left(kids)
|
|
429
432
|
return import_path
|
|
430
433
|
|
|
431
|
-
return
|
|
434
|
+
return uni.ModulePath(
|
|
432
435
|
path=None,
|
|
433
436
|
level=level,
|
|
434
437
|
alias=None,
|
|
435
438
|
kid=self.cur_nodes,
|
|
436
439
|
)
|
|
437
440
|
|
|
438
|
-
def
|
|
441
|
+
def import_path(self, _: None) -> uni.ModulePath:
|
|
439
442
|
"""Grammar rule.
|
|
440
443
|
|
|
441
|
-
|
|
444
|
+
import_path: dotted_name (KW_AS NAME)?
|
|
442
445
|
"""
|
|
443
|
-
|
|
444
|
-
self.
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
kid = (
|
|
451
|
-
(kid[:2] if lang else kid[:1]) + [items] + kid[-1:]
|
|
452
|
-
) # TODO: Will be removed.
|
|
453
|
-
is_absorb = True
|
|
454
|
-
return ast.Import(
|
|
455
|
-
hint=lang,
|
|
456
|
-
from_loc=None,
|
|
457
|
-
items=items,
|
|
458
|
-
is_absorb=is_absorb,
|
|
459
|
-
kid=kid,
|
|
446
|
+
valid_path = self.consume(uni.SubNodeList)
|
|
447
|
+
alias = self.consume(uni.Name) if self.match_token(Tok.KW_AS) else None
|
|
448
|
+
return uni.ModulePath(
|
|
449
|
+
path=valid_path,
|
|
450
|
+
level=0,
|
|
451
|
+
alias=alias,
|
|
452
|
+
kid=self.cur_nodes,
|
|
460
453
|
)
|
|
461
454
|
|
|
462
|
-
def
|
|
455
|
+
def dotted_name(self, _: None) -> uni.SubNodeList[uni.Name]:
|
|
463
456
|
"""Grammar rule.
|
|
464
457
|
|
|
465
|
-
|
|
458
|
+
dotted_name: named_ref (DOT named_ref)*
|
|
466
459
|
"""
|
|
467
|
-
valid_path = [self.consume(
|
|
460
|
+
valid_path = [self.consume(uni.Name)]
|
|
468
461
|
while self.match_token(Tok.DOT):
|
|
469
|
-
valid_path.append(self.consume(
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
level=0,
|
|
474
|
-
alias=alias,
|
|
462
|
+
valid_path.append(self.consume(uni.Name))
|
|
463
|
+
return uni.SubNodeList[uni.Name](
|
|
464
|
+
items=valid_path,
|
|
465
|
+
delim=Tok.DOT,
|
|
475
466
|
kid=self.cur_nodes,
|
|
476
467
|
)
|
|
477
468
|
|
|
478
|
-
def import_items(self, _: None) ->
|
|
469
|
+
def import_items(self, _: None) -> uni.SubNodeList[uni.ModuleItem]:
|
|
479
470
|
"""Grammar rule.
|
|
480
471
|
|
|
481
472
|
import_items: (import_item COMMA)* import_item COMMA?
|
|
482
473
|
"""
|
|
483
|
-
items = [self.consume(
|
|
474
|
+
items = [self.consume(uni.ModuleItem)]
|
|
484
475
|
while self.match_token(Tok.COMMA):
|
|
485
|
-
if module_item := self.match(
|
|
476
|
+
if module_item := self.match(uni.ModuleItem):
|
|
486
477
|
items.append(module_item)
|
|
487
|
-
ret =
|
|
478
|
+
ret = uni.SubNodeList[uni.ModuleItem](
|
|
488
479
|
items=items,
|
|
489
480
|
delim=Tok.COMMA,
|
|
490
481
|
kid=self.cur_nodes,
|
|
491
482
|
)
|
|
492
483
|
return ret
|
|
493
484
|
|
|
494
|
-
def import_item(self, _: None) ->
|
|
485
|
+
def import_item(self, _: None) -> uni.ModuleItem:
|
|
495
486
|
"""Grammar rule.
|
|
496
487
|
|
|
497
488
|
import_item: named_ref (KW_AS NAME)?
|
|
498
489
|
"""
|
|
499
|
-
name = self.consume(
|
|
500
|
-
alias = self.consume(
|
|
501
|
-
return
|
|
490
|
+
name = self.consume(uni.Name)
|
|
491
|
+
alias = self.consume(uni.Name) if self.match_token(Tok.KW_AS) else None
|
|
492
|
+
return uni.ModuleItem(
|
|
502
493
|
name=name,
|
|
503
494
|
alias=alias,
|
|
504
495
|
kid=self.cur_nodes,
|
|
505
496
|
)
|
|
506
497
|
|
|
507
|
-
def
|
|
508
|
-
self, _: None
|
|
509
|
-
) -> ast.ArchSpec | ast.ArchDef | ast.Enum | ast.EnumDef:
|
|
498
|
+
def archetype(self, _: None) -> uni.ArchSpec | uni.Enum:
|
|
510
499
|
"""Grammar rule.
|
|
511
500
|
|
|
512
|
-
|
|
513
|
-
|
|
|
501
|
+
archetype: decorators? archetype_decl
|
|
502
|
+
| archetype_def
|
|
514
503
|
| enum
|
|
515
504
|
"""
|
|
516
|
-
archspec:
|
|
505
|
+
archspec: uni.ArchSpec | uni.Enum | None = None
|
|
517
506
|
|
|
518
|
-
decorators = self.match(
|
|
507
|
+
decorators = self.match(uni.SubNodeList)
|
|
508
|
+
is_async = self.match_token(Tok.KW_ASYNC)
|
|
519
509
|
if decorators is not None:
|
|
520
|
-
archspec = self.consume(
|
|
510
|
+
archspec = self.consume(uni.ArchSpec)
|
|
521
511
|
archspec.decorators = decorators
|
|
522
512
|
archspec.add_kids_left([decorators])
|
|
523
513
|
else:
|
|
524
|
-
archspec = (
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
514
|
+
archspec = self.match(uni.ArchSpec) or self.consume(uni.Enum)
|
|
515
|
+
if is_async and isinstance(archspec, uni.ArchSpec):
|
|
516
|
+
archspec.is_async = True
|
|
517
|
+
archspec.add_kids_left([is_async])
|
|
518
|
+
assert isinstance(archspec, uni.Archetype)
|
|
519
|
+
if archspec.arch_type.name != Tok.KW_WALKER:
|
|
520
|
+
self.parse_ref.log_error(
|
|
521
|
+
f"Expected async archetype to be walker, but got {archspec.arch_type.value}"
|
|
522
|
+
)
|
|
530
523
|
return archspec
|
|
531
524
|
|
|
532
|
-
def
|
|
525
|
+
def impl_def(self, _: None) -> uni.ImplDef:
|
|
526
|
+
"""Grammar rule.
|
|
527
|
+
|
|
528
|
+
impl_def: decorators? KW_IMPL dotted_name impl_spec? impl_tail
|
|
529
|
+
"""
|
|
530
|
+
decorators = self.match(uni.SubNodeList)
|
|
531
|
+
self.consume_token(Tok.KW_IMPL)
|
|
532
|
+
target = self.consume(uni.SubNodeList)
|
|
533
|
+
spec = (
|
|
534
|
+
self.match(uni.SubNodeList)
|
|
535
|
+
or self.match(uni.FuncSignature)
|
|
536
|
+
or self.match(uni.EventSignature)
|
|
537
|
+
)
|
|
538
|
+
tail = self.match(uni.SubNodeList) or self.match(uni.FuncCall)
|
|
539
|
+
valid_tail = spec if tail is None else tail
|
|
540
|
+
valid_spec = None if tail is None else spec
|
|
541
|
+
assert isinstance(valid_tail, (uni.SubNodeList, uni.FuncCall))
|
|
542
|
+
|
|
543
|
+
impl = uni.ImplDef(
|
|
544
|
+
decorators=decorators,
|
|
545
|
+
target=target,
|
|
546
|
+
spec=valid_spec,
|
|
547
|
+
body=valid_tail,
|
|
548
|
+
kid=self.cur_nodes,
|
|
549
|
+
)
|
|
550
|
+
return impl
|
|
551
|
+
|
|
552
|
+
def impl_spec(
|
|
553
|
+
self, _: None
|
|
554
|
+
) -> uni.SubNodeList[uni.Expr] | uni.FuncSignature | uni.EventSignature:
|
|
555
|
+
"""Grammar rule.
|
|
556
|
+
|
|
557
|
+
impl_spec: inherited_archs | func_decl | event_clause
|
|
558
|
+
"""
|
|
559
|
+
spec = (
|
|
560
|
+
self.match(uni.SubNodeList) # inherited_archs
|
|
561
|
+
or self.match(uni.FuncSignature) # func_decl
|
|
562
|
+
or self.consume(uni.EventSignature) # event_clause
|
|
563
|
+
)
|
|
564
|
+
return spec
|
|
565
|
+
|
|
566
|
+
def impl_tail(
|
|
567
|
+
self, _: None
|
|
568
|
+
) -> uni.SubNodeList[uni.CodeBlockStmt] | uni.FuncCall:
|
|
569
|
+
"""Grammar rule.
|
|
570
|
+
|
|
571
|
+
impl_tail: enum_block | block_tail
|
|
572
|
+
"""
|
|
573
|
+
tail = (
|
|
574
|
+
self.match(uni.SubNodeList) # enum_block
|
|
575
|
+
or self.match(uni.SubNodeList) # block_tail (code_block)
|
|
576
|
+
or self.consume(uni.FuncCall) # block_tail (KW_BY atomic_call)
|
|
577
|
+
)
|
|
578
|
+
return tail
|
|
579
|
+
|
|
580
|
+
def archetype_decl(self, _: None) -> uni.ArchSpec:
|
|
533
581
|
"""Grammar rule.
|
|
534
582
|
|
|
535
|
-
|
|
583
|
+
archetype_decl: arch_type access_tag? NAME inherited_archs? (member_block | SEMI)
|
|
536
584
|
"""
|
|
537
|
-
arch_type = self.consume(
|
|
538
|
-
access = self.match(
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
sub_list2 = self.match(ast.SubNodeList)
|
|
585
|
+
arch_type = self.consume(uni.Token)
|
|
586
|
+
access = self.match(uni.SubTag)
|
|
587
|
+
name = self.consume(uni.Name)
|
|
588
|
+
sub_list1 = self.match(uni.SubNodeList)
|
|
589
|
+
sub_list2 = self.match(uni.SubNodeList)
|
|
543
590
|
if self.match_token(Tok.SEMI):
|
|
544
591
|
inh, body = sub_list1, None
|
|
545
592
|
else:
|
|
@@ -547,30 +594,16 @@ class JacParser(Pass):
|
|
|
547
594
|
sub_list2 or sub_list1
|
|
548
595
|
) # if sub_list2 is None then body is sub_list1
|
|
549
596
|
inh = sub_list2 and sub_list1 # if sub_list2 is None then inh is None.
|
|
550
|
-
return
|
|
597
|
+
return uni.Archetype(
|
|
551
598
|
arch_type=arch_type,
|
|
552
599
|
name=name,
|
|
553
|
-
semstr=semstr,
|
|
554
600
|
access=access,
|
|
555
601
|
base_classes=inh,
|
|
556
602
|
body=body,
|
|
557
603
|
kid=self.cur_nodes,
|
|
558
604
|
)
|
|
559
605
|
|
|
560
|
-
def
|
|
561
|
-
"""Grammar rule.
|
|
562
|
-
|
|
563
|
-
architype_def: abil_to_arch_chain member_block
|
|
564
|
-
"""
|
|
565
|
-
archref = self.consume(ast.ArchRefChain)
|
|
566
|
-
subnodelist = self.consume(ast.SubNodeList)
|
|
567
|
-
return ast.ArchDef(
|
|
568
|
-
target=archref,
|
|
569
|
-
body=subnodelist,
|
|
570
|
-
kid=self.cur_nodes,
|
|
571
|
-
)
|
|
572
|
-
|
|
573
|
-
def arch_type(self, _: None) -> ast.Token:
|
|
606
|
+
def arch_type(self, _: None) -> uni.Token:
|
|
574
607
|
"""Grammar rule.
|
|
575
608
|
|
|
576
609
|
arch_type: KW_WALKER
|
|
@@ -578,56 +611,43 @@ class JacParser(Pass):
|
|
|
578
611
|
| KW_EDGE
|
|
579
612
|
| KW_NODE
|
|
580
613
|
"""
|
|
581
|
-
return self.consume(
|
|
614
|
+
return self.consume(uni.Token)
|
|
582
615
|
|
|
583
|
-
def decorators(self, _: None) ->
|
|
616
|
+
def decorators(self, _: None) -> uni.SubNodeList[uni.Expr]:
|
|
584
617
|
"""Grammar rule.
|
|
585
618
|
|
|
586
619
|
decorators: (DECOR_OP atomic_chain)+
|
|
587
620
|
"""
|
|
588
621
|
self.consume_token(Tok.DECOR_OP)
|
|
589
|
-
return
|
|
590
|
-
items=self.consume_many(
|
|
622
|
+
return uni.SubNodeList[uni.Expr](
|
|
623
|
+
items=self.consume_many(uni.Expr),
|
|
591
624
|
delim=Tok.DECOR_OP,
|
|
592
625
|
kid=self.cur_nodes,
|
|
593
626
|
)
|
|
594
627
|
|
|
595
|
-
def inherited_archs(self, kid: list[
|
|
628
|
+
def inherited_archs(self, kid: list[uni.UniNode]) -> uni.SubNodeList[uni.Expr]:
|
|
596
629
|
"""Grammar rule.
|
|
597
630
|
|
|
598
|
-
inherited_archs:
|
|
599
|
-
| COLON (atomic_chain COMMA)* atomic_chain COLON
|
|
631
|
+
inherited_archs: LPAREN (atomic_chain COMMA)* atomic_chain RPAREN
|
|
600
632
|
"""
|
|
601
|
-
self.match_token(Tok.
|
|
633
|
+
self.match_token(Tok.LPAREN)
|
|
602
634
|
items: list = []
|
|
603
|
-
while inherited_arch := self.match(
|
|
635
|
+
while inherited_arch := self.match(uni.Expr):
|
|
604
636
|
items.append(inherited_arch)
|
|
605
637
|
self.match_token(Tok.COMMA)
|
|
606
|
-
self.match_token(Tok.
|
|
607
|
-
return
|
|
638
|
+
self.match_token(Tok.RPAREN)
|
|
639
|
+
return uni.SubNodeList[uni.Expr](items=items, delim=Tok.COMMA, kid=kid)
|
|
608
640
|
|
|
609
|
-
def
|
|
610
|
-
"""Grammar rule.
|
|
611
|
-
|
|
612
|
-
sub_name: COLON NAME
|
|
613
|
-
"""
|
|
614
|
-
self.consume_token(Tok.COLON)
|
|
615
|
-
target = self.consume(ast.Name)
|
|
616
|
-
return ast.SubTag(
|
|
617
|
-
tag=target,
|
|
618
|
-
kid=self.cur_nodes,
|
|
619
|
-
)
|
|
620
|
-
|
|
621
|
-
def named_ref(self, _: None) -> ast.NameAtom:
|
|
641
|
+
def named_ref(self, _: None) -> uni.NameAtom:
|
|
622
642
|
"""Grammar rule.
|
|
623
643
|
|
|
624
644
|
named_ref: special_ref
|
|
625
645
|
| KWESC_NAME
|
|
626
646
|
| NAME
|
|
627
647
|
"""
|
|
628
|
-
return self.consume(
|
|
648
|
+
return self.consume(uni.NameAtom)
|
|
629
649
|
|
|
630
|
-
def special_ref(self, _: None) ->
|
|
650
|
+
def special_ref(self, _: None) -> uni.SpecialVarRef:
|
|
631
651
|
"""Grammar rule.
|
|
632
652
|
|
|
633
653
|
special_ref: KW_INIT
|
|
@@ -636,40 +656,39 @@ class JacParser(Pass):
|
|
|
636
656
|
| KW_SUPER
|
|
637
657
|
| KW_SELF
|
|
638
658
|
| KW_HERE
|
|
659
|
+
| KW_VISITOR
|
|
639
660
|
"""
|
|
640
|
-
return
|
|
661
|
+
return uni.SpecialVarRef(var=self.consume(uni.Name))
|
|
641
662
|
|
|
642
|
-
def enum(self, _: None) ->
|
|
663
|
+
def enum(self, _: None) -> uni.Enum:
|
|
643
664
|
"""Grammar rule.
|
|
644
665
|
|
|
645
666
|
enum: decorators? enum_decl
|
|
646
667
|
| enum_def
|
|
647
668
|
"""
|
|
648
|
-
if decorator := self.match(
|
|
649
|
-
enum_decl = self.consume(
|
|
669
|
+
if decorator := self.match(uni.SubNodeList):
|
|
670
|
+
enum_decl = self.consume(uni.Enum)
|
|
650
671
|
enum_decl.decorators = decorator
|
|
651
672
|
enum_decl.add_kids_left([decorator])
|
|
652
673
|
return enum_decl
|
|
653
|
-
return self.
|
|
674
|
+
return self.consume(uni.Enum)
|
|
654
675
|
|
|
655
|
-
def enum_decl(self, _: None) ->
|
|
676
|
+
def enum_decl(self, _: None) -> uni.Enum:
|
|
656
677
|
"""Grammar rule.
|
|
657
678
|
|
|
658
679
|
enum_decl: KW_ENUM access_tag? STRING? NAME inherited_archs? (enum_block | SEMI)
|
|
659
680
|
"""
|
|
660
681
|
self.consume_token(Tok.KW_ENUM)
|
|
661
|
-
access = self.match(
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
sub_list2 = self.match(ast.SubNodeList)
|
|
682
|
+
access = self.match(uni.SubTag)
|
|
683
|
+
name = self.consume(uni.Name)
|
|
684
|
+
sub_list1 = self.match(uni.SubNodeList)
|
|
685
|
+
sub_list2 = self.match(uni.SubNodeList)
|
|
666
686
|
if self.match_token(Tok.SEMI):
|
|
667
687
|
inh, body = sub_list1, None
|
|
668
688
|
else:
|
|
669
689
|
body = sub_list2 or sub_list1
|
|
670
690
|
inh = sub_list2 and sub_list1
|
|
671
|
-
return
|
|
672
|
-
semstr=semstr,
|
|
691
|
+
return uni.Enum(
|
|
673
692
|
name=name,
|
|
674
693
|
access=access,
|
|
675
694
|
base_classes=inh,
|
|
@@ -677,323 +696,204 @@ class JacParser(Pass):
|
|
|
677
696
|
kid=self.cur_nodes,
|
|
678
697
|
)
|
|
679
698
|
|
|
680
|
-
def
|
|
699
|
+
def enum_block(self, _: None) -> uni.SubNodeList[uni.EnumBlockStmt]:
|
|
681
700
|
"""Grammar rule.
|
|
682
701
|
|
|
683
|
-
|
|
702
|
+
enum_block: LBRACE assignment_list COMMA? (py_code_block | free_code)* RBRACE
|
|
684
703
|
"""
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
)
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
while enum_stmt := self.match(ast.EnumBlockStmt):
|
|
701
|
-
enum_statements.append(enum_stmt)
|
|
702
|
-
self.match_token(Tok.COMMA)
|
|
703
|
-
self.consume_token(Tok.RBRACE)
|
|
704
|
-
return ast.SubNodeList[ast.EnumBlockStmt](
|
|
705
|
-
items=enum_statements,
|
|
706
|
-
delim=Tok.COMMA,
|
|
707
|
-
kid=self.cur_nodes,
|
|
708
|
-
)
|
|
704
|
+
left_enc = self.consume_token(Tok.LBRACE)
|
|
705
|
+
assignments = self.consume(uni.SubNodeList)
|
|
706
|
+
self.match_token(Tok.COMMA)
|
|
707
|
+
while item := self.match(uni.EnumBlockStmt):
|
|
708
|
+
assignments.add_kids_right([item])
|
|
709
|
+
assignments.items.append(item)
|
|
710
|
+
right_enc = self.consume_token(Tok.RBRACE)
|
|
711
|
+
assignments.add_kids_left([left_enc])
|
|
712
|
+
assignments.add_kids_right([right_enc])
|
|
713
|
+
assignments.left_enc = left_enc
|
|
714
|
+
assignments.right_enc = right_enc
|
|
715
|
+
for i in assignments.kid:
|
|
716
|
+
if isinstance(i, uni.Assignment):
|
|
717
|
+
i.is_enum_stmt = True
|
|
718
|
+
return assignments
|
|
709
719
|
|
|
710
|
-
def
|
|
720
|
+
def ability(self, _: None) -> uni.Ability | uni.FuncCall:
|
|
711
721
|
"""Grammar rule.
|
|
712
722
|
|
|
713
|
-
|
|
714
|
-
| NAME (COLON STRING)?
|
|
715
|
-
| py_code_block
|
|
716
|
-
| free_code
|
|
717
|
-
| abstract_ability
|
|
718
|
-
| ability
|
|
723
|
+
ability: decorators? KW_ASYNC? (ability_decl | function_decl)
|
|
719
724
|
"""
|
|
720
|
-
|
|
721
|
-
self.match(ast.PyInlineCode)
|
|
722
|
-
or self.match(ast.ModuleCode)
|
|
723
|
-
or self.match(ast.Ability)
|
|
724
|
-
):
|
|
725
|
-
return stmt
|
|
726
|
-
name = self.consume(ast.Name)
|
|
727
|
-
semstr = self.consume(ast.String) if self.match_token(Tok.COLON) else None
|
|
728
|
-
expr = self.consume(ast.Expr) if self.match_token(Tok.EQ) else None
|
|
729
|
-
targ = ast.SubNodeList[ast.Expr](items=[name], delim=Tok.COMMA, kid=[name])
|
|
730
|
-
self.cur_nodes[0] = targ
|
|
731
|
-
return ast.Assignment(
|
|
732
|
-
target=targ,
|
|
733
|
-
value=expr,
|
|
734
|
-
type_tag=None,
|
|
735
|
-
kid=self.cur_nodes,
|
|
736
|
-
semstr=semstr,
|
|
737
|
-
is_enum_stmt=True,
|
|
738
|
-
)
|
|
739
|
-
|
|
740
|
-
def ability(self, _: None) -> ast.Ability | ast.AbilityDef | ast.FuncCall:
|
|
741
|
-
"""Grammer rule.
|
|
742
|
-
|
|
743
|
-
ability: decorators? KW_ASYNC? ability_decl
|
|
744
|
-
| decorators? genai_ability
|
|
745
|
-
| ability_def
|
|
746
|
-
"""
|
|
747
|
-
ability: ast.Ability | ast.AbilityDef | None = None
|
|
748
|
-
decorators = self.match(ast.SubNodeList)
|
|
725
|
+
decorators = self.match(uni.SubNodeList)
|
|
749
726
|
is_async = self.match_token(Tok.KW_ASYNC)
|
|
750
|
-
|
|
751
|
-
|
|
727
|
+
|
|
728
|
+
# Try to match ability_decl or function_decl
|
|
729
|
+
ability = self.consume(uni.Ability)
|
|
730
|
+
if is_async and ability and isinstance(ability, uni.Ability):
|
|
752
731
|
ability.is_async = True
|
|
753
732
|
ability.add_kids_left([is_async])
|
|
754
|
-
|
|
755
|
-
ability = self.consume(ast.AbilityDef)
|
|
733
|
+
|
|
756
734
|
if decorators:
|
|
757
735
|
for dec in decorators.items:
|
|
758
736
|
if (
|
|
759
|
-
isinstance(dec,
|
|
737
|
+
isinstance(dec, uni.NameAtom)
|
|
760
738
|
and dec.sym_name == "staticmethod"
|
|
761
|
-
and isinstance(ability, (
|
|
739
|
+
and isinstance(ability, (uni.Ability))
|
|
762
740
|
):
|
|
763
|
-
|
|
741
|
+
static_kw = ability.gen_token(Tok.KW_STATIC)
|
|
742
|
+
static_kw.line_no = dec.loc.first_line
|
|
743
|
+
static_kw.c_start = dec.loc.col_start
|
|
744
|
+
static_kw.c_end = static_kw.c_start + len(static_kw.name)
|
|
764
745
|
decorators.items.remove(dec) # noqa: B038
|
|
746
|
+
if not ability.is_static:
|
|
747
|
+
ability.is_static = True
|
|
748
|
+
if not ability.is_override:
|
|
749
|
+
ability.add_kids_left([static_kw])
|
|
750
|
+
else:
|
|
751
|
+
ability.insert_kids_at_pos([static_kw], 1)
|
|
765
752
|
break
|
|
766
753
|
if decorators.items:
|
|
767
754
|
ability.decorators = decorators
|
|
768
755
|
ability.add_kids_left([decorators])
|
|
769
|
-
|
|
756
|
+
|
|
770
757
|
return ability
|
|
771
758
|
|
|
772
|
-
def ability_decl(self, _: None) ->
|
|
759
|
+
def ability_decl(self, _: None) -> uni.Ability:
|
|
773
760
|
"""Grammar rule.
|
|
774
761
|
|
|
775
|
-
ability_decl: KW_OVERRIDE? KW_STATIC? KW_CAN access_tag?
|
|
776
|
-
|
|
762
|
+
ability_decl: KW_OVERRIDE? KW_STATIC? KW_CAN access_tag? named_ref
|
|
763
|
+
event_clause (block_tail | KW_ABSTRACT? SEMI)
|
|
777
764
|
"""
|
|
778
|
-
signature: ast.FuncSignature | ast.EventSignature | None = None
|
|
779
|
-
body: ast.SubNodeList | None = None
|
|
780
765
|
is_override = self.match_token(Tok.KW_OVERRIDE) is not None
|
|
781
766
|
is_static = self.match_token(Tok.KW_STATIC) is not None
|
|
782
767
|
self.consume_token(Tok.KW_CAN)
|
|
783
|
-
access = self.match(
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
)
|
|
789
|
-
if
|
|
768
|
+
access = self.match(uni.SubTag)
|
|
769
|
+
name = self.consume(uni.NameAtom)
|
|
770
|
+
signature = self.consume(uni.EventSignature)
|
|
771
|
+
|
|
772
|
+
# Handle block_tail
|
|
773
|
+
body = self.match(uni.SubNodeList) or self.match(uni.FuncCall)
|
|
774
|
+
if body is None:
|
|
775
|
+
is_abstract = self.match_token(Tok.KW_ABSTRACT) is not None
|
|
790
776
|
self.consume_token(Tok.SEMI)
|
|
791
|
-
|
|
777
|
+
else:
|
|
778
|
+
is_abstract = False
|
|
779
|
+
|
|
780
|
+
return uni.Ability(
|
|
792
781
|
name_ref=name,
|
|
793
782
|
is_async=False,
|
|
794
783
|
is_override=is_override,
|
|
795
784
|
is_static=is_static,
|
|
796
|
-
is_abstract=
|
|
785
|
+
is_abstract=is_abstract,
|
|
797
786
|
access=access,
|
|
798
|
-
semstr=semstr,
|
|
799
787
|
signature=signature,
|
|
800
788
|
body=body,
|
|
801
789
|
kid=self.cur_nodes,
|
|
802
790
|
)
|
|
803
791
|
|
|
804
|
-
def
|
|
792
|
+
def function_decl(self, _: None) -> uni.Ability:
|
|
805
793
|
"""Grammar rule.
|
|
806
794
|
|
|
807
|
-
|
|
795
|
+
function_decl: KW_OVERRIDE? KW_STATIC? KW_DEF access_tag? named_ref
|
|
796
|
+
func_decl? (block_tail | KW_ABSTRACT? SEMI)
|
|
808
797
|
"""
|
|
809
|
-
|
|
810
|
-
signature = self.match(ast.FuncSignature) or self.consume(
|
|
811
|
-
ast.EventSignature
|
|
812
|
-
)
|
|
813
|
-
body = self.consume(ast.SubNodeList)
|
|
814
|
-
|
|
815
|
-
return ast.AbilityDef(
|
|
816
|
-
target=target,
|
|
817
|
-
signature=signature,
|
|
818
|
-
body=body,
|
|
819
|
-
kid=self.cur_nodes,
|
|
820
|
-
)
|
|
821
|
-
|
|
822
|
-
# We need separate production rule for abstract_ability because we don't
|
|
823
|
-
# want to allow regular abilities outside of classed to be abstract.
|
|
824
|
-
def abstract_ability(self, _: None) -> ast.Ability:
|
|
825
|
-
"""Grammar rule.
|
|
826
|
-
|
|
827
|
-
abstract_ability: KW_OVERRIDE? KW_STATIC? KW_CAN access_tag? STRING?
|
|
828
|
-
named_ref (func_decl | event_clause) KW_ABSTRACT SEMI
|
|
829
|
-
"""
|
|
830
|
-
signature: ast.FuncSignature | ast.EventSignature | None = None
|
|
798
|
+
# Save original kids to track tokens
|
|
831
799
|
is_override = self.match_token(Tok.KW_OVERRIDE) is not None
|
|
832
800
|
is_static = self.match_token(Tok.KW_STATIC) is not None
|
|
833
|
-
self.consume_token(Tok.
|
|
834
|
-
access = self.match(
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
)
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
is_override=is_override,
|
|
846
|
-
is_static=is_static,
|
|
847
|
-
is_abstract=True,
|
|
848
|
-
access=access,
|
|
849
|
-
semstr=semstr,
|
|
850
|
-
signature=signature,
|
|
851
|
-
body=None,
|
|
852
|
-
kid=self.cur_nodes,
|
|
853
|
-
)
|
|
854
|
-
|
|
855
|
-
def genai_ability(self, _: None) -> ast.Ability:
|
|
856
|
-
"""Grammar rule.
|
|
801
|
+
self.consume_token(Tok.KW_DEF)
|
|
802
|
+
access = self.match(uni.SubTag)
|
|
803
|
+
name = self.consume(uni.NameAtom)
|
|
804
|
+
signature = self.match(uni.FuncSignature)
|
|
805
|
+
|
|
806
|
+
# Handle block_tail
|
|
807
|
+
body = self.match(uni.SubNodeList) or self.match(uni.FuncCall)
|
|
808
|
+
if body is None:
|
|
809
|
+
is_abstract = self.match_token(Tok.KW_ABSTRACT) is not None
|
|
810
|
+
self.consume_token(Tok.SEMI)
|
|
811
|
+
else:
|
|
812
|
+
is_abstract = False
|
|
857
813
|
|
|
858
|
-
|
|
859
|
-
named_ref (func_decl) KW_BY atomic_call SEMI
|
|
860
|
-
"""
|
|
861
|
-
is_override = self.match_token(Tok.KW_OVERRIDE) is not None
|
|
862
|
-
is_static = self.match_token(Tok.KW_STATIC) is not None
|
|
863
|
-
self.consume_token(Tok.KW_CAN)
|
|
864
|
-
access = self.match(ast.SubTag)
|
|
865
|
-
semstr = self.match(ast.String)
|
|
866
|
-
name = self.consume(ast.NameAtom)
|
|
867
|
-
signature = self.match(ast.FuncSignature) or self.consume(
|
|
868
|
-
ast.EventSignature
|
|
869
|
-
)
|
|
870
|
-
self.consume_token(Tok.KW_BY)
|
|
871
|
-
body = self.consume(ast.FuncCall)
|
|
872
|
-
self.consume_token(Tok.SEMI)
|
|
873
|
-
return ast.Ability(
|
|
814
|
+
return uni.Ability(
|
|
874
815
|
name_ref=name,
|
|
875
816
|
is_async=False,
|
|
876
817
|
is_override=is_override,
|
|
877
818
|
is_static=is_static,
|
|
878
|
-
is_abstract=
|
|
819
|
+
is_abstract=is_abstract,
|
|
879
820
|
access=access,
|
|
880
|
-
semstr=semstr,
|
|
881
821
|
signature=signature,
|
|
882
822
|
body=body,
|
|
883
823
|
kid=self.cur_nodes,
|
|
884
824
|
)
|
|
885
825
|
|
|
886
|
-
def
|
|
826
|
+
def func_decl(self, _: None) -> uni.FuncSignature:
|
|
887
827
|
"""Grammar rule.
|
|
888
828
|
|
|
889
|
-
|
|
829
|
+
func_decl: (LPAREN func_decl_params? RPAREN) (RETURN_HINT expression)?
|
|
830
|
+
| (RETURN_HINT expression)
|
|
890
831
|
"""
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
self.consume_token(Tok.KW_WITH)
|
|
894
|
-
type_specs = self.match(ast.Expr)
|
|
895
|
-
event = self.match_token(Tok.KW_EXIT) or self.consume_token(Tok.KW_ENTRY)
|
|
896
|
-
if semstr := self.match(ast.String):
|
|
897
|
-
self.consume_token(Tok.RETURN_HINT)
|
|
898
|
-
return_spec = self.consume(ast.Expr)
|
|
899
|
-
return ast.EventSignature(
|
|
900
|
-
semstr=semstr,
|
|
901
|
-
event=event,
|
|
902
|
-
arch_tag_info=type_specs,
|
|
903
|
-
return_type=return_spec,
|
|
904
|
-
kid=self.cur_nodes,
|
|
905
|
-
)
|
|
832
|
+
params: uni.SubNodeList | None = None
|
|
833
|
+
return_spec: uni.Expr | None = None
|
|
906
834
|
|
|
907
|
-
|
|
908
|
-
"""Grammar rule.
|
|
909
|
-
|
|
910
|
-
func_decl: (LPAREN func_decl_params? RPAREN)? (RETURN_HINT (STRING COLON)? expression)?
|
|
911
|
-
"""
|
|
912
|
-
params: ast.SubNodeList | None = None
|
|
913
|
-
return_spec: ast.Expr | None = None
|
|
914
|
-
semstr: ast.String | None = None
|
|
915
|
-
if self.match_token(Tok.LPAREN):
|
|
916
|
-
params = self.match(ast.SubNodeList)
|
|
917
|
-
self.consume_token(Tok.RPAREN)
|
|
835
|
+
# Check if starting with RETURN_HINT
|
|
918
836
|
if self.match_token(Tok.RETURN_HINT):
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
)
|
|
931
|
-
|
|
837
|
+
return_spec = self.consume(uni.Expr)
|
|
838
|
+
return uni.FuncSignature(
|
|
839
|
+
params=None,
|
|
840
|
+
return_type=return_spec,
|
|
841
|
+
kid=self.cur_nodes,
|
|
842
|
+
)
|
|
843
|
+
# Otherwise, parse the traditional parameter list form
|
|
844
|
+
else:
|
|
845
|
+
self.consume_token(Tok.LPAREN)
|
|
846
|
+
params = self.match(uni.SubNodeList)
|
|
847
|
+
self.consume_token(Tok.RPAREN)
|
|
848
|
+
if self.match_token(Tok.RETURN_HINT):
|
|
849
|
+
return_spec = self.consume(uni.Expr)
|
|
850
|
+
return uni.FuncSignature(
|
|
851
|
+
params=params,
|
|
852
|
+
return_type=return_spec,
|
|
853
|
+
kid=self.cur_nodes,
|
|
854
|
+
)
|
|
932
855
|
|
|
933
|
-
def func_decl_params(self, _: None) ->
|
|
856
|
+
def func_decl_params(self, _: None) -> uni.SubNodeList[uni.ParamVar]:
|
|
934
857
|
"""Grammar rule.
|
|
935
858
|
|
|
936
859
|
func_decl_params: (param_var COMMA)* param_var COMMA?
|
|
937
860
|
"""
|
|
938
861
|
paramvar: list = []
|
|
939
|
-
while param_stmt := self.match(
|
|
862
|
+
while param_stmt := self.match(uni.ParamVar):
|
|
940
863
|
paramvar.append(param_stmt)
|
|
941
864
|
self.match_token(Tok.COMMA)
|
|
942
|
-
return
|
|
865
|
+
return uni.SubNodeList[uni.ParamVar](
|
|
943
866
|
items=paramvar,
|
|
944
867
|
delim=Tok.COMMA,
|
|
945
868
|
kid=self.cur_nodes,
|
|
946
869
|
)
|
|
947
870
|
|
|
948
|
-
def param_var(self,
|
|
871
|
+
def param_var(self, _: None) -> uni.ParamVar:
|
|
949
872
|
"""Grammar rule.
|
|
950
873
|
|
|
951
|
-
param_var: (STAR_POW | STAR_MUL)? NAME
|
|
874
|
+
param_var: (STAR_POW | STAR_MUL)? NAME type_tag (EQ expression)?
|
|
952
875
|
"""
|
|
953
|
-
star = (
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
semstr = (
|
|
964
|
-
kid[3]
|
|
965
|
-
if star and len(kid) > 3 and isinstance(kid[3], ast.String)
|
|
966
|
-
else (
|
|
967
|
-
kid[2]
|
|
968
|
-
if len(kid) > 4 and value and isinstance(kid[2], ast.String)
|
|
969
|
-
else (
|
|
970
|
-
kid[2]
|
|
971
|
-
if len(kid) > 2 and isinstance(kid[2], ast.String)
|
|
972
|
-
else None
|
|
973
|
-
)
|
|
974
|
-
)
|
|
876
|
+
star = self.match_token(Tok.STAR_POW) or self.match_token(Tok.STAR_MUL)
|
|
877
|
+
name = self.consume(uni.Name)
|
|
878
|
+
type_tag = self.consume(uni.SubTag)
|
|
879
|
+
value = self.consume(uni.Expr) if self.match_token(Tok.EQ) else None
|
|
880
|
+
return uni.ParamVar(
|
|
881
|
+
name=name,
|
|
882
|
+
type_tag=type_tag,
|
|
883
|
+
value=value,
|
|
884
|
+
unpack=star,
|
|
885
|
+
kid=self.cur_nodes,
|
|
975
886
|
)
|
|
976
|
-
if isinstance(name, ast.Name) and isinstance(type_tag, ast.SubTag):
|
|
977
|
-
return ast.ParamVar(
|
|
978
|
-
semstr=semstr,
|
|
979
|
-
name=name,
|
|
980
|
-
type_tag=type_tag,
|
|
981
|
-
value=value,
|
|
982
|
-
unpack=star,
|
|
983
|
-
kid=kid,
|
|
984
|
-
)
|
|
985
|
-
else:
|
|
986
|
-
raise self.ice()
|
|
987
887
|
|
|
988
|
-
def member_block(self, _: None) ->
|
|
888
|
+
def member_block(self, _: None) -> uni.SubNodeList[uni.ArchBlockStmt]:
|
|
989
889
|
"""Grammar rule.
|
|
990
890
|
|
|
991
891
|
member_block: LBRACE member_stmt* RBRACE
|
|
992
892
|
"""
|
|
993
893
|
left_enc = self.consume_token(Tok.LBRACE)
|
|
994
|
-
items = self.match_many(
|
|
894
|
+
items = self.match_many(uni.ArchBlockStmt)
|
|
995
895
|
right_enc = self.consume_token(Tok.RBRACE)
|
|
996
|
-
ret =
|
|
896
|
+
ret = uni.SubNodeList[uni.ArchBlockStmt](
|
|
997
897
|
items=items,
|
|
998
898
|
delim=Tok.WS,
|
|
999
899
|
kid=self.cur_nodes,
|
|
@@ -1002,48 +902,35 @@ class JacParser(Pass):
|
|
|
1002
902
|
ret.right_enc = right_enc
|
|
1003
903
|
return ret
|
|
1004
904
|
|
|
1005
|
-
def member_stmt(self,
|
|
905
|
+
def member_stmt(self, _: None) -> uni.ArchBlockStmt:
|
|
1006
906
|
"""Grammar rule.
|
|
1007
907
|
|
|
1008
|
-
member_stmt:
|
|
1009
|
-
| doc_tag? abstract_ability
|
|
1010
|
-
| doc_tag? ability
|
|
1011
|
-
| doc_tag? architype
|
|
1012
|
-
| doc_tag? has_stmt
|
|
908
|
+
member_stmt: STRING? (py_code_block | ability | archetype | impl_def | has_stmt | free_code)
|
|
1013
909
|
"""
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
and isinstance(kid[0], ast.String)
|
|
1020
|
-
):
|
|
1021
|
-
kid[1].doc = kid[0]
|
|
1022
|
-
kid[1].add_kids_left([kid[0]])
|
|
1023
|
-
ret = kid[1]
|
|
1024
|
-
else:
|
|
1025
|
-
raise self.ice()
|
|
1026
|
-
if isinstance(ret, ast.Ability):
|
|
1027
|
-
ret.signature.is_method = True
|
|
910
|
+
doc = self.match(uni.String)
|
|
911
|
+
ret = self.consume(uni.ArchBlockStmt)
|
|
912
|
+
if doc and isinstance(ret, uni.AstDocNode):
|
|
913
|
+
ret.doc = doc
|
|
914
|
+
ret.add_kids_left([doc])
|
|
1028
915
|
return ret
|
|
1029
916
|
|
|
1030
|
-
def has_stmt(self, kid: list[
|
|
917
|
+
def has_stmt(self, kid: list[uni.UniNode]) -> uni.ArchHas:
|
|
1031
918
|
"""Grammar rule.
|
|
1032
919
|
|
|
1033
920
|
has_stmt: KW_STATIC? (KW_LET | KW_HAS) access_tag? has_assign_list SEMI
|
|
1034
921
|
"""
|
|
1035
922
|
chomp = [*kid]
|
|
1036
923
|
is_static = (
|
|
1037
|
-
isinstance(chomp[0],
|
|
924
|
+
isinstance(chomp[0], uni.Token) and chomp[0].name == Tok.KW_STATIC
|
|
1038
925
|
)
|
|
1039
926
|
chomp = chomp[1:] if is_static else chomp
|
|
1040
|
-
is_freeze = isinstance(chomp[0],
|
|
927
|
+
is_freeze = isinstance(chomp[0], uni.Token) and chomp[0].name == Tok.KW_LET
|
|
1041
928
|
chomp = chomp[1:]
|
|
1042
|
-
access = chomp[0] if isinstance(chomp[0],
|
|
929
|
+
access = chomp[0] if isinstance(chomp[0], uni.SubTag) else None
|
|
1043
930
|
chomp = chomp[1:] if access else chomp
|
|
1044
931
|
assign = chomp[0]
|
|
1045
|
-
if isinstance(assign,
|
|
1046
|
-
return
|
|
932
|
+
if isinstance(assign, uni.SubNodeList):
|
|
933
|
+
return uni.ArchHas(
|
|
1047
934
|
vars=assign,
|
|
1048
935
|
is_static=is_static,
|
|
1049
936
|
is_frozen=is_freeze,
|
|
@@ -1053,57 +940,56 @@ class JacParser(Pass):
|
|
|
1053
940
|
else:
|
|
1054
941
|
raise self.ice()
|
|
1055
942
|
|
|
1056
|
-
def has_assign_list(self, _: None) ->
|
|
943
|
+
def has_assign_list(self, _: None) -> uni.SubNodeList[uni.HasVar]:
|
|
1057
944
|
"""Grammar rule.
|
|
1058
945
|
|
|
1059
946
|
has_assign_list: (has_assign_list COMMA)? typed_has_clause
|
|
1060
947
|
"""
|
|
1061
|
-
if consume := self.match(
|
|
948
|
+
if consume := self.match(uni.SubNodeList):
|
|
1062
949
|
comma = self.consume_token(Tok.COMMA)
|
|
1063
|
-
assign = self.consume(
|
|
950
|
+
assign = self.consume(uni.HasVar)
|
|
1064
951
|
new_kid = [*consume.kid, comma, assign]
|
|
1065
952
|
else:
|
|
1066
|
-
assign = self.consume(
|
|
953
|
+
assign = self.consume(uni.HasVar)
|
|
1067
954
|
new_kid = [assign]
|
|
1068
|
-
valid_kid = [i for i in new_kid if isinstance(i,
|
|
1069
|
-
return
|
|
955
|
+
valid_kid = [i for i in new_kid if isinstance(i, uni.HasVar)]
|
|
956
|
+
return uni.SubNodeList[uni.HasVar](
|
|
1070
957
|
items=valid_kid,
|
|
1071
958
|
delim=Tok.COMMA,
|
|
1072
959
|
kid=new_kid,
|
|
1073
960
|
)
|
|
1074
961
|
|
|
1075
|
-
def typed_has_clause(self,
|
|
962
|
+
def typed_has_clause(self, _: None) -> uni.HasVar:
|
|
1076
963
|
"""Grammar rule.
|
|
1077
964
|
|
|
1078
|
-
typed_has_clause: named_ref
|
|
965
|
+
typed_has_clause: named_ref type_tag (EQ expression | KW_BY KW_POST_INIT)?
|
|
1079
966
|
"""
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
raise self.ice()
|
|
967
|
+
value: uni.Expr | None = None
|
|
968
|
+
defer: bool = False
|
|
969
|
+
name = self.consume(uni.Name)
|
|
970
|
+
type_tag = self.consume(uni.SubTag)
|
|
971
|
+
if self.match_token(Tok.EQ):
|
|
972
|
+
value = self.consume(uni.Expr)
|
|
973
|
+
elif self.match_token(Tok.KW_BY):
|
|
974
|
+
defer = bool(self.consume_token(Tok.KW_POST_INIT))
|
|
975
|
+
return uni.HasVar(
|
|
976
|
+
name=name,
|
|
977
|
+
type_tag=type_tag,
|
|
978
|
+
defer=defer,
|
|
979
|
+
value=value,
|
|
980
|
+
kid=self.cur_nodes,
|
|
981
|
+
)
|
|
1096
982
|
|
|
1097
|
-
def type_tag(self, _: None) ->
|
|
983
|
+
def type_tag(self, _: None) -> uni.SubTag[uni.Expr]:
|
|
1098
984
|
"""Grammar rule.
|
|
1099
985
|
|
|
1100
986
|
type_tag: COLON expression
|
|
1101
987
|
"""
|
|
1102
988
|
self.consume_token(Tok.COLON)
|
|
1103
|
-
tag = self.consume(
|
|
1104
|
-
return
|
|
989
|
+
tag = self.consume(uni.Expr)
|
|
990
|
+
return uni.SubTag[uni.Expr](tag=tag, kid=self.cur_nodes)
|
|
1105
991
|
|
|
1106
|
-
def builtin_type(self, _: None) ->
|
|
992
|
+
def builtin_type(self, _: None) -> uni.Token:
|
|
1107
993
|
"""Grammar rule.
|
|
1108
994
|
|
|
1109
995
|
builtin_type: TYP_TYPE
|
|
@@ -1118,10 +1004,10 @@ class JacParser(Pass):
|
|
|
1118
1004
|
| TYP_BYTES
|
|
1119
1005
|
| TYP_STRING
|
|
1120
1006
|
"""
|
|
1121
|
-
token = self.consume(
|
|
1122
|
-
return
|
|
1007
|
+
token = self.consume(uni.Token)
|
|
1008
|
+
return uni.BuiltinType(
|
|
1123
1009
|
name=token.name,
|
|
1124
|
-
orig_src=self.parse_ref.
|
|
1010
|
+
orig_src=self.parse_ref.ir_in,
|
|
1125
1011
|
value=token.value,
|
|
1126
1012
|
line=token.loc.first_line,
|
|
1127
1013
|
end_line=token.loc.last_line,
|
|
@@ -1132,17 +1018,17 @@ class JacParser(Pass):
|
|
|
1132
1018
|
)
|
|
1133
1019
|
|
|
1134
1020
|
def code_block(
|
|
1135
|
-
self, kid: list[
|
|
1136
|
-
) ->
|
|
1021
|
+
self, kid: list[uni.UniNode]
|
|
1022
|
+
) -> uni.SubNodeList[uni.CodeBlockStmt]:
|
|
1137
1023
|
"""Grammar rule.
|
|
1138
1024
|
|
|
1139
1025
|
code_block: LBRACE statement* RBRACE
|
|
1140
1026
|
"""
|
|
1141
|
-
left_enc = kid[0] if isinstance(kid[0],
|
|
1142
|
-
right_enc = kid[-1] if isinstance(kid[-1],
|
|
1143
|
-
valid_stmt = [i for i in kid if isinstance(i,
|
|
1027
|
+
left_enc = kid[0] if isinstance(kid[0], uni.Token) else None
|
|
1028
|
+
right_enc = kid[-1] if isinstance(kid[-1], uni.Token) else None
|
|
1029
|
+
valid_stmt = [i for i in kid if isinstance(i, uni.CodeBlockStmt)]
|
|
1144
1030
|
if len(valid_stmt) == len(kid) - 2:
|
|
1145
|
-
return
|
|
1031
|
+
return uni.SubNodeList[uni.CodeBlockStmt](
|
|
1146
1032
|
items=valid_stmt,
|
|
1147
1033
|
delim=Tok.WS,
|
|
1148
1034
|
left_enc=left_enc,
|
|
@@ -1152,12 +1038,12 @@ class JacParser(Pass):
|
|
|
1152
1038
|
else:
|
|
1153
1039
|
raise self.ice()
|
|
1154
1040
|
|
|
1155
|
-
def statement(self, kid: list[
|
|
1041
|
+
def statement(self, kid: list[uni.UniNode]) -> uni.CodeBlockStmt:
|
|
1156
1042
|
"""Grammar rule.
|
|
1157
1043
|
|
|
1158
1044
|
statement: import_stmt
|
|
1159
1045
|
| ability
|
|
1160
|
-
|
|
|
1046
|
+
| archetype
|
|
1161
1047
|
| if_stmt
|
|
1162
1048
|
| while_stmt
|
|
1163
1049
|
| for_stmt
|
|
@@ -1178,17 +1064,17 @@ class JacParser(Pass):
|
|
|
1178
1064
|
| expression SEMI
|
|
1179
1065
|
| ctrl_stmt SEMI
|
|
1180
1066
|
| py_code_block
|
|
1181
|
-
|
|
|
1067
|
+
| spatial_stmt
|
|
1182
1068
|
| SEMI
|
|
1183
1069
|
"""
|
|
1184
|
-
if (code_block := self.match(
|
|
1070
|
+
if (code_block := self.match(uni.CodeBlockStmt)) and len(
|
|
1185
1071
|
self.cur_nodes
|
|
1186
1072
|
) < 2:
|
|
1187
1073
|
return code_block
|
|
1188
|
-
elif (token := self.match(
|
|
1189
|
-
return
|
|
1074
|
+
elif (token := self.match(uni.Token)) and token.name == Tok.KW_YIELD:
|
|
1075
|
+
return uni.ExprStmt(
|
|
1190
1076
|
expr=(
|
|
1191
|
-
expr :=
|
|
1077
|
+
expr := uni.YieldExpr(
|
|
1192
1078
|
expr=None,
|
|
1193
1079
|
with_from=False,
|
|
1194
1080
|
kid=self.cur_nodes,
|
|
@@ -1197,87 +1083,87 @@ class JacParser(Pass):
|
|
|
1197
1083
|
in_fstring=False,
|
|
1198
1084
|
kid=[expr],
|
|
1199
1085
|
)
|
|
1200
|
-
elif isinstance(kid[0],
|
|
1201
|
-
return
|
|
1086
|
+
elif isinstance(kid[0], uni.Expr):
|
|
1087
|
+
return uni.ExprStmt(
|
|
1202
1088
|
expr=kid[0],
|
|
1203
1089
|
in_fstring=False,
|
|
1204
1090
|
kid=self.cur_nodes,
|
|
1205
1091
|
)
|
|
1206
|
-
elif isinstance(kid[0],
|
|
1092
|
+
elif isinstance(kid[0], uni.CodeBlockStmt):
|
|
1207
1093
|
kid[0].add_kids_right([kid[1]])
|
|
1208
1094
|
return kid[0]
|
|
1209
1095
|
else:
|
|
1210
1096
|
raise self.ice()
|
|
1211
1097
|
|
|
1212
|
-
def typed_ctx_block(self, _: None) ->
|
|
1098
|
+
def typed_ctx_block(self, _: None) -> uni.TypedCtxBlock:
|
|
1213
1099
|
"""Grammar rule.
|
|
1214
1100
|
|
|
1215
1101
|
typed_ctx_block: RETURN_HINT expression code_block
|
|
1216
1102
|
"""
|
|
1217
1103
|
self.consume_token(Tok.RETURN_HINT)
|
|
1218
|
-
ctx = self.consume(
|
|
1219
|
-
body = self.consume(
|
|
1220
|
-
return
|
|
1104
|
+
ctx = self.consume(uni.Expr)
|
|
1105
|
+
body = self.consume(uni.SubNodeList)
|
|
1106
|
+
return uni.TypedCtxBlock(
|
|
1221
1107
|
type_ctx=ctx,
|
|
1222
1108
|
body=body,
|
|
1223
1109
|
kid=self.cur_nodes,
|
|
1224
1110
|
)
|
|
1225
1111
|
|
|
1226
|
-
def if_stmt(self, _: None) ->
|
|
1112
|
+
def if_stmt(self, _: None) -> uni.IfStmt:
|
|
1227
1113
|
"""Grammar rule.
|
|
1228
1114
|
|
|
1229
1115
|
if_stmt: KW_IF expression code_block (elif_stmt | else_stmt)?
|
|
1230
1116
|
"""
|
|
1231
1117
|
self.consume_token(Tok.KW_IF)
|
|
1232
|
-
condition = self.consume(
|
|
1233
|
-
body = self.consume(
|
|
1234
|
-
else_body = self.match(
|
|
1235
|
-
return
|
|
1118
|
+
condition = self.consume(uni.Expr)
|
|
1119
|
+
body = self.consume(uni.SubNodeList)
|
|
1120
|
+
else_body = self.match(uni.ElseStmt) or self.match(uni.ElseIf)
|
|
1121
|
+
return uni.IfStmt(
|
|
1236
1122
|
condition=condition,
|
|
1237
1123
|
body=body,
|
|
1238
1124
|
else_body=else_body,
|
|
1239
1125
|
kid=self.cur_nodes,
|
|
1240
1126
|
)
|
|
1241
1127
|
|
|
1242
|
-
def elif_stmt(self, _: None) ->
|
|
1128
|
+
def elif_stmt(self, _: None) -> uni.ElseIf:
|
|
1243
1129
|
"""Grammar rule.
|
|
1244
1130
|
|
|
1245
1131
|
elif_stmt: KW_ELIF expression code_block (elif_stmt | else_stmt)?
|
|
1246
1132
|
"""
|
|
1247
1133
|
self.consume_token(Tok.KW_ELIF)
|
|
1248
|
-
condition = self.consume(
|
|
1249
|
-
body = self.consume(
|
|
1250
|
-
else_body = self.match(
|
|
1251
|
-
return
|
|
1134
|
+
condition = self.consume(uni.Expr)
|
|
1135
|
+
body = self.consume(uni.SubNodeList)
|
|
1136
|
+
else_body = self.match(uni.ElseStmt) or self.match(uni.ElseIf)
|
|
1137
|
+
return uni.ElseIf(
|
|
1252
1138
|
condition=condition,
|
|
1253
1139
|
body=body,
|
|
1254
1140
|
else_body=else_body,
|
|
1255
1141
|
kid=self.cur_nodes,
|
|
1256
1142
|
)
|
|
1257
1143
|
|
|
1258
|
-
def else_stmt(self, _: None) ->
|
|
1144
|
+
def else_stmt(self, _: None) -> uni.ElseStmt:
|
|
1259
1145
|
"""Grammar rule.
|
|
1260
1146
|
|
|
1261
1147
|
else_stmt: KW_ELSE code_block
|
|
1262
1148
|
"""
|
|
1263
1149
|
self.consume_token(Tok.KW_ELSE)
|
|
1264
|
-
body = self.consume(
|
|
1265
|
-
return
|
|
1150
|
+
body = self.consume(uni.SubNodeList)
|
|
1151
|
+
return uni.ElseStmt(
|
|
1266
1152
|
body=body,
|
|
1267
1153
|
kid=self.cur_nodes,
|
|
1268
1154
|
)
|
|
1269
1155
|
|
|
1270
|
-
def try_stmt(self, _: None) ->
|
|
1156
|
+
def try_stmt(self, _: None) -> uni.TryStmt:
|
|
1271
1157
|
"""Grammar rule.
|
|
1272
1158
|
|
|
1273
1159
|
try_stmt: KW_TRY code_block except_list? else_stmt? finally_stmt?
|
|
1274
1160
|
"""
|
|
1275
1161
|
self.consume_token(Tok.KW_TRY)
|
|
1276
|
-
block = self.consume(
|
|
1277
|
-
except_list = self.match(
|
|
1278
|
-
else_stmt = self.match(
|
|
1279
|
-
finally_stmt = self.match(
|
|
1280
|
-
return
|
|
1162
|
+
block = self.consume(uni.SubNodeList)
|
|
1163
|
+
except_list = self.match(uni.SubNodeList)
|
|
1164
|
+
else_stmt = self.match(uni.ElseStmt)
|
|
1165
|
+
finally_stmt = self.match(uni.FinallyStmt)
|
|
1166
|
+
return uni.TryStmt(
|
|
1281
1167
|
body=block,
|
|
1282
1168
|
excepts=except_list,
|
|
1283
1169
|
else_body=else_stmt,
|
|
@@ -1285,67 +1171,66 @@ class JacParser(Pass):
|
|
|
1285
1171
|
kid=self.cur_nodes,
|
|
1286
1172
|
)
|
|
1287
1173
|
|
|
1288
|
-
def except_list(self, _: None) ->
|
|
1174
|
+
def except_list(self, _: None) -> uni.SubNodeList[uni.Except]:
|
|
1289
1175
|
"""Grammar rule.
|
|
1290
1176
|
|
|
1291
1177
|
except_list: except_def+
|
|
1292
1178
|
"""
|
|
1293
|
-
items = [self.consume(
|
|
1294
|
-
while expt := self.match(
|
|
1179
|
+
items = [self.consume(uni.Except)]
|
|
1180
|
+
while expt := self.match(uni.Except):
|
|
1295
1181
|
items.append(expt)
|
|
1296
|
-
return
|
|
1182
|
+
return uni.SubNodeList[uni.Except](
|
|
1297
1183
|
items=items,
|
|
1298
1184
|
delim=Tok.WS,
|
|
1299
1185
|
kid=self.cur_nodes,
|
|
1300
1186
|
)
|
|
1301
1187
|
|
|
1302
|
-
def except_def(self, _: None) ->
|
|
1188
|
+
def except_def(self, _: None) -> uni.Except:
|
|
1303
1189
|
"""Grammar rule.
|
|
1304
1190
|
|
|
1305
1191
|
except_def: KW_EXCEPT expression (KW_AS NAME)? code_block
|
|
1306
1192
|
"""
|
|
1307
|
-
name:
|
|
1193
|
+
name: uni.Name | None = None
|
|
1308
1194
|
self.consume_token(Tok.KW_EXCEPT)
|
|
1309
|
-
ex_type = self.consume(
|
|
1195
|
+
ex_type = self.consume(uni.Expr)
|
|
1310
1196
|
if self.match_token(Tok.KW_AS):
|
|
1311
|
-
name = self.consume(
|
|
1312
|
-
body = self.consume(
|
|
1313
|
-
return
|
|
1197
|
+
name = self.consume(uni.Name)
|
|
1198
|
+
body = self.consume(uni.SubNodeList)
|
|
1199
|
+
return uni.Except(
|
|
1314
1200
|
ex_type=ex_type,
|
|
1315
1201
|
name=name,
|
|
1316
1202
|
body=body,
|
|
1317
1203
|
kid=self.cur_nodes,
|
|
1318
1204
|
)
|
|
1319
1205
|
|
|
1320
|
-
def finally_stmt(self, _: None) ->
|
|
1206
|
+
def finally_stmt(self, _: None) -> uni.FinallyStmt:
|
|
1321
1207
|
"""Grammar rule.
|
|
1322
1208
|
|
|
1323
1209
|
finally_stmt: KW_FINALLY code_block
|
|
1324
1210
|
"""
|
|
1325
1211
|
self.consume_token(Tok.KW_FINALLY)
|
|
1326
|
-
body = self.consume(
|
|
1327
|
-
return
|
|
1212
|
+
body = self.consume(uni.SubNodeList)
|
|
1213
|
+
return uni.FinallyStmt(
|
|
1328
1214
|
body=body,
|
|
1329
1215
|
kid=self.cur_nodes,
|
|
1330
1216
|
)
|
|
1331
1217
|
|
|
1332
|
-
def for_stmt(self, _: None) ->
|
|
1218
|
+
def for_stmt(self, _: None) -> uni.IterForStmt | uni.InForStmt:
|
|
1333
1219
|
"""Grammar rule.
|
|
1334
1220
|
|
|
1335
|
-
for_stmt: KW_ASYNC? KW_FOR assignment KW_TO expression KW_BY
|
|
1336
|
-
|
|
1337
|
-
| KW_ASYNC? KW_FOR expression KW_IN expression code_block else_stmt?
|
|
1221
|
+
for_stmt: KW_ASYNC? KW_FOR assignment KW_TO expression KW_BY assignment code_block else_stmt?
|
|
1222
|
+
| KW_ASYNC? KW_FOR atomic_chain KW_IN expression code_block else_stmt?
|
|
1338
1223
|
"""
|
|
1339
1224
|
is_async = bool(self.match_token(Tok.KW_ASYNC))
|
|
1340
1225
|
self.consume_token(Tok.KW_FOR)
|
|
1341
|
-
if iter := self.match(
|
|
1226
|
+
if iter := self.match(uni.Assignment):
|
|
1342
1227
|
self.consume_token(Tok.KW_TO)
|
|
1343
|
-
condition = self.consume(
|
|
1228
|
+
condition = self.consume(uni.Expr)
|
|
1344
1229
|
self.consume_token(Tok.KW_BY)
|
|
1345
|
-
count_by = self.consume(
|
|
1346
|
-
body = self.consume(
|
|
1347
|
-
else_body = self.match(
|
|
1348
|
-
return
|
|
1230
|
+
count_by = self.consume(uni.Assignment)
|
|
1231
|
+
body = self.consume(uni.SubNodeList)
|
|
1232
|
+
else_body = self.match(uni.ElseStmt)
|
|
1233
|
+
return uni.IterForStmt(
|
|
1349
1234
|
is_async=is_async,
|
|
1350
1235
|
iter=iter,
|
|
1351
1236
|
condition=condition,
|
|
@@ -1354,12 +1239,12 @@ class JacParser(Pass):
|
|
|
1354
1239
|
else_body=else_body,
|
|
1355
1240
|
kid=self.cur_nodes,
|
|
1356
1241
|
)
|
|
1357
|
-
target = self.consume(
|
|
1242
|
+
target = self.consume(uni.Expr)
|
|
1358
1243
|
self.consume_token(Tok.KW_IN)
|
|
1359
|
-
collection = self.consume(
|
|
1360
|
-
body = self.consume(
|
|
1361
|
-
else_body = self.match(
|
|
1362
|
-
return
|
|
1244
|
+
collection = self.consume(uni.Expr)
|
|
1245
|
+
body = self.consume(uni.SubNodeList)
|
|
1246
|
+
else_body = self.match(uni.ElseStmt)
|
|
1247
|
+
return uni.InForStmt(
|
|
1363
1248
|
is_async=is_async,
|
|
1364
1249
|
target=target,
|
|
1365
1250
|
collection=collection,
|
|
@@ -1368,109 +1253,110 @@ class JacParser(Pass):
|
|
|
1368
1253
|
kid=self.cur_nodes,
|
|
1369
1254
|
)
|
|
1370
1255
|
|
|
1371
|
-
def while_stmt(self, _: None) ->
|
|
1256
|
+
def while_stmt(self, _: None) -> uni.WhileStmt:
|
|
1372
1257
|
"""Grammar rule.
|
|
1373
1258
|
|
|
1374
1259
|
while_stmt: KW_WHILE expression code_block
|
|
1375
1260
|
"""
|
|
1376
1261
|
self.consume_token(Tok.KW_WHILE)
|
|
1377
|
-
condition = self.consume(
|
|
1378
|
-
body = self.consume(
|
|
1379
|
-
return
|
|
1262
|
+
condition = self.consume(uni.Expr)
|
|
1263
|
+
body = self.consume(uni.SubNodeList)
|
|
1264
|
+
return uni.WhileStmt(
|
|
1380
1265
|
condition=condition,
|
|
1381
1266
|
body=body,
|
|
1382
1267
|
kid=self.cur_nodes,
|
|
1383
1268
|
)
|
|
1384
1269
|
|
|
1385
|
-
def with_stmt(self, _: None) ->
|
|
1270
|
+
def with_stmt(self, _: None) -> uni.WithStmt:
|
|
1386
1271
|
"""Grammar rule.
|
|
1387
1272
|
|
|
1388
1273
|
with_stmt: KW_ASYNC? KW_WITH expr_as_list code_block
|
|
1389
1274
|
"""
|
|
1390
1275
|
is_async = bool(self.match_token(Tok.KW_ASYNC))
|
|
1391
1276
|
self.consume_token(Tok.KW_WITH)
|
|
1392
|
-
exprs = self.consume(
|
|
1393
|
-
body = self.consume(
|
|
1394
|
-
return
|
|
1277
|
+
exprs = self.consume(uni.SubNodeList)
|
|
1278
|
+
body = self.consume(uni.SubNodeList)
|
|
1279
|
+
return uni.WithStmt(
|
|
1395
1280
|
is_async=is_async,
|
|
1396
1281
|
exprs=exprs,
|
|
1397
1282
|
body=body,
|
|
1398
1283
|
kid=self.cur_nodes,
|
|
1399
1284
|
)
|
|
1400
1285
|
|
|
1401
|
-
def expr_as_list(self, _: None) ->
|
|
1286
|
+
def expr_as_list(self, _: None) -> uni.SubNodeList[uni.ExprAsItem]:
|
|
1402
1287
|
"""Grammar rule.
|
|
1403
1288
|
|
|
1404
1289
|
expr_as_list: (expr_as COMMA)* expr_as
|
|
1405
1290
|
"""
|
|
1406
|
-
items = [self.consume(
|
|
1291
|
+
items = [self.consume(uni.ExprAsItem)]
|
|
1407
1292
|
while self.match_token(Tok.COMMA):
|
|
1408
|
-
items.append(self.consume(
|
|
1409
|
-
return
|
|
1293
|
+
items.append(self.consume(uni.ExprAsItem))
|
|
1294
|
+
return uni.SubNodeList[uni.ExprAsItem](
|
|
1410
1295
|
items=items,
|
|
1411
1296
|
delim=Tok.COMMA,
|
|
1412
1297
|
kid=self.cur_nodes,
|
|
1413
1298
|
)
|
|
1414
1299
|
|
|
1415
|
-
def expr_as(self, _: None) ->
|
|
1300
|
+
def expr_as(self, _: None) -> uni.ExprAsItem:
|
|
1416
1301
|
"""Grammar rule.
|
|
1417
1302
|
|
|
1418
1303
|
expr_as: expression (KW_AS expression)?
|
|
1419
1304
|
"""
|
|
1420
|
-
expr = self.consume(
|
|
1421
|
-
alias = self.consume(
|
|
1422
|
-
return
|
|
1305
|
+
expr = self.consume(uni.Expr)
|
|
1306
|
+
alias = self.consume(uni.Expr) if self.match_token(Tok.KW_AS) else None
|
|
1307
|
+
return uni.ExprAsItem(
|
|
1423
1308
|
expr=expr,
|
|
1424
1309
|
alias=alias,
|
|
1425
1310
|
kid=self.cur_nodes,
|
|
1426
1311
|
)
|
|
1427
1312
|
|
|
1428
|
-
def raise_stmt(self,
|
|
1313
|
+
def raise_stmt(self, _: None) -> uni.RaiseStmt:
|
|
1429
1314
|
"""Grammar rule.
|
|
1430
1315
|
|
|
1431
1316
|
raise_stmt: KW_RAISE (expression (KW_FROM expression)?)?
|
|
1432
1317
|
"""
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
)
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1318
|
+
e_type: uni.Expr | None = None
|
|
1319
|
+
from_target: uni.Expr | None = None
|
|
1320
|
+
self.consume_token(Tok.KW_RAISE)
|
|
1321
|
+
if e_type := self.match(uni.Expr):
|
|
1322
|
+
from_target = (
|
|
1323
|
+
self.consume(uni.Expr) if self.match_token(Tok.KW_FROM) else None
|
|
1324
|
+
)
|
|
1325
|
+
return uni.RaiseStmt(
|
|
1440
1326
|
cause=e_type,
|
|
1441
|
-
from_target=
|
|
1442
|
-
kid=
|
|
1327
|
+
from_target=from_target,
|
|
1328
|
+
kid=self.cur_nodes,
|
|
1443
1329
|
)
|
|
1444
1330
|
|
|
1445
|
-
def assert_stmt(self, _: None) ->
|
|
1331
|
+
def assert_stmt(self, _: None) -> uni.AssertStmt:
|
|
1446
1332
|
"""Grammar rule.
|
|
1447
1333
|
|
|
1448
1334
|
assert_stmt: KW_ASSERT expression (COMMA expression)?
|
|
1449
1335
|
"""
|
|
1450
|
-
error_msg:
|
|
1336
|
+
error_msg: uni.Expr | None = None
|
|
1451
1337
|
self.consume_token(Tok.KW_ASSERT)
|
|
1452
|
-
condition = self.consume(
|
|
1338
|
+
condition = self.consume(uni.Expr)
|
|
1453
1339
|
if self.match_token(Tok.COMMA):
|
|
1454
|
-
error_msg = self.consume(
|
|
1455
|
-
return
|
|
1340
|
+
error_msg = self.consume(uni.Expr)
|
|
1341
|
+
return uni.AssertStmt(
|
|
1456
1342
|
condition=condition,
|
|
1457
1343
|
error_msg=error_msg,
|
|
1458
1344
|
kid=self.cur_nodes,
|
|
1459
1345
|
)
|
|
1460
1346
|
|
|
1461
|
-
def check_stmt(self, _: None) ->
|
|
1347
|
+
def check_stmt(self, _: None) -> uni.CheckStmt:
|
|
1462
1348
|
"""Grammar rule.
|
|
1463
1349
|
|
|
1464
1350
|
check_stmt: KW_CHECK expression
|
|
1465
1351
|
"""
|
|
1466
1352
|
self.consume_token(Tok.KW_CHECK)
|
|
1467
|
-
target = self.consume(
|
|
1468
|
-
return
|
|
1353
|
+
target = self.consume(uni.Expr)
|
|
1354
|
+
return uni.CheckStmt(
|
|
1469
1355
|
target=target,
|
|
1470
1356
|
kid=self.cur_nodes,
|
|
1471
1357
|
)
|
|
1472
1358
|
|
|
1473
|
-
def ctrl_stmt(self, _: None) ->
|
|
1359
|
+
def ctrl_stmt(self, _: None) -> uni.CtrlStmt | uni.DisengageStmt:
|
|
1474
1360
|
"""Grammar rule.
|
|
1475
1361
|
|
|
1476
1362
|
ctrl_stmt: KW_SKIP | KW_BREAK | KW_CONTINUE
|
|
@@ -1480,156 +1366,143 @@ class JacParser(Pass):
|
|
|
1480
1366
|
or self.match_token(Tok.KW_BREAK)
|
|
1481
1367
|
or self.consume_token(Tok.KW_CONTINUE)
|
|
1482
1368
|
)
|
|
1483
|
-
return
|
|
1369
|
+
return uni.CtrlStmt(
|
|
1484
1370
|
ctrl=tok,
|
|
1485
1371
|
kid=self.cur_nodes,
|
|
1486
1372
|
)
|
|
1487
1373
|
|
|
1488
|
-
def delete_stmt(self, _: None) ->
|
|
1374
|
+
def delete_stmt(self, _: None) -> uni.DeleteStmt:
|
|
1489
1375
|
"""Grammar rule.
|
|
1490
1376
|
|
|
1491
1377
|
delete_stmt: KW_DELETE expression
|
|
1492
1378
|
"""
|
|
1493
1379
|
self.consume_token(Tok.KW_DELETE)
|
|
1494
|
-
target = self.consume(
|
|
1495
|
-
return
|
|
1380
|
+
target = self.consume(uni.Expr)
|
|
1381
|
+
return uni.DeleteStmt(
|
|
1496
1382
|
target=target,
|
|
1497
1383
|
kid=self.cur_nodes,
|
|
1498
1384
|
)
|
|
1499
1385
|
|
|
1500
|
-
def report_stmt(self, _: None) ->
|
|
1386
|
+
def report_stmt(self, _: None) -> uni.ReportStmt:
|
|
1501
1387
|
"""Grammar rule.
|
|
1502
1388
|
|
|
1503
1389
|
report_stmt: KW_REPORT expression
|
|
1504
1390
|
"""
|
|
1505
1391
|
self.consume_token(Tok.KW_REPORT)
|
|
1506
|
-
target = self.consume(
|
|
1507
|
-
return
|
|
1392
|
+
target = self.consume(uni.Expr)
|
|
1393
|
+
return uni.ReportStmt(
|
|
1508
1394
|
expr=target,
|
|
1509
1395
|
kid=self.cur_nodes,
|
|
1510
1396
|
)
|
|
1511
1397
|
|
|
1512
|
-
def return_stmt(self, _: None) ->
|
|
1398
|
+
def return_stmt(self, _: None) -> uni.ReturnStmt:
|
|
1513
1399
|
"""Grammar rule.
|
|
1514
1400
|
|
|
1515
1401
|
return_stmt: KW_RETURN expression?
|
|
1516
1402
|
"""
|
|
1517
1403
|
self.consume_token(Tok.KW_RETURN)
|
|
1518
|
-
expr = self.match(
|
|
1519
|
-
return
|
|
1404
|
+
expr = self.match(uni.Expr)
|
|
1405
|
+
return uni.ReturnStmt(
|
|
1520
1406
|
expr=expr,
|
|
1521
1407
|
kid=self.cur_nodes,
|
|
1522
1408
|
)
|
|
1523
1409
|
|
|
1524
|
-
def
|
|
1410
|
+
def spatial_stmt(self, _: None) -> uni.CodeBlockStmt:
|
|
1525
1411
|
"""Grammar rule.
|
|
1526
1412
|
|
|
1527
|
-
|
|
1413
|
+
spatial_stmt: visit_stmt | ignore_stmt
|
|
1528
1414
|
"""
|
|
1529
|
-
return self.consume(
|
|
1415
|
+
return self.consume(uni.CodeBlockStmt)
|
|
1530
1416
|
|
|
1531
|
-
def ignore_stmt(self, _: None) ->
|
|
1417
|
+
def ignore_stmt(self, _: None) -> uni.IgnoreStmt:
|
|
1532
1418
|
"""Grammar rule.
|
|
1533
1419
|
|
|
1534
1420
|
ignore_stmt: KW_IGNORE expression SEMI
|
|
1535
1421
|
"""
|
|
1536
1422
|
self.consume_token(Tok.KW_IGNORE)
|
|
1537
|
-
target = self.consume(
|
|
1423
|
+
target = self.consume(uni.Expr)
|
|
1538
1424
|
self.consume_token(Tok.SEMI)
|
|
1539
|
-
return
|
|
1425
|
+
return uni.IgnoreStmt(
|
|
1540
1426
|
target=target,
|
|
1541
1427
|
kid=self.cur_nodes,
|
|
1542
1428
|
)
|
|
1543
1429
|
|
|
1544
|
-
def
|
|
1430
|
+
def disenage_stmt(self, _: None) -> uni.DisengageStmt:
|
|
1545
1431
|
"""Grammar rule.
|
|
1546
1432
|
|
|
1547
|
-
|
|
1433
|
+
disenage_stmt: KW_DISENGAGE SEMI
|
|
1548
1434
|
"""
|
|
1549
|
-
self.consume_token(Tok.
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
else_body = self.match(ast.ElseStmt)
|
|
1553
|
-
if else_body is None:
|
|
1554
|
-
self.consume_token(Tok.SEMI)
|
|
1555
|
-
return ast.VisitStmt(
|
|
1556
|
-
vis_type=sub_name,
|
|
1557
|
-
target=target,
|
|
1558
|
-
else_body=else_body,
|
|
1435
|
+
self.consume_token(Tok.KW_DISENGAGE)
|
|
1436
|
+
self.consume_token(Tok.SEMI)
|
|
1437
|
+
return uni.DisengageStmt(
|
|
1559
1438
|
kid=self.cur_nodes,
|
|
1560
1439
|
)
|
|
1561
1440
|
|
|
1562
|
-
def
|
|
1441
|
+
def visit_stmt(self, _: None) -> uni.VisitStmt:
|
|
1563
1442
|
"""Grammar rule.
|
|
1564
1443
|
|
|
1565
|
-
|
|
1444
|
+
visit_stmt: KW_VISIT (COLON expression COLON)?
|
|
1445
|
+
expression (else_stmt | SEMI)
|
|
1566
1446
|
"""
|
|
1567
|
-
self.consume_token(Tok.
|
|
1568
|
-
|
|
1569
|
-
|
|
1447
|
+
self.consume_token(Tok.KW_VISIT)
|
|
1448
|
+
insert_loc = None
|
|
1449
|
+
if self.match_token(Tok.COLON):
|
|
1450
|
+
insert_loc = self.consume(uni.Expr)
|
|
1451
|
+
self.consume_token(Tok.COLON)
|
|
1452
|
+
target = self.consume(uni.Expr)
|
|
1453
|
+
else_body = self.match(uni.ElseStmt)
|
|
1570
1454
|
if else_body is None:
|
|
1571
1455
|
self.consume_token(Tok.SEMI)
|
|
1572
|
-
return
|
|
1573
|
-
|
|
1456
|
+
return uni.VisitStmt(
|
|
1457
|
+
insert_loc=insert_loc,
|
|
1458
|
+
target=target,
|
|
1574
1459
|
else_body=else_body,
|
|
1575
1460
|
kid=self.cur_nodes,
|
|
1576
1461
|
)
|
|
1577
1462
|
|
|
1578
|
-
def
|
|
1579
|
-
"""Grammar rule.
|
|
1580
|
-
|
|
1581
|
-
disengage_stmt: KW_DISENGAGE SEMI
|
|
1582
|
-
"""
|
|
1583
|
-
kw = self.consume_token(Tok.KW_DISENGAGE)
|
|
1584
|
-
semi = self.consume_token(Tok.SEMI)
|
|
1585
|
-
return ast.DisengageStmt(
|
|
1586
|
-
kid=[kw, semi],
|
|
1587
|
-
)
|
|
1588
|
-
|
|
1589
|
-
def global_ref(self, _: None) -> ast.GlobalStmt:
|
|
1463
|
+
def global_ref(self, _: None) -> uni.GlobalStmt:
|
|
1590
1464
|
"""Grammar rule.
|
|
1591
1465
|
|
|
1592
1466
|
global_ref: GLOBAL_OP name_list
|
|
1593
1467
|
"""
|
|
1594
1468
|
self.consume_token(Tok.GLOBAL_OP)
|
|
1595
|
-
target = self.consume(
|
|
1596
|
-
return
|
|
1469
|
+
target = self.consume(uni.SubNodeList)
|
|
1470
|
+
return uni.GlobalStmt(
|
|
1597
1471
|
target=target,
|
|
1598
1472
|
kid=self.cur_nodes,
|
|
1599
1473
|
)
|
|
1600
1474
|
|
|
1601
|
-
def nonlocal_ref(self, _: None) ->
|
|
1475
|
+
def nonlocal_ref(self, _: None) -> uni.NonLocalStmt:
|
|
1602
1476
|
"""Grammar rule.
|
|
1603
1477
|
|
|
1604
1478
|
nonlocal_ref: NONLOCAL_OP name_list
|
|
1605
1479
|
"""
|
|
1606
1480
|
self.consume_token(Tok.NONLOCAL_OP)
|
|
1607
|
-
target = self.consume(
|
|
1608
|
-
return
|
|
1481
|
+
target = self.consume(uni.SubNodeList)
|
|
1482
|
+
return uni.NonLocalStmt(
|
|
1609
1483
|
target=target,
|
|
1610
1484
|
kid=self.cur_nodes,
|
|
1611
1485
|
)
|
|
1612
1486
|
|
|
1613
|
-
def assignment(self, _: None) ->
|
|
1487
|
+
def assignment(self, _: None) -> uni.Assignment:
|
|
1614
1488
|
"""Grammar rule.
|
|
1615
1489
|
|
|
1616
1490
|
assignment: KW_LET? (atomic_chain EQ)+ (yield_expr | expression)
|
|
1617
|
-
|
|
1618
|
-
|
|
1491
|
+
| atomic_chain type_tag (EQ (yield_expr | expression))?
|
|
1492
|
+
| atomic_chain aug_op (yield_expr | expression)
|
|
1619
1493
|
"""
|
|
1620
1494
|
assignees: list = []
|
|
1621
|
-
type_tag:
|
|
1622
|
-
is_aug:
|
|
1623
|
-
semstr: ast.String | None = None
|
|
1495
|
+
type_tag: uni.SubTag | None = None
|
|
1496
|
+
is_aug: uni.Token | None = None
|
|
1624
1497
|
|
|
1625
1498
|
is_frozen = bool(self.match_token(Tok.KW_LET))
|
|
1626
|
-
if first_expr := self.match(
|
|
1499
|
+
if first_expr := self.match(uni.Expr):
|
|
1627
1500
|
assignees.append(first_expr)
|
|
1628
1501
|
|
|
1629
|
-
token = self.match(
|
|
1502
|
+
token = self.match(uni.Token)
|
|
1630
1503
|
if token and (token.name == Tok.EQ):
|
|
1631
1504
|
assignees.append(token)
|
|
1632
|
-
while expr := self.match(
|
|
1505
|
+
while expr := self.match(uni.Expr):
|
|
1633
1506
|
eq = self.match_token(Tok.EQ)
|
|
1634
1507
|
assignees.append(expr)
|
|
1635
1508
|
if eq:
|
|
@@ -1637,18 +1510,13 @@ class JacParser(Pass):
|
|
|
1637
1510
|
value = assignees.pop()
|
|
1638
1511
|
elif token and (token.name not in {Tok.COLON, Tok.EQ}):
|
|
1639
1512
|
is_aug = token
|
|
1640
|
-
value = self.consume(
|
|
1513
|
+
value = self.consume(uni.Expr)
|
|
1641
1514
|
else:
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
if (token and (token.name == Tok.COLON))
|
|
1645
|
-
else None
|
|
1646
|
-
)
|
|
1647
|
-
type_tag = self.consume(ast.SubTag)
|
|
1648
|
-
value = self.consume(ast.Expr) if self.match_token(Tok.EQ) else None
|
|
1515
|
+
type_tag = self.consume(uni.SubTag)
|
|
1516
|
+
value = self.consume(uni.Expr) if self.match_token(Tok.EQ) else None
|
|
1649
1517
|
|
|
1650
|
-
valid_assignees = [i for i in assignees if isinstance(i, (
|
|
1651
|
-
new_targ =
|
|
1518
|
+
valid_assignees = [i for i in assignees if isinstance(i, (uni.Expr))]
|
|
1519
|
+
new_targ = uni.SubNodeList[uni.Expr](
|
|
1652
1520
|
items=valid_assignees,
|
|
1653
1521
|
delim=Tok.EQ,
|
|
1654
1522
|
kid=assignees,
|
|
@@ -1656,7 +1524,7 @@ class JacParser(Pass):
|
|
|
1656
1524
|
kid = [x for x in self.cur_nodes if x not in assignees]
|
|
1657
1525
|
kid.insert(1, new_targ) if is_frozen else kid.insert(0, new_targ)
|
|
1658
1526
|
if is_aug:
|
|
1659
|
-
return
|
|
1527
|
+
return uni.Assignment(
|
|
1660
1528
|
target=new_targ,
|
|
1661
1529
|
type_tag=type_tag,
|
|
1662
1530
|
value=value,
|
|
@@ -1664,28 +1532,26 @@ class JacParser(Pass):
|
|
|
1664
1532
|
aug_op=is_aug,
|
|
1665
1533
|
kid=kid,
|
|
1666
1534
|
)
|
|
1667
|
-
return
|
|
1535
|
+
return uni.Assignment(
|
|
1668
1536
|
target=new_targ,
|
|
1669
1537
|
type_tag=type_tag,
|
|
1670
1538
|
value=value,
|
|
1671
1539
|
mutable=is_frozen,
|
|
1672
1540
|
kid=kid,
|
|
1673
|
-
semstr=semstr,
|
|
1674
1541
|
)
|
|
1675
1542
|
|
|
1676
|
-
def expression(self, _: None) ->
|
|
1543
|
+
def expression(self, _: None) -> uni.Expr:
|
|
1677
1544
|
"""Grammar rule.
|
|
1678
1545
|
|
|
1679
|
-
expression: walrus_assign
|
|
1680
|
-
|
|
1681
|
-
| lambda_expr
|
|
1546
|
+
expression: walrus_assign (KW_IF expression KW_ELSE expression)?
|
|
1547
|
+
| lambda_expr
|
|
1682
1548
|
"""
|
|
1683
|
-
value = self.consume(
|
|
1549
|
+
value = self.consume(uni.Expr)
|
|
1684
1550
|
if self.match_token(Tok.KW_IF):
|
|
1685
|
-
condition = self.consume(
|
|
1551
|
+
condition = self.consume(uni.Expr)
|
|
1686
1552
|
self.consume_token(Tok.KW_ELSE)
|
|
1687
|
-
else_value = self.consume(
|
|
1688
|
-
return
|
|
1553
|
+
else_value = self.consume(uni.Expr)
|
|
1554
|
+
return uni.IfElseExpr(
|
|
1689
1555
|
value=value,
|
|
1690
1556
|
condition=condition,
|
|
1691
1557
|
else_value=else_value,
|
|
@@ -1693,32 +1559,49 @@ class JacParser(Pass):
|
|
|
1693
1559
|
)
|
|
1694
1560
|
return value
|
|
1695
1561
|
|
|
1696
|
-
def
|
|
1562
|
+
def concurrent_expr(self, _: None) -> uni.ConcurrentExpr | uni.Expr:
|
|
1563
|
+
"""Grammar rule.
|
|
1564
|
+
|
|
1565
|
+
concurrent: (KW_FLOW | KW_WAIT)
|
|
1566
|
+
"""
|
|
1567
|
+
if (tok := self.match_token(Tok.KW_FLOW)) or (
|
|
1568
|
+
tok := self.match_token(Tok.KW_WAIT)
|
|
1569
|
+
):
|
|
1570
|
+
target = self.consume(uni.Expr)
|
|
1571
|
+
return uni.ConcurrentExpr(
|
|
1572
|
+
tok=tok,
|
|
1573
|
+
target=target,
|
|
1574
|
+
kid=self.cur_nodes,
|
|
1575
|
+
)
|
|
1576
|
+
else:
|
|
1577
|
+
return self.consume(uni.Expr)
|
|
1578
|
+
|
|
1579
|
+
def walrus_assign(self, _: None) -> uni.Expr:
|
|
1697
1580
|
"""Grammar rule.
|
|
1698
1581
|
|
|
1699
|
-
walrus_assign: (
|
|
1582
|
+
walrus_assign: (named_ref WALRUS_EQ)? pipe
|
|
1700
1583
|
"""
|
|
1701
1584
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1702
1585
|
|
|
1703
|
-
def lambda_expr(self, _: None) ->
|
|
1586
|
+
def lambda_expr(self, _: None) -> uni.LambdaExpr:
|
|
1704
1587
|
"""Grammar rule.
|
|
1705
1588
|
|
|
1706
|
-
|
|
1589
|
+
lambda_expr: KW_LAMBDA func_decl_params? (RETURN_HINT expression)? COLON expression
|
|
1707
1590
|
"""
|
|
1708
|
-
return_type:
|
|
1709
|
-
sig_kid: list[
|
|
1710
|
-
self.consume_token(Tok.
|
|
1711
|
-
params = self.match(
|
|
1591
|
+
return_type: uni.Expr | None = None
|
|
1592
|
+
sig_kid: list[uni.UniNode] = []
|
|
1593
|
+
self.consume_token(Tok.KW_LAMBDA)
|
|
1594
|
+
params = self.match(uni.SubNodeList)
|
|
1712
1595
|
if self.match_token(Tok.RETURN_HINT):
|
|
1713
|
-
return_type = self.consume(
|
|
1714
|
-
self.consume_token(Tok.
|
|
1715
|
-
body = self.consume(
|
|
1596
|
+
return_type = self.consume(uni.Expr)
|
|
1597
|
+
self.consume_token(Tok.COLON)
|
|
1598
|
+
body = self.consume(uni.Expr)
|
|
1716
1599
|
if params:
|
|
1717
1600
|
sig_kid.append(params)
|
|
1718
1601
|
if return_type:
|
|
1719
1602
|
sig_kid.append(return_type)
|
|
1720
1603
|
signature = (
|
|
1721
|
-
|
|
1604
|
+
uni.FuncSignature(
|
|
1722
1605
|
params=params,
|
|
1723
1606
|
return_type=return_type,
|
|
1724
1607
|
kid=sig_kid,
|
|
@@ -1728,132 +1611,127 @@ class JacParser(Pass):
|
|
|
1728
1611
|
)
|
|
1729
1612
|
new_kid = [i for i in self.cur_nodes if i != params and i != return_type]
|
|
1730
1613
|
new_kid.insert(1, signature) if signature else None
|
|
1731
|
-
return
|
|
1614
|
+
return uni.LambdaExpr(
|
|
1732
1615
|
signature=signature,
|
|
1733
1616
|
body=body,
|
|
1734
1617
|
kid=new_kid,
|
|
1735
1618
|
)
|
|
1736
1619
|
|
|
1737
|
-
def pipe(self, _: None) ->
|
|
1620
|
+
def pipe(self, _: None) -> uni.Expr:
|
|
1738
1621
|
"""Grammar rule.
|
|
1739
1622
|
|
|
1740
|
-
pipe:
|
|
1741
|
-
| pipe_back
|
|
1623
|
+
pipe: (pipe PIPE_FWD)? pipe_back
|
|
1742
1624
|
"""
|
|
1743
1625
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1744
1626
|
|
|
1745
|
-
def pipe_back(self, _: None) ->
|
|
1627
|
+
def pipe_back(self, _: None) -> uni.Expr:
|
|
1746
1628
|
"""Grammar rule.
|
|
1747
1629
|
|
|
1748
|
-
pipe_back:
|
|
1749
|
-
| bitwise_or
|
|
1630
|
+
pipe_back: (pipe_back PIPE_BKWD)? bitwise_or
|
|
1750
1631
|
"""
|
|
1751
1632
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1752
1633
|
|
|
1753
|
-
def bitwise_or(self, _: None) ->
|
|
1634
|
+
def bitwise_or(self, _: None) -> uni.Expr:
|
|
1754
1635
|
"""Grammar rule.
|
|
1755
1636
|
|
|
1756
|
-
bitwise_or:
|
|
1757
|
-
| bitwise_xor
|
|
1637
|
+
bitwise_or: (bitwise_or BW_OR)? bitwise_xor
|
|
1758
1638
|
"""
|
|
1759
1639
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1760
1640
|
|
|
1761
|
-
def bitwise_xor(self, _: None) ->
|
|
1641
|
+
def bitwise_xor(self, _: None) -> uni.Expr:
|
|
1762
1642
|
"""Grammar rule.
|
|
1763
1643
|
|
|
1764
|
-
bitwise_xor:
|
|
1765
|
-
| bitwise_and
|
|
1644
|
+
bitwise_xor: (bitwise_xor BW_XOR)? bitwise_and
|
|
1766
1645
|
"""
|
|
1767
1646
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1768
1647
|
|
|
1769
|
-
def bitwise_and(self, _: None) ->
|
|
1648
|
+
def bitwise_and(self, _: None) -> uni.Expr:
|
|
1770
1649
|
"""Grammar rule.
|
|
1771
1650
|
|
|
1772
|
-
bitwise_and:
|
|
1773
|
-
| shift
|
|
1651
|
+
bitwise_and: (bitwise_and BW_AND)? shift
|
|
1774
1652
|
"""
|
|
1775
1653
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1776
1654
|
|
|
1777
|
-
def shift(self, _: None) ->
|
|
1655
|
+
def shift(self, _: None) -> uni.Expr:
|
|
1778
1656
|
"""Grammar rule.
|
|
1779
1657
|
|
|
1780
1658
|
shift: (shift (RSHIFT | LSHIFT))? logical_or
|
|
1781
1659
|
"""
|
|
1782
1660
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1783
1661
|
|
|
1784
|
-
def logical_or(self, _: None) ->
|
|
1662
|
+
def logical_or(self, _: None) -> uni.Expr:
|
|
1785
1663
|
"""Grammar rule.
|
|
1786
1664
|
|
|
1787
1665
|
logical_or: logical_and (KW_OR logical_and)*
|
|
1788
1666
|
"""
|
|
1789
|
-
value = self.consume(
|
|
1667
|
+
value = self.consume(uni.Expr)
|
|
1790
1668
|
if not (ops := self.match_token(Tok.KW_OR)):
|
|
1791
1669
|
return value
|
|
1792
1670
|
values: list = [value]
|
|
1793
|
-
while value := self.consume(
|
|
1671
|
+
while value := self.consume(uni.Expr):
|
|
1794
1672
|
values.append(value)
|
|
1795
1673
|
if not self.match_token(Tok.KW_OR):
|
|
1796
1674
|
break
|
|
1797
|
-
return
|
|
1675
|
+
return uni.BoolExpr(
|
|
1798
1676
|
op=ops,
|
|
1799
1677
|
values=values,
|
|
1800
1678
|
kid=self.cur_nodes,
|
|
1801
1679
|
)
|
|
1802
1680
|
|
|
1803
|
-
def logical_and(self, _: None) ->
|
|
1681
|
+
def logical_and(self, _: None) -> uni.Expr:
|
|
1804
1682
|
"""Grammar rule.
|
|
1805
1683
|
|
|
1806
1684
|
logical_and: logical_not (KW_AND logical_not)*
|
|
1807
1685
|
"""
|
|
1808
|
-
value = self.consume(
|
|
1686
|
+
value = self.consume(uni.Expr)
|
|
1809
1687
|
if not (ops := self.match_token(Tok.KW_AND)):
|
|
1810
1688
|
return value
|
|
1811
1689
|
values: list = [value]
|
|
1812
|
-
while value := self.consume(
|
|
1690
|
+
while value := self.consume(uni.Expr):
|
|
1813
1691
|
values.append(value)
|
|
1814
1692
|
if not self.match_token(Tok.KW_AND):
|
|
1815
1693
|
break
|
|
1816
|
-
return
|
|
1694
|
+
return uni.BoolExpr(
|
|
1817
1695
|
op=ops,
|
|
1818
1696
|
values=values,
|
|
1819
1697
|
kid=self.cur_nodes,
|
|
1820
1698
|
)
|
|
1821
1699
|
|
|
1822
|
-
def logical_not(self, _: None) ->
|
|
1700
|
+
def logical_not(self, _: None) -> uni.Expr:
|
|
1823
1701
|
"""Grammar rule.
|
|
1824
1702
|
|
|
1825
1703
|
logical_not: NOT logical_not | compare
|
|
1826
1704
|
"""
|
|
1827
1705
|
if op := self.match_token(Tok.NOT):
|
|
1828
|
-
operand = self.consume(
|
|
1829
|
-
return
|
|
1706
|
+
operand = self.consume(uni.Expr)
|
|
1707
|
+
return uni.UnaryExpr(
|
|
1830
1708
|
op=op,
|
|
1831
1709
|
operand=operand,
|
|
1832
1710
|
kid=self.cur_nodes,
|
|
1833
1711
|
)
|
|
1834
|
-
return self.consume(
|
|
1712
|
+
return self.consume(uni.Expr)
|
|
1835
1713
|
|
|
1836
|
-
def compare(self, _: None) ->
|
|
1714
|
+
def compare(self, _: None) -> uni.Expr:
|
|
1837
1715
|
"""Grammar rule.
|
|
1838
1716
|
|
|
1839
1717
|
compare: (arithmetic cmp_op)* arithmetic
|
|
1840
1718
|
"""
|
|
1841
1719
|
ops: list = []
|
|
1842
1720
|
rights: list = []
|
|
1843
|
-
left = self.consume(
|
|
1844
|
-
while op := self.match(
|
|
1721
|
+
left = self.consume(uni.Expr)
|
|
1722
|
+
while op := self.match(uni.Token):
|
|
1845
1723
|
ops.append(op)
|
|
1846
|
-
rights.append(self.consume(
|
|
1724
|
+
rights.append(self.consume(uni.Expr))
|
|
1847
1725
|
if not ops:
|
|
1848
1726
|
return left
|
|
1849
|
-
return
|
|
1727
|
+
return uni.CompareExpr(
|
|
1850
1728
|
left=left,
|
|
1851
1729
|
ops=ops,
|
|
1852
1730
|
rights=rights,
|
|
1853
1731
|
kid=self.cur_nodes,
|
|
1854
1732
|
)
|
|
1855
1733
|
|
|
1856
|
-
def cmp_op(self, _: None) ->
|
|
1734
|
+
def cmp_op(self, _: None) -> uni.Token:
|
|
1857
1735
|
"""Grammar rule.
|
|
1858
1736
|
|
|
1859
1737
|
cmp_op: KW_ISN
|
|
@@ -1867,23 +1745,23 @@ class JacParser(Pass):
|
|
|
1867
1745
|
| LT
|
|
1868
1746
|
| EE
|
|
1869
1747
|
"""
|
|
1870
|
-
return self.consume(
|
|
1748
|
+
return self.consume(uni.Token)
|
|
1871
1749
|
|
|
1872
|
-
def arithmetic(self, _: None) ->
|
|
1750
|
+
def arithmetic(self, _: None) -> uni.Expr:
|
|
1873
1751
|
"""Grammar rule.
|
|
1874
1752
|
|
|
1875
1753
|
arithmetic: (arithmetic (MINUS | PLUS))? term
|
|
1876
1754
|
"""
|
|
1877
1755
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1878
1756
|
|
|
1879
|
-
def term(self, _: None) ->
|
|
1757
|
+
def term(self, _: None) -> uni.Expr:
|
|
1880
1758
|
"""Grammar rule.
|
|
1881
1759
|
|
|
1882
1760
|
term: (term (MOD | DIV | FLOOR_DIV | STAR_MUL | DECOR_OP))? power
|
|
1883
1761
|
"""
|
|
1884
1762
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1885
1763
|
|
|
1886
|
-
def factor(self, _: None) ->
|
|
1764
|
+
def factor(self, _: None) -> uni.Expr:
|
|
1887
1765
|
"""Grammar rule.
|
|
1888
1766
|
|
|
1889
1767
|
factor: (BW_NOT | MINUS | PLUS) factor | connect
|
|
@@ -1893,123 +1771,120 @@ class JacParser(Pass):
|
|
|
1893
1771
|
or self.match_token(Tok.MINUS)
|
|
1894
1772
|
or self.match_token(Tok.PLUS)
|
|
1895
1773
|
):
|
|
1896
|
-
operand = self.consume(
|
|
1897
|
-
return
|
|
1774
|
+
operand = self.consume(uni.Expr)
|
|
1775
|
+
return uni.UnaryExpr(
|
|
1898
1776
|
op=op,
|
|
1899
1777
|
operand=operand,
|
|
1900
1778
|
kid=self.cur_nodes,
|
|
1901
1779
|
)
|
|
1902
1780
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1903
1781
|
|
|
1904
|
-
def power(self, _: None) ->
|
|
1782
|
+
def power(self, _: None) -> uni.Expr:
|
|
1905
1783
|
"""Grammar rule.
|
|
1906
1784
|
|
|
1907
1785
|
power: (power STAR_POW)? factor
|
|
1908
1786
|
"""
|
|
1909
1787
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1910
1788
|
|
|
1911
|
-
def connect(self, _: None) ->
|
|
1789
|
+
def connect(self, _: None) -> uni.Expr:
|
|
1912
1790
|
"""Grammar rule.
|
|
1913
1791
|
|
|
1914
1792
|
connect: (connect (connect_op | disconnect_op))? atomic_pipe
|
|
1915
1793
|
"""
|
|
1916
1794
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1917
1795
|
|
|
1918
|
-
def atomic_pipe(self, _: None) ->
|
|
1796
|
+
def atomic_pipe(self, _: None) -> uni.Expr:
|
|
1919
1797
|
"""Grammar rule.
|
|
1920
1798
|
|
|
1921
1799
|
atomic_pipe: (atomic_pipe A_PIPE_FWD)? atomic_pipe_back
|
|
1922
1800
|
"""
|
|
1923
1801
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1924
1802
|
|
|
1925
|
-
def atomic_pipe_back(self, _: None) ->
|
|
1803
|
+
def atomic_pipe_back(self, _: None) -> uni.Expr:
|
|
1926
1804
|
"""Grammar rule.
|
|
1927
1805
|
|
|
1928
1806
|
atomic_pipe_back: (atomic_pipe_back A_PIPE_BKWD)? ds_spawn
|
|
1929
1807
|
"""
|
|
1930
1808
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1931
1809
|
|
|
1932
|
-
def ds_spawn(self, _: None) ->
|
|
1810
|
+
def ds_spawn(self, _: None) -> uni.Expr:
|
|
1933
1811
|
"""Grammar rule.
|
|
1934
1812
|
|
|
1935
1813
|
ds_spawn: (ds_spawn KW_SPAWN)? unpack
|
|
1936
1814
|
"""
|
|
1937
1815
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1938
1816
|
|
|
1939
|
-
def unpack(self, _: None) ->
|
|
1817
|
+
def unpack(self, _: None) -> uni.Expr:
|
|
1940
1818
|
"""Grammar rule.
|
|
1941
1819
|
|
|
1942
1820
|
unpack: STAR_MUL? ref
|
|
1943
1821
|
"""
|
|
1944
1822
|
if op := self.match_token(Tok.STAR_MUL):
|
|
1945
|
-
operand = self.consume(
|
|
1946
|
-
return
|
|
1823
|
+
operand = self.consume(uni.Expr)
|
|
1824
|
+
return uni.UnaryExpr(
|
|
1947
1825
|
op=op,
|
|
1948
1826
|
operand=operand,
|
|
1949
1827
|
kid=self.cur_nodes,
|
|
1950
1828
|
)
|
|
1951
1829
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1952
1830
|
|
|
1953
|
-
def ref(self, _: None) ->
|
|
1831
|
+
def ref(self, _: None) -> uni.Expr:
|
|
1954
1832
|
"""Grammar rule.
|
|
1955
1833
|
|
|
1956
1834
|
ref: walrus_assign
|
|
1957
1835
|
| BW_AND walrus_assign
|
|
1958
1836
|
"""
|
|
1959
1837
|
if op := self.match_token(Tok.BW_AND):
|
|
1960
|
-
operand = self.consume(
|
|
1961
|
-
return
|
|
1838
|
+
operand = self.consume(uni.Expr)
|
|
1839
|
+
return uni.UnaryExpr(
|
|
1962
1840
|
op=op,
|
|
1963
1841
|
operand=operand,
|
|
1964
1842
|
kid=self.cur_nodes,
|
|
1965
1843
|
)
|
|
1966
1844
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1967
1845
|
|
|
1968
|
-
def pipe_call(self, _: None) ->
|
|
1846
|
+
def pipe_call(self, _: None) -> uni.Expr:
|
|
1969
1847
|
"""Grammar rule.
|
|
1970
1848
|
|
|
1971
|
-
pipe_call: atomic_chain
|
|
1972
|
-
| PIPE_FWD atomic_chain
|
|
1973
|
-
| A_PIPE_FWD atomic_chain
|
|
1974
|
-
| KW_SPAWN atomic_chain
|
|
1975
|
-
| KW_AWAIT atomic_chain
|
|
1849
|
+
pipe_call: (PIPE_FWD | A_PIPE_FWD | KW_SPAWN | KW_AWAIT)? atomic_chain
|
|
1976
1850
|
"""
|
|
1977
1851
|
if len(self.cur_nodes) == 2:
|
|
1978
1852
|
if self.match_token(Tok.KW_AWAIT):
|
|
1979
|
-
target = self.consume(
|
|
1980
|
-
return
|
|
1853
|
+
target = self.consume(uni.Expr)
|
|
1854
|
+
return uni.AwaitExpr(
|
|
1981
1855
|
target=target,
|
|
1982
1856
|
kid=self.cur_nodes,
|
|
1983
1857
|
)
|
|
1984
|
-
elif op := self.match(
|
|
1985
|
-
operand = self.consume(
|
|
1986
|
-
return
|
|
1858
|
+
elif op := self.match(uni.Token):
|
|
1859
|
+
operand = self.consume(uni.Expr)
|
|
1860
|
+
return uni.UnaryExpr(
|
|
1987
1861
|
op=op,
|
|
1988
1862
|
operand=operand,
|
|
1989
1863
|
kid=self.cur_nodes,
|
|
1990
1864
|
)
|
|
1991
1865
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1992
1866
|
|
|
1993
|
-
def aug_op(self, _: None) ->
|
|
1867
|
+
def aug_op(self, _: None) -> uni.Token:
|
|
1994
1868
|
"""Grammar rule.
|
|
1995
1869
|
|
|
1996
1870
|
aug_op: RSHIFT_EQ
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
1871
|
+
| LSHIFT_EQ
|
|
1872
|
+
| BW_NOT_EQ
|
|
1873
|
+
| BW_XOR_EQ
|
|
1874
|
+
| BW_OR_EQ
|
|
1875
|
+
| BW_AND_EQ
|
|
1876
|
+
| MOD_EQ
|
|
1877
|
+
| DIV_EQ
|
|
1878
|
+
| FLOOR_DIV_EQ
|
|
1879
|
+
| MUL_EQ
|
|
1880
|
+
| SUB_EQ
|
|
1881
|
+
| ADD_EQ
|
|
1882
|
+
| MATMUL_EQ
|
|
1883
|
+
| STAR_POW_EQ
|
|
2009
1884
|
"""
|
|
2010
|
-
return self.consume(
|
|
1885
|
+
return self.consume(uni.Token)
|
|
2011
1886
|
|
|
2012
|
-
def atomic_chain(self, _: None) ->
|
|
1887
|
+
def atomic_chain(self, _: None) -> uni.Expr:
|
|
2013
1888
|
"""Grammar rule.
|
|
2014
1889
|
|
|
2015
1890
|
atomic_chain: atomic_chain NULL_OK? (filter_compr | assign_compr | index_slice)
|
|
@@ -2017,11 +1892,11 @@ class JacParser(Pass):
|
|
|
2017
1892
|
| (atomic_call | atom | edge_ref_chain)
|
|
2018
1893
|
"""
|
|
2019
1894
|
if len(self.cur_nodes) == 1:
|
|
2020
|
-
return self.consume(
|
|
2021
|
-
target = self.consume(
|
|
1895
|
+
return self.consume(uni.Expr)
|
|
1896
|
+
target = self.consume(uni.Expr)
|
|
2022
1897
|
is_null_ok = bool(self.match_token(Tok.NULL_OK))
|
|
2023
|
-
if right := self.match(
|
|
2024
|
-
return
|
|
1898
|
+
if right := self.match(uni.AtomExpr):
|
|
1899
|
+
return uni.AtomTrailer(
|
|
2025
1900
|
target=target,
|
|
2026
1901
|
right=right,
|
|
2027
1902
|
is_null_ok=is_null_ok,
|
|
@@ -2033,8 +1908,8 @@ class JacParser(Pass):
|
|
|
2033
1908
|
or self.match_token(Tok.DOT_FWD)
|
|
2034
1909
|
or self.consume_token(Tok.DOT)
|
|
2035
1910
|
)
|
|
2036
|
-
name = self.match(
|
|
2037
|
-
return
|
|
1911
|
+
name = self.match(uni.AtomExpr) or self.consume(uni.AtomTrailer)
|
|
1912
|
+
return uni.AtomTrailer(
|
|
2038
1913
|
target=(target if token.name != Tok.DOT_BKWD else name),
|
|
2039
1914
|
right=(name if token.name != Tok.DOT_BKWD else target),
|
|
2040
1915
|
is_null_ok=is_null_ok,
|
|
@@ -2042,26 +1917,26 @@ class JacParser(Pass):
|
|
|
2042
1917
|
kid=self.cur_nodes,
|
|
2043
1918
|
)
|
|
2044
1919
|
|
|
2045
|
-
def atomic_call(self, _: None) ->
|
|
1920
|
+
def atomic_call(self, _: None) -> uni.FuncCall:
|
|
2046
1921
|
"""Grammar rule.
|
|
2047
1922
|
|
|
2048
1923
|
atomic_call: atomic_chain LPAREN param_list? (KW_BY atomic_call)? RPAREN
|
|
2049
1924
|
"""
|
|
2050
|
-
genai_call:
|
|
2051
|
-
target = self.consume(
|
|
1925
|
+
genai_call: uni.FuncCall | None = None
|
|
1926
|
+
target = self.consume(uni.Expr)
|
|
2052
1927
|
self.consume_token(Tok.LPAREN)
|
|
2053
|
-
params = self.match(
|
|
1928
|
+
params = self.match(uni.SubNodeList)
|
|
2054
1929
|
if self.match_token(Tok.KW_BY):
|
|
2055
|
-
genai_call = self.consume(
|
|
1930
|
+
genai_call = self.consume(uni.FuncCall)
|
|
2056
1931
|
self.consume_token(Tok.RPAREN)
|
|
2057
|
-
return
|
|
1932
|
+
return uni.FuncCall(
|
|
2058
1933
|
target=target,
|
|
2059
1934
|
params=params,
|
|
2060
1935
|
genai_call=genai_call,
|
|
2061
1936
|
kid=self.cur_nodes,
|
|
2062
1937
|
)
|
|
2063
1938
|
|
|
2064
|
-
def index_slice(self, _: None) ->
|
|
1939
|
+
def index_slice(self, _: None) -> uni.IndexSlice:
|
|
2065
1940
|
"""Grammar rule.
|
|
2066
1941
|
|
|
2067
1942
|
index_slice: LSQUARE \
|
|
@@ -2071,44 +1946,44 @@ class JacParser(Pass):
|
|
|
2071
1946
|
| list_val
|
|
2072
1947
|
"""
|
|
2073
1948
|
if len(self.cur_nodes) == 1:
|
|
2074
|
-
index = self.consume(
|
|
1949
|
+
index = self.consume(uni.ListVal)
|
|
2075
1950
|
if not index.values:
|
|
2076
1951
|
raise self.ice()
|
|
2077
1952
|
if len(index.values.items) == 1:
|
|
2078
1953
|
expr = index.values.items[0] if index.values else None
|
|
2079
1954
|
kid = self.cur_nodes
|
|
2080
1955
|
else:
|
|
2081
|
-
sublist =
|
|
1956
|
+
sublist = uni.SubNodeList[uni.Expr | uni.KWPair](
|
|
2082
1957
|
items=[*index.values.items], delim=Tok.COMMA, kid=index.kid
|
|
2083
1958
|
)
|
|
2084
|
-
expr =
|
|
1959
|
+
expr = uni.TupleVal(values=sublist, kid=[sublist])
|
|
2085
1960
|
kid = [expr]
|
|
2086
|
-
return
|
|
2087
|
-
slices=[
|
|
1961
|
+
return uni.IndexSlice(
|
|
1962
|
+
slices=[uni.IndexSlice.Slice(start=expr, stop=None, step=None)],
|
|
2088
1963
|
is_range=False,
|
|
2089
1964
|
kid=kid,
|
|
2090
1965
|
)
|
|
2091
1966
|
else:
|
|
2092
1967
|
self.consume_token(Tok.LSQUARE)
|
|
2093
|
-
slices: list[
|
|
1968
|
+
slices: list[uni.IndexSlice.Slice] = []
|
|
2094
1969
|
while not self.match_token(Tok.RSQUARE):
|
|
2095
|
-
expr1 = self.match(
|
|
1970
|
+
expr1 = self.match(uni.Expr)
|
|
2096
1971
|
self.consume_token(Tok.COLON)
|
|
2097
|
-
expr2 = self.match(
|
|
1972
|
+
expr2 = self.match(uni.Expr)
|
|
2098
1973
|
expr3 = (
|
|
2099
|
-
self.match(
|
|
1974
|
+
self.match(uni.Expr) if self.match_token(Tok.COLON) else None
|
|
2100
1975
|
)
|
|
2101
1976
|
self.match_token(Tok.COMMA)
|
|
2102
1977
|
slices.append(
|
|
2103
|
-
|
|
1978
|
+
uni.IndexSlice.Slice(start=expr1, stop=expr2, step=expr3)
|
|
2104
1979
|
)
|
|
2105
|
-
return
|
|
1980
|
+
return uni.IndexSlice(
|
|
2106
1981
|
slices=slices,
|
|
2107
1982
|
is_range=True,
|
|
2108
1983
|
kid=self.cur_nodes,
|
|
2109
1984
|
)
|
|
2110
1985
|
|
|
2111
|
-
def atom(self, _: None) ->
|
|
1986
|
+
def atom(self, _: None) -> uni.Expr:
|
|
2112
1987
|
"""Grammar rule.
|
|
2113
1988
|
|
|
2114
1989
|
atom: named_ref
|
|
@@ -2118,41 +1993,42 @@ class JacParser(Pass):
|
|
|
2118
1993
|
| type_ref
|
|
2119
1994
|
"""
|
|
2120
1995
|
if self.match_token(Tok.LPAREN):
|
|
2121
|
-
value = self.match(
|
|
1996
|
+
value = self.match(uni.Expr) or self.consume(uni.YieldExpr)
|
|
2122
1997
|
self.consume_token(Tok.RPAREN)
|
|
2123
|
-
return
|
|
2124
|
-
return self.consume(
|
|
1998
|
+
return uni.AtomUnit(value=value, kid=self.cur_nodes)
|
|
1999
|
+
return self.consume(uni.AtomExpr)
|
|
2125
2000
|
|
|
2126
|
-
def yield_expr(self, _: None) ->
|
|
2001
|
+
def yield_expr(self, _: None) -> uni.YieldExpr:
|
|
2127
2002
|
"""Grammar rule.
|
|
2128
2003
|
|
|
2129
2004
|
yield_expr: KW_YIELD KW_FROM? expression
|
|
2130
2005
|
"""
|
|
2131
2006
|
self.consume_token(Tok.KW_YIELD)
|
|
2132
2007
|
is_with_from = bool(self.match_token(Tok.KW_FROM))
|
|
2133
|
-
expr = self.consume(
|
|
2134
|
-
return
|
|
2008
|
+
expr = self.consume(uni.Expr)
|
|
2009
|
+
return uni.YieldExpr(
|
|
2135
2010
|
expr=expr,
|
|
2136
2011
|
with_from=is_with_from,
|
|
2137
2012
|
kid=self.cur_nodes,
|
|
2138
2013
|
)
|
|
2139
2014
|
|
|
2140
|
-
def atom_literal(self, _: None) ->
|
|
2015
|
+
def atom_literal(self, _: None) -> uni.AtomExpr:
|
|
2141
2016
|
"""Grammar rule.
|
|
2142
2017
|
|
|
2143
2018
|
atom_literal: builtin_type
|
|
2144
2019
|
| NULL
|
|
2145
2020
|
| BOOL
|
|
2146
2021
|
| multistring
|
|
2022
|
+
| ELLIPSIS
|
|
2147
2023
|
| FLOAT
|
|
2148
2024
|
| OCT
|
|
2149
2025
|
| BIN
|
|
2150
2026
|
| HEX
|
|
2151
2027
|
| INT
|
|
2152
2028
|
"""
|
|
2153
|
-
return self.consume(
|
|
2029
|
+
return self.consume(uni.AtomExpr)
|
|
2154
2030
|
|
|
2155
|
-
def atom_collection(self, kid: list[
|
|
2031
|
+
def atom_collection(self, kid: list[uni.UniNode]) -> uni.AtomExpr:
|
|
2156
2032
|
"""Grammar rule.
|
|
2157
2033
|
|
|
2158
2034
|
atom_collection: dict_compr
|
|
@@ -2164,217 +2040,204 @@ class JacParser(Pass):
|
|
|
2164
2040
|
| tuple_val
|
|
2165
2041
|
| list_val
|
|
2166
2042
|
"""
|
|
2167
|
-
return self.consume(
|
|
2043
|
+
return self.consume(uni.AtomExpr)
|
|
2168
2044
|
|
|
2169
|
-
def multistring(self, _: None) ->
|
|
2045
|
+
def multistring(self, _: None) -> uni.AtomExpr:
|
|
2170
2046
|
"""Grammar rule.
|
|
2171
2047
|
|
|
2172
2048
|
multistring: (fstring | STRING)+
|
|
2173
2049
|
"""
|
|
2174
|
-
valid_strs = [self.match(
|
|
2175
|
-
while node := (self.match(
|
|
2050
|
+
valid_strs = [self.match(uni.String) or self.consume(uni.FString)]
|
|
2051
|
+
while node := (self.match(uni.String) or self.match(uni.FString)):
|
|
2176
2052
|
valid_strs.append(node)
|
|
2177
|
-
return
|
|
2053
|
+
return uni.MultiString(
|
|
2178
2054
|
strings=valid_strs,
|
|
2179
2055
|
kid=self.cur_nodes,
|
|
2180
2056
|
)
|
|
2181
2057
|
|
|
2182
|
-
def fstring(self, _: None) ->
|
|
2058
|
+
def fstring(self, _: None) -> uni.FString:
|
|
2183
2059
|
"""Grammar rule.
|
|
2184
2060
|
|
|
2185
2061
|
fstring: FSTR_START fstr_parts FSTR_END
|
|
2186
2062
|
| FSTR_SQ_START fstr_sq_parts FSTR_SQ_END
|
|
2187
2063
|
"""
|
|
2188
2064
|
self.match_token(Tok.FSTR_START) or self.consume_token(Tok.FSTR_SQ_START)
|
|
2189
|
-
target = self.match(
|
|
2065
|
+
target = self.match(uni.SubNodeList)
|
|
2190
2066
|
self.match_token(Tok.FSTR_END) or self.consume_token(Tok.FSTR_SQ_END)
|
|
2191
|
-
return
|
|
2067
|
+
return uni.FString(
|
|
2192
2068
|
parts=target,
|
|
2193
2069
|
kid=self.cur_nodes,
|
|
2194
2070
|
)
|
|
2195
2071
|
|
|
2196
|
-
def fstr_parts(self, _: None) ->
|
|
2072
|
+
def fstr_parts(self, _: None) -> uni.SubNodeList[uni.String | uni.ExprStmt]:
|
|
2197
2073
|
"""Grammar rule.
|
|
2198
2074
|
|
|
2199
2075
|
fstr_parts: (FSTR_PIECE | FSTR_BESC | LBRACE expression RBRACE )*
|
|
2200
2076
|
"""
|
|
2201
|
-
valid_parts: list[
|
|
2077
|
+
valid_parts: list[uni.String | uni.ExprStmt] = [
|
|
2202
2078
|
(
|
|
2203
2079
|
i
|
|
2204
|
-
if isinstance(i,
|
|
2205
|
-
else
|
|
2080
|
+
if isinstance(i, uni.String)
|
|
2081
|
+
else uni.ExprStmt(expr=i, in_fstring=True, kid=[i])
|
|
2206
2082
|
)
|
|
2207
2083
|
for i in self.cur_nodes
|
|
2208
|
-
if isinstance(i,
|
|
2084
|
+
if isinstance(i, uni.Expr)
|
|
2209
2085
|
]
|
|
2210
|
-
return
|
|
2086
|
+
return uni.SubNodeList[uni.String | uni.ExprStmt](
|
|
2211
2087
|
items=valid_parts,
|
|
2212
2088
|
delim=None,
|
|
2213
2089
|
kid=valid_parts,
|
|
2214
2090
|
)
|
|
2215
2091
|
|
|
2216
|
-
def fstr_sq_parts(self, _: None) ->
|
|
2092
|
+
def fstr_sq_parts(self, _: None) -> uni.SubNodeList[uni.String | uni.ExprStmt]:
|
|
2217
2093
|
"""Grammar rule.
|
|
2218
2094
|
|
|
2219
2095
|
fstr_sq_parts: (FSTR_SQ_PIECE | FSTR_BESC | LBRACE expression RBRACE )*
|
|
2220
2096
|
"""
|
|
2221
|
-
valid_parts: list[
|
|
2097
|
+
valid_parts: list[uni.String | uni.ExprStmt] = [
|
|
2222
2098
|
(
|
|
2223
2099
|
i
|
|
2224
|
-
if isinstance(i,
|
|
2225
|
-
else
|
|
2100
|
+
if isinstance(i, uni.String)
|
|
2101
|
+
else uni.ExprStmt(expr=i, in_fstring=True, kid=[i])
|
|
2226
2102
|
)
|
|
2227
2103
|
for i in self.cur_nodes
|
|
2228
|
-
if isinstance(i,
|
|
2104
|
+
if isinstance(i, uni.Expr)
|
|
2229
2105
|
]
|
|
2230
|
-
return
|
|
2106
|
+
return uni.SubNodeList[uni.String | uni.ExprStmt](
|
|
2231
2107
|
items=valid_parts,
|
|
2232
2108
|
delim=None,
|
|
2233
2109
|
kid=valid_parts,
|
|
2234
2110
|
)
|
|
2235
2111
|
|
|
2236
|
-
def list_val(self,
|
|
2112
|
+
def list_val(self, _: None) -> uni.ListVal:
|
|
2237
2113
|
"""Grammar rule.
|
|
2238
2114
|
|
|
2239
2115
|
list_val: LSQUARE (expr_list COMMA?)? RSQUARE
|
|
2240
2116
|
"""
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
kid=kid,
|
|
2250
|
-
)
|
|
2251
|
-
else:
|
|
2252
|
-
raise self.ice()
|
|
2117
|
+
self.consume_token(Tok.LSQUARE)
|
|
2118
|
+
values = self.match(uni.SubNodeList)
|
|
2119
|
+
self.match_token(Tok.COMMA)
|
|
2120
|
+
self.consume_token(Tok.RSQUARE)
|
|
2121
|
+
return uni.ListVal(
|
|
2122
|
+
values=values,
|
|
2123
|
+
kid=self.cur_nodes,
|
|
2124
|
+
)
|
|
2253
2125
|
|
|
2254
|
-
def tuple_val(self, _: None) ->
|
|
2126
|
+
def tuple_val(self, _: None) -> uni.TupleVal:
|
|
2255
2127
|
"""Grammar rule.
|
|
2256
2128
|
|
|
2257
2129
|
tuple_val: LPAREN tuple_list? RPAREN
|
|
2258
2130
|
"""
|
|
2259
2131
|
self.consume_token(Tok.LPAREN)
|
|
2260
|
-
target = self.match(
|
|
2132
|
+
target = self.match(uni.SubNodeList)
|
|
2261
2133
|
self.consume_token(Tok.RPAREN)
|
|
2262
|
-
return
|
|
2134
|
+
return uni.TupleVal(
|
|
2263
2135
|
values=target,
|
|
2264
2136
|
kid=self.cur_nodes,
|
|
2265
2137
|
)
|
|
2266
2138
|
|
|
2267
|
-
def set_val(self, _: None) ->
|
|
2139
|
+
def set_val(self, _: None) -> uni.SetVal:
|
|
2268
2140
|
"""Grammar rule.
|
|
2269
2141
|
|
|
2270
2142
|
set_val: LBRACE expr_list COMMA? RBRACE
|
|
2271
2143
|
"""
|
|
2272
2144
|
self.match_token(Tok.LBRACE)
|
|
2273
|
-
expr_list = self.match(
|
|
2145
|
+
expr_list = self.match(uni.SubNodeList)
|
|
2274
2146
|
self.match_token(Tok.COMMA)
|
|
2275
2147
|
self.match_token(Tok.RBRACE)
|
|
2276
|
-
return
|
|
2148
|
+
return uni.SetVal(
|
|
2277
2149
|
values=expr_list,
|
|
2278
2150
|
kid=self.cur_nodes,
|
|
2279
2151
|
)
|
|
2280
2152
|
|
|
2281
|
-
def expr_list(self, kid: list[
|
|
2153
|
+
def expr_list(self, kid: list[uni.UniNode]) -> uni.SubNodeList[uni.Expr]:
|
|
2282
2154
|
"""Grammar rule.
|
|
2283
2155
|
|
|
2284
2156
|
expr_list: (expr_list COMMA)? expression
|
|
2285
2157
|
"""
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
else:
|
|
2295
|
-
expr = kid[0]
|
|
2296
|
-
new_kid = [expr]
|
|
2297
|
-
valid_kid = [i for i in new_kid if isinstance(i, ast.Expr)]
|
|
2298
|
-
return ast.SubNodeList[ast.Expr](
|
|
2158
|
+
new_kid: list = []
|
|
2159
|
+
if consume := self.match(uni.SubNodeList):
|
|
2160
|
+
comma = self.consume_token(Tok.COMMA)
|
|
2161
|
+
new_kid.extend([*consume.kid, comma])
|
|
2162
|
+
expr = self.consume(uni.Expr)
|
|
2163
|
+
new_kid.extend([expr])
|
|
2164
|
+
valid_kid = [i for i in new_kid if isinstance(i, uni.Expr)]
|
|
2165
|
+
return uni.SubNodeList[uni.Expr](
|
|
2299
2166
|
items=valid_kid,
|
|
2300
2167
|
delim=Tok.COMMA,
|
|
2301
2168
|
kid=new_kid,
|
|
2302
2169
|
)
|
|
2303
2170
|
|
|
2304
|
-
def kw_expr_list(self, kid: list[
|
|
2171
|
+
def kw_expr_list(self, kid: list[uni.UniNode]) -> uni.SubNodeList[uni.KWPair]:
|
|
2305
2172
|
"""Grammar rule.
|
|
2306
2173
|
|
|
2307
2174
|
kw_expr_list: (kw_expr_list COMMA)? kw_expr
|
|
2308
2175
|
"""
|
|
2309
|
-
if consume := self.match(
|
|
2176
|
+
if consume := self.match(uni.SubNodeList):
|
|
2310
2177
|
comma = self.consume_token(Tok.COMMA)
|
|
2311
|
-
expr = self.consume(
|
|
2178
|
+
expr = self.consume(uni.KWPair)
|
|
2312
2179
|
new_kid = [*consume.kid, comma, expr]
|
|
2313
2180
|
else:
|
|
2314
|
-
expr = self.consume(
|
|
2181
|
+
expr = self.consume(uni.KWPair)
|
|
2315
2182
|
new_kid = [expr]
|
|
2316
|
-
valid_kid = [i for i in new_kid if isinstance(i,
|
|
2317
|
-
return
|
|
2183
|
+
valid_kid = [i for i in new_kid if isinstance(i, uni.KWPair)]
|
|
2184
|
+
return uni.SubNodeList[uni.KWPair](
|
|
2318
2185
|
items=valid_kid,
|
|
2319
2186
|
delim=Tok.COMMA,
|
|
2320
2187
|
kid=new_kid,
|
|
2321
2188
|
)
|
|
2322
2189
|
|
|
2323
|
-
def kw_expr(self,
|
|
2190
|
+
def kw_expr(self, _: None) -> uni.KWPair:
|
|
2324
2191
|
"""Grammar rule.
|
|
2325
2192
|
|
|
2326
2193
|
kw_expr: named_ref EQ expression | STAR_POW expression
|
|
2327
2194
|
"""
|
|
2328
|
-
if (
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
and isinstance(kid[2], ast.Expr)
|
|
2332
|
-
):
|
|
2333
|
-
return ast.KWPair(
|
|
2334
|
-
key=kid[0],
|
|
2335
|
-
value=kid[2],
|
|
2336
|
-
kid=kid,
|
|
2337
|
-
)
|
|
2338
|
-
elif len(kid) == 2 and isinstance(kid[1], ast.Expr):
|
|
2339
|
-
return ast.KWPair(
|
|
2340
|
-
key=None,
|
|
2341
|
-
value=kid[1],
|
|
2342
|
-
kid=kid,
|
|
2343
|
-
)
|
|
2195
|
+
if self.match_token(Tok.STAR_POW):
|
|
2196
|
+
value = self.consume(uni.Expr)
|
|
2197
|
+
key = None
|
|
2344
2198
|
else:
|
|
2345
|
-
|
|
2199
|
+
key = self.consume(uni.Name)
|
|
2200
|
+
self.consume_token(Tok.EQ)
|
|
2201
|
+
value = self.consume(uni.Expr)
|
|
2202
|
+
return uni.KWPair(
|
|
2203
|
+
key=key,
|
|
2204
|
+
value=value,
|
|
2205
|
+
kid=self.cur_nodes,
|
|
2206
|
+
)
|
|
2346
2207
|
|
|
2347
|
-
def name_list(self,
|
|
2208
|
+
def name_list(self, _: None) -> uni.SubNodeList[uni.Name]:
|
|
2348
2209
|
"""Grammar rule.
|
|
2349
2210
|
|
|
2350
2211
|
name_list: (named_ref COMMA)* named_ref
|
|
2351
2212
|
"""
|
|
2352
|
-
valid_kid = [
|
|
2353
|
-
|
|
2213
|
+
valid_kid = [self.consume(uni.Name)]
|
|
2214
|
+
while self.match_token(Tok.COMMA):
|
|
2215
|
+
valid_kid.append(self.consume(uni.Name))
|
|
2216
|
+
return uni.SubNodeList[uni.Name](
|
|
2354
2217
|
items=valid_kid,
|
|
2355
2218
|
delim=Tok.COMMA,
|
|
2356
|
-
kid=
|
|
2219
|
+
kid=self.cur_nodes,
|
|
2357
2220
|
)
|
|
2358
2221
|
|
|
2359
|
-
def tuple_list(self, _: None) ->
|
|
2222
|
+
def tuple_list(self, _: None) -> uni.SubNodeList[uni.Expr | uni.KWPair]:
|
|
2360
2223
|
"""Grammar rule.
|
|
2361
2224
|
|
|
2362
|
-
tuple_list: expression COMMA expr_list
|
|
2225
|
+
tuple_list: expression COMMA expr_list COMMA kw_expr_list COMMA?
|
|
2363
2226
|
| expression COMMA kw_expr_list COMMA?
|
|
2364
|
-
| expression COMMA expr_list
|
|
2227
|
+
| expression COMMA expr_list COMMA?
|
|
2365
2228
|
| expression COMMA
|
|
2366
2229
|
| kw_expr_list COMMA?
|
|
2367
2230
|
"""
|
|
2368
|
-
if first_expr := self.match(
|
|
2231
|
+
if first_expr := self.match(uni.SubNodeList):
|
|
2369
2232
|
comma = self.match_token(Tok.COMMA)
|
|
2370
2233
|
if comma:
|
|
2371
2234
|
first_expr.kid.append(comma)
|
|
2372
2235
|
return first_expr
|
|
2373
|
-
expr = self.consume(
|
|
2236
|
+
expr = self.consume(uni.Expr)
|
|
2374
2237
|
self.consume_token(Tok.COMMA)
|
|
2375
|
-
second_expr = self.match(
|
|
2238
|
+
second_expr = self.match(uni.SubNodeList)
|
|
2376
2239
|
self.match_token(Tok.COMMA)
|
|
2377
|
-
kw_expr_list = self.match(
|
|
2240
|
+
kw_expr_list = self.match(uni.SubNodeList)
|
|
2378
2241
|
self.match_token(Tok.COMMA)
|
|
2379
2242
|
expr_list: list = []
|
|
2380
2243
|
if second_expr:
|
|
@@ -2382,111 +2245,111 @@ class JacParser(Pass):
|
|
|
2382
2245
|
if kw_expr_list:
|
|
2383
2246
|
expr_list = [*expr_list, *kw_expr_list.kid]
|
|
2384
2247
|
expr_list = [expr, *expr_list]
|
|
2385
|
-
valid_kid = [i for i in expr_list if isinstance(i, (
|
|
2386
|
-
return
|
|
2248
|
+
valid_kid = [i for i in expr_list if isinstance(i, (uni.Expr, uni.KWPair))]
|
|
2249
|
+
return uni.SubNodeList[uni.Expr | uni.KWPair](
|
|
2387
2250
|
items=valid_kid,
|
|
2388
2251
|
delim=Tok.COMMA,
|
|
2389
2252
|
kid=self.cur_nodes,
|
|
2390
2253
|
)
|
|
2391
2254
|
|
|
2392
|
-
def dict_val(self, _: None) ->
|
|
2255
|
+
def dict_val(self, _: None) -> uni.DictVal:
|
|
2393
2256
|
"""Grammar rule.
|
|
2394
2257
|
|
|
2395
2258
|
dict_val: LBRACE ((kv_pair COMMA)* kv_pair COMMA?)? RBRACE
|
|
2396
2259
|
"""
|
|
2397
2260
|
self.consume_token(Tok.LBRACE)
|
|
2398
2261
|
kv_pairs: list = []
|
|
2399
|
-
while item := self.match(
|
|
2262
|
+
while item := self.match(uni.KVPair):
|
|
2400
2263
|
kv_pairs.append(item)
|
|
2401
2264
|
self.match_token(Tok.COMMA)
|
|
2402
2265
|
self.consume_token(Tok.RBRACE)
|
|
2403
|
-
return
|
|
2266
|
+
return uni.DictVal(
|
|
2404
2267
|
kv_pairs=kv_pairs,
|
|
2405
2268
|
kid=self.cur_nodes,
|
|
2406
2269
|
)
|
|
2407
2270
|
|
|
2408
|
-
def kv_pair(self, _: None) ->
|
|
2271
|
+
def kv_pair(self, _: None) -> uni.KVPair:
|
|
2409
2272
|
"""Grammar rule.
|
|
2410
2273
|
|
|
2411
2274
|
kv_pair: expression COLON expression | STAR_POW expression
|
|
2412
2275
|
"""
|
|
2413
2276
|
if self.match_token(Tok.STAR_POW):
|
|
2414
|
-
value = self.consume(
|
|
2415
|
-
return
|
|
2277
|
+
value = self.consume(uni.Expr)
|
|
2278
|
+
return uni.KVPair(
|
|
2416
2279
|
key=None,
|
|
2417
2280
|
value=value,
|
|
2418
2281
|
kid=self.cur_nodes,
|
|
2419
2282
|
)
|
|
2420
|
-
key = self.consume(
|
|
2283
|
+
key = self.consume(uni.Expr)
|
|
2421
2284
|
self.consume_token(Tok.COLON)
|
|
2422
|
-
value = self.consume(
|
|
2423
|
-
return
|
|
2285
|
+
value = self.consume(uni.Expr)
|
|
2286
|
+
return uni.KVPair(
|
|
2424
2287
|
key=key,
|
|
2425
2288
|
value=value,
|
|
2426
2289
|
kid=self.cur_nodes,
|
|
2427
2290
|
)
|
|
2428
2291
|
|
|
2429
|
-
def list_compr(self, _: None) ->
|
|
2292
|
+
def list_compr(self, _: None) -> uni.ListCompr:
|
|
2430
2293
|
"""Grammar rule.
|
|
2431
2294
|
|
|
2432
2295
|
list_compr: LSQUARE expression inner_compr+ RSQUARE
|
|
2433
2296
|
"""
|
|
2434
2297
|
self.consume_token(Tok.LSQUARE)
|
|
2435
|
-
out_expr = self.consume(
|
|
2436
|
-
comprs = self.consume_many(
|
|
2298
|
+
out_expr = self.consume(uni.Expr)
|
|
2299
|
+
comprs = self.consume_many(uni.InnerCompr)
|
|
2437
2300
|
self.consume_token(Tok.RSQUARE)
|
|
2438
|
-
return
|
|
2301
|
+
return uni.ListCompr(
|
|
2439
2302
|
out_expr=out_expr,
|
|
2440
2303
|
compr=comprs,
|
|
2441
2304
|
kid=self.cur_nodes,
|
|
2442
2305
|
)
|
|
2443
2306
|
|
|
2444
|
-
def gen_compr(self, _: None) ->
|
|
2307
|
+
def gen_compr(self, _: None) -> uni.GenCompr:
|
|
2445
2308
|
"""Grammar rule.
|
|
2446
2309
|
|
|
2447
2310
|
gen_compr: LPAREN expression inner_compr+ RPAREN
|
|
2448
2311
|
"""
|
|
2449
2312
|
self.consume_token(Tok.LPAREN)
|
|
2450
|
-
out_expr = self.consume(
|
|
2451
|
-
comprs = self.consume_many(
|
|
2313
|
+
out_expr = self.consume(uni.Expr)
|
|
2314
|
+
comprs = self.consume_many(uni.InnerCompr)
|
|
2452
2315
|
self.consume_token(Tok.RPAREN)
|
|
2453
|
-
return
|
|
2316
|
+
return uni.GenCompr(
|
|
2454
2317
|
out_expr=out_expr,
|
|
2455
2318
|
compr=comprs,
|
|
2456
2319
|
kid=self.cur_nodes,
|
|
2457
2320
|
)
|
|
2458
2321
|
|
|
2459
|
-
def set_compr(self, _: None) ->
|
|
2322
|
+
def set_compr(self, _: None) -> uni.SetCompr:
|
|
2460
2323
|
"""Grammar rule.
|
|
2461
2324
|
|
|
2462
2325
|
set_compr: LBRACE expression inner_compr+ RBRACE
|
|
2463
2326
|
"""
|
|
2464
2327
|
self.consume_token(Tok.LBRACE)
|
|
2465
|
-
out_expr = self.consume(
|
|
2466
|
-
comprs = self.consume_many(
|
|
2328
|
+
out_expr = self.consume(uni.Expr)
|
|
2329
|
+
comprs = self.consume_many(uni.InnerCompr)
|
|
2467
2330
|
self.consume_token(Tok.RBRACE)
|
|
2468
|
-
return
|
|
2331
|
+
return uni.SetCompr(
|
|
2469
2332
|
out_expr=out_expr,
|
|
2470
2333
|
compr=comprs,
|
|
2471
2334
|
kid=self.cur_nodes,
|
|
2472
2335
|
)
|
|
2473
2336
|
|
|
2474
|
-
def dict_compr(self, _: None) ->
|
|
2337
|
+
def dict_compr(self, _: None) -> uni.DictCompr:
|
|
2475
2338
|
"""Grammar rule.
|
|
2476
2339
|
|
|
2477
2340
|
dict_compr: LBRACE kv_pair inner_compr+ RBRACE
|
|
2478
2341
|
"""
|
|
2479
2342
|
self.consume_token(Tok.LBRACE)
|
|
2480
|
-
kv_pair = self.consume(
|
|
2481
|
-
comprs = self.consume_many(
|
|
2343
|
+
kv_pair = self.consume(uni.KVPair)
|
|
2344
|
+
comprs = self.consume_many(uni.InnerCompr)
|
|
2482
2345
|
self.consume_token(Tok.RBRACE)
|
|
2483
|
-
return
|
|
2346
|
+
return uni.DictCompr(
|
|
2484
2347
|
kv_pair=kv_pair,
|
|
2485
2348
|
compr=comprs,
|
|
2486
2349
|
kid=self.cur_nodes,
|
|
2487
2350
|
)
|
|
2488
2351
|
|
|
2489
|
-
def inner_compr(self, _: None) ->
|
|
2352
|
+
def inner_compr(self, _: None) -> uni.InnerCompr:
|
|
2490
2353
|
"""Grammar rule.
|
|
2491
2354
|
|
|
2492
2355
|
inner_compr: KW_ASYNC? KW_FOR atomic_chain KW_IN pipe_call (KW_IF walrus_assign)*
|
|
@@ -2494,12 +2357,12 @@ class JacParser(Pass):
|
|
|
2494
2357
|
conditional: list = []
|
|
2495
2358
|
is_async = bool(self.match_token(Tok.KW_ASYNC))
|
|
2496
2359
|
self.consume_token(Tok.KW_FOR)
|
|
2497
|
-
target = self.consume(
|
|
2360
|
+
target = self.consume(uni.Expr)
|
|
2498
2361
|
self.consume_token(Tok.KW_IN)
|
|
2499
|
-
collection = self.consume(
|
|
2362
|
+
collection = self.consume(uni.Expr)
|
|
2500
2363
|
while self.match_token(Tok.KW_IF):
|
|
2501
|
-
conditional.append(self.consume(
|
|
2502
|
-
return
|
|
2364
|
+
conditional.append(self.consume(uni.Expr))
|
|
2365
|
+
return uni.InnerCompr(
|
|
2503
2366
|
is_async=is_async,
|
|
2504
2367
|
target=target,
|
|
2505
2368
|
collection=collection,
|
|
@@ -2507,26 +2370,26 @@ class JacParser(Pass):
|
|
|
2507
2370
|
kid=self.cur_nodes,
|
|
2508
2371
|
)
|
|
2509
2372
|
|
|
2510
|
-
def param_list(self, _: None) ->
|
|
2373
|
+
def param_list(self, _: None) -> uni.SubNodeList[uni.Expr | uni.KWPair]:
|
|
2511
2374
|
"""Grammar rule.
|
|
2512
2375
|
|
|
2513
2376
|
param_list: expr_list COMMA kw_expr_list COMMA?
|
|
2514
2377
|
| kw_expr_list COMMA?
|
|
2515
2378
|
| expr_list COMMA?
|
|
2516
2379
|
"""
|
|
2517
|
-
kw_expr_list:
|
|
2518
|
-
expr_list = self.consume(
|
|
2380
|
+
kw_expr_list: uni.SubNodeList | None = None
|
|
2381
|
+
expr_list = self.consume(uni.SubNodeList)
|
|
2519
2382
|
if len(self.cur_nodes) > 2:
|
|
2520
2383
|
self.consume_token(Tok.COMMA)
|
|
2521
|
-
kw_expr_list = self.consume(
|
|
2384
|
+
kw_expr_list = self.consume(uni.SubNodeList)
|
|
2522
2385
|
ends_comma = self.match_token(Tok.COMMA)
|
|
2523
2386
|
if kw_expr_list:
|
|
2524
2387
|
valid_kid = [
|
|
2525
2388
|
i
|
|
2526
2389
|
for i in [*expr_list.items, *kw_expr_list.items]
|
|
2527
|
-
if isinstance(i, (
|
|
2390
|
+
if isinstance(i, (uni.Expr, uni.KWPair))
|
|
2528
2391
|
]
|
|
2529
|
-
return
|
|
2392
|
+
return uni.SubNodeList[uni.Expr | uni.KWPair](
|
|
2530
2393
|
items=valid_kid,
|
|
2531
2394
|
delim=Tok.COMMA,
|
|
2532
2395
|
kid=self.cur_nodes,
|
|
@@ -2536,284 +2399,108 @@ class JacParser(Pass):
|
|
|
2536
2399
|
expr_list.kid.append(ends_comma)
|
|
2537
2400
|
return expr_list
|
|
2538
2401
|
|
|
2539
|
-
def assignment_list(
|
|
2540
|
-
self, kid: list[ast.AstNode]
|
|
2541
|
-
) -> ast.SubNodeList[ast.Assignment]:
|
|
2402
|
+
def assignment_list(self, _: None) -> uni.SubNodeList[uni.Assignment]:
|
|
2542
2403
|
"""Grammar rule.
|
|
2543
2404
|
|
|
2544
|
-
assignment_list: assignment_list COMMA assignment |
|
|
2405
|
+
assignment_list: (assignment_list COMMA)? (assignment | NAME)
|
|
2545
2406
|
"""
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2407
|
+
|
|
2408
|
+
def name_to_assign(name_consume: uni.NameAtom) -> uni.Assignment:
|
|
2409
|
+
target = uni.SubNodeList[uni.Expr](
|
|
2410
|
+
items=[name_consume], delim=Tok.EQ, kid=[name_consume]
|
|
2411
|
+
)
|
|
2412
|
+
return uni.Assignment(
|
|
2413
|
+
target=target, value=None, type_tag=None, kid=[target]
|
|
2414
|
+
)
|
|
2415
|
+
|
|
2416
|
+
if consume := self.match(uni.SubNodeList):
|
|
2417
|
+
comma = self.consume_token(Tok.COMMA)
|
|
2418
|
+
assign = self.match(uni.Assignment) or self.consume(uni.NameAtom)
|
|
2419
|
+
if isinstance(assign, uni.NameAtom):
|
|
2420
|
+
assign = name_to_assign(assign)
|
|
2553
2421
|
new_kid = [*consume.kid, comma, assign]
|
|
2422
|
+
elif name_consume := self.match(uni.NameAtom):
|
|
2423
|
+
name_assign = name_to_assign(name_consume)
|
|
2424
|
+
new_kid = [name_assign]
|
|
2554
2425
|
else:
|
|
2555
|
-
assign =
|
|
2426
|
+
assign = self.consume(uni.Assignment)
|
|
2556
2427
|
new_kid = [assign]
|
|
2557
|
-
valid_kid = [i for i in new_kid if isinstance(i,
|
|
2558
|
-
return
|
|
2428
|
+
valid_kid = [i for i in new_kid if isinstance(i, uni.Assignment)]
|
|
2429
|
+
return uni.SubNodeList[uni.Assignment](
|
|
2559
2430
|
items=valid_kid,
|
|
2560
2431
|
delim=Tok.COMMA,
|
|
2561
2432
|
kid=new_kid,
|
|
2562
2433
|
)
|
|
2563
2434
|
|
|
2564
|
-
def
|
|
2565
|
-
"""Grammar rule.
|
|
2566
|
-
|
|
2567
|
-
arch_ref: object_ref
|
|
2568
|
-
| walker_ref
|
|
2569
|
-
| edge_ref
|
|
2570
|
-
| node_ref
|
|
2571
|
-
| type_ref
|
|
2572
|
-
"""
|
|
2573
|
-
return self.consume(ast.ArchRef)
|
|
2574
|
-
|
|
2575
|
-
def node_ref(self, kid: list[ast.AstNode]) -> ast.ArchRef:
|
|
2576
|
-
"""Grammar rule.
|
|
2577
|
-
|
|
2578
|
-
node_ref: NODE_OP NAME
|
|
2579
|
-
"""
|
|
2580
|
-
arch_type = self.consume(ast.Token)
|
|
2581
|
-
arch_name = self.consume(ast.NameAtom)
|
|
2582
|
-
return ast.ArchRef(
|
|
2583
|
-
arch_type=arch_type,
|
|
2584
|
-
arch_name=arch_name,
|
|
2585
|
-
kid=self.cur_nodes,
|
|
2586
|
-
)
|
|
2587
|
-
|
|
2588
|
-
def edge_ref(self, kid: list[ast.AstNode]) -> ast.ArchRef:
|
|
2589
|
-
"""Grammar rule.
|
|
2590
|
-
|
|
2591
|
-
edge_ref: EDGE_OP NAME
|
|
2592
|
-
"""
|
|
2593
|
-
arch_type = self.consume(ast.Token)
|
|
2594
|
-
arch_name = self.consume(ast.NameAtom)
|
|
2595
|
-
return ast.ArchRef(
|
|
2596
|
-
arch_type=arch_type,
|
|
2597
|
-
arch_name=arch_name,
|
|
2598
|
-
kid=self.cur_nodes,
|
|
2599
|
-
)
|
|
2600
|
-
|
|
2601
|
-
def walker_ref(self, kid: list[ast.AstNode]) -> ast.ArchRef:
|
|
2602
|
-
"""Grammar rule.
|
|
2603
|
-
|
|
2604
|
-
walker_ref: WALKER_OP NAME
|
|
2605
|
-
"""
|
|
2606
|
-
arch_type = self.consume(ast.Token)
|
|
2607
|
-
arch_name = self.consume(ast.NameAtom)
|
|
2608
|
-
return ast.ArchRef(
|
|
2609
|
-
arch_type=arch_type,
|
|
2610
|
-
arch_name=arch_name,
|
|
2611
|
-
kid=self.cur_nodes,
|
|
2612
|
-
)
|
|
2613
|
-
|
|
2614
|
-
def class_ref(self, kid: list[ast.AstNode]) -> ast.ArchRef:
|
|
2615
|
-
"""Grammar rule.
|
|
2616
|
-
|
|
2617
|
-
class_ref: CLASS_OP name_ref
|
|
2618
|
-
"""
|
|
2619
|
-
arch_type = self.consume(ast.Token)
|
|
2620
|
-
arch_name = self.consume(ast.NameAtom)
|
|
2621
|
-
return ast.ArchRef(
|
|
2622
|
-
arch_type=arch_type,
|
|
2623
|
-
arch_name=arch_name,
|
|
2624
|
-
kid=self.cur_nodes,
|
|
2625
|
-
)
|
|
2626
|
-
|
|
2627
|
-
def object_ref(self, kid: list[ast.AstNode]) -> ast.ArchRef:
|
|
2628
|
-
"""Grammar rule.
|
|
2629
|
-
|
|
2630
|
-
object_ref: OBJECT_OP name_ref
|
|
2631
|
-
"""
|
|
2632
|
-
arch_type = self.consume(ast.Token)
|
|
2633
|
-
arch_name = self.consume(ast.NameAtom)
|
|
2634
|
-
return ast.ArchRef(
|
|
2635
|
-
arch_type=arch_type,
|
|
2636
|
-
arch_name=arch_name,
|
|
2637
|
-
kid=self.cur_nodes,
|
|
2638
|
-
)
|
|
2639
|
-
|
|
2640
|
-
def type_ref(self, kid: list[ast.AstNode]) -> ast.ArchRef:
|
|
2435
|
+
def type_ref(self, kid: list[uni.UniNode]) -> uni.TypeRef:
|
|
2641
2436
|
"""Grammar rule.
|
|
2642
2437
|
|
|
2643
2438
|
type_ref: TYPE_OP (named_ref | builtin_type)
|
|
2644
2439
|
"""
|
|
2645
|
-
|
|
2646
|
-
arch_name = self.consume(
|
|
2647
|
-
return
|
|
2648
|
-
|
|
2649
|
-
arch_name=arch_name,
|
|
2650
|
-
kid=self.cur_nodes,
|
|
2651
|
-
)
|
|
2652
|
-
|
|
2653
|
-
def enum_ref(self, kid: list[ast.AstNode]) -> ast.ArchRef:
|
|
2654
|
-
"""Grammar rule.
|
|
2655
|
-
|
|
2656
|
-
enum_ref: ENUM_OP NAME
|
|
2657
|
-
"""
|
|
2658
|
-
arch_type = self.consume(ast.Token)
|
|
2659
|
-
arch_name = self.consume(ast.NameAtom)
|
|
2660
|
-
return ast.ArchRef(
|
|
2661
|
-
arch_type=arch_type,
|
|
2662
|
-
arch_name=arch_name,
|
|
2440
|
+
self.consume(uni.Token)
|
|
2441
|
+
arch_name = self.consume(uni.NameAtom)
|
|
2442
|
+
return uni.TypeRef(
|
|
2443
|
+
target=arch_name,
|
|
2663
2444
|
kid=self.cur_nodes,
|
|
2664
2445
|
)
|
|
2665
2446
|
|
|
2666
|
-
def
|
|
2667
|
-
"""Grammar rule.
|
|
2668
|
-
|
|
2669
|
-
ability_ref: ABILITY_OP (special_ref | name_ref)
|
|
2670
|
-
"""
|
|
2671
|
-
arch_type = self.consume_token(Tok.ABILITY_OP)
|
|
2672
|
-
arch_name = self.consume(ast.NameAtom)
|
|
2673
|
-
return ast.ArchRef(
|
|
2674
|
-
arch_type=arch_type,
|
|
2675
|
-
arch_name=arch_name,
|
|
2676
|
-
kid=self.cur_nodes,
|
|
2677
|
-
)
|
|
2678
|
-
|
|
2679
|
-
def arch_or_ability_chain(self, kid: list[ast.AstNode]) -> ast.ArchRefChain:
|
|
2680
|
-
"""Grammar rule.
|
|
2681
|
-
|
|
2682
|
-
arch_or_ability_chain: arch_or_ability_chain? (ability_ref | arch_ref)
|
|
2683
|
-
"""
|
|
2684
|
-
consume = self.match(ast.ArchRefChain)
|
|
2685
|
-
name = self.consume(ast.ArchRef)
|
|
2686
|
-
new_kid = [*consume.kid, name] if consume else [name]
|
|
2687
|
-
valid_kid = [i for i in new_kid if isinstance(i, ast.ArchRef)]
|
|
2688
|
-
if len(valid_kid) == len(new_kid):
|
|
2689
|
-
return ast.ArchRefChain(
|
|
2690
|
-
archs=valid_kid,
|
|
2691
|
-
kid=new_kid,
|
|
2692
|
-
)
|
|
2693
|
-
else:
|
|
2694
|
-
raise self.ice()
|
|
2695
|
-
|
|
2696
|
-
def abil_to_arch_chain(self, kid: list[ast.AstNode]) -> ast.ArchRefChain:
|
|
2697
|
-
"""Grammar rule.
|
|
2698
|
-
|
|
2699
|
-
abil_to_arch_chain: arch_or_ability_chain? arch_ref
|
|
2700
|
-
"""
|
|
2701
|
-
if len(kid) == 2:
|
|
2702
|
-
if isinstance(kid[1], ast.ArchRef) and isinstance(
|
|
2703
|
-
kid[0], ast.ArchRefChain
|
|
2704
|
-
):
|
|
2705
|
-
return ast.ArchRefChain(
|
|
2706
|
-
archs=[*(kid[0].archs), kid[1]],
|
|
2707
|
-
kid=[*(kid[0].kid), kid[1]],
|
|
2708
|
-
)
|
|
2709
|
-
else:
|
|
2710
|
-
raise self.ice()
|
|
2711
|
-
elif isinstance(kid[0], ast.ArchRef):
|
|
2712
|
-
return ast.ArchRefChain(
|
|
2713
|
-
archs=[kid[0]],
|
|
2714
|
-
kid=kid,
|
|
2715
|
-
)
|
|
2716
|
-
else:
|
|
2717
|
-
raise self.ice()
|
|
2718
|
-
|
|
2719
|
-
def arch_to_abil_chain(self, kid: list[ast.AstNode]) -> ast.ArchRefChain:
|
|
2720
|
-
"""Grammar rule.
|
|
2721
|
-
|
|
2722
|
-
arch_to_abil_chain: arch_or_ability_chain? ability_ref
|
|
2723
|
-
"""
|
|
2724
|
-
if len(kid) == 2:
|
|
2725
|
-
if isinstance(kid[1], ast.ArchRef) and isinstance(
|
|
2726
|
-
kid[0], ast.ArchRefChain
|
|
2727
|
-
):
|
|
2728
|
-
return ast.ArchRefChain(
|
|
2729
|
-
archs=[*(kid[0].archs), kid[1]],
|
|
2730
|
-
kid=[*(kid[0].kid), kid[1]],
|
|
2731
|
-
)
|
|
2732
|
-
else:
|
|
2733
|
-
raise self.ice()
|
|
2734
|
-
elif isinstance(kid[0], ast.ArchRef):
|
|
2735
|
-
return ast.ArchRefChain(
|
|
2736
|
-
archs=[kid[0]],
|
|
2737
|
-
kid=kid,
|
|
2738
|
-
)
|
|
2739
|
-
else:
|
|
2740
|
-
raise self.ice()
|
|
2741
|
-
|
|
2742
|
-
def arch_to_enum_chain(self, kid: list[ast.AstNode]) -> ast.ArchRefChain:
|
|
2447
|
+
def edge_ref_chain(self, _: None) -> uni.EdgeRefTrailer:
|
|
2743
2448
|
"""Grammar rule.
|
|
2744
2449
|
|
|
2745
|
-
|
|
2450
|
+
LSQUARE (KW_NODE| KW_EDGE)? expression? (edge_op_ref (filter_compr | expression)?)+ RSQUARE
|
|
2746
2451
|
"""
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
raise self.ice()
|
|
2757
|
-
elif isinstance(kid[0], ast.ArchRef):
|
|
2758
|
-
return ast.ArchRefChain(
|
|
2759
|
-
archs=[kid[0]],
|
|
2760
|
-
kid=kid,
|
|
2761
|
-
)
|
|
2762
|
-
else:
|
|
2763
|
-
raise self.ice()
|
|
2764
|
-
|
|
2765
|
-
def edge_ref_chain(self, kid: list[ast.AstNode]) -> ast.EdgeRefTrailer:
|
|
2766
|
-
"""Grammar rule.
|
|
2767
|
-
|
|
2768
|
-
(EDGE_OP|NODE_OP)? LSQUARE expression? (edge_op_ref (filter_compr | expression)?)+ RSQUARE
|
|
2769
|
-
"""
|
|
2770
|
-
valid_chain = [i for i in kid if isinstance(i, (ast.Expr, ast.FilterCompr))]
|
|
2771
|
-
return ast.EdgeRefTrailer(
|
|
2452
|
+
self.consume_token(Tok.LSQUARE)
|
|
2453
|
+
edges_only = bool(self.match_token(Tok.KW_EDGE))
|
|
2454
|
+
self.match_token(Tok.KW_NODE)
|
|
2455
|
+
valid_chain = []
|
|
2456
|
+
if expr := self.match(uni.Expr):
|
|
2457
|
+
valid_chain.append(expr)
|
|
2458
|
+
valid_chain.extend(self.match_many(uni.Expr))
|
|
2459
|
+
self.consume_token(Tok.RSQUARE)
|
|
2460
|
+
return uni.EdgeRefTrailer(
|
|
2772
2461
|
chain=valid_chain,
|
|
2773
|
-
edges_only=
|
|
2774
|
-
kid=
|
|
2462
|
+
edges_only=edges_only,
|
|
2463
|
+
kid=self.cur_nodes,
|
|
2775
2464
|
)
|
|
2776
2465
|
|
|
2777
|
-
def edge_op_ref(self, kid: list[
|
|
2466
|
+
def edge_op_ref(self, kid: list[uni.UniNode]) -> uni.EdgeOpRef:
|
|
2778
2467
|
"""Grammar rule.
|
|
2779
2468
|
|
|
2780
2469
|
edge_op_ref: (edge_any | edge_from | edge_to)
|
|
2781
2470
|
"""
|
|
2782
|
-
return self.consume(
|
|
2471
|
+
return self.consume(uni.EdgeOpRef)
|
|
2783
2472
|
|
|
2784
|
-
def edge_to(self, _: None) ->
|
|
2473
|
+
def edge_to(self, _: None) -> uni.EdgeOpRef:
|
|
2785
2474
|
"""Grammar rule.
|
|
2786
2475
|
|
|
2787
|
-
edge_to: ARROW_R_P1 typed_filter_compare_list ARROW_R_P2
|
|
2788
|
-
| ARROW_R
|
|
2476
|
+
edge_to: ARROW_R | ARROW_R_P1 typed_filter_compare_list ARROW_R_P2
|
|
2789
2477
|
"""
|
|
2790
2478
|
if self.match_token(Tok.ARROW_R):
|
|
2791
2479
|
fcond = None
|
|
2792
2480
|
else:
|
|
2793
2481
|
self.consume_token(Tok.ARROW_R_P1)
|
|
2794
|
-
fcond = self.consume(
|
|
2482
|
+
fcond = self.consume(uni.FilterCompr)
|
|
2795
2483
|
self.consume_token(Tok.ARROW_R_P2)
|
|
2796
|
-
return
|
|
2484
|
+
return uni.EdgeOpRef(
|
|
2797
2485
|
filter_cond=fcond, edge_dir=EdgeDir.OUT, kid=self.cur_nodes
|
|
2798
2486
|
)
|
|
2799
2487
|
|
|
2800
|
-
def edge_from(self, _: None) ->
|
|
2488
|
+
def edge_from(self, _: None) -> uni.EdgeOpRef:
|
|
2801
2489
|
"""Grammar rule.
|
|
2802
2490
|
|
|
2803
|
-
edge_from: ARROW_L_P1 typed_filter_compare_list ARROW_L_P2
|
|
2804
|
-
| ARROW_L
|
|
2491
|
+
edge_from: ARROW_L | ARROW_L_P1 typed_filter_compare_list ARROW_L_P2
|
|
2805
2492
|
"""
|
|
2806
2493
|
if self.match_token(Tok.ARROW_L):
|
|
2807
2494
|
fcond = None
|
|
2808
2495
|
else:
|
|
2809
2496
|
self.consume_token(Tok.ARROW_L_P1)
|
|
2810
|
-
fcond = self.consume(
|
|
2497
|
+
fcond = self.consume(uni.FilterCompr)
|
|
2811
2498
|
self.consume_token(Tok.ARROW_L_P2)
|
|
2812
|
-
return
|
|
2499
|
+
return uni.EdgeOpRef(
|
|
2813
2500
|
filter_cond=fcond, edge_dir=EdgeDir.IN, kid=self.cur_nodes
|
|
2814
2501
|
)
|
|
2815
2502
|
|
|
2816
|
-
def edge_any(self, _: None) ->
|
|
2503
|
+
def edge_any(self, _: None) -> uni.EdgeOpRef:
|
|
2817
2504
|
"""Grammar rule.
|
|
2818
2505
|
|
|
2819
2506
|
edge_any: ARROW_L_P1 typed_filter_compare_list ARROW_R_P2
|
|
@@ -2823,44 +2510,43 @@ class JacParser(Pass):
|
|
|
2823
2510
|
fcond = None
|
|
2824
2511
|
else:
|
|
2825
2512
|
self.consume_token(Tok.ARROW_L_P1)
|
|
2826
|
-
fcond = self.consume(
|
|
2513
|
+
fcond = self.consume(uni.FilterCompr)
|
|
2827
2514
|
self.consume_token(Tok.ARROW_R_P2)
|
|
2828
|
-
return
|
|
2515
|
+
return uni.EdgeOpRef(
|
|
2829
2516
|
filter_cond=fcond, edge_dir=EdgeDir.ANY, kid=self.cur_nodes
|
|
2830
2517
|
)
|
|
2831
2518
|
|
|
2832
|
-
def connect_op(self, _: None) ->
|
|
2519
|
+
def connect_op(self, _: None) -> uni.ConnectOp:
|
|
2833
2520
|
"""Grammar rule.
|
|
2834
2521
|
|
|
2835
2522
|
connect_op: connect_from | connect_to | connect_any
|
|
2836
2523
|
"""
|
|
2837
|
-
return self.consume(
|
|
2524
|
+
return self.consume(uni.ConnectOp)
|
|
2838
2525
|
|
|
2839
|
-
def disconnect_op(self, kid: list[
|
|
2526
|
+
def disconnect_op(self, kid: list[uni.UniNode]) -> uni.DisconnectOp:
|
|
2840
2527
|
"""Grammar rule.
|
|
2841
2528
|
|
|
2842
|
-
disconnect_op:
|
|
2529
|
+
disconnect_op: KW_DELETE edge_op_ref
|
|
2843
2530
|
"""
|
|
2844
|
-
if isinstance(kid[1],
|
|
2845
|
-
return
|
|
2531
|
+
if isinstance(kid[1], uni.EdgeOpRef):
|
|
2532
|
+
return uni.DisconnectOp(
|
|
2846
2533
|
edge_spec=kid[1],
|
|
2847
2534
|
kid=kid,
|
|
2848
2535
|
)
|
|
2849
2536
|
else:
|
|
2850
2537
|
raise self.ice()
|
|
2851
2538
|
|
|
2852
|
-
def connect_to(self, _: None) ->
|
|
2539
|
+
def connect_to(self, _: None) -> uni.ConnectOp:
|
|
2853
2540
|
"""Grammar rule.
|
|
2854
2541
|
|
|
2855
|
-
connect_to: CARROW_R_P1 expression (COLON kw_expr_list)? CARROW_R_P2
|
|
2856
|
-
| CARROW_R
|
|
2542
|
+
connect_to: CARROW_R | CARROW_R_P1 expression (COLON kw_expr_list)? CARROW_R_P2
|
|
2857
2543
|
"""
|
|
2858
|
-
conn_type:
|
|
2859
|
-
conn_assign_sub:
|
|
2544
|
+
conn_type: uni.Expr | None = None
|
|
2545
|
+
conn_assign_sub: uni.SubNodeList | None = None
|
|
2860
2546
|
if self.match_token(Tok.CARROW_R_P1):
|
|
2861
|
-
conn_type = self.consume(
|
|
2547
|
+
conn_type = self.consume(uni.Expr)
|
|
2862
2548
|
conn_assign_sub = (
|
|
2863
|
-
self.consume(
|
|
2549
|
+
self.consume(uni.SubNodeList)
|
|
2864
2550
|
if self.match_token(Tok.COLON)
|
|
2865
2551
|
else None
|
|
2866
2552
|
)
|
|
@@ -2868,31 +2554,30 @@ class JacParser(Pass):
|
|
|
2868
2554
|
else:
|
|
2869
2555
|
self.consume_token(Tok.CARROW_R)
|
|
2870
2556
|
conn_assign = (
|
|
2871
|
-
|
|
2557
|
+
uni.AssignCompr(assigns=conn_assign_sub, kid=[conn_assign_sub])
|
|
2872
2558
|
if conn_assign_sub
|
|
2873
2559
|
else None
|
|
2874
2560
|
)
|
|
2875
2561
|
if conn_assign:
|
|
2876
2562
|
self.cur_nodes[3] = conn_assign
|
|
2877
|
-
return
|
|
2563
|
+
return uni.ConnectOp(
|
|
2878
2564
|
conn_type=conn_type,
|
|
2879
2565
|
conn_assign=conn_assign,
|
|
2880
2566
|
edge_dir=EdgeDir.OUT,
|
|
2881
2567
|
kid=self.cur_nodes,
|
|
2882
2568
|
)
|
|
2883
2569
|
|
|
2884
|
-
def connect_from(self, _: None) ->
|
|
2570
|
+
def connect_from(self, _: None) -> uni.ConnectOp:
|
|
2885
2571
|
"""Grammar rule.
|
|
2886
2572
|
|
|
2887
|
-
connect_from: CARROW_L_P1 expression (COLON kw_expr_list)? CARROW_L_P2
|
|
2888
|
-
| CARROW_L
|
|
2573
|
+
connect_from: CARROW_L | CARROW_L_P1 expression (COLON kw_expr_list)? CARROW_L_P2
|
|
2889
2574
|
"""
|
|
2890
|
-
conn_type:
|
|
2891
|
-
conn_assign_sub:
|
|
2575
|
+
conn_type: uni.Expr | None = None
|
|
2576
|
+
conn_assign_sub: uni.SubNodeList | None = None
|
|
2892
2577
|
if self.match_token(Tok.CARROW_L_P1):
|
|
2893
|
-
conn_type = self.consume(
|
|
2578
|
+
conn_type = self.consume(uni.Expr)
|
|
2894
2579
|
conn_assign_sub = (
|
|
2895
|
-
self.consume(
|
|
2580
|
+
self.consume(uni.SubNodeList)
|
|
2896
2581
|
if self.match_token(Tok.COLON)
|
|
2897
2582
|
else None
|
|
2898
2583
|
)
|
|
@@ -2900,30 +2585,30 @@ class JacParser(Pass):
|
|
|
2900
2585
|
else:
|
|
2901
2586
|
self.consume_token(Tok.CARROW_L)
|
|
2902
2587
|
conn_assign = (
|
|
2903
|
-
|
|
2588
|
+
uni.AssignCompr(assigns=conn_assign_sub, kid=[conn_assign_sub])
|
|
2904
2589
|
if conn_assign_sub
|
|
2905
2590
|
else None
|
|
2906
2591
|
)
|
|
2907
2592
|
if conn_assign:
|
|
2908
2593
|
self.cur_nodes[3] = conn_assign
|
|
2909
|
-
return
|
|
2594
|
+
return uni.ConnectOp(
|
|
2910
2595
|
conn_type=conn_type,
|
|
2911
2596
|
conn_assign=conn_assign,
|
|
2912
2597
|
edge_dir=EdgeDir.IN,
|
|
2913
2598
|
kid=self.cur_nodes,
|
|
2914
2599
|
)
|
|
2915
2600
|
|
|
2916
|
-
def connect_any(self, _: None) ->
|
|
2601
|
+
def connect_any(self, _: None) -> uni.ConnectOp:
|
|
2917
2602
|
"""Grammar rule.
|
|
2918
2603
|
|
|
2919
2604
|
connect_any: CARROW_BI | CARROW_L_P1 expression (COLON kw_expr_list)? CARROW_R_P2
|
|
2920
2605
|
"""
|
|
2921
|
-
conn_type:
|
|
2922
|
-
conn_assign_sub:
|
|
2606
|
+
conn_type: uni.Expr | None = None
|
|
2607
|
+
conn_assign_sub: uni.SubNodeList | None = None
|
|
2923
2608
|
if self.match_token(Tok.CARROW_L_P1):
|
|
2924
|
-
conn_type = self.consume(
|
|
2609
|
+
conn_type = self.consume(uni.Expr)
|
|
2925
2610
|
conn_assign_sub = (
|
|
2926
|
-
self.consume(
|
|
2611
|
+
self.consume(uni.SubNodeList)
|
|
2927
2612
|
if self.match_token(Tok.COLON)
|
|
2928
2613
|
else None
|
|
2929
2614
|
)
|
|
@@ -2931,20 +2616,20 @@ class JacParser(Pass):
|
|
|
2931
2616
|
else:
|
|
2932
2617
|
self.consume_token(Tok.CARROW_BI)
|
|
2933
2618
|
conn_assign = (
|
|
2934
|
-
|
|
2619
|
+
uni.AssignCompr(assigns=conn_assign_sub, kid=[conn_assign_sub])
|
|
2935
2620
|
if conn_assign_sub
|
|
2936
2621
|
else None
|
|
2937
2622
|
)
|
|
2938
2623
|
if conn_assign:
|
|
2939
2624
|
self.cur_nodes[3] = conn_assign
|
|
2940
|
-
return
|
|
2625
|
+
return uni.ConnectOp(
|
|
2941
2626
|
conn_type=conn_type,
|
|
2942
2627
|
conn_assign=conn_assign,
|
|
2943
2628
|
edge_dir=EdgeDir.ANY,
|
|
2944
2629
|
kid=self.cur_nodes,
|
|
2945
2630
|
)
|
|
2946
2631
|
|
|
2947
|
-
def filter_compr(self, _: None) ->
|
|
2632
|
+
def filter_compr(self, _: None) -> uni.FilterCompr:
|
|
2948
2633
|
"""Grammar rule.
|
|
2949
2634
|
|
|
2950
2635
|
filter_compr: LPAREN NULL_OK filter_compare_list RPAREN
|
|
@@ -2954,160 +2639,149 @@ class JacParser(Pass):
|
|
|
2954
2639
|
self.consume_token(Tok.LPAREN)
|
|
2955
2640
|
if self.match_token(Tok.TYPE_OP):
|
|
2956
2641
|
self.consume_token(Tok.NULL_OK)
|
|
2957
|
-
f_type = self.consume(
|
|
2642
|
+
f_type = self.consume(uni.FilterCompr)
|
|
2958
2643
|
f_type.add_kids_left(kid[:3])
|
|
2959
2644
|
f_type.add_kids_right(kid[4:])
|
|
2960
2645
|
self.consume_token(Tok.RPAREN)
|
|
2961
2646
|
return f_type
|
|
2962
2647
|
self.consume_token(Tok.NULL_OK)
|
|
2963
|
-
compares = self.consume(
|
|
2648
|
+
compares = self.consume(uni.SubNodeList)
|
|
2964
2649
|
self.consume_token(Tok.RPAREN)
|
|
2965
|
-
return
|
|
2650
|
+
return uni.FilterCompr(
|
|
2966
2651
|
compares=compares,
|
|
2967
2652
|
f_type=None,
|
|
2968
2653
|
kid=self.cur_nodes,
|
|
2969
2654
|
)
|
|
2970
2655
|
|
|
2971
|
-
def filter_compare_list(self, _: None) ->
|
|
2656
|
+
def filter_compare_list(self, _: None) -> uni.SubNodeList[uni.CompareExpr]:
|
|
2972
2657
|
"""Grammar rule.
|
|
2973
2658
|
|
|
2974
2659
|
filter_compare_list: (filter_compare_list COMMA)? filter_compare_item
|
|
2975
2660
|
"""
|
|
2976
|
-
if consume := self.match(
|
|
2661
|
+
if consume := self.match(uni.SubNodeList):
|
|
2977
2662
|
comma = self.consume_token(Tok.COMMA)
|
|
2978
|
-
expr = self.consume(
|
|
2663
|
+
expr = self.consume(uni.CompareExpr)
|
|
2979
2664
|
new_kid = [*consume.kid, comma, expr]
|
|
2980
2665
|
else:
|
|
2981
|
-
expr = self.consume(
|
|
2666
|
+
expr = self.consume(uni.CompareExpr)
|
|
2982
2667
|
new_kid = [expr]
|
|
2983
|
-
valid_kid = [i for i in new_kid if isinstance(i,
|
|
2984
|
-
return
|
|
2668
|
+
valid_kid = [i for i in new_kid if isinstance(i, uni.CompareExpr)]
|
|
2669
|
+
return uni.SubNodeList[uni.CompareExpr](
|
|
2985
2670
|
items=valid_kid,
|
|
2986
2671
|
delim=Tok.COMMA,
|
|
2987
2672
|
kid=new_kid,
|
|
2988
2673
|
)
|
|
2989
2674
|
|
|
2990
|
-
def typed_filter_compare_list(self,
|
|
2675
|
+
def typed_filter_compare_list(self, _: None) -> uni.FilterCompr:
|
|
2991
2676
|
"""Grammar rule.
|
|
2992
2677
|
|
|
2993
2678
|
typed_filter_compare_list: expression (COLON filter_compare_list)?
|
|
2994
2679
|
"""
|
|
2995
|
-
|
|
2996
|
-
expr =
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
if len(chomp)
|
|
3001
|
-
and isinstance(chomp[0], ast.Token)
|
|
3002
|
-
and chomp[0].name == Tok.COLON
|
|
3003
|
-
else None
|
|
3004
|
-
)
|
|
3005
|
-
if isinstance(expr, ast.Expr) and (
|
|
3006
|
-
(isinstance(compares, ast.SubNodeList)) or compares is None
|
|
3007
|
-
):
|
|
3008
|
-
return ast.FilterCompr(compares=compares, f_type=expr, kid=kid)
|
|
3009
|
-
else:
|
|
3010
|
-
raise self.ice()
|
|
2680
|
+
compares: uni.SubNodeList | None = None
|
|
2681
|
+
expr = self.consume(uni.Expr)
|
|
2682
|
+
if self.match_token(Tok.COLON):
|
|
2683
|
+
compares = self.consume(uni.SubNodeList)
|
|
2684
|
+
return uni.FilterCompr(compares=compares, f_type=expr, kid=self.cur_nodes)
|
|
3011
2685
|
|
|
3012
|
-
def filter_compare_item(self, _: None) ->
|
|
2686
|
+
def filter_compare_item(self, _: None) -> uni.CompareExpr:
|
|
3013
2687
|
"""Grammar rule.
|
|
3014
2688
|
|
|
3015
2689
|
filter_compare_item: name_ref cmp_op expression
|
|
3016
2690
|
"""
|
|
3017
|
-
name_ref = self.consume(
|
|
3018
|
-
cmp_op = self.consume(
|
|
3019
|
-
expr = self.consume(
|
|
3020
|
-
return
|
|
2691
|
+
name_ref = self.consume(uni.Name)
|
|
2692
|
+
cmp_op = self.consume(uni.Token)
|
|
2693
|
+
expr = self.consume(uni.Expr)
|
|
2694
|
+
return uni.CompareExpr(
|
|
3021
2695
|
left=name_ref, ops=[cmp_op], rights=[expr], kid=self.cur_nodes
|
|
3022
2696
|
)
|
|
3023
2697
|
|
|
3024
|
-
def assign_compr(self, _: None) ->
|
|
2698
|
+
def assign_compr(self, _: None) -> uni.AssignCompr:
|
|
3025
2699
|
"""Grammar rule.
|
|
3026
2700
|
|
|
3027
2701
|
filter_compr: LPAREN EQ kw_expr_list RPAREN
|
|
3028
2702
|
"""
|
|
3029
2703
|
self.consume_token(Tok.LPAREN)
|
|
3030
2704
|
self.consume_token(Tok.EQ)
|
|
3031
|
-
assigns = self.consume(
|
|
2705
|
+
assigns = self.consume(uni.SubNodeList)
|
|
3032
2706
|
self.consume_token(Tok.RPAREN)
|
|
3033
|
-
return
|
|
2707
|
+
return uni.AssignCompr(assigns=assigns, kid=self.cur_nodes)
|
|
3034
2708
|
|
|
3035
|
-
def match_stmt(self, _: None) ->
|
|
2709
|
+
def match_stmt(self, _: None) -> uni.MatchStmt:
|
|
3036
2710
|
"""Grammar rule.
|
|
3037
2711
|
|
|
3038
|
-
match_stmt: KW_MATCH
|
|
2712
|
+
match_stmt: KW_MATCH expression LBRACE match_case_block+ RBRACE
|
|
3039
2713
|
"""
|
|
3040
2714
|
self.consume_token(Tok.KW_MATCH)
|
|
3041
|
-
target = self.consume(
|
|
2715
|
+
target = self.consume(uni.Expr)
|
|
3042
2716
|
self.consume_token(Tok.LBRACE)
|
|
3043
|
-
cases = [self.consume(
|
|
3044
|
-
while case := self.match(
|
|
2717
|
+
cases = [self.consume(uni.MatchCase)]
|
|
2718
|
+
while case := self.match(uni.MatchCase):
|
|
3045
2719
|
cases.append(case)
|
|
3046
2720
|
self.consume_token(Tok.RBRACE)
|
|
3047
|
-
return
|
|
2721
|
+
return uni.MatchStmt(
|
|
3048
2722
|
target=target,
|
|
3049
2723
|
cases=cases,
|
|
3050
2724
|
kid=self.cur_nodes,
|
|
3051
2725
|
)
|
|
3052
2726
|
|
|
3053
|
-
def match_case_block(self, _: None) ->
|
|
2727
|
+
def match_case_block(self, _: None) -> uni.MatchCase:
|
|
3054
2728
|
"""Grammar rule.
|
|
3055
2729
|
|
|
3056
|
-
match_case_block: KW_CASE pattern_seq (KW_IF expression)? COLON
|
|
2730
|
+
match_case_block: KW_CASE pattern_seq (KW_IF expression)? COLON statement+
|
|
3057
2731
|
"""
|
|
3058
|
-
guard:
|
|
2732
|
+
guard: uni.Expr | None = None
|
|
3059
2733
|
self.consume_token(Tok.KW_CASE)
|
|
3060
|
-
pattern = self.consume(
|
|
2734
|
+
pattern = self.consume(uni.MatchPattern)
|
|
3061
2735
|
if self.match_token(Tok.KW_IF):
|
|
3062
|
-
guard = self.consume(
|
|
2736
|
+
guard = self.consume(uni.Expr)
|
|
3063
2737
|
self.consume_token(Tok.COLON)
|
|
3064
|
-
stmts = [self.consume(
|
|
3065
|
-
while stmt := self.match(
|
|
2738
|
+
stmts = [self.consume(uni.CodeBlockStmt)]
|
|
2739
|
+
while stmt := self.match(uni.CodeBlockStmt):
|
|
3066
2740
|
stmts.append(stmt)
|
|
3067
|
-
return
|
|
2741
|
+
return uni.MatchCase(
|
|
3068
2742
|
pattern=pattern,
|
|
3069
2743
|
guard=guard,
|
|
3070
2744
|
body=stmts,
|
|
3071
2745
|
kid=self.cur_nodes,
|
|
3072
2746
|
)
|
|
3073
2747
|
|
|
3074
|
-
def pattern_seq(self, _: None) ->
|
|
2748
|
+
def pattern_seq(self, _: None) -> uni.MatchPattern:
|
|
3075
2749
|
"""Grammar rule.
|
|
3076
2750
|
|
|
3077
2751
|
pattern_seq: (or_pattern | as_pattern)
|
|
3078
2752
|
"""
|
|
3079
|
-
return self.consume(
|
|
2753
|
+
return self.consume(uni.MatchPattern)
|
|
3080
2754
|
|
|
3081
|
-
def or_pattern(self, _: None) ->
|
|
2755
|
+
def or_pattern(self, _: None) -> uni.MatchPattern:
|
|
3082
2756
|
"""Grammar rule.
|
|
3083
2757
|
|
|
3084
2758
|
or_pattern: (pattern BW_OR)* pattern
|
|
3085
2759
|
"""
|
|
3086
|
-
patterns: list = [self.consume(
|
|
2760
|
+
patterns: list = [self.consume(uni.MatchPattern)]
|
|
3087
2761
|
while self.match_token(Tok.BW_OR):
|
|
3088
|
-
patterns.append(self.consume(
|
|
2762
|
+
patterns.append(self.consume(uni.MatchPattern))
|
|
3089
2763
|
if len(patterns) == 1:
|
|
3090
2764
|
return patterns[0]
|
|
3091
|
-
return
|
|
2765
|
+
return uni.MatchOr(
|
|
3092
2766
|
patterns=patterns,
|
|
3093
2767
|
kid=self.cur_nodes,
|
|
3094
2768
|
)
|
|
3095
2769
|
|
|
3096
|
-
def as_pattern(self, _: None) ->
|
|
2770
|
+
def as_pattern(self, _: None) -> uni.MatchPattern:
|
|
3097
2771
|
"""Grammar rule.
|
|
3098
2772
|
|
|
3099
|
-
as_pattern:
|
|
2773
|
+
as_pattern: or_pattern KW_AS NAME
|
|
3100
2774
|
"""
|
|
3101
|
-
pattern = self.consume(
|
|
2775
|
+
pattern = self.consume(uni.MatchPattern)
|
|
3102
2776
|
self.consume_token(Tok.KW_AS)
|
|
3103
|
-
name = self.consume(
|
|
3104
|
-
return
|
|
2777
|
+
name = self.consume(uni.NameAtom)
|
|
2778
|
+
return uni.MatchAs(
|
|
3105
2779
|
pattern=pattern,
|
|
3106
2780
|
name=name,
|
|
3107
2781
|
kid=self.cur_nodes,
|
|
3108
2782
|
)
|
|
3109
2783
|
|
|
3110
|
-
def pattern(self, kid: list[
|
|
2784
|
+
def pattern(self, kid: list[uni.UniNode]) -> uni.MatchPattern:
|
|
3111
2785
|
"""Grammar rule.
|
|
3112
2786
|
|
|
3113
2787
|
pattern: literal_pattern
|
|
@@ -3116,122 +2790,122 @@ class JacParser(Pass):
|
|
|
3116
2790
|
| mapping_pattern
|
|
3117
2791
|
| class_pattern
|
|
3118
2792
|
"""
|
|
3119
|
-
return self.consume(
|
|
2793
|
+
return self.consume(uni.MatchPattern)
|
|
3120
2794
|
|
|
3121
|
-
def literal_pattern(self, _: None) ->
|
|
2795
|
+
def literal_pattern(self, _: None) -> uni.MatchPattern:
|
|
3122
2796
|
"""Grammar rule.
|
|
3123
2797
|
|
|
3124
2798
|
literal_pattern: (INT | FLOAT | multistring)
|
|
3125
2799
|
"""
|
|
3126
|
-
value = self.consume(
|
|
3127
|
-
return
|
|
2800
|
+
value = self.consume(uni.Expr)
|
|
2801
|
+
return uni.MatchValue(
|
|
3128
2802
|
value=value,
|
|
3129
2803
|
kid=self.cur_nodes,
|
|
3130
2804
|
)
|
|
3131
2805
|
|
|
3132
|
-
def singleton_pattern(self, _: None) ->
|
|
2806
|
+
def singleton_pattern(self, _: None) -> uni.MatchPattern:
|
|
3133
2807
|
"""Grammar rule.
|
|
3134
2808
|
|
|
3135
2809
|
singleton_pattern: (NULL | BOOL)
|
|
3136
2810
|
"""
|
|
3137
|
-
value = self.match(
|
|
3138
|
-
return
|
|
2811
|
+
value = self.match(uni.Null) or self.consume(uni.Bool)
|
|
2812
|
+
return uni.MatchSingleton(
|
|
3139
2813
|
value=value,
|
|
3140
2814
|
kid=self.cur_nodes,
|
|
3141
2815
|
)
|
|
3142
2816
|
|
|
3143
|
-
def capture_pattern(self, _: None) ->
|
|
2817
|
+
def capture_pattern(self, _: None) -> uni.MatchPattern:
|
|
3144
2818
|
"""Grammar rule.
|
|
3145
2819
|
|
|
3146
2820
|
capture_pattern: NAME
|
|
3147
2821
|
"""
|
|
3148
|
-
name = self.consume(
|
|
2822
|
+
name = self.consume(uni.Name)
|
|
3149
2823
|
if name.sym_name == "_":
|
|
3150
|
-
return
|
|
2824
|
+
return uni.MatchWild(
|
|
3151
2825
|
kid=self.cur_nodes,
|
|
3152
2826
|
)
|
|
3153
|
-
return
|
|
2827
|
+
return uni.MatchAs(
|
|
3154
2828
|
name=name,
|
|
3155
2829
|
pattern=None,
|
|
3156
2830
|
kid=self.cur_nodes,
|
|
3157
2831
|
)
|
|
3158
2832
|
|
|
3159
|
-
def sequence_pattern(self, _: None) ->
|
|
2833
|
+
def sequence_pattern(self, _: None) -> uni.MatchPattern:
|
|
3160
2834
|
"""Grammar rule.
|
|
3161
2835
|
|
|
3162
2836
|
sequence_pattern: LSQUARE list_inner_pattern (COMMA list_inner_pattern)* RSQUARE
|
|
3163
2837
|
| LPAREN list_inner_pattern (COMMA list_inner_pattern)* RPAREN
|
|
3164
2838
|
"""
|
|
3165
2839
|
self.consume_token(Tok.LSQUARE) or self.consume_token(Tok.LPAREN)
|
|
3166
|
-
patterns = [self.consume(
|
|
2840
|
+
patterns = [self.consume(uni.MatchPattern)]
|
|
3167
2841
|
while self.match_token(Tok.COMMA):
|
|
3168
|
-
patterns.append(self.consume(
|
|
2842
|
+
patterns.append(self.consume(uni.MatchPattern))
|
|
3169
2843
|
self.consume_token(Tok.RSQUARE) or self.consume_token(Tok.RPAREN)
|
|
3170
|
-
return
|
|
2844
|
+
return uni.MatchSequence(
|
|
3171
2845
|
values=patterns,
|
|
3172
2846
|
kid=self.cur_nodes,
|
|
3173
2847
|
)
|
|
3174
2848
|
|
|
3175
|
-
def mapping_pattern(self, _: None) ->
|
|
2849
|
+
def mapping_pattern(self, _: None) -> uni.MatchMapping:
|
|
3176
2850
|
"""Grammar rule.
|
|
3177
2851
|
|
|
3178
2852
|
mapping_pattern: LBRACE (dict_inner_pattern (COMMA dict_inner_pattern)*)? RBRACE
|
|
3179
2853
|
"""
|
|
3180
2854
|
self.consume_token(Tok.LBRACE)
|
|
3181
|
-
patterns = [self.match(
|
|
2855
|
+
patterns = [self.match(uni.MatchKVPair) or self.consume(uni.MatchStar)]
|
|
3182
2856
|
while self.match_token(Tok.COMMA):
|
|
3183
2857
|
patterns.append(
|
|
3184
|
-
self.match(
|
|
2858
|
+
self.match(uni.MatchKVPair) or self.consume(uni.MatchStar)
|
|
3185
2859
|
)
|
|
3186
2860
|
self.consume_token(Tok.RBRACE)
|
|
3187
|
-
return
|
|
2861
|
+
return uni.MatchMapping(
|
|
3188
2862
|
values=patterns,
|
|
3189
2863
|
kid=self.cur_nodes,
|
|
3190
2864
|
)
|
|
3191
2865
|
|
|
3192
|
-
def list_inner_pattern(self, _: None) ->
|
|
2866
|
+
def list_inner_pattern(self, _: None) -> uni.MatchPattern:
|
|
3193
2867
|
"""Grammar rule.
|
|
3194
2868
|
|
|
3195
2869
|
list_inner_pattern: (pattern_seq | STAR_MUL NAME)
|
|
3196
2870
|
"""
|
|
3197
2871
|
if self.match_token(Tok.STAR_MUL):
|
|
3198
|
-
name = self.consume(
|
|
3199
|
-
return
|
|
2872
|
+
name = self.consume(uni.Name)
|
|
2873
|
+
return uni.MatchStar(
|
|
3200
2874
|
is_list=True,
|
|
3201
2875
|
name=name,
|
|
3202
2876
|
kid=self.cur_nodes,
|
|
3203
2877
|
)
|
|
3204
|
-
return self.consume(
|
|
2878
|
+
return self.consume(uni.MatchPattern)
|
|
3205
2879
|
|
|
3206
|
-
def dict_inner_pattern(self, _: None) ->
|
|
2880
|
+
def dict_inner_pattern(self, _: None) -> uni.MatchKVPair | uni.MatchStar:
|
|
3207
2881
|
"""Grammar rule.
|
|
3208
2882
|
|
|
3209
|
-
dict_inner_pattern: (
|
|
2883
|
+
dict_inner_pattern: (literal_pattern COLON pattern_seq | STAR_POW NAME)
|
|
3210
2884
|
"""
|
|
3211
2885
|
if self.match_token(Tok.STAR_POW):
|
|
3212
|
-
name = self.consume(
|
|
3213
|
-
return
|
|
2886
|
+
name = self.consume(uni.Name)
|
|
2887
|
+
return uni.MatchStar(
|
|
3214
2888
|
is_list=False,
|
|
3215
2889
|
name=name,
|
|
3216
2890
|
kid=self.cur_nodes,
|
|
3217
2891
|
)
|
|
3218
|
-
pattern = self.consume(
|
|
2892
|
+
pattern = self.consume(uni.MatchPattern)
|
|
3219
2893
|
self.consume_token(Tok.COLON)
|
|
3220
|
-
value = self.consume(
|
|
3221
|
-
return
|
|
2894
|
+
value = self.consume(uni.MatchPattern)
|
|
2895
|
+
return uni.MatchKVPair(key=pattern, value=value, kid=self.cur_nodes)
|
|
3222
2896
|
|
|
3223
|
-
def class_pattern(self, _: None) ->
|
|
2897
|
+
def class_pattern(self, _: None) -> uni.MatchArch:
|
|
3224
2898
|
"""Grammar rule.
|
|
3225
2899
|
|
|
3226
2900
|
class_pattern: NAME (DOT NAME)* LPAREN kw_pattern_list? RPAREN
|
|
3227
2901
|
| NAME (DOT NAME)* LPAREN pattern_list (COMMA kw_pattern_list)? RPAREN
|
|
3228
2902
|
"""
|
|
3229
|
-
cur_element = self.consume(
|
|
3230
|
-
trailer:
|
|
2903
|
+
cur_element = self.consume(uni.NameAtom)
|
|
2904
|
+
trailer: uni.AtomTrailer | None = None
|
|
3231
2905
|
while dot := self.match_token(Tok.DOT):
|
|
3232
2906
|
target = trailer if trailer else cur_element
|
|
3233
|
-
right = self.consume(
|
|
3234
|
-
trailer =
|
|
2907
|
+
right = self.consume(uni.Expr)
|
|
2908
|
+
trailer = uni.AtomTrailer(
|
|
3235
2909
|
target=target,
|
|
3236
2910
|
right=right,
|
|
3237
2911
|
is_attr=True,
|
|
@@ -3239,29 +2913,29 @@ class JacParser(Pass):
|
|
|
3239
2913
|
kid=[target, dot, right],
|
|
3240
2914
|
)
|
|
3241
2915
|
name = trailer if trailer else cur_element
|
|
3242
|
-
if not isinstance(name, (
|
|
2916
|
+
if not isinstance(name, (uni.NameAtom, uni.AtomTrailer)):
|
|
3243
2917
|
raise TypeError(
|
|
3244
2918
|
f"Expected name to be either NameAtom or AtomTrailer, got {type(name)}"
|
|
3245
2919
|
)
|
|
3246
2920
|
lparen = self.consume_token(Tok.LPAREN)
|
|
3247
|
-
first = self.match(
|
|
2921
|
+
first = self.match(uni.SubNodeList)
|
|
3248
2922
|
second = (
|
|
3249
|
-
self.consume(
|
|
2923
|
+
self.consume(uni.SubNodeList)
|
|
3250
2924
|
if (comma := self.match_token(Tok.COMMA))
|
|
3251
2925
|
else None
|
|
3252
2926
|
)
|
|
3253
2927
|
rparen = self.consume_token(Tok.RPAREN)
|
|
3254
2928
|
arg = (
|
|
3255
2929
|
first
|
|
3256
|
-
if (first and isinstance(first.items[0],
|
|
2930
|
+
if (first and isinstance(first.items[0], uni.MatchPattern))
|
|
3257
2931
|
else None
|
|
3258
2932
|
)
|
|
3259
2933
|
kw = (
|
|
3260
2934
|
second
|
|
3261
|
-
if (second and isinstance(second.items[0],
|
|
2935
|
+
if (second and isinstance(second.items[0], uni.MatchKVPair))
|
|
3262
2936
|
else (
|
|
3263
2937
|
first
|
|
3264
|
-
if (first and isinstance(first.items[0],
|
|
2938
|
+
if (first and isinstance(first.items[0], uni.MatchKVPair))
|
|
3265
2939
|
else None
|
|
3266
2940
|
)
|
|
3267
2941
|
)
|
|
@@ -3273,58 +2947,58 @@ class JacParser(Pass):
|
|
|
3273
2947
|
elif kw:
|
|
3274
2948
|
kid_nodes.append(kw)
|
|
3275
2949
|
kid_nodes.append(rparen)
|
|
3276
|
-
return
|
|
2950
|
+
return uni.MatchArch(
|
|
3277
2951
|
name=name,
|
|
3278
2952
|
arg_patterns=arg,
|
|
3279
2953
|
kw_patterns=kw,
|
|
3280
2954
|
kid=kid_nodes,
|
|
3281
2955
|
)
|
|
3282
2956
|
|
|
3283
|
-
def pattern_list(self, _: None) ->
|
|
2957
|
+
def pattern_list(self, _: None) -> uni.SubNodeList[uni.MatchPattern]:
|
|
3284
2958
|
"""Grammar rule.
|
|
3285
2959
|
|
|
3286
2960
|
pattern_list: (pattern_list COMMA)? pattern_seq
|
|
3287
2961
|
"""
|
|
3288
|
-
if consume := self.match(
|
|
2962
|
+
if consume := self.match(uni.SubNodeList):
|
|
3289
2963
|
comma = self.consume_token(Tok.COMMA)
|
|
3290
|
-
pattern = self.consume(
|
|
2964
|
+
pattern = self.consume(uni.MatchPattern)
|
|
3291
2965
|
else:
|
|
3292
|
-
pattern = self.consume(
|
|
2966
|
+
pattern = self.consume(uni.MatchPattern)
|
|
3293
2967
|
new_kid = [*consume.kid, comma, pattern] if consume else [pattern]
|
|
3294
|
-
valid_kid = [i for i in new_kid if isinstance(i,
|
|
3295
|
-
return
|
|
2968
|
+
valid_kid = [i for i in new_kid if isinstance(i, uni.MatchPattern)]
|
|
2969
|
+
return uni.SubNodeList[uni.MatchPattern](
|
|
3296
2970
|
items=valid_kid,
|
|
3297
2971
|
delim=Tok.COMMA,
|
|
3298
2972
|
kid=new_kid,
|
|
3299
2973
|
)
|
|
3300
2974
|
|
|
3301
|
-
def kw_pattern_list(self, _: None) ->
|
|
2975
|
+
def kw_pattern_list(self, _: None) -> uni.SubNodeList[uni.MatchKVPair]:
|
|
3302
2976
|
"""Grammar rule.
|
|
3303
2977
|
|
|
3304
2978
|
kw_pattern_list: (kw_pattern_list COMMA)? named_ref EQ pattern_seq
|
|
3305
2979
|
"""
|
|
3306
2980
|
new_kid: list = []
|
|
3307
|
-
if consume := self.match(
|
|
2981
|
+
if consume := self.match(uni.SubNodeList):
|
|
3308
2982
|
comma = self.consume_token(Tok.COMMA)
|
|
3309
2983
|
new_kid.extend([*consume.kid, comma])
|
|
3310
|
-
name = self.consume(
|
|
2984
|
+
name = self.consume(uni.NameAtom)
|
|
3311
2985
|
eq = self.consume_token(Tok.EQ)
|
|
3312
|
-
value = self.consume(
|
|
2986
|
+
value = self.consume(uni.MatchPattern)
|
|
3313
2987
|
new_kid.extend(
|
|
3314
|
-
[
|
|
2988
|
+
[uni.MatchKVPair(key=name, value=value, kid=[name, eq, value])]
|
|
3315
2989
|
)
|
|
3316
|
-
valid_kid = [i for i in new_kid if isinstance(i,
|
|
3317
|
-
return
|
|
2990
|
+
valid_kid = [i for i in new_kid if isinstance(i, uni.MatchKVPair)]
|
|
2991
|
+
return uni.SubNodeList[uni.MatchKVPair](
|
|
3318
2992
|
items=valid_kid,
|
|
3319
2993
|
delim=Tok.COMMA,
|
|
3320
2994
|
kid=new_kid,
|
|
3321
2995
|
)
|
|
3322
2996
|
|
|
3323
|
-
def __default_token__(self, token: jl.Token) ->
|
|
2997
|
+
def __default_token__(self, token: jl.Token) -> uni.Token:
|
|
3324
2998
|
"""Token handler."""
|
|
3325
|
-
ret_type =
|
|
2999
|
+
ret_type = uni.Token
|
|
3326
3000
|
if token.type in [Tok.NAME, Tok.KWESC_NAME]:
|
|
3327
|
-
ret_type =
|
|
3001
|
+
ret_type = uni.Name
|
|
3328
3002
|
if token.type in [
|
|
3329
3003
|
Tok.KW_INIT,
|
|
3330
3004
|
Tok.KW_POST_INIT,
|
|
@@ -3332,33 +3006,34 @@ class JacParser(Pass):
|
|
|
3332
3006
|
Tok.KW_SUPER,
|
|
3333
3007
|
Tok.KW_SELF,
|
|
3334
3008
|
Tok.KW_HERE,
|
|
3009
|
+
Tok.KW_VISITOR,
|
|
3335
3010
|
]:
|
|
3336
|
-
ret_type =
|
|
3011
|
+
ret_type = uni.Name
|
|
3337
3012
|
elif token.type == Tok.SEMI:
|
|
3338
|
-
ret_type =
|
|
3013
|
+
ret_type = uni.Semi
|
|
3339
3014
|
elif token.type == Tok.NULL:
|
|
3340
|
-
ret_type =
|
|
3015
|
+
ret_type = uni.Null
|
|
3341
3016
|
elif token.type == Tok.ELLIPSIS:
|
|
3342
|
-
ret_type =
|
|
3017
|
+
ret_type = uni.Ellipsis
|
|
3343
3018
|
elif token.type == Tok.FLOAT:
|
|
3344
|
-
ret_type =
|
|
3019
|
+
ret_type = uni.Float
|
|
3345
3020
|
elif token.type in [Tok.INT, Tok.INT, Tok.HEX, Tok.BIN, Tok.OCT]:
|
|
3346
|
-
ret_type =
|
|
3021
|
+
ret_type = uni.Int
|
|
3347
3022
|
elif token.type in [
|
|
3348
3023
|
Tok.STRING,
|
|
3349
3024
|
Tok.FSTR_BESC,
|
|
3350
3025
|
Tok.FSTR_PIECE,
|
|
3351
3026
|
Tok.FSTR_SQ_PIECE,
|
|
3352
3027
|
]:
|
|
3353
|
-
ret_type =
|
|
3028
|
+
ret_type = uni.String
|
|
3354
3029
|
if token.type == Tok.FSTR_BESC:
|
|
3355
3030
|
token.value = token.value[1:]
|
|
3356
3031
|
elif token.type == Tok.BOOL:
|
|
3357
|
-
ret_type =
|
|
3032
|
+
ret_type = uni.Bool
|
|
3358
3033
|
elif token.type == Tok.PYNLINE and isinstance(token.value, str):
|
|
3359
3034
|
token.value = token.value.replace("::py::", "")
|
|
3360
3035
|
ret = ret_type(
|
|
3361
|
-
orig_src=self.parse_ref.
|
|
3036
|
+
orig_src=self.parse_ref.ir_in,
|
|
3362
3037
|
name=token.type,
|
|
3363
3038
|
value=token.value[2:] if token.type == Tok.KWESC_NAME else token.value,
|
|
3364
3039
|
line=token.line if token.line is not None else 0,
|
|
@@ -3368,7 +3043,7 @@ class JacParser(Pass):
|
|
|
3368
3043
|
pos_start=token.start_pos if token.start_pos is not None else 0,
|
|
3369
3044
|
pos_end=token.end_pos if token.end_pos is not None else 0,
|
|
3370
3045
|
)
|
|
3371
|
-
if isinstance(ret,
|
|
3046
|
+
if isinstance(ret, uni.Name):
|
|
3372
3047
|
if token.type == Tok.KWESC_NAME:
|
|
3373
3048
|
ret.is_kwesc = True
|
|
3374
3049
|
if ret.value in keyword.kwlist:
|
|
@@ -3378,3 +3053,41 @@ class JacParser(Pass):
|
|
|
3378
3053
|
raise err
|
|
3379
3054
|
self.terminals.append(ret)
|
|
3380
3055
|
return ret
|
|
3056
|
+
|
|
3057
|
+
def event_clause(self, _: None) -> uni.EventSignature:
|
|
3058
|
+
"""Grammar rule.
|
|
3059
|
+
|
|
3060
|
+
event_clause: KW_WITH expression? (KW_EXIT | KW_ENTRY) (RETURN_HINT expression)?
|
|
3061
|
+
"""
|
|
3062
|
+
return_spec: uni.Expr | None = None
|
|
3063
|
+
self.consume_token(Tok.KW_WITH)
|
|
3064
|
+
type_specs = self.match(uni.Expr)
|
|
3065
|
+
event = self.match_token(Tok.KW_EXIT) or self.consume_token(Tok.KW_ENTRY)
|
|
3066
|
+
if self.match_token(Tok.RETURN_HINT):
|
|
3067
|
+
return_spec = self.consume(uni.Expr)
|
|
3068
|
+
return uni.EventSignature(
|
|
3069
|
+
event=event,
|
|
3070
|
+
arch_tag_info=type_specs,
|
|
3071
|
+
return_type=return_spec,
|
|
3072
|
+
kid=self.cur_nodes,
|
|
3073
|
+
)
|
|
3074
|
+
|
|
3075
|
+
def block_tail(self, _: None) -> uni.SubNodeList | uni.FuncCall:
|
|
3076
|
+
"""Grammar rule.
|
|
3077
|
+
|
|
3078
|
+
block_tail: code_block | KW_BY atomic_call SEMI | KW_ABSTRACT? SEMI
|
|
3079
|
+
"""
|
|
3080
|
+
# Try to match code_block first
|
|
3081
|
+
if code_block := self.match(uni.SubNodeList):
|
|
3082
|
+
return code_block
|
|
3083
|
+
|
|
3084
|
+
# Otherwise, it must be KW_BY atomic_call SEMI
|
|
3085
|
+
by_token = self.consume_token(Tok.KW_BY)
|
|
3086
|
+
func_call = self.consume(uni.FuncCall)
|
|
3087
|
+
semi_token = self.consume_token(Tok.SEMI)
|
|
3088
|
+
|
|
3089
|
+
# Add the tokens to the function call's kid array
|
|
3090
|
+
func_call.add_kids_left([by_token])
|
|
3091
|
+
func_call.add_kids_right([semi_token])
|
|
3092
|
+
|
|
3093
|
+
return func_call
|