jaclang 0.7.34__py3-none-any.whl → 0.8.1__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 +316 -217
- 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 +65 -106
- jaclang/compiler/larkparse/jac_parser.py +3444 -0
- jaclang/compiler/parser.py +1137 -1517
- 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 +159 -114
- jaclang/compiler/passes/main/def_use_pass.py +66 -274
- jaclang/compiler/passes/main/import_pass.py +178 -363
- jaclang/compiler/passes/main/inheritance_pass.py +109 -107
- jaclang/compiler/passes/main/pyast_gen_pass.py +1242 -1735
- jaclang/compiler/passes/main/pyast_load_pass.py +579 -819
- jaclang/compiler/passes/main/pybc_gen_pass.py +38 -35
- jaclang/compiler/passes/main/pyjac_ast_link_pass.py +50 -163
- jaclang/compiler/passes/main/sym_tab_build_pass.py +114 -1203
- 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 +19 -0
- jaclang/compiler/passes/main/tests/fixtures/symtab_link_tests/main.jac +7 -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 +101 -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 +1287 -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 +200 -0
- jaclang/compiler/tests/fixtures/codegentext.jac +31 -0
- jaclang/compiler/tests/fixtures/fam.jac +12 -12
- jaclang/compiler/tests/fixtures/hello_world.jac +1 -1
- jaclang/compiler/tests/fixtures/pkg_import_lib/__init__.jac +1 -0
- jaclang/compiler/tests/fixtures/pkg_import_lib/sub/__init__.jac +1 -0
- jaclang/compiler/tests/fixtures/pkg_import_lib/sub/helper.jac +3 -0
- jaclang/compiler/tests/fixtures/pkg_import_lib/tools.jac +3 -0
- jaclang/compiler/tests/fixtures/pkg_import_lib_py/__init__.py +11 -0
- jaclang/compiler/tests/fixtures/pkg_import_lib_py/sub/__init__.py +7 -0
- jaclang/compiler/tests/fixtures/pkg_import_lib_py/sub/helper.jac +3 -0
- jaclang/compiler/tests/fixtures/pkg_import_lib_py/tools.jac +3 -0
- jaclang/compiler/tests/fixtures/pkg_import_main.jac +10 -0
- jaclang/compiler/tests/fixtures/pkg_import_main_py.jac +11 -0
- jaclang/compiler/tests/fixtures/staticcheck.jac +2 -2
- jaclang/compiler/tests/test_importer.py +41 -16
- jaclang/compiler/tests/test_parser.py +39 -17
- jaclang/compiler/{absyntree.py → unitree.py} +1521 -1261
- jaclang/langserve/engine.jac +498 -0
- jaclang/langserve/sem_manager.jac +309 -0
- jaclang/langserve/server.jac +186 -0
- 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 +261 -0
- jaclang/langserve/tests/server_test/utils.py +118 -0
- jaclang/langserve/tests/session.jac +294 -0
- jaclang/langserve/tests/test_sem_tokens.py +4 -4
- jaclang/langserve/tests/test_server.py +53 -30
- jaclang/langserve/utils.jac +459 -0
- jaclang/runtimelib/{architype.py → archetype.py} +86 -62
- jaclang/runtimelib/builtin.py +95 -0
- jaclang/runtimelib/constructs.py +11 -13
- jaclang/runtimelib/importer.py +83 -53
- jaclang/runtimelib/machine.py +1592 -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/{plugin → runtimelib}/tests/fixtures/traversing_save.jac +7 -5
- jaclang/runtimelib/tests/test_features.py +72 -0
- jaclang/{plugin → runtimelib}/tests/test_jaseci.py +6 -5
- jaclang/runtimelib/utils.py +34 -66
- 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/backward_edge_visit.jac +31 -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_printgraph.jac +85 -0
- jaclang/tests/fixtures/builtin_printgraph_json.jac +21 -0
- jaclang/tests/fixtures/builtin_printgraph_mermaid.jac +16 -0
- jaclang/tests/fixtures/byllmissue.jac +1 -1
- jaclang/tests/fixtures/chandra_bugs.jac +1 -1
- jaclang/tests/fixtures/chandra_bugs2.jac +21 -14
- 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 +2 -2
- jaclang/tests/fixtures/dynamic_archetype.jac +34 -0
- jaclang/tests/fixtures/edge_ability.jac +49 -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 +6 -6
- 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/here_usage_error.jac +21 -0
- jaclang/tests/fixtures/here_visitor_usage.jac +21 -0
- 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 +54 -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/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/visit_traversal.jac +47 -0
- 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 +127 -227
- jaclang/tests/test_language.py +542 -474
- 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 +24 -31
- jaclang/utils/lang_tools.py +84 -75
- jaclang/utils/module_resolver.py +69 -0
- jaclang/utils/test.py +8 -5
- jaclang/utils/tests/test_lang_tools.py +40 -14
- jaclang/utils/treeprinter.py +178 -42
- 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.34.dist-info → jaclang-0.8.1.dist-info}/METADATA +2 -1
- jaclang-0.8.1.dist-info/RECORD +568 -0
- {jaclang-0.7.34.dist-info → jaclang-0.8.1.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/engine.py +0 -541
- jaclang/langserve/sem_manager.py +0 -379
- jaclang/langserve/server.py +0 -176
- jaclang/langserve/tests/session.py +0 -255
- 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/builtin_dotgen.jac +0 -42
- 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.34.dist-info/RECORD +0 -1563
- /jaclang/{vendor/mypy/dmypy → compiler/larkparse}/__init__.py +0 -0
- /jaclang/{tests → compiler/passes/main/tests}/fixtures/access_checker.jac +0 -0
- /jaclang/langserve/{__init__.py → __init__.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/{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.34.dist-info → jaclang-0.8.1.dist-info}/entry_points.txt +0 -0
jaclang/compiler/parser.py
CHANGED
|
@@ -5,47 +5,48 @@ 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, Sequence, TYPE_CHECKING, TypeAlias, TypeVar, cast
|
|
9
9
|
|
|
10
|
-
import jaclang.compiler.
|
|
11
|
-
from jaclang.compiler import jac_lark as jl
|
|
10
|
+
import jaclang.compiler.unitree as uni
|
|
11
|
+
from jaclang.compiler import jac_lark as jl
|
|
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)
|
|
20
|
+
TL = TypeVar("TL", bound=(uni.UniNode | list))
|
|
18
21
|
|
|
19
22
|
|
|
20
|
-
class JacParser(
|
|
23
|
+
class JacParser(Transform[uni.Source, uni.Module]):
|
|
21
24
|
"""Jac Parser."""
|
|
22
25
|
|
|
23
26
|
dev_mode = False
|
|
24
27
|
|
|
25
|
-
def __init__(self,
|
|
28
|
+
def __init__(self, root_ir: uni.Source, prog: JacProgram) -> None:
|
|
26
29
|
"""Initialize parser."""
|
|
27
|
-
self.
|
|
28
|
-
self.
|
|
29
|
-
self.node_list: list[ast.AstNode] = []
|
|
30
|
+
self.mod_path = root_ir.loc.mod_path
|
|
31
|
+
self.node_list: list[uni.UniNode] = []
|
|
30
32
|
if JacParser.dev_mode:
|
|
31
33
|
JacParser.make_dev()
|
|
32
|
-
|
|
34
|
+
Transform.__init__(self, ir_in=root_ir, prog=prog)
|
|
33
35
|
|
|
34
|
-
def transform(self,
|
|
36
|
+
def transform(self, ir_in: uni.Source) -> uni.Module:
|
|
35
37
|
"""Transform input IR."""
|
|
36
38
|
try:
|
|
37
|
-
tree, comments = JacParser.parse(
|
|
38
|
-
self.source.value, on_error=self.error_callback
|
|
39
|
-
)
|
|
39
|
+
tree, comments = JacParser.parse(ir_in.value, on_error=self.error_callback)
|
|
40
40
|
mod = JacParser.TreeToAST(parser=self).transform(tree)
|
|
41
|
-
|
|
42
|
-
if isinstance(mod,
|
|
41
|
+
ir_in.comments = [self.proc_comment(i, mod) for i in comments]
|
|
42
|
+
if isinstance(mod, uni.Module):
|
|
43
|
+
self.ir_out = mod
|
|
43
44
|
return mod
|
|
44
45
|
else:
|
|
45
46
|
raise self.ice()
|
|
46
47
|
except jl.UnexpectedInput as e:
|
|
47
|
-
catch_error =
|
|
48
|
-
catch_error.orig_src =
|
|
48
|
+
catch_error = uni.EmptyToken()
|
|
49
|
+
catch_error.orig_src = ir_in
|
|
49
50
|
catch_error.line_no = e.line
|
|
50
51
|
catch_error.end_line = e.line
|
|
51
52
|
catch_error.c_start = e.column
|
|
@@ -56,25 +57,17 @@ class JacParser(Pass):
|
|
|
56
57
|
error_msg = "Syntax Error"
|
|
57
58
|
if len(e.args) >= 1 and isinstance(e.args[0], str):
|
|
58
59
|
error_msg += e.args[0]
|
|
59
|
-
self.
|
|
60
|
+
self.log_error(error_msg, node_override=catch_error)
|
|
60
61
|
|
|
61
62
|
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
|
-
)
|
|
63
|
+
raise e
|
|
64
|
+
|
|
65
|
+
return uni.Module.make_stub(inject_src=ir_in)
|
|
73
66
|
|
|
74
67
|
@staticmethod
|
|
75
|
-
def proc_comment(token: jl.Token, mod:
|
|
68
|
+
def proc_comment(token: jl.Token, mod: uni.UniNode) -> uni.CommentToken:
|
|
76
69
|
"""Process comment."""
|
|
77
|
-
return
|
|
70
|
+
return uni.CommentToken(
|
|
78
71
|
orig_src=mod.loc.orig_src,
|
|
79
72
|
name=token.type,
|
|
80
73
|
value=token.value,
|
|
@@ -116,13 +109,13 @@ class JacParser(Pass):
|
|
|
116
109
|
debug=True,
|
|
117
110
|
lexer_callbacks={"COMMENT": JacParser._comment_callback},
|
|
118
111
|
)
|
|
119
|
-
JacParser.JacTransformer = Transformer[Tree[str],
|
|
112
|
+
JacParser.JacTransformer = Transformer[Tree[str], uni.UniNode] # type: ignore
|
|
120
113
|
logger.setLevel(logging.DEBUG)
|
|
121
114
|
|
|
122
115
|
comment_cache: list[jl.Token] = []
|
|
123
116
|
|
|
124
117
|
parser = jl.Lark_StandAlone(lexer_callbacks={"COMMENT": _comment_callback}) # type: ignore
|
|
125
|
-
JacTransformer: TypeAlias = jl.Transformer[jl.Tree[str],
|
|
118
|
+
JacTransformer: TypeAlias = jl.Transformer[jl.Tree[str], uni.UniNode]
|
|
126
119
|
|
|
127
120
|
class TreeToAST(JacTransformer):
|
|
128
121
|
"""Transform parse tree to AST."""
|
|
@@ -131,15 +124,15 @@ class JacParser(Pass):
|
|
|
131
124
|
"""Initialize transformer."""
|
|
132
125
|
super().__init__(*args, **kwargs)
|
|
133
126
|
self.parse_ref = parser
|
|
134
|
-
self.terminals: list[
|
|
127
|
+
self.terminals: list[uni.Token] = []
|
|
135
128
|
# TODO: Once the kid is removed from the ast, we can get rid of this
|
|
136
129
|
# node_idx and directly pop(0) kid as we process the nodes.
|
|
137
130
|
self.node_idx = 0
|
|
138
|
-
self.cur_nodes: list[
|
|
131
|
+
self.cur_nodes: list[uni.UniNode] = []
|
|
139
132
|
|
|
140
133
|
def ice(self) -> Exception:
|
|
141
134
|
"""Raise internal compiler error."""
|
|
142
|
-
self.parse_ref.
|
|
135
|
+
self.parse_ref.log_error("Internal Compiler Error, Invalid Parse Tree!")
|
|
143
136
|
return RuntimeError(
|
|
144
137
|
f"{self.parse_ref.__class__.__name__} - Internal Compiler Error, Invalid Parse Tree!"
|
|
145
138
|
)
|
|
@@ -151,8 +144,8 @@ class JacParser(Pass):
|
|
|
151
144
|
return node
|
|
152
145
|
|
|
153
146
|
def _call_userfunc(
|
|
154
|
-
self, tree: jl.Tree, new_children: None | list[
|
|
155
|
-
) ->
|
|
147
|
+
self, tree: jl.Tree, new_children: None | list[uni.UniNode] = None
|
|
148
|
+
) -> uni.UniNode:
|
|
156
149
|
self.cur_nodes = new_children or tree.children # type: ignore[assignment]
|
|
157
150
|
try:
|
|
158
151
|
return self._node_update(super()._call_userfunc(tree, new_children))
|
|
@@ -160,21 +153,21 @@ class JacParser(Pass):
|
|
|
160
153
|
self.cur_nodes = []
|
|
161
154
|
self.node_idx = 0
|
|
162
155
|
|
|
163
|
-
def _call_userfunc_token(self, token: jl.Token) ->
|
|
156
|
+
def _call_userfunc_token(self, token: jl.Token) -> uni.UniNode:
|
|
164
157
|
return self._node_update(super()._call_userfunc_token(token))
|
|
165
158
|
|
|
166
|
-
def _binary_expr_unwind(self, kid: list[
|
|
159
|
+
def _binary_expr_unwind(self, kid: list[uni.UniNode]) -> uni.Expr:
|
|
167
160
|
"""Binary expression helper."""
|
|
168
161
|
if len(kid) > 1:
|
|
169
162
|
if (
|
|
170
|
-
isinstance(kid[0],
|
|
163
|
+
isinstance(kid[0], uni.Expr)
|
|
171
164
|
and isinstance(
|
|
172
165
|
kid[1],
|
|
173
|
-
(
|
|
166
|
+
(uni.Token, uni.DisconnectOp, uni.ConnectOp),
|
|
174
167
|
)
|
|
175
|
-
and isinstance(kid[2],
|
|
168
|
+
and isinstance(kid[2], uni.Expr)
|
|
176
169
|
):
|
|
177
|
-
return
|
|
170
|
+
return uni.BinaryExpr(
|
|
178
171
|
left=kid[0],
|
|
179
172
|
op=kid[1],
|
|
180
173
|
right=kid[2],
|
|
@@ -182,7 +175,7 @@ class JacParser(Pass):
|
|
|
182
175
|
)
|
|
183
176
|
else:
|
|
184
177
|
raise self.ice()
|
|
185
|
-
elif isinstance(kid[0],
|
|
178
|
+
elif isinstance(kid[0], uni.Expr):
|
|
186
179
|
return kid[0]
|
|
187
180
|
else:
|
|
188
181
|
raise self.ice()
|
|
@@ -191,7 +184,13 @@ class JacParser(Pass):
|
|
|
191
184
|
# Parser Helper functions. #
|
|
192
185
|
# ******************************************************************* #
|
|
193
186
|
|
|
194
|
-
def
|
|
187
|
+
def extract_from_list(
|
|
188
|
+
self, nd_list: list[uni.UniNode], ty: type[T] | tuple[type[T], ...]
|
|
189
|
+
) -> list[T]:
|
|
190
|
+
"""Extract a list of nodes of type 'ty' from the current nodes."""
|
|
191
|
+
return cast(list[T], [node for node in nd_list if isinstance(node, ty)])
|
|
192
|
+
|
|
193
|
+
def match(self, ty: type[TL]) -> TL | None:
|
|
195
194
|
"""Return a node matching type 'ty' if possible from the current nodes."""
|
|
196
195
|
if (self.node_idx < len(self.cur_nodes)) and isinstance(
|
|
197
196
|
self.cur_nodes[self.node_idx], ty
|
|
@@ -200,15 +199,15 @@ class JacParser(Pass):
|
|
|
200
199
|
return self.cur_nodes[self.node_idx - 1] # type: ignore[return-value]
|
|
201
200
|
return None
|
|
202
201
|
|
|
203
|
-
def consume(self, ty: type[
|
|
202
|
+
def consume(self, ty: type[TL]) -> TL:
|
|
204
203
|
"""Consume and return the specified type, if it's not exists, will be an internal compiler error."""
|
|
205
204
|
if node := self.match(ty):
|
|
206
205
|
return node
|
|
207
206
|
raise self.ice()
|
|
208
207
|
|
|
209
|
-
def match_token(self, tok: Tok) ->
|
|
208
|
+
def match_token(self, tok: Tok) -> uni.Token | None:
|
|
210
209
|
"""Match a token with the given type and return it."""
|
|
211
|
-
if token := self.match(
|
|
210
|
+
if token := self.match(uni.Token):
|
|
212
211
|
if token.name == tok.name:
|
|
213
212
|
return token
|
|
214
213
|
self.node_idx -= (
|
|
@@ -216,7 +215,7 @@ class JacParser(Pass):
|
|
|
216
215
|
)
|
|
217
216
|
return None
|
|
218
217
|
|
|
219
|
-
def consume_token(self, tok: Tok) ->
|
|
218
|
+
def consume_token(self, tok: Tok) -> uni.Token:
|
|
220
219
|
"""Consume a token with the given type and return it."""
|
|
221
220
|
if token := self.match_token(tok):
|
|
222
221
|
return token
|
|
@@ -224,191 +223,198 @@ class JacParser(Pass):
|
|
|
224
223
|
|
|
225
224
|
def match_many(self, ty: type[T]) -> list[T]:
|
|
226
225
|
"""Match 0 or more of the given type and return the list."""
|
|
227
|
-
nodes: list[
|
|
226
|
+
nodes: list[uni.UniNode] = []
|
|
228
227
|
while node := self.match(ty):
|
|
229
228
|
nodes.append(node)
|
|
230
229
|
return nodes # type: ignore[return-value]
|
|
231
230
|
|
|
232
231
|
def consume_many(self, ty: type[T]) -> list[T]:
|
|
233
232
|
"""Match 1 or more of the given type and return the list."""
|
|
234
|
-
nodes: list[
|
|
233
|
+
nodes: list[uni.UniNode] = [self.consume(ty)]
|
|
235
234
|
while node := self.match(ty):
|
|
236
235
|
nodes.append(node)
|
|
237
236
|
return nodes # type: ignore[return-value]
|
|
238
237
|
|
|
238
|
+
@property
|
|
239
|
+
def flat_cur_nodes(self) -> list[uni.UniNode]:
|
|
240
|
+
"""Flatten the current nodes."""
|
|
241
|
+
flat_nodes: list[uni.UniNode] = []
|
|
242
|
+
for node in self.cur_nodes:
|
|
243
|
+
if isinstance(node, list):
|
|
244
|
+
flat_nodes.extend(node)
|
|
245
|
+
else:
|
|
246
|
+
flat_nodes.append(node)
|
|
247
|
+
return flat_nodes
|
|
248
|
+
|
|
239
249
|
# ******************************************************************* #
|
|
240
250
|
# Parsing Rules #
|
|
241
251
|
# ******************************************************************* #
|
|
242
252
|
|
|
243
|
-
def start(self, _: None) ->
|
|
253
|
+
def start(self, _: None) -> uni.Module:
|
|
244
254
|
"""Grammar rule.
|
|
245
255
|
|
|
246
256
|
start: module
|
|
247
257
|
"""
|
|
248
|
-
module = self.consume(
|
|
258
|
+
module = self.consume(uni.Module)
|
|
249
259
|
module._in_mod_nodes = self.parse_ref.node_list
|
|
250
260
|
return module
|
|
251
261
|
|
|
252
|
-
def module(self, _: None) ->
|
|
262
|
+
def module(self, _: None) -> uni.Module:
|
|
253
263
|
"""Grammar rule.
|
|
254
264
|
|
|
255
265
|
module: (toplevel_stmt (tl_stmt_with_doc | toplevel_stmt)*)?
|
|
256
266
|
| STRING (tl_stmt_with_doc | toplevel_stmt)*
|
|
257
267
|
"""
|
|
258
|
-
doc = self.match(
|
|
259
|
-
body = self.match_many(
|
|
260
|
-
mod =
|
|
268
|
+
doc = self.match(uni.String)
|
|
269
|
+
body = self.match_many(uni.ElementStmt)
|
|
270
|
+
mod = uni.Module(
|
|
261
271
|
name=self.parse_ref.mod_path.split(os.path.sep)[-1].rstrip(".jac"),
|
|
262
|
-
source=self.parse_ref.
|
|
272
|
+
source=self.parse_ref.ir_in,
|
|
263
273
|
doc=doc,
|
|
264
274
|
body=body,
|
|
265
|
-
is_imported=False,
|
|
266
275
|
terminals=self.terminals,
|
|
267
276
|
kid=(
|
|
268
277
|
self.cur_nodes
|
|
269
|
-
or [
|
|
278
|
+
or [uni.EmptyToken(uni.Source("", self.parse_ref.mod_path))]
|
|
270
279
|
),
|
|
271
280
|
)
|
|
272
281
|
return mod
|
|
273
282
|
|
|
274
|
-
def tl_stmt_with_doc(self, _: None) ->
|
|
283
|
+
def tl_stmt_with_doc(self, _: None) -> uni.ElementStmt:
|
|
275
284
|
"""Grammar rule.
|
|
276
285
|
|
|
277
|
-
tl_stmt_with_doc:
|
|
286
|
+
tl_stmt_with_doc: STRING toplevel_stmt
|
|
278
287
|
"""
|
|
279
|
-
doc = self.consume(
|
|
280
|
-
element = self.consume(
|
|
288
|
+
doc = self.consume(uni.String)
|
|
289
|
+
element = self.consume(uni.ElementStmt)
|
|
281
290
|
element.doc = doc
|
|
282
291
|
element.add_kids_left([doc])
|
|
283
292
|
return element
|
|
284
293
|
|
|
285
|
-
def toplevel_stmt(self, _: None) ->
|
|
294
|
+
def toplevel_stmt(self, _: None) -> uni.ElementStmt:
|
|
286
295
|
"""Grammar rule.
|
|
287
296
|
|
|
288
|
-
|
|
289
|
-
|
|
|
297
|
+
toplevel_stmt: import_stmt
|
|
298
|
+
| archetype
|
|
290
299
|
| ability
|
|
291
|
-
|
|
|
300
|
+
| global_var
|
|
292
301
|
| free_code
|
|
302
|
+
| py_code_block
|
|
293
303
|
| test
|
|
294
|
-
| global_var
|
|
295
304
|
"""
|
|
296
|
-
return self.consume(
|
|
305
|
+
return self.consume(uni.ElementStmt)
|
|
297
306
|
|
|
298
|
-
def global_var(self, _: None) ->
|
|
307
|
+
def global_var(self, _: None) -> uni.GlobalVars:
|
|
299
308
|
"""Grammar rule.
|
|
300
309
|
|
|
301
310
|
global_var: (KW_LET | KW_GLOBAL) access_tag? assignment_list SEMI
|
|
302
311
|
"""
|
|
303
|
-
is_frozen = self.consume(
|
|
304
|
-
access_tag = self.match(
|
|
305
|
-
|
|
306
|
-
return
|
|
312
|
+
is_frozen = self.consume(uni.Token).name == Tok.KW_LET
|
|
313
|
+
access_tag = self.match(uni.SubTag)
|
|
314
|
+
assignments_list = self.consume(list)
|
|
315
|
+
return uni.GlobalVars(
|
|
307
316
|
access=access_tag,
|
|
308
|
-
assignments=
|
|
317
|
+
assignments=self.extract_from_list(assignments_list, uni.Assignment),
|
|
309
318
|
is_frozen=is_frozen,
|
|
310
|
-
kid=self.
|
|
319
|
+
kid=self.flat_cur_nodes,
|
|
311
320
|
)
|
|
312
321
|
|
|
313
|
-
def access_tag(self, _: None) ->
|
|
322
|
+
def access_tag(self, _: None) -> uni.SubTag[uni.Token]:
|
|
314
323
|
"""Grammar rule.
|
|
315
324
|
|
|
316
325
|
access_tag: COLON ( KW_PROT | KW_PUB | KW_PRIV )
|
|
317
326
|
"""
|
|
318
327
|
self.consume_token(Tok.COLON)
|
|
319
|
-
access = self.consume(
|
|
320
|
-
return
|
|
328
|
+
access = self.consume(uni.Token)
|
|
329
|
+
return uni.SubTag[uni.Token](tag=access, kid=self.cur_nodes)
|
|
321
330
|
|
|
322
|
-
def test(self, _: None) ->
|
|
331
|
+
def test(self, _: None) -> uni.Test:
|
|
323
332
|
"""Grammar rule.
|
|
324
333
|
|
|
325
334
|
test: KW_TEST NAME? code_block
|
|
326
335
|
"""
|
|
327
336
|
# Q(thakee): Why the name should be KW_TEST if no name present?
|
|
328
337
|
test_tok = self.consume_token(Tok.KW_TEST)
|
|
329
|
-
name = self.match(
|
|
330
|
-
codeblock = self.consume(
|
|
331
|
-
return
|
|
338
|
+
name = self.match(uni.Name) or test_tok
|
|
339
|
+
codeblock = self.consume(list)
|
|
340
|
+
return uni.Test(
|
|
332
341
|
name=name,
|
|
333
|
-
body=codeblock,
|
|
334
|
-
kid=self.
|
|
342
|
+
body=self.extract_from_list(codeblock, uni.CodeBlockStmt),
|
|
343
|
+
kid=self.flat_cur_nodes,
|
|
335
344
|
)
|
|
336
345
|
|
|
337
|
-
def free_code(self, _: None) ->
|
|
346
|
+
def free_code(self, _: None) -> uni.ModuleCode:
|
|
338
347
|
"""Grammar rule.
|
|
339
348
|
|
|
340
|
-
free_code: KW_WITH KW_ENTRY
|
|
349
|
+
free_code: KW_WITH KW_ENTRY (COLON NAME)? code_block
|
|
341
350
|
"""
|
|
342
351
|
self.consume_token(Tok.KW_WITH)
|
|
343
352
|
self.consume_token(Tok.KW_ENTRY)
|
|
344
|
-
name =
|
|
345
|
-
|
|
346
|
-
|
|
353
|
+
name = None
|
|
354
|
+
if self.match_token(Tok.COLON):
|
|
355
|
+
name = self.consume(uni.Name)
|
|
356
|
+
codeblock = self.consume(list)
|
|
357
|
+
return uni.ModuleCode(
|
|
347
358
|
name=name,
|
|
348
|
-
body=codeblock,
|
|
349
|
-
kid=self.
|
|
359
|
+
body=self.extract_from_list(codeblock, uni.CodeBlockStmt),
|
|
360
|
+
kid=self.flat_cur_nodes,
|
|
350
361
|
)
|
|
351
362
|
|
|
352
|
-
def py_code_block(self, _: None) ->
|
|
363
|
+
def py_code_block(self, _: None) -> uni.PyInlineCode:
|
|
353
364
|
"""Grammar rule.
|
|
354
365
|
|
|
355
366
|
py_code_block: PYNLINE
|
|
356
367
|
"""
|
|
357
368
|
pyinline = self.consume_token(Tok.PYNLINE)
|
|
358
|
-
return
|
|
369
|
+
return uni.PyInlineCode(
|
|
359
370
|
code=pyinline,
|
|
360
371
|
kid=self.cur_nodes,
|
|
361
372
|
)
|
|
362
373
|
|
|
363
|
-
def import_stmt(self, _: None) ->
|
|
374
|
+
def import_stmt(self, _: None) -> uni.Import:
|
|
364
375
|
"""Grammar rule.
|
|
365
376
|
|
|
366
|
-
import_stmt: KW_IMPORT
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
| include_stmt
|
|
377
|
+
import_stmt: KW_IMPORT KW_FROM from_path LBRACE import_items RBRACE
|
|
378
|
+
| KW_IMPORT import_path (COMMA import_path)* SEMI
|
|
379
|
+
| KW_INCLUDE import_path SEMI
|
|
370
380
|
"""
|
|
371
|
-
if
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
381
|
+
if self.match_token(Tok.KW_INCLUDE):
|
|
382
|
+
# Handle include statement
|
|
383
|
+
import_path_obj = self.consume(uni.ModulePath)
|
|
384
|
+
return uni.Import(
|
|
385
|
+
from_loc=None,
|
|
386
|
+
items=[import_path_obj],
|
|
387
|
+
is_absorb=True,
|
|
388
|
+
kid=self.cur_nodes,
|
|
389
|
+
)
|
|
376
390
|
|
|
377
|
-
from_path:
|
|
391
|
+
from_path: uni.ModulePath | None = None
|
|
378
392
|
self.consume_token(Tok.KW_IMPORT)
|
|
379
|
-
lang = self.match(ast.SubTag)
|
|
380
393
|
|
|
381
394
|
if self.match_token(Tok.KW_FROM):
|
|
382
|
-
from_path = self.consume(
|
|
383
|
-
self.consume(
|
|
384
|
-
items = self.consume(
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
395
|
+
from_path = self.consume(uni.ModulePath)
|
|
396
|
+
self.consume(uni.Token) # LBRACE or COMMA
|
|
397
|
+
items = self.extract_from_list(self.consume(list), uni.ModuleItem)
|
|
398
|
+
self.consume(uni.Token)
|
|
399
|
+
return uni.Import(
|
|
400
|
+
from_loc=from_path,
|
|
401
|
+
items=items,
|
|
402
|
+
is_absorb=False,
|
|
403
|
+
kid=self.flat_cur_nodes,
|
|
404
|
+
)
|
|
389
405
|
else:
|
|
390
|
-
paths = [self.consume(
|
|
406
|
+
paths = [self.consume(uni.ModulePath)]
|
|
391
407
|
while self.match_token(Tok.COMMA):
|
|
392
|
-
paths.append(self.consume(
|
|
408
|
+
paths.append(self.consume(uni.ModulePath))
|
|
393
409
|
self.consume_token(Tok.SEMI)
|
|
394
|
-
|
|
410
|
+
return uni.Import(
|
|
411
|
+
from_loc=from_path,
|
|
395
412
|
items=paths,
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
kid=self.cur_nodes[2 if lang else 1 : -1],
|
|
413
|
+
is_absorb=False,
|
|
414
|
+
kid=self.flat_cur_nodes,
|
|
399
415
|
)
|
|
400
|
-
kid = (kid[:2] if lang else kid[:1]) + [items] + kid[-1:]
|
|
401
416
|
|
|
402
|
-
|
|
403
|
-
return ast.Import(
|
|
404
|
-
hint=lang,
|
|
405
|
-
from_loc=from_path,
|
|
406
|
-
items=items,
|
|
407
|
-
is_absorb=is_absorb,
|
|
408
|
-
kid=kid,
|
|
409
|
-
)
|
|
410
|
-
|
|
411
|
-
def from_path(self, _: None) -> ast.ModulePath:
|
|
417
|
+
def from_path(self, _: None) -> uni.ModulePath:
|
|
412
418
|
"""Grammar rule.
|
|
413
419
|
|
|
414
420
|
from_path: (DOT | ELLIPSIS)* import_path
|
|
@@ -422,212 +428,211 @@ class JacParser(Pass):
|
|
|
422
428
|
level += 3
|
|
423
429
|
else:
|
|
424
430
|
break
|
|
425
|
-
if import_path := self.match(
|
|
426
|
-
kids = [i for i in self.cur_nodes if isinstance(i,
|
|
431
|
+
if import_path := self.match(uni.ModulePath):
|
|
432
|
+
kids = [i for i in self.cur_nodes if isinstance(i, uni.Token)]
|
|
427
433
|
import_path.level = level
|
|
428
434
|
import_path.add_kids_left(kids)
|
|
429
435
|
return import_path
|
|
430
436
|
|
|
431
|
-
return
|
|
437
|
+
return uni.ModulePath(
|
|
432
438
|
path=None,
|
|
433
439
|
level=level,
|
|
434
440
|
alias=None,
|
|
435
441
|
kid=self.cur_nodes,
|
|
436
442
|
)
|
|
437
443
|
|
|
438
|
-
def
|
|
444
|
+
def import_path(self, _: None) -> uni.ModulePath:
|
|
439
445
|
"""Grammar rule.
|
|
440
446
|
|
|
441
|
-
|
|
447
|
+
import_path: dotted_name (KW_AS NAME)?
|
|
442
448
|
"""
|
|
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,
|
|
449
|
+
valid_path = self.extract_from_list(self.consume(list), uni.Name)
|
|
450
|
+
alias = self.consume(uni.Name) if self.match_token(Tok.KW_AS) else None
|
|
451
|
+
return uni.ModulePath(
|
|
452
|
+
path=valid_path,
|
|
453
|
+
level=0,
|
|
454
|
+
alias=alias,
|
|
455
|
+
kid=self.flat_cur_nodes,
|
|
460
456
|
)
|
|
461
457
|
|
|
462
|
-
def
|
|
458
|
+
def dotted_name(self, _: None) -> list[uni.UniNode]:
|
|
463
459
|
"""Grammar rule.
|
|
464
460
|
|
|
465
|
-
|
|
461
|
+
dotted_name: named_ref (DOT named_ref)*
|
|
466
462
|
"""
|
|
467
|
-
|
|
468
|
-
while self.match_token(Tok.DOT):
|
|
469
|
-
valid_path.append(self.consume(ast.Name))
|
|
470
|
-
alias = self.consume(ast.Name) if self.match_token(Tok.KW_AS) else None
|
|
471
|
-
return ast.ModulePath(
|
|
472
|
-
path=valid_path,
|
|
473
|
-
level=0,
|
|
474
|
-
alias=alias,
|
|
475
|
-
kid=self.cur_nodes,
|
|
476
|
-
)
|
|
463
|
+
return self.cur_nodes
|
|
477
464
|
|
|
478
|
-
def import_items(self, _: None) ->
|
|
465
|
+
def import_items(self, _: None) -> list[uni.UniNode]:
|
|
479
466
|
"""Grammar rule.
|
|
480
467
|
|
|
481
468
|
import_items: (import_item COMMA)* import_item COMMA?
|
|
482
469
|
"""
|
|
483
|
-
|
|
484
|
-
while self.match_token(Tok.COMMA):
|
|
485
|
-
if module_item := self.match(ast.ModuleItem):
|
|
486
|
-
items.append(module_item)
|
|
487
|
-
ret = ast.SubNodeList[ast.ModuleItem](
|
|
488
|
-
items=items,
|
|
489
|
-
delim=Tok.COMMA,
|
|
490
|
-
kid=self.cur_nodes,
|
|
491
|
-
)
|
|
492
|
-
return ret
|
|
470
|
+
return self.flat_cur_nodes
|
|
493
471
|
|
|
494
|
-
def import_item(self, _: None) ->
|
|
472
|
+
def import_item(self, _: None) -> uni.ModuleItem:
|
|
495
473
|
"""Grammar rule.
|
|
496
474
|
|
|
497
475
|
import_item: named_ref (KW_AS NAME)?
|
|
498
476
|
"""
|
|
499
|
-
name = self.consume(
|
|
500
|
-
alias = self.consume(
|
|
501
|
-
return
|
|
477
|
+
name = self.consume(uni.Name)
|
|
478
|
+
alias = self.consume(uni.Name) if self.match_token(Tok.KW_AS) else None
|
|
479
|
+
return uni.ModuleItem(
|
|
502
480
|
name=name,
|
|
503
481
|
alias=alias,
|
|
504
482
|
kid=self.cur_nodes,
|
|
505
483
|
)
|
|
506
484
|
|
|
507
|
-
def
|
|
508
|
-
self, _: None
|
|
509
|
-
) -> ast.ArchSpec | ast.ArchDef | ast.Enum | ast.EnumDef:
|
|
485
|
+
def archetype(self, _: None) -> uni.ArchSpec | uni.Enum:
|
|
510
486
|
"""Grammar rule.
|
|
511
487
|
|
|
512
|
-
|
|
513
|
-
|
|
|
488
|
+
archetype: decorators? archetype_decl
|
|
489
|
+
| archetype_def
|
|
514
490
|
| enum
|
|
515
491
|
"""
|
|
516
|
-
archspec:
|
|
492
|
+
archspec: uni.ArchSpec | uni.Enum | None = None
|
|
517
493
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
494
|
+
decorators_node = self.match(list)
|
|
495
|
+
is_async = self.match_token(Tok.KW_ASYNC)
|
|
496
|
+
if decorators_node is not None:
|
|
497
|
+
archspec = self.consume(uni.ArchSpec)
|
|
498
|
+
decorators = self.extract_from_list(decorators_node, uni.Expr)
|
|
521
499
|
archspec.decorators = decorators
|
|
522
|
-
archspec.add_kids_left(
|
|
500
|
+
archspec.add_kids_left(decorators_node)
|
|
523
501
|
else:
|
|
524
|
-
archspec = (
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
502
|
+
archspec = self.match(uni.ArchSpec) or self.consume(uni.Enum)
|
|
503
|
+
if is_async and isinstance(archspec, uni.ArchSpec):
|
|
504
|
+
archspec.is_async = True
|
|
505
|
+
archspec.add_kids_left([is_async])
|
|
506
|
+
assert isinstance(archspec, uni.Archetype)
|
|
507
|
+
if archspec.arch_type.name != Tok.KW_WALKER:
|
|
508
|
+
self.parse_ref.log_error(
|
|
509
|
+
f"Expected async archetype to be walker, but got {archspec.arch_type.value}"
|
|
510
|
+
)
|
|
530
511
|
return archspec
|
|
531
512
|
|
|
532
|
-
def
|
|
513
|
+
def impl_def(self, _: None) -> uni.ImplDef:
|
|
533
514
|
"""Grammar rule.
|
|
534
515
|
|
|
535
|
-
|
|
516
|
+
impl_def: decorators? KW_IMPL dotted_name impl_spec? impl_tail
|
|
536
517
|
"""
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
inh, body = sub_list1, None
|
|
545
|
-
else:
|
|
546
|
-
body = (
|
|
547
|
-
sub_list2 or sub_list1
|
|
548
|
-
) # if sub_list2 is None then body is sub_list1
|
|
549
|
-
inh = sub_list2 and sub_list1 # if sub_list2 is None then inh is None.
|
|
550
|
-
return ast.Architype(
|
|
551
|
-
arch_type=arch_type,
|
|
552
|
-
name=name,
|
|
553
|
-
semstr=semstr,
|
|
554
|
-
access=access,
|
|
555
|
-
base_classes=inh,
|
|
556
|
-
body=body,
|
|
557
|
-
kid=self.cur_nodes,
|
|
518
|
+
decorators_node = self.match(list)
|
|
519
|
+
self.consume_token(Tok.KW_IMPL)
|
|
520
|
+
target = self.extract_from_list(self.consume(list), uni.NameAtom)
|
|
521
|
+
spec = (
|
|
522
|
+
self.match(list)
|
|
523
|
+
or self.match(uni.FuncSignature)
|
|
524
|
+
or self.match(uni.EventSignature)
|
|
558
525
|
)
|
|
526
|
+
tail = self.match(list) or self.match(uni.FuncCall)
|
|
527
|
+
valid_tail = spec if tail is None else tail
|
|
528
|
+
valid_spec = None if tail is None else spec
|
|
529
|
+
impl = uni.ImplDef(
|
|
530
|
+
body=(
|
|
531
|
+
self.extract_from_list(
|
|
532
|
+
valid_tail,
|
|
533
|
+
(uni.EnumBlockStmt, uni.CodeBlockStmt), # type: ignore[arg-type]
|
|
534
|
+
)
|
|
535
|
+
if isinstance(valid_tail, list)
|
|
536
|
+
else valid_tail
|
|
537
|
+
),
|
|
538
|
+
target=target,
|
|
539
|
+
decorators=(
|
|
540
|
+
self.extract_from_list(decorators_node, uni.Expr)
|
|
541
|
+
if decorators_node
|
|
542
|
+
else None
|
|
543
|
+
),
|
|
544
|
+
spec=valid_spec,
|
|
545
|
+
kid=self.flat_cur_nodes,
|
|
546
|
+
)
|
|
547
|
+
return impl
|
|
559
548
|
|
|
560
|
-
def
|
|
549
|
+
def impl_spec(
|
|
550
|
+
self, _: None
|
|
551
|
+
) -> Sequence[uni.Expr] | uni.FuncSignature | uni.EventSignature:
|
|
561
552
|
"""Grammar rule.
|
|
562
553
|
|
|
563
|
-
|
|
554
|
+
impl_spec: inherited_archs | func_decl | event_clause
|
|
564
555
|
"""
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
body=subnodelist,
|
|
570
|
-
kid=self.cur_nodes,
|
|
556
|
+
spec = (
|
|
557
|
+
self.match(list) # inherited_archs
|
|
558
|
+
or self.match(uni.FuncSignature) # func_decl
|
|
559
|
+
or self.consume(uni.EventSignature) # event_clause
|
|
571
560
|
)
|
|
561
|
+
return spec
|
|
572
562
|
|
|
573
|
-
def
|
|
563
|
+
def impl_tail(
|
|
564
|
+
self, _: None
|
|
565
|
+
) -> Sequence[uni.EnumBlockStmt] | list[uni.CodeBlockStmt] | uni.FuncCall:
|
|
574
566
|
"""Grammar rule.
|
|
575
567
|
|
|
576
|
-
|
|
577
|
-
| KW_OBJECT
|
|
578
|
-
| KW_EDGE
|
|
579
|
-
| KW_NODE
|
|
568
|
+
impl_tail: enum_block | block_tail
|
|
580
569
|
"""
|
|
581
|
-
|
|
570
|
+
tail = self.match(list) or self.consume( # enum_block or code_block
|
|
571
|
+
uni.FuncCall
|
|
572
|
+
) # block_tail (KW_BY atomic_call)
|
|
573
|
+
return tail
|
|
582
574
|
|
|
583
|
-
def
|
|
575
|
+
def archetype_decl(self, _: None) -> uni.ArchSpec:
|
|
584
576
|
"""Grammar rule.
|
|
585
577
|
|
|
586
|
-
|
|
578
|
+
archetype_decl: arch_type access_tag? NAME inherited_archs? (member_block | SEMI)
|
|
587
579
|
"""
|
|
588
|
-
self.
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
580
|
+
arch_type = self.consume(uni.Token)
|
|
581
|
+
access = self.match(uni.SubTag)
|
|
582
|
+
name = self.consume(uni.Name)
|
|
583
|
+
inh_sn = self.match(list)
|
|
584
|
+
body_list = self.match(list)
|
|
585
|
+
body: list[uni.ArchBlockStmt] | None
|
|
586
|
+
if body_list is None and self.match_token(Tok.SEMI):
|
|
587
|
+
body = None
|
|
588
|
+
elif body_list is None:
|
|
589
|
+
body = self.extract_from_list(inh_sn or [], uni.ArchBlockStmt)
|
|
590
|
+
inh_sn = None
|
|
591
|
+
else:
|
|
592
|
+
body = self.extract_from_list(body_list or [], uni.ArchBlockStmt)
|
|
593
|
+
return uni.Archetype(
|
|
594
|
+
arch_type=arch_type,
|
|
595
|
+
name=name,
|
|
596
|
+
access=access,
|
|
597
|
+
base_classes=self.extract_from_list(inh_sn or [], uni.Expr) or [],
|
|
598
|
+
body=body,
|
|
599
|
+
kid=self.flat_cur_nodes,
|
|
593
600
|
)
|
|
594
601
|
|
|
595
|
-
def
|
|
602
|
+
def arch_type(self, _: None) -> uni.Token:
|
|
603
|
+
"""Grammar rule.
|
|
604
|
+
|
|
605
|
+
arch_type: KW_WALKER
|
|
606
|
+
| KW_OBJECT
|
|
607
|
+
| KW_EDGE
|
|
608
|
+
| KW_NODE
|
|
609
|
+
"""
|
|
610
|
+
return self.consume(uni.Token)
|
|
611
|
+
|
|
612
|
+
def decorators(self, _: None) -> list[uni.UniNode]:
|
|
596
613
|
"""Grammar rule.
|
|
597
614
|
|
|
598
|
-
|
|
599
|
-
| COLON (atomic_chain COMMA)* atomic_chain COLON
|
|
615
|
+
decorators: (DECOR_OP atomic_chain)+
|
|
600
616
|
"""
|
|
601
|
-
|
|
602
|
-
items: list = []
|
|
603
|
-
while inherited_arch := self.match(ast.Expr):
|
|
604
|
-
items.append(inherited_arch)
|
|
605
|
-
self.match_token(Tok.COMMA)
|
|
606
|
-
self.match_token(Tok.LT) or self.consume_token(Tok.COLON)
|
|
607
|
-
return ast.SubNodeList[ast.Expr](items=items, delim=Tok.COMMA, kid=kid)
|
|
617
|
+
return self.cur_nodes
|
|
608
618
|
|
|
609
|
-
def
|
|
619
|
+
def inherited_archs(self, kid: list[uni.UniNode]) -> list[uni.UniNode]:
|
|
610
620
|
"""Grammar rule.
|
|
611
621
|
|
|
612
|
-
|
|
622
|
+
inherited_archs: LPAREN (atomic_chain COMMA)* atomic_chain RPAREN
|
|
613
623
|
"""
|
|
614
|
-
self.
|
|
615
|
-
target = self.consume(ast.Name)
|
|
616
|
-
return ast.SubTag(
|
|
617
|
-
tag=target,
|
|
618
|
-
kid=self.cur_nodes,
|
|
619
|
-
)
|
|
624
|
+
return self.flat_cur_nodes
|
|
620
625
|
|
|
621
|
-
def named_ref(self, _: None) ->
|
|
626
|
+
def named_ref(self, _: None) -> uni.NameAtom:
|
|
622
627
|
"""Grammar rule.
|
|
623
628
|
|
|
624
629
|
named_ref: special_ref
|
|
625
630
|
| KWESC_NAME
|
|
626
631
|
| NAME
|
|
627
632
|
"""
|
|
628
|
-
return self.consume(
|
|
633
|
+
return self.consume(uni.NameAtom)
|
|
629
634
|
|
|
630
|
-
def special_ref(self, _: None) ->
|
|
635
|
+
def special_ref(self, _: None) -> uni.SpecialVarRef:
|
|
631
636
|
"""Grammar rule.
|
|
632
637
|
|
|
633
638
|
special_ref: KW_INIT
|
|
@@ -636,327 +641,235 @@ class JacParser(Pass):
|
|
|
636
641
|
| KW_SUPER
|
|
637
642
|
| KW_SELF
|
|
638
643
|
| KW_HERE
|
|
644
|
+
| KW_VISITOR
|
|
639
645
|
"""
|
|
640
|
-
return
|
|
646
|
+
return uni.SpecialVarRef(var=self.consume(uni.Name))
|
|
641
647
|
|
|
642
|
-
def enum(self, _: None) ->
|
|
648
|
+
def enum(self, _: None) -> uni.Enum:
|
|
643
649
|
"""Grammar rule.
|
|
644
650
|
|
|
645
651
|
enum: decorators? enum_decl
|
|
646
652
|
| enum_def
|
|
647
653
|
"""
|
|
648
|
-
if decorator := self.match(
|
|
649
|
-
enum_decl = self.consume(
|
|
650
|
-
enum_decl.decorators = decorator
|
|
651
|
-
enum_decl.add_kids_left(
|
|
654
|
+
if decorator := self.match(list):
|
|
655
|
+
enum_decl = self.consume(uni.Enum)
|
|
656
|
+
enum_decl.decorators = self.extract_from_list(decorator, uni.Expr)
|
|
657
|
+
enum_decl.add_kids_left(decorator)
|
|
652
658
|
return enum_decl
|
|
653
|
-
return self.
|
|
659
|
+
return self.consume(uni.Enum)
|
|
654
660
|
|
|
655
|
-
def enum_decl(self, _: None) ->
|
|
661
|
+
def enum_decl(self, _: None) -> uni.Enum:
|
|
656
662
|
"""Grammar rule.
|
|
657
663
|
|
|
658
664
|
enum_decl: KW_ENUM access_tag? STRING? NAME inherited_archs? (enum_block | SEMI)
|
|
659
665
|
"""
|
|
660
666
|
self.consume_token(Tok.KW_ENUM)
|
|
661
|
-
access = self.match(
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
if self.match_token(Tok.SEMI):
|
|
667
|
+
access = self.match(uni.SubTag)
|
|
668
|
+
name = self.consume(uni.Name)
|
|
669
|
+
sub_list1 = self.match(list)
|
|
670
|
+
enum_body = self.match(list)
|
|
671
|
+
body: list[uni.UniNode] | None = None
|
|
672
|
+
if enum_body is None and self.match_token(Tok.SEMI):
|
|
667
673
|
inh, body = sub_list1, None
|
|
674
|
+
elif enum_body is None:
|
|
675
|
+
body = self.extract_from_list(sub_list1 or [], uni.EnumBlockStmt)
|
|
676
|
+
inh = None
|
|
668
677
|
else:
|
|
669
|
-
body =
|
|
670
|
-
inh =
|
|
671
|
-
return
|
|
672
|
-
semstr=semstr,
|
|
678
|
+
body = enum_body
|
|
679
|
+
inh = sub_list1
|
|
680
|
+
return uni.Enum(
|
|
673
681
|
name=name,
|
|
674
682
|
access=access,
|
|
675
|
-
base_classes=inh,
|
|
676
|
-
body=body,
|
|
677
|
-
kid=self.
|
|
678
|
-
)
|
|
679
|
-
|
|
680
|
-
def enum_def(self, _: None) -> ast.EnumDef:
|
|
681
|
-
"""Grammar rule.
|
|
682
|
-
|
|
683
|
-
enum_def: arch_to_enum_chain enum_block
|
|
684
|
-
"""
|
|
685
|
-
enum_def = self.consume(ast.ArchRefChain)
|
|
686
|
-
enum_block = self.consume(ast.SubNodeList)
|
|
687
|
-
return ast.EnumDef(
|
|
688
|
-
target=enum_def,
|
|
689
|
-
body=enum_block,
|
|
690
|
-
kid=self.cur_nodes,
|
|
683
|
+
base_classes=self.extract_from_list(inh or [], uni.Expr) or [],
|
|
684
|
+
body=self.extract_from_list(body, uni.EnumBlockStmt) if body else None,
|
|
685
|
+
kid=self.flat_cur_nodes,
|
|
691
686
|
)
|
|
692
687
|
|
|
693
|
-
def enum_block(self, _: None) ->
|
|
688
|
+
def enum_block(self, _: None) -> list[uni.UniNode]:
|
|
694
689
|
"""Grammar rule.
|
|
695
690
|
|
|
696
|
-
enum_block: LBRACE
|
|
691
|
+
enum_block: LBRACE assignment_list COMMA? (py_code_block | free_code)* RBRACE
|
|
697
692
|
"""
|
|
698
|
-
self.consume_token(Tok.LBRACE)
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
693
|
+
left_enc = self.consume_token(Tok.LBRACE)
|
|
694
|
+
assignments = self.consume(list)
|
|
695
|
+
self.match_token(Tok.COMMA)
|
|
696
|
+
while item := self.match(uni.EnumBlockStmt):
|
|
697
|
+
item.is_enum_stmt = True
|
|
698
|
+
assignments.append(item)
|
|
699
|
+
right_enc = self.consume_token(Tok.RBRACE)
|
|
700
|
+
for i in assignments:
|
|
701
|
+
if isinstance(i, uni.Assignment):
|
|
702
|
+
i.is_enum_stmt = True
|
|
703
|
+
return [left_enc, *assignments, right_enc]
|
|
709
704
|
|
|
710
|
-
def
|
|
705
|
+
def ability(self, _: None) -> uni.Ability | uni.FuncCall:
|
|
711
706
|
"""Grammar rule.
|
|
712
707
|
|
|
713
|
-
|
|
714
|
-
| NAME (COLON STRING)?
|
|
715
|
-
| py_code_block
|
|
716
|
-
| free_code
|
|
717
|
-
| abstract_ability
|
|
718
|
-
| ability
|
|
708
|
+
ability: decorators? KW_ASYNC? (ability_decl | function_decl)
|
|
719
709
|
"""
|
|
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)
|
|
710
|
+
decorators_node = self.match(list)
|
|
749
711
|
is_async = self.match_token(Tok.KW_ASYNC)
|
|
750
|
-
|
|
751
|
-
|
|
712
|
+
|
|
713
|
+
# Try to match ability_decl or function_decl
|
|
714
|
+
ability = self.consume(uni.Ability)
|
|
715
|
+
if is_async and ability and isinstance(ability, uni.Ability):
|
|
752
716
|
ability.is_async = True
|
|
753
717
|
ability.add_kids_left([is_async])
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
for dec in decorators
|
|
718
|
+
|
|
719
|
+
if decorators_node:
|
|
720
|
+
decorators = self.extract_from_list(decorators_node, uni.Expr)
|
|
721
|
+
for dec in decorators[:]:
|
|
758
722
|
if (
|
|
759
|
-
isinstance(dec,
|
|
723
|
+
isinstance(dec, uni.NameAtom)
|
|
760
724
|
and dec.sym_name == "staticmethod"
|
|
761
|
-
and isinstance(ability, (
|
|
725
|
+
and isinstance(ability, (uni.Ability))
|
|
762
726
|
):
|
|
763
|
-
|
|
764
|
-
|
|
727
|
+
static_kw = ability.gen_token(Tok.KW_STATIC)
|
|
728
|
+
static_kw.line_no = dec.loc.first_line
|
|
729
|
+
static_kw.c_start = dec.loc.col_start
|
|
730
|
+
static_kw.c_end = static_kw.c_start + len(static_kw.name)
|
|
731
|
+
decorators.remove(dec) # noqa: B038
|
|
732
|
+
if not ability.is_static:
|
|
733
|
+
ability.is_static = True
|
|
734
|
+
if not ability.is_override:
|
|
735
|
+
ability.add_kids_left([static_kw])
|
|
736
|
+
else:
|
|
737
|
+
ability.insert_kids_at_pos([static_kw], 1)
|
|
765
738
|
break
|
|
766
|
-
if decorators
|
|
739
|
+
if decorators:
|
|
767
740
|
ability.decorators = decorators
|
|
768
|
-
ability.add_kids_left(
|
|
769
|
-
|
|
741
|
+
ability.add_kids_left(decorators_node)
|
|
742
|
+
|
|
770
743
|
return ability
|
|
771
744
|
|
|
772
|
-
def ability_decl(self, _: None) ->
|
|
745
|
+
def ability_decl(self, _: None) -> uni.Ability:
|
|
773
746
|
"""Grammar rule.
|
|
774
747
|
|
|
775
|
-
ability_decl: KW_OVERRIDE? KW_STATIC? KW_CAN access_tag?
|
|
776
|
-
|
|
748
|
+
ability_decl: KW_OVERRIDE? KW_STATIC? KW_CAN access_tag? named_ref
|
|
749
|
+
event_clause (block_tail | KW_ABSTRACT? SEMI)
|
|
777
750
|
"""
|
|
778
|
-
signature: ast.FuncSignature | ast.EventSignature | None = None
|
|
779
|
-
body: ast.SubNodeList | None = None
|
|
780
751
|
is_override = self.match_token(Tok.KW_OVERRIDE) is not None
|
|
781
752
|
is_static = self.match_token(Tok.KW_STATIC) is not None
|
|
782
753
|
self.consume_token(Tok.KW_CAN)
|
|
783
|
-
access = self.match(
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
)
|
|
789
|
-
if
|
|
754
|
+
access = self.match(uni.SubTag)
|
|
755
|
+
name = self.consume(uni.NameAtom)
|
|
756
|
+
signature = self.consume(uni.EventSignature)
|
|
757
|
+
|
|
758
|
+
# Handle block_tail
|
|
759
|
+
body_sn_or_call = self.match(list) or self.match(uni.FuncCall)
|
|
760
|
+
if body_sn_or_call is None:
|
|
761
|
+
is_abstract = self.match_token(Tok.KW_ABSTRACT) is not None
|
|
790
762
|
self.consume_token(Tok.SEMI)
|
|
791
|
-
|
|
763
|
+
body = None
|
|
764
|
+
else:
|
|
765
|
+
is_abstract = False
|
|
766
|
+
body = (
|
|
767
|
+
self.extract_from_list(body_sn_or_call, uni.CodeBlockStmt)
|
|
768
|
+
if isinstance(body_sn_or_call, list)
|
|
769
|
+
else body_sn_or_call
|
|
770
|
+
)
|
|
771
|
+
|
|
772
|
+
return uni.Ability(
|
|
792
773
|
name_ref=name,
|
|
793
774
|
is_async=False,
|
|
794
775
|
is_override=is_override,
|
|
795
776
|
is_static=is_static,
|
|
796
|
-
is_abstract=
|
|
777
|
+
is_abstract=is_abstract,
|
|
797
778
|
access=access,
|
|
798
|
-
semstr=semstr,
|
|
799
|
-
signature=signature,
|
|
800
|
-
body=body,
|
|
801
|
-
kid=self.cur_nodes,
|
|
802
|
-
)
|
|
803
|
-
|
|
804
|
-
def ability_def(self, kid: list[ast.AstNode]) -> ast.AbilityDef:
|
|
805
|
-
"""Grammar rule.
|
|
806
|
-
|
|
807
|
-
ability_def: arch_to_abil_chain (func_decl | event_clause) code_block
|
|
808
|
-
"""
|
|
809
|
-
target = self.consume(ast.ArchRefChain)
|
|
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
779
|
signature=signature,
|
|
818
780
|
body=body,
|
|
819
|
-
kid=self.
|
|
781
|
+
kid=self.flat_cur_nodes,
|
|
820
782
|
)
|
|
821
783
|
|
|
822
|
-
|
|
823
|
-
# want to allow regular abilities outside of classed to be abstract.
|
|
824
|
-
def abstract_ability(self, _: None) -> ast.Ability:
|
|
784
|
+
def function_decl(self, _: None) -> uni.Ability:
|
|
825
785
|
"""Grammar rule.
|
|
826
786
|
|
|
827
|
-
|
|
828
|
-
|
|
787
|
+
function_decl: KW_OVERRIDE? KW_STATIC? KW_DEF access_tag? named_ref
|
|
788
|
+
func_decl? (block_tail | KW_ABSTRACT? SEMI)
|
|
829
789
|
"""
|
|
830
|
-
|
|
790
|
+
# Save original kids to track tokens
|
|
831
791
|
is_override = self.match_token(Tok.KW_OVERRIDE) is not None
|
|
832
792
|
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
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
body=None,
|
|
852
|
-
kid=self.cur_nodes,
|
|
853
|
-
)
|
|
854
|
-
|
|
855
|
-
def genai_ability(self, _: None) -> ast.Ability:
|
|
856
|
-
"""Grammar rule.
|
|
793
|
+
self.consume_token(Tok.KW_DEF)
|
|
794
|
+
access = self.match(uni.SubTag)
|
|
795
|
+
name = self.consume(uni.NameAtom)
|
|
796
|
+
signature = self.match(uni.FuncSignature)
|
|
797
|
+
|
|
798
|
+
# Handle block_tail
|
|
799
|
+
body_sn_or_call = self.match(list) or self.match(uni.FuncCall)
|
|
800
|
+
if body_sn_or_call is None:
|
|
801
|
+
is_abstract = self.match_token(Tok.KW_ABSTRACT) is not None
|
|
802
|
+
self.consume_token(Tok.SEMI)
|
|
803
|
+
body = None
|
|
804
|
+
else:
|
|
805
|
+
is_abstract = False
|
|
806
|
+
body = (
|
|
807
|
+
self.extract_from_list(body_sn_or_call, uni.CodeBlockStmt)
|
|
808
|
+
if isinstance(body_sn_or_call, list)
|
|
809
|
+
else body_sn_or_call
|
|
810
|
+
)
|
|
857
811
|
|
|
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(
|
|
812
|
+
return uni.Ability(
|
|
874
813
|
name_ref=name,
|
|
875
814
|
is_async=False,
|
|
876
815
|
is_override=is_override,
|
|
877
816
|
is_static=is_static,
|
|
878
|
-
is_abstract=
|
|
817
|
+
is_abstract=is_abstract,
|
|
879
818
|
access=access,
|
|
880
|
-
semstr=semstr,
|
|
881
819
|
signature=signature,
|
|
882
820
|
body=body,
|
|
883
|
-
kid=self.
|
|
821
|
+
kid=self.flat_cur_nodes,
|
|
884
822
|
)
|
|
885
823
|
|
|
886
|
-
def
|
|
824
|
+
def func_decl(self, _: None) -> uni.FuncSignature:
|
|
887
825
|
"""Grammar rule.
|
|
888
826
|
|
|
889
|
-
|
|
827
|
+
func_decl: (LPAREN func_decl_params? RPAREN) (RETURN_HINT expression)?
|
|
828
|
+
| (RETURN_HINT expression)
|
|
890
829
|
"""
|
|
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
|
-
)
|
|
906
|
-
|
|
907
|
-
def func_decl(self, _: None) -> ast.FuncSignature:
|
|
908
|
-
"""Grammar rule.
|
|
830
|
+
params: list[uni.UniNode] | None = None
|
|
831
|
+
return_spec: uni.Expr | None = None
|
|
909
832
|
|
|
910
|
-
|
|
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)
|
|
833
|
+
# Check if starting with RETURN_HINT
|
|
918
834
|
if self.match_token(Tok.RETURN_HINT):
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
)
|
|
931
|
-
|
|
835
|
+
return_spec = self.consume(uni.Expr)
|
|
836
|
+
return uni.FuncSignature(
|
|
837
|
+
params=[],
|
|
838
|
+
return_type=return_spec,
|
|
839
|
+
kid=self.flat_cur_nodes,
|
|
840
|
+
)
|
|
841
|
+
# Otherwise, parse the traditional parameter list form
|
|
842
|
+
else:
|
|
843
|
+
self.consume_token(Tok.LPAREN)
|
|
844
|
+
params = self.match(list)
|
|
845
|
+
self.consume_token(Tok.RPAREN)
|
|
846
|
+
if self.match_token(Tok.RETURN_HINT):
|
|
847
|
+
return_spec = self.consume(uni.Expr)
|
|
848
|
+
return uni.FuncSignature(
|
|
849
|
+
params=(
|
|
850
|
+
self.extract_from_list(params, uni.ParamVar) if params else []
|
|
851
|
+
),
|
|
852
|
+
return_type=return_spec,
|
|
853
|
+
kid=self.flat_cur_nodes,
|
|
854
|
+
)
|
|
932
855
|
|
|
933
|
-
def func_decl_params(self, _: None) ->
|
|
856
|
+
def func_decl_params(self, _: None) -> list[uni.UniNode]:
|
|
934
857
|
"""Grammar rule.
|
|
935
858
|
|
|
936
859
|
func_decl_params: (param_var COMMA)* param_var COMMA?
|
|
937
860
|
"""
|
|
938
|
-
|
|
939
|
-
while param_stmt := self.match(ast.ParamVar):
|
|
940
|
-
paramvar.append(param_stmt)
|
|
941
|
-
self.match_token(Tok.COMMA)
|
|
942
|
-
return ast.SubNodeList[ast.ParamVar](
|
|
943
|
-
items=paramvar,
|
|
944
|
-
delim=Tok.COMMA,
|
|
945
|
-
kid=self.cur_nodes,
|
|
946
|
-
)
|
|
861
|
+
return self.cur_nodes
|
|
947
862
|
|
|
948
|
-
def param_var(self, _: None) ->
|
|
863
|
+
def param_var(self, _: None) -> uni.ParamVar:
|
|
949
864
|
"""Grammar rule.
|
|
950
865
|
|
|
951
|
-
param_var: (STAR_POW | STAR_MUL)? NAME
|
|
866
|
+
param_var: (STAR_POW | STAR_MUL)? NAME type_tag (EQ expression)?
|
|
952
867
|
"""
|
|
953
868
|
star = self.match_token(Tok.STAR_POW) or self.match_token(Tok.STAR_MUL)
|
|
954
|
-
name = self.consume(
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
return ast.ParamVar(
|
|
959
|
-
semstr=semstr,
|
|
869
|
+
name = self.consume(uni.Name)
|
|
870
|
+
type_tag = self.consume(uni.SubTag)
|
|
871
|
+
value = self.consume(uni.Expr) if self.match_token(Tok.EQ) else None
|
|
872
|
+
return uni.ParamVar(
|
|
960
873
|
name=name,
|
|
961
874
|
type_tag=type_tag,
|
|
962
875
|
value=value,
|
|
@@ -964,104 +877,73 @@ class JacParser(Pass):
|
|
|
964
877
|
kid=self.cur_nodes,
|
|
965
878
|
)
|
|
966
879
|
|
|
967
|
-
def member_block(self, _: None) ->
|
|
880
|
+
def member_block(self, _: None) -> list[uni.UniNode]:
|
|
968
881
|
"""Grammar rule.
|
|
969
882
|
|
|
970
883
|
member_block: LBRACE member_stmt* RBRACE
|
|
971
884
|
"""
|
|
972
|
-
|
|
973
|
-
items = self.match_many(ast.ArchBlockStmt)
|
|
974
|
-
right_enc = self.consume_token(Tok.RBRACE)
|
|
975
|
-
ret = ast.SubNodeList[ast.ArchBlockStmt](
|
|
976
|
-
items=items,
|
|
977
|
-
delim=Tok.WS,
|
|
978
|
-
kid=self.cur_nodes,
|
|
979
|
-
)
|
|
980
|
-
ret.left_enc = left_enc
|
|
981
|
-
ret.right_enc = right_enc
|
|
982
|
-
return ret
|
|
885
|
+
return self.cur_nodes
|
|
983
886
|
|
|
984
|
-
def member_stmt(self, _: None) ->
|
|
887
|
+
def member_stmt(self, _: None) -> uni.ArchBlockStmt:
|
|
985
888
|
"""Grammar rule.
|
|
986
889
|
|
|
987
|
-
member_stmt:
|
|
988
|
-
| doc_tag? abstract_ability
|
|
989
|
-
| doc_tag? ability
|
|
990
|
-
| doc_tag? architype
|
|
991
|
-
| doc_tag? has_stmt
|
|
890
|
+
member_stmt: STRING? (py_code_block | ability | archetype | impl_def | has_stmt | free_code)
|
|
992
891
|
"""
|
|
993
|
-
doc = self.match(
|
|
994
|
-
ret = self.consume(
|
|
995
|
-
if doc and isinstance(ret,
|
|
892
|
+
doc = self.match(uni.String)
|
|
893
|
+
ret = self.consume(uni.ArchBlockStmt)
|
|
894
|
+
if doc and isinstance(ret, uni.AstDocNode):
|
|
996
895
|
ret.doc = doc
|
|
997
896
|
ret.add_kids_left([doc])
|
|
998
|
-
if isinstance(ret, ast.Ability):
|
|
999
|
-
ret.signature.is_method = True
|
|
1000
897
|
return ret
|
|
1001
898
|
|
|
1002
|
-
def has_stmt(self, kid: list[
|
|
899
|
+
def has_stmt(self, kid: list[uni.UniNode]) -> uni.ArchHas:
|
|
1003
900
|
"""Grammar rule.
|
|
1004
901
|
|
|
1005
902
|
has_stmt: KW_STATIC? (KW_LET | KW_HAS) access_tag? has_assign_list SEMI
|
|
1006
903
|
"""
|
|
1007
904
|
chomp = [*kid]
|
|
1008
905
|
is_static = (
|
|
1009
|
-
isinstance(chomp[0],
|
|
906
|
+
isinstance(chomp[0], uni.Token) and chomp[0].name == Tok.KW_STATIC
|
|
1010
907
|
)
|
|
1011
908
|
chomp = chomp[1:] if is_static else chomp
|
|
1012
|
-
is_freeze = isinstance(chomp[0],
|
|
909
|
+
is_freeze = isinstance(chomp[0], uni.Token) and chomp[0].name == Tok.KW_LET
|
|
1013
910
|
chomp = chomp[1:]
|
|
1014
|
-
access = chomp[0] if isinstance(chomp[0],
|
|
911
|
+
access = chomp[0] if isinstance(chomp[0], uni.SubTag) else None
|
|
1015
912
|
chomp = chomp[1:] if access else chomp
|
|
1016
913
|
assign = chomp[0]
|
|
1017
|
-
if isinstance(assign,
|
|
1018
|
-
|
|
1019
|
-
|
|
914
|
+
if isinstance(assign, list):
|
|
915
|
+
assigns = self.extract_from_list(assign, uni.HasVar)
|
|
916
|
+
return uni.ArchHas(
|
|
917
|
+
vars=assigns,
|
|
1020
918
|
is_static=is_static,
|
|
1021
919
|
is_frozen=is_freeze,
|
|
1022
920
|
access=access,
|
|
1023
|
-
kid=
|
|
921
|
+
kid=self.flat_cur_nodes,
|
|
1024
922
|
)
|
|
1025
923
|
else:
|
|
1026
924
|
raise self.ice()
|
|
1027
925
|
|
|
1028
|
-
def has_assign_list(self, _: None) ->
|
|
926
|
+
def has_assign_list(self, _: None) -> list[uni.UniNode]:
|
|
1029
927
|
"""Grammar rule.
|
|
1030
928
|
|
|
1031
929
|
has_assign_list: (has_assign_list COMMA)? typed_has_clause
|
|
1032
930
|
"""
|
|
1033
|
-
|
|
1034
|
-
comma = self.consume_token(Tok.COMMA)
|
|
1035
|
-
assign = self.consume(ast.HasVar)
|
|
1036
|
-
new_kid = [*consume.kid, comma, assign]
|
|
1037
|
-
else:
|
|
1038
|
-
assign = self.consume(ast.HasVar)
|
|
1039
|
-
new_kid = [assign]
|
|
1040
|
-
valid_kid = [i for i in new_kid if isinstance(i, ast.HasVar)]
|
|
1041
|
-
return ast.SubNodeList[ast.HasVar](
|
|
1042
|
-
items=valid_kid,
|
|
1043
|
-
delim=Tok.COMMA,
|
|
1044
|
-
kid=new_kid,
|
|
1045
|
-
)
|
|
931
|
+
return self.flat_cur_nodes
|
|
1046
932
|
|
|
1047
|
-
def typed_has_clause(self, _: None) ->
|
|
933
|
+
def typed_has_clause(self, _: None) -> uni.HasVar:
|
|
1048
934
|
"""Grammar rule.
|
|
1049
935
|
|
|
1050
|
-
typed_has_clause: named_ref
|
|
936
|
+
typed_has_clause: named_ref type_tag (EQ expression | KW_BY KW_POST_INIT)?
|
|
1051
937
|
"""
|
|
1052
|
-
|
|
1053
|
-
value: ast.Expr | None = None
|
|
938
|
+
value: uni.Expr | None = None
|
|
1054
939
|
defer: bool = False
|
|
1055
|
-
name = self.consume(
|
|
1056
|
-
|
|
1057
|
-
semstr = self.consume(ast.String)
|
|
1058
|
-
type_tag = self.consume(ast.SubTag)
|
|
940
|
+
name = self.consume(uni.Name)
|
|
941
|
+
type_tag = self.consume(uni.SubTag)
|
|
1059
942
|
if self.match_token(Tok.EQ):
|
|
1060
|
-
value = self.consume(
|
|
943
|
+
value = self.consume(uni.Expr)
|
|
1061
944
|
elif self.match_token(Tok.KW_BY):
|
|
1062
945
|
defer = bool(self.consume_token(Tok.KW_POST_INIT))
|
|
1063
|
-
return
|
|
1064
|
-
semstr=semstr,
|
|
946
|
+
return uni.HasVar(
|
|
1065
947
|
name=name,
|
|
1066
948
|
type_tag=type_tag,
|
|
1067
949
|
defer=defer,
|
|
@@ -1069,16 +951,16 @@ class JacParser(Pass):
|
|
|
1069
951
|
kid=self.cur_nodes,
|
|
1070
952
|
)
|
|
1071
953
|
|
|
1072
|
-
def type_tag(self, _: None) ->
|
|
954
|
+
def type_tag(self, _: None) -> uni.SubTag[uni.Expr]:
|
|
1073
955
|
"""Grammar rule.
|
|
1074
956
|
|
|
1075
957
|
type_tag: COLON expression
|
|
1076
958
|
"""
|
|
1077
959
|
self.consume_token(Tok.COLON)
|
|
1078
|
-
tag = self.consume(
|
|
1079
|
-
return
|
|
960
|
+
tag = self.consume(uni.Expr)
|
|
961
|
+
return uni.SubTag[uni.Expr](tag=tag, kid=self.cur_nodes)
|
|
1080
962
|
|
|
1081
|
-
def builtin_type(self, _: None) ->
|
|
963
|
+
def builtin_type(self, _: None) -> uni.Token:
|
|
1082
964
|
"""Grammar rule.
|
|
1083
965
|
|
|
1084
966
|
builtin_type: TYP_TYPE
|
|
@@ -1093,10 +975,10 @@ class JacParser(Pass):
|
|
|
1093
975
|
| TYP_BYTES
|
|
1094
976
|
| TYP_STRING
|
|
1095
977
|
"""
|
|
1096
|
-
token = self.consume(
|
|
1097
|
-
return
|
|
978
|
+
token = self.consume(uni.Token)
|
|
979
|
+
return uni.BuiltinType(
|
|
1098
980
|
name=token.name,
|
|
1099
|
-
orig_src=self.parse_ref.
|
|
981
|
+
orig_src=self.parse_ref.ir_in,
|
|
1100
982
|
value=token.value,
|
|
1101
983
|
line=token.loc.first_line,
|
|
1102
984
|
end_line=token.loc.last_line,
|
|
@@ -1106,33 +988,19 @@ class JacParser(Pass):
|
|
|
1106
988
|
pos_end=token.pos_end,
|
|
1107
989
|
)
|
|
1108
990
|
|
|
1109
|
-
def code_block(
|
|
1110
|
-
self, kid: list[ast.AstNode]
|
|
1111
|
-
) -> ast.SubNodeList[ast.CodeBlockStmt]:
|
|
991
|
+
def code_block(self, kid: list[uni.UniNode]) -> list[uni.UniNode]:
|
|
1112
992
|
"""Grammar rule.
|
|
1113
993
|
|
|
1114
994
|
code_block: LBRACE statement* RBRACE
|
|
1115
995
|
"""
|
|
1116
|
-
|
|
1117
|
-
right_enc = kid[-1] if isinstance(kid[-1], ast.Token) else None
|
|
1118
|
-
valid_stmt = [i for i in kid if isinstance(i, ast.CodeBlockStmt)]
|
|
1119
|
-
if len(valid_stmt) == len(kid) - 2:
|
|
1120
|
-
return ast.SubNodeList[ast.CodeBlockStmt](
|
|
1121
|
-
items=valid_stmt,
|
|
1122
|
-
delim=Tok.WS,
|
|
1123
|
-
left_enc=left_enc,
|
|
1124
|
-
right_enc=right_enc,
|
|
1125
|
-
kid=kid,
|
|
1126
|
-
)
|
|
1127
|
-
else:
|
|
1128
|
-
raise self.ice()
|
|
996
|
+
return self.flat_cur_nodes
|
|
1129
997
|
|
|
1130
|
-
def statement(self, kid: list[
|
|
998
|
+
def statement(self, kid: list[uni.UniNode]) -> uni.CodeBlockStmt:
|
|
1131
999
|
"""Grammar rule.
|
|
1132
1000
|
|
|
1133
1001
|
statement: import_stmt
|
|
1134
1002
|
| ability
|
|
1135
|
-
|
|
|
1003
|
+
| archetype
|
|
1136
1004
|
| if_stmt
|
|
1137
1005
|
| while_stmt
|
|
1138
1006
|
| for_stmt
|
|
@@ -1153,17 +1021,17 @@ class JacParser(Pass):
|
|
|
1153
1021
|
| expression SEMI
|
|
1154
1022
|
| ctrl_stmt SEMI
|
|
1155
1023
|
| py_code_block
|
|
1156
|
-
|
|
|
1024
|
+
| spatial_stmt
|
|
1157
1025
|
| SEMI
|
|
1158
1026
|
"""
|
|
1159
|
-
if (code_block := self.match(
|
|
1027
|
+
if (code_block := self.match(uni.CodeBlockStmt)) and len(
|
|
1160
1028
|
self.cur_nodes
|
|
1161
1029
|
) < 2:
|
|
1162
1030
|
return code_block
|
|
1163
|
-
elif (token := self.match(
|
|
1164
|
-
return
|
|
1031
|
+
elif (token := self.match(uni.Token)) and token.name == Tok.KW_YIELD:
|
|
1032
|
+
return uni.ExprStmt(
|
|
1165
1033
|
expr=(
|
|
1166
|
-
expr :=
|
|
1034
|
+
expr := uni.YieldExpr(
|
|
1167
1035
|
expr=None,
|
|
1168
1036
|
with_from=False,
|
|
1169
1037
|
kid=self.cur_nodes,
|
|
@@ -1172,281 +1040,270 @@ class JacParser(Pass):
|
|
|
1172
1040
|
in_fstring=False,
|
|
1173
1041
|
kid=[expr],
|
|
1174
1042
|
)
|
|
1175
|
-
elif isinstance(kid[0],
|
|
1176
|
-
return
|
|
1043
|
+
elif isinstance(kid[0], uni.Expr):
|
|
1044
|
+
return uni.ExprStmt(
|
|
1177
1045
|
expr=kid[0],
|
|
1178
1046
|
in_fstring=False,
|
|
1179
1047
|
kid=self.cur_nodes,
|
|
1180
1048
|
)
|
|
1181
|
-
elif isinstance(kid[0],
|
|
1049
|
+
elif isinstance(kid[0], uni.CodeBlockStmt):
|
|
1182
1050
|
kid[0].add_kids_right([kid[1]])
|
|
1183
1051
|
return kid[0]
|
|
1184
1052
|
else:
|
|
1185
1053
|
raise self.ice()
|
|
1186
1054
|
|
|
1187
|
-
def typed_ctx_block(self, _: None) ->
|
|
1055
|
+
def typed_ctx_block(self, _: None) -> uni.TypedCtxBlock:
|
|
1188
1056
|
"""Grammar rule.
|
|
1189
1057
|
|
|
1190
1058
|
typed_ctx_block: RETURN_HINT expression code_block
|
|
1191
1059
|
"""
|
|
1192
1060
|
self.consume_token(Tok.RETURN_HINT)
|
|
1193
|
-
ctx = self.consume(
|
|
1194
|
-
body = self.consume(
|
|
1195
|
-
return
|
|
1061
|
+
ctx = self.consume(uni.Expr)
|
|
1062
|
+
body = self.consume(list)
|
|
1063
|
+
return uni.TypedCtxBlock(
|
|
1196
1064
|
type_ctx=ctx,
|
|
1197
|
-
body=body,
|
|
1198
|
-
kid=self.
|
|
1065
|
+
body=self.extract_from_list(body, uni.CodeBlockStmt),
|
|
1066
|
+
kid=self.flat_cur_nodes,
|
|
1199
1067
|
)
|
|
1200
1068
|
|
|
1201
|
-
def if_stmt(self, _: None) ->
|
|
1069
|
+
def if_stmt(self, _: None) -> uni.IfStmt:
|
|
1202
1070
|
"""Grammar rule.
|
|
1203
1071
|
|
|
1204
1072
|
if_stmt: KW_IF expression code_block (elif_stmt | else_stmt)?
|
|
1205
1073
|
"""
|
|
1206
1074
|
self.consume_token(Tok.KW_IF)
|
|
1207
|
-
condition = self.consume(
|
|
1208
|
-
body = self.consume(
|
|
1209
|
-
else_body = self.match(
|
|
1210
|
-
return
|
|
1075
|
+
condition = self.consume(uni.Expr)
|
|
1076
|
+
body = self.consume(list)
|
|
1077
|
+
else_body = self.match(uni.ElseStmt) or self.match(uni.ElseIf)
|
|
1078
|
+
return uni.IfStmt(
|
|
1211
1079
|
condition=condition,
|
|
1212
|
-
body=body,
|
|
1080
|
+
body=self.extract_from_list(body, uni.CodeBlockStmt),
|
|
1213
1081
|
else_body=else_body,
|
|
1214
|
-
kid=self.
|
|
1082
|
+
kid=self.flat_cur_nodes,
|
|
1215
1083
|
)
|
|
1216
1084
|
|
|
1217
|
-
def elif_stmt(self, _: None) ->
|
|
1085
|
+
def elif_stmt(self, _: None) -> uni.ElseIf:
|
|
1218
1086
|
"""Grammar rule.
|
|
1219
1087
|
|
|
1220
1088
|
elif_stmt: KW_ELIF expression code_block (elif_stmt | else_stmt)?
|
|
1221
1089
|
"""
|
|
1222
1090
|
self.consume_token(Tok.KW_ELIF)
|
|
1223
|
-
condition = self.consume(
|
|
1224
|
-
body = self.consume(
|
|
1225
|
-
else_body = self.match(
|
|
1226
|
-
return
|
|
1091
|
+
condition = self.consume(uni.Expr)
|
|
1092
|
+
body = self.consume(list)
|
|
1093
|
+
else_body = self.match(uni.ElseStmt) or self.match(uni.ElseIf)
|
|
1094
|
+
return uni.ElseIf(
|
|
1227
1095
|
condition=condition,
|
|
1228
|
-
body=body,
|
|
1096
|
+
body=self.extract_from_list(body, uni.CodeBlockStmt),
|
|
1229
1097
|
else_body=else_body,
|
|
1230
|
-
kid=self.
|
|
1098
|
+
kid=self.flat_cur_nodes,
|
|
1231
1099
|
)
|
|
1232
1100
|
|
|
1233
|
-
def else_stmt(self, _: None) ->
|
|
1101
|
+
def else_stmt(self, _: None) -> uni.ElseStmt:
|
|
1234
1102
|
"""Grammar rule.
|
|
1235
1103
|
|
|
1236
1104
|
else_stmt: KW_ELSE code_block
|
|
1237
1105
|
"""
|
|
1238
1106
|
self.consume_token(Tok.KW_ELSE)
|
|
1239
|
-
body = self.consume(
|
|
1240
|
-
return
|
|
1241
|
-
body=body,
|
|
1242
|
-
kid=self.
|
|
1107
|
+
body = self.consume(list)
|
|
1108
|
+
return uni.ElseStmt(
|
|
1109
|
+
body=self.extract_from_list(body, uni.CodeBlockStmt),
|
|
1110
|
+
kid=self.flat_cur_nodes,
|
|
1243
1111
|
)
|
|
1244
1112
|
|
|
1245
|
-
def try_stmt(self, _: None) ->
|
|
1113
|
+
def try_stmt(self, _: None) -> uni.TryStmt:
|
|
1246
1114
|
"""Grammar rule.
|
|
1247
1115
|
|
|
1248
1116
|
try_stmt: KW_TRY code_block except_list? else_stmt? finally_stmt?
|
|
1249
1117
|
"""
|
|
1250
1118
|
self.consume_token(Tok.KW_TRY)
|
|
1251
|
-
block = self.consume(
|
|
1252
|
-
except_list = self.match(
|
|
1253
|
-
else_stmt = self.match(
|
|
1254
|
-
finally_stmt = self.match(
|
|
1255
|
-
return
|
|
1256
|
-
body=block,
|
|
1257
|
-
excepts=
|
|
1119
|
+
block = self.consume(list)
|
|
1120
|
+
except_list = self.match(list)
|
|
1121
|
+
else_stmt = self.match(uni.ElseStmt)
|
|
1122
|
+
finally_stmt = self.match(uni.FinallyStmt)
|
|
1123
|
+
return uni.TryStmt(
|
|
1124
|
+
body=self.extract_from_list(block, uni.CodeBlockStmt),
|
|
1125
|
+
excepts=(
|
|
1126
|
+
self.extract_from_list(except_list, uni.Except)
|
|
1127
|
+
if except_list
|
|
1128
|
+
else []
|
|
1129
|
+
),
|
|
1258
1130
|
else_body=else_stmt,
|
|
1259
1131
|
finally_body=finally_stmt,
|
|
1260
|
-
kid=self.
|
|
1132
|
+
kid=self.flat_cur_nodes,
|
|
1261
1133
|
)
|
|
1262
1134
|
|
|
1263
|
-
def except_list(self, _: None) ->
|
|
1135
|
+
def except_list(self, _: None) -> list[uni.UniNode]:
|
|
1264
1136
|
"""Grammar rule.
|
|
1265
1137
|
|
|
1266
1138
|
except_list: except_def+
|
|
1267
1139
|
"""
|
|
1268
|
-
|
|
1269
|
-
while expt := self.match(ast.Except):
|
|
1270
|
-
items.append(expt)
|
|
1271
|
-
return ast.SubNodeList[ast.Except](
|
|
1272
|
-
items=items,
|
|
1273
|
-
delim=Tok.WS,
|
|
1274
|
-
kid=self.cur_nodes,
|
|
1275
|
-
)
|
|
1140
|
+
return self.flat_cur_nodes
|
|
1276
1141
|
|
|
1277
|
-
def except_def(self, _: None) ->
|
|
1142
|
+
def except_def(self, _: None) -> uni.Except:
|
|
1278
1143
|
"""Grammar rule.
|
|
1279
1144
|
|
|
1280
1145
|
except_def: KW_EXCEPT expression (KW_AS NAME)? code_block
|
|
1281
1146
|
"""
|
|
1282
|
-
name:
|
|
1147
|
+
name: uni.Name | None = None
|
|
1283
1148
|
self.consume_token(Tok.KW_EXCEPT)
|
|
1284
|
-
ex_type = self.consume(
|
|
1149
|
+
ex_type = self.consume(uni.Expr)
|
|
1285
1150
|
if self.match_token(Tok.KW_AS):
|
|
1286
|
-
name = self.consume(
|
|
1287
|
-
|
|
1288
|
-
return
|
|
1151
|
+
name = self.consume(uni.Name)
|
|
1152
|
+
body_node = self.consume(list)
|
|
1153
|
+
return uni.Except(
|
|
1289
1154
|
ex_type=ex_type,
|
|
1290
1155
|
name=name,
|
|
1291
|
-
body=
|
|
1292
|
-
kid=self.
|
|
1156
|
+
body=self.extract_from_list(body_node, uni.CodeBlockStmt),
|
|
1157
|
+
kid=self.flat_cur_nodes,
|
|
1293
1158
|
)
|
|
1294
1159
|
|
|
1295
|
-
def finally_stmt(self, _: None) ->
|
|
1160
|
+
def finally_stmt(self, _: None) -> uni.FinallyStmt:
|
|
1296
1161
|
"""Grammar rule.
|
|
1297
1162
|
|
|
1298
1163
|
finally_stmt: KW_FINALLY code_block
|
|
1299
1164
|
"""
|
|
1300
1165
|
self.consume_token(Tok.KW_FINALLY)
|
|
1301
|
-
body = self.consume(
|
|
1302
|
-
return
|
|
1303
|
-
body=body,
|
|
1304
|
-
kid=self.
|
|
1166
|
+
body = self.consume(list)
|
|
1167
|
+
return uni.FinallyStmt(
|
|
1168
|
+
body=self.extract_from_list(body, uni.CodeBlockStmt),
|
|
1169
|
+
kid=self.flat_cur_nodes,
|
|
1305
1170
|
)
|
|
1306
1171
|
|
|
1307
|
-
def for_stmt(self, _: None) ->
|
|
1172
|
+
def for_stmt(self, _: None) -> uni.IterForStmt | uni.InForStmt:
|
|
1308
1173
|
"""Grammar rule.
|
|
1309
1174
|
|
|
1310
|
-
for_stmt: KW_ASYNC? KW_FOR assignment KW_TO expression KW_BY
|
|
1311
|
-
|
|
1312
|
-
| KW_ASYNC? KW_FOR expression KW_IN expression code_block else_stmt?
|
|
1175
|
+
for_stmt: KW_ASYNC? KW_FOR assignment KW_TO expression KW_BY assignment code_block else_stmt?
|
|
1176
|
+
| KW_ASYNC? KW_FOR atomic_chain KW_IN expression code_block else_stmt?
|
|
1313
1177
|
"""
|
|
1314
1178
|
is_async = bool(self.match_token(Tok.KW_ASYNC))
|
|
1315
1179
|
self.consume_token(Tok.KW_FOR)
|
|
1316
|
-
if iter := self.match(
|
|
1180
|
+
if iter := self.match(uni.Assignment):
|
|
1317
1181
|
self.consume_token(Tok.KW_TO)
|
|
1318
|
-
condition = self.consume(
|
|
1182
|
+
condition = self.consume(uni.Expr)
|
|
1319
1183
|
self.consume_token(Tok.KW_BY)
|
|
1320
|
-
count_by = self.consume(
|
|
1321
|
-
body = self.consume(
|
|
1322
|
-
else_body = self.match(
|
|
1323
|
-
return
|
|
1184
|
+
count_by = self.consume(uni.Assignment)
|
|
1185
|
+
body = self.consume(list)
|
|
1186
|
+
else_body = self.match(uni.ElseStmt)
|
|
1187
|
+
return uni.IterForStmt(
|
|
1324
1188
|
is_async=is_async,
|
|
1325
1189
|
iter=iter,
|
|
1326
1190
|
condition=condition,
|
|
1327
1191
|
count_by=count_by,
|
|
1328
|
-
body=body,
|
|
1192
|
+
body=self.extract_from_list(body, uni.CodeBlockStmt),
|
|
1329
1193
|
else_body=else_body,
|
|
1330
|
-
kid=self.
|
|
1194
|
+
kid=self.flat_cur_nodes,
|
|
1331
1195
|
)
|
|
1332
|
-
target = self.consume(
|
|
1196
|
+
target = self.consume(uni.Expr)
|
|
1333
1197
|
self.consume_token(Tok.KW_IN)
|
|
1334
|
-
collection = self.consume(
|
|
1335
|
-
body = self.consume(
|
|
1336
|
-
else_body = self.match(
|
|
1337
|
-
return
|
|
1198
|
+
collection = self.consume(uni.Expr)
|
|
1199
|
+
body = self.consume(list)
|
|
1200
|
+
else_body = self.match(uni.ElseStmt)
|
|
1201
|
+
return uni.InForStmt(
|
|
1338
1202
|
is_async=is_async,
|
|
1339
1203
|
target=target,
|
|
1340
1204
|
collection=collection,
|
|
1341
|
-
body=body,
|
|
1205
|
+
body=self.extract_from_list(body, uni.CodeBlockStmt),
|
|
1342
1206
|
else_body=else_body,
|
|
1343
|
-
kid=self.
|
|
1207
|
+
kid=self.flat_cur_nodes,
|
|
1344
1208
|
)
|
|
1345
1209
|
|
|
1346
|
-
def while_stmt(self, _: None) ->
|
|
1210
|
+
def while_stmt(self, _: None) -> uni.WhileStmt:
|
|
1347
1211
|
"""Grammar rule.
|
|
1348
1212
|
|
|
1349
1213
|
while_stmt: KW_WHILE expression code_block
|
|
1350
1214
|
"""
|
|
1351
1215
|
self.consume_token(Tok.KW_WHILE)
|
|
1352
|
-
condition = self.consume(
|
|
1353
|
-
body = self.consume(
|
|
1354
|
-
return
|
|
1216
|
+
condition = self.consume(uni.Expr)
|
|
1217
|
+
body = self.consume(list)
|
|
1218
|
+
return uni.WhileStmt(
|
|
1355
1219
|
condition=condition,
|
|
1356
|
-
body=body,
|
|
1357
|
-
kid=self.
|
|
1220
|
+
body=self.extract_from_list(body, uni.CodeBlockStmt),
|
|
1221
|
+
kid=self.flat_cur_nodes,
|
|
1358
1222
|
)
|
|
1359
1223
|
|
|
1360
|
-
def with_stmt(self, _: None) ->
|
|
1224
|
+
def with_stmt(self, _: None) -> uni.WithStmt:
|
|
1361
1225
|
"""Grammar rule.
|
|
1362
1226
|
|
|
1363
1227
|
with_stmt: KW_ASYNC? KW_WITH expr_as_list code_block
|
|
1364
1228
|
"""
|
|
1365
1229
|
is_async = bool(self.match_token(Tok.KW_ASYNC))
|
|
1366
1230
|
self.consume_token(Tok.KW_WITH)
|
|
1367
|
-
|
|
1368
|
-
body = self.consume(
|
|
1369
|
-
return
|
|
1231
|
+
exprs_node = self.extract_from_list(self.consume(list), uni.ExprAsItem)
|
|
1232
|
+
body = self.consume(list)
|
|
1233
|
+
return uni.WithStmt(
|
|
1370
1234
|
is_async=is_async,
|
|
1371
|
-
exprs=
|
|
1372
|
-
body=body,
|
|
1373
|
-
kid=self.
|
|
1235
|
+
exprs=exprs_node,
|
|
1236
|
+
body=self.extract_from_list(body, uni.CodeBlockStmt),
|
|
1237
|
+
kid=self.flat_cur_nodes,
|
|
1374
1238
|
)
|
|
1375
1239
|
|
|
1376
|
-
def expr_as_list(self, _: None) ->
|
|
1240
|
+
def expr_as_list(self, _: None) -> list[uni.UniNode]:
|
|
1377
1241
|
"""Grammar rule.
|
|
1378
1242
|
|
|
1379
1243
|
expr_as_list: (expr_as COMMA)* expr_as
|
|
1380
1244
|
"""
|
|
1381
|
-
|
|
1382
|
-
while self.match_token(Tok.COMMA):
|
|
1383
|
-
items.append(self.consume(ast.ExprAsItem))
|
|
1384
|
-
return ast.SubNodeList[ast.ExprAsItem](
|
|
1385
|
-
items=items,
|
|
1386
|
-
delim=Tok.COMMA,
|
|
1387
|
-
kid=self.cur_nodes,
|
|
1388
|
-
)
|
|
1245
|
+
return self.cur_nodes
|
|
1389
1246
|
|
|
1390
|
-
def expr_as(self, _: None) ->
|
|
1247
|
+
def expr_as(self, _: None) -> uni.ExprAsItem:
|
|
1391
1248
|
"""Grammar rule.
|
|
1392
1249
|
|
|
1393
1250
|
expr_as: expression (KW_AS expression)?
|
|
1394
1251
|
"""
|
|
1395
|
-
expr = self.consume(
|
|
1396
|
-
alias = self.consume(
|
|
1397
|
-
return
|
|
1252
|
+
expr = self.consume(uni.Expr)
|
|
1253
|
+
alias = self.consume(uni.Expr) if self.match_token(Tok.KW_AS) else None
|
|
1254
|
+
return uni.ExprAsItem(
|
|
1398
1255
|
expr=expr,
|
|
1399
1256
|
alias=alias,
|
|
1400
1257
|
kid=self.cur_nodes,
|
|
1401
1258
|
)
|
|
1402
1259
|
|
|
1403
|
-
def raise_stmt(self, _: None) ->
|
|
1260
|
+
def raise_stmt(self, _: None) -> uni.RaiseStmt:
|
|
1404
1261
|
"""Grammar rule.
|
|
1405
1262
|
|
|
1406
1263
|
raise_stmt: KW_RAISE (expression (KW_FROM expression)?)?
|
|
1407
1264
|
"""
|
|
1408
|
-
e_type:
|
|
1409
|
-
from_target:
|
|
1265
|
+
e_type: uni.Expr | None = None
|
|
1266
|
+
from_target: uni.Expr | None = None
|
|
1410
1267
|
self.consume_token(Tok.KW_RAISE)
|
|
1411
|
-
if e_type := self.match(
|
|
1268
|
+
if e_type := self.match(uni.Expr):
|
|
1412
1269
|
from_target = (
|
|
1413
|
-
self.consume(
|
|
1270
|
+
self.consume(uni.Expr) if self.match_token(Tok.KW_FROM) else None
|
|
1414
1271
|
)
|
|
1415
|
-
return
|
|
1272
|
+
return uni.RaiseStmt(
|
|
1416
1273
|
cause=e_type,
|
|
1417
1274
|
from_target=from_target,
|
|
1418
1275
|
kid=self.cur_nodes,
|
|
1419
1276
|
)
|
|
1420
1277
|
|
|
1421
|
-
def assert_stmt(self, _: None) ->
|
|
1278
|
+
def assert_stmt(self, _: None) -> uni.AssertStmt:
|
|
1422
1279
|
"""Grammar rule.
|
|
1423
1280
|
|
|
1424
1281
|
assert_stmt: KW_ASSERT expression (COMMA expression)?
|
|
1425
1282
|
"""
|
|
1426
|
-
error_msg:
|
|
1283
|
+
error_msg: uni.Expr | None = None
|
|
1427
1284
|
self.consume_token(Tok.KW_ASSERT)
|
|
1428
|
-
condition = self.consume(
|
|
1285
|
+
condition = self.consume(uni.Expr)
|
|
1429
1286
|
if self.match_token(Tok.COMMA):
|
|
1430
|
-
error_msg = self.consume(
|
|
1431
|
-
return
|
|
1287
|
+
error_msg = self.consume(uni.Expr)
|
|
1288
|
+
return uni.AssertStmt(
|
|
1432
1289
|
condition=condition,
|
|
1433
1290
|
error_msg=error_msg,
|
|
1434
1291
|
kid=self.cur_nodes,
|
|
1435
1292
|
)
|
|
1436
1293
|
|
|
1437
|
-
def check_stmt(self, _: None) ->
|
|
1294
|
+
def check_stmt(self, _: None) -> uni.CheckStmt:
|
|
1438
1295
|
"""Grammar rule.
|
|
1439
1296
|
|
|
1440
1297
|
check_stmt: KW_CHECK expression
|
|
1441
1298
|
"""
|
|
1442
1299
|
self.consume_token(Tok.KW_CHECK)
|
|
1443
|
-
target = self.consume(
|
|
1444
|
-
return
|
|
1300
|
+
target = self.consume(uni.Expr)
|
|
1301
|
+
return uni.CheckStmt(
|
|
1445
1302
|
target=target,
|
|
1446
1303
|
kid=self.cur_nodes,
|
|
1447
1304
|
)
|
|
1448
1305
|
|
|
1449
|
-
def ctrl_stmt(self, _: None) ->
|
|
1306
|
+
def ctrl_stmt(self, _: None) -> uni.CtrlStmt | uni.DisengageStmt:
|
|
1450
1307
|
"""Grammar rule.
|
|
1451
1308
|
|
|
1452
1309
|
ctrl_stmt: KW_SKIP | KW_BREAK | KW_CONTINUE
|
|
@@ -1456,156 +1313,143 @@ class JacParser(Pass):
|
|
|
1456
1313
|
or self.match_token(Tok.KW_BREAK)
|
|
1457
1314
|
or self.consume_token(Tok.KW_CONTINUE)
|
|
1458
1315
|
)
|
|
1459
|
-
return
|
|
1316
|
+
return uni.CtrlStmt(
|
|
1460
1317
|
ctrl=tok,
|
|
1461
1318
|
kid=self.cur_nodes,
|
|
1462
1319
|
)
|
|
1463
1320
|
|
|
1464
|
-
def delete_stmt(self, _: None) ->
|
|
1321
|
+
def delete_stmt(self, _: None) -> uni.DeleteStmt:
|
|
1465
1322
|
"""Grammar rule.
|
|
1466
1323
|
|
|
1467
1324
|
delete_stmt: KW_DELETE expression
|
|
1468
1325
|
"""
|
|
1469
1326
|
self.consume_token(Tok.KW_DELETE)
|
|
1470
|
-
target = self.consume(
|
|
1471
|
-
return
|
|
1327
|
+
target = self.consume(uni.Expr)
|
|
1328
|
+
return uni.DeleteStmt(
|
|
1472
1329
|
target=target,
|
|
1473
1330
|
kid=self.cur_nodes,
|
|
1474
1331
|
)
|
|
1475
1332
|
|
|
1476
|
-
def report_stmt(self, _: None) ->
|
|
1333
|
+
def report_stmt(self, _: None) -> uni.ReportStmt:
|
|
1477
1334
|
"""Grammar rule.
|
|
1478
1335
|
|
|
1479
1336
|
report_stmt: KW_REPORT expression
|
|
1480
1337
|
"""
|
|
1481
1338
|
self.consume_token(Tok.KW_REPORT)
|
|
1482
|
-
target = self.consume(
|
|
1483
|
-
return
|
|
1339
|
+
target = self.consume(uni.Expr)
|
|
1340
|
+
return uni.ReportStmt(
|
|
1484
1341
|
expr=target,
|
|
1485
1342
|
kid=self.cur_nodes,
|
|
1486
1343
|
)
|
|
1487
1344
|
|
|
1488
|
-
def return_stmt(self, _: None) ->
|
|
1345
|
+
def return_stmt(self, _: None) -> uni.ReturnStmt:
|
|
1489
1346
|
"""Grammar rule.
|
|
1490
1347
|
|
|
1491
1348
|
return_stmt: KW_RETURN expression?
|
|
1492
1349
|
"""
|
|
1493
1350
|
self.consume_token(Tok.KW_RETURN)
|
|
1494
|
-
expr = self.match(
|
|
1495
|
-
return
|
|
1351
|
+
expr = self.match(uni.Expr)
|
|
1352
|
+
return uni.ReturnStmt(
|
|
1496
1353
|
expr=expr,
|
|
1497
1354
|
kid=self.cur_nodes,
|
|
1498
1355
|
)
|
|
1499
1356
|
|
|
1500
|
-
def
|
|
1357
|
+
def spatial_stmt(self, _: None) -> uni.CodeBlockStmt:
|
|
1501
1358
|
"""Grammar rule.
|
|
1502
1359
|
|
|
1503
|
-
|
|
1360
|
+
spatial_stmt: visit_stmt | ignore_stmt
|
|
1504
1361
|
"""
|
|
1505
|
-
return self.consume(
|
|
1362
|
+
return self.consume(uni.CodeBlockStmt)
|
|
1506
1363
|
|
|
1507
|
-
def ignore_stmt(self, _: None) ->
|
|
1364
|
+
def ignore_stmt(self, _: None) -> uni.IgnoreStmt:
|
|
1508
1365
|
"""Grammar rule.
|
|
1509
1366
|
|
|
1510
1367
|
ignore_stmt: KW_IGNORE expression SEMI
|
|
1511
1368
|
"""
|
|
1512
1369
|
self.consume_token(Tok.KW_IGNORE)
|
|
1513
|
-
target = self.consume(
|
|
1370
|
+
target = self.consume(uni.Expr)
|
|
1514
1371
|
self.consume_token(Tok.SEMI)
|
|
1515
|
-
return
|
|
1372
|
+
return uni.IgnoreStmt(
|
|
1516
1373
|
target=target,
|
|
1517
1374
|
kid=self.cur_nodes,
|
|
1518
1375
|
)
|
|
1519
1376
|
|
|
1520
|
-
def
|
|
1377
|
+
def disenage_stmt(self, _: None) -> uni.DisengageStmt:
|
|
1521
1378
|
"""Grammar rule.
|
|
1522
1379
|
|
|
1523
|
-
|
|
1380
|
+
disenage_stmt: KW_DISENGAGE SEMI
|
|
1524
1381
|
"""
|
|
1525
|
-
self.consume_token(Tok.
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
else_body = self.match(ast.ElseStmt)
|
|
1529
|
-
if else_body is None:
|
|
1530
|
-
self.consume_token(Tok.SEMI)
|
|
1531
|
-
return ast.VisitStmt(
|
|
1532
|
-
vis_type=sub_name,
|
|
1533
|
-
target=target,
|
|
1534
|
-
else_body=else_body,
|
|
1382
|
+
self.consume_token(Tok.KW_DISENGAGE)
|
|
1383
|
+
self.consume_token(Tok.SEMI)
|
|
1384
|
+
return uni.DisengageStmt(
|
|
1535
1385
|
kid=self.cur_nodes,
|
|
1536
1386
|
)
|
|
1537
1387
|
|
|
1538
|
-
def
|
|
1388
|
+
def visit_stmt(self, _: None) -> uni.VisitStmt:
|
|
1539
1389
|
"""Grammar rule.
|
|
1540
1390
|
|
|
1541
|
-
|
|
1391
|
+
visit_stmt: KW_VISIT (COLON expression COLON)?
|
|
1392
|
+
expression (else_stmt | SEMI)
|
|
1542
1393
|
"""
|
|
1543
|
-
self.consume_token(Tok.
|
|
1544
|
-
|
|
1545
|
-
|
|
1394
|
+
self.consume_token(Tok.KW_VISIT)
|
|
1395
|
+
insert_loc = None
|
|
1396
|
+
if self.match_token(Tok.COLON):
|
|
1397
|
+
insert_loc = self.consume(uni.Expr)
|
|
1398
|
+
self.consume_token(Tok.COLON)
|
|
1399
|
+
target = self.consume(uni.Expr)
|
|
1400
|
+
else_body = self.match(uni.ElseStmt)
|
|
1546
1401
|
if else_body is None:
|
|
1547
1402
|
self.consume_token(Tok.SEMI)
|
|
1548
|
-
return
|
|
1549
|
-
|
|
1403
|
+
return uni.VisitStmt(
|
|
1404
|
+
insert_loc=insert_loc,
|
|
1405
|
+
target=target,
|
|
1550
1406
|
else_body=else_body,
|
|
1551
1407
|
kid=self.cur_nodes,
|
|
1552
1408
|
)
|
|
1553
1409
|
|
|
1554
|
-
def
|
|
1555
|
-
"""Grammar rule.
|
|
1556
|
-
|
|
1557
|
-
disengage_stmt: KW_DISENGAGE SEMI
|
|
1558
|
-
"""
|
|
1559
|
-
kw = self.consume_token(Tok.KW_DISENGAGE)
|
|
1560
|
-
semi = self.consume_token(Tok.SEMI)
|
|
1561
|
-
return ast.DisengageStmt(
|
|
1562
|
-
kid=[kw, semi],
|
|
1563
|
-
)
|
|
1564
|
-
|
|
1565
|
-
def global_ref(self, _: None) -> ast.GlobalStmt:
|
|
1410
|
+
def global_ref(self, _: None) -> uni.GlobalStmt:
|
|
1566
1411
|
"""Grammar rule.
|
|
1567
1412
|
|
|
1568
1413
|
global_ref: GLOBAL_OP name_list
|
|
1569
1414
|
"""
|
|
1570
1415
|
self.consume_token(Tok.GLOBAL_OP)
|
|
1571
|
-
target = self.consume(
|
|
1572
|
-
return
|
|
1573
|
-
target=target,
|
|
1574
|
-
kid=self.
|
|
1416
|
+
target = self.consume(list)
|
|
1417
|
+
return uni.GlobalStmt(
|
|
1418
|
+
target=self.extract_from_list(target, uni.Name),
|
|
1419
|
+
kid=self.flat_cur_nodes,
|
|
1575
1420
|
)
|
|
1576
1421
|
|
|
1577
|
-
def nonlocal_ref(self, _: None) ->
|
|
1422
|
+
def nonlocal_ref(self, _: None) -> uni.NonLocalStmt:
|
|
1578
1423
|
"""Grammar rule.
|
|
1579
1424
|
|
|
1580
1425
|
nonlocal_ref: NONLOCAL_OP name_list
|
|
1581
1426
|
"""
|
|
1582
1427
|
self.consume_token(Tok.NONLOCAL_OP)
|
|
1583
|
-
target = self.consume(
|
|
1584
|
-
return
|
|
1585
|
-
target=target,
|
|
1586
|
-
kid=self.
|
|
1428
|
+
target = self.consume(list)
|
|
1429
|
+
return uni.NonLocalStmt(
|
|
1430
|
+
target=self.extract_from_list(target, uni.Name),
|
|
1431
|
+
kid=self.flat_cur_nodes,
|
|
1587
1432
|
)
|
|
1588
1433
|
|
|
1589
|
-
def assignment(self, _: None) ->
|
|
1434
|
+
def assignment(self, _: None) -> uni.Assignment:
|
|
1590
1435
|
"""Grammar rule.
|
|
1591
1436
|
|
|
1592
1437
|
assignment: KW_LET? (atomic_chain EQ)+ (yield_expr | expression)
|
|
1593
|
-
|
|
1594
|
-
|
|
1438
|
+
| atomic_chain type_tag (EQ (yield_expr | expression))?
|
|
1439
|
+
| atomic_chain aug_op (yield_expr | expression)
|
|
1595
1440
|
"""
|
|
1596
1441
|
assignees: list = []
|
|
1597
|
-
type_tag:
|
|
1598
|
-
is_aug:
|
|
1599
|
-
semstr: ast.String | None = None
|
|
1442
|
+
type_tag: uni.SubTag | None = None
|
|
1443
|
+
is_aug: uni.Token | None = None
|
|
1600
1444
|
|
|
1601
1445
|
is_frozen = bool(self.match_token(Tok.KW_LET))
|
|
1602
|
-
if first_expr := self.match(
|
|
1446
|
+
if first_expr := self.match(uni.Expr):
|
|
1603
1447
|
assignees.append(first_expr)
|
|
1604
1448
|
|
|
1605
|
-
token = self.match(
|
|
1449
|
+
token = self.match(uni.Token)
|
|
1606
1450
|
if token and (token.name == Tok.EQ):
|
|
1607
1451
|
assignees.append(token)
|
|
1608
|
-
while expr := self.match(
|
|
1452
|
+
while expr := self.match(uni.Expr):
|
|
1609
1453
|
eq = self.match_token(Tok.EQ)
|
|
1610
1454
|
assignees.append(expr)
|
|
1611
1455
|
if eq:
|
|
@@ -1613,55 +1457,41 @@ class JacParser(Pass):
|
|
|
1613
1457
|
value = assignees.pop()
|
|
1614
1458
|
elif token and (token.name not in {Tok.COLON, Tok.EQ}):
|
|
1615
1459
|
is_aug = token
|
|
1616
|
-
value = self.consume(
|
|
1460
|
+
value = self.consume(uni.Expr)
|
|
1617
1461
|
else:
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
if (token and (token.name == Tok.COLON))
|
|
1621
|
-
else None
|
|
1622
|
-
)
|
|
1623
|
-
type_tag = self.consume(ast.SubTag)
|
|
1624
|
-
value = self.consume(ast.Expr) if self.match_token(Tok.EQ) else None
|
|
1462
|
+
type_tag = self.consume(uni.SubTag)
|
|
1463
|
+
value = self.consume(uni.Expr) if self.match_token(Tok.EQ) else None
|
|
1625
1464
|
|
|
1626
|
-
valid_assignees = [i for i in assignees if isinstance(i, (
|
|
1627
|
-
new_targ = ast.SubNodeList[ast.Expr](
|
|
1628
|
-
items=valid_assignees,
|
|
1629
|
-
delim=Tok.EQ,
|
|
1630
|
-
kid=assignees,
|
|
1631
|
-
)
|
|
1632
|
-
kid = [x for x in self.cur_nodes if x not in assignees]
|
|
1633
|
-
kid.insert(1, new_targ) if is_frozen else kid.insert(0, new_targ)
|
|
1465
|
+
valid_assignees = [i for i in assignees if isinstance(i, (uni.Expr))]
|
|
1634
1466
|
if is_aug:
|
|
1635
|
-
return
|
|
1636
|
-
target=
|
|
1467
|
+
return uni.Assignment(
|
|
1468
|
+
target=valid_assignees,
|
|
1637
1469
|
type_tag=type_tag,
|
|
1638
1470
|
value=value,
|
|
1639
1471
|
mutable=is_frozen,
|
|
1640
1472
|
aug_op=is_aug,
|
|
1641
|
-
kid=
|
|
1473
|
+
kid=self.flat_cur_nodes,
|
|
1642
1474
|
)
|
|
1643
|
-
return
|
|
1644
|
-
target=
|
|
1475
|
+
return uni.Assignment(
|
|
1476
|
+
target=valid_assignees,
|
|
1645
1477
|
type_tag=type_tag,
|
|
1646
1478
|
value=value,
|
|
1647
1479
|
mutable=is_frozen,
|
|
1648
|
-
kid=
|
|
1649
|
-
semstr=semstr,
|
|
1480
|
+
kid=self.flat_cur_nodes,
|
|
1650
1481
|
)
|
|
1651
1482
|
|
|
1652
|
-
def expression(self, _: None) ->
|
|
1483
|
+
def expression(self, _: None) -> uni.Expr:
|
|
1653
1484
|
"""Grammar rule.
|
|
1654
1485
|
|
|
1655
|
-
expression: walrus_assign
|
|
1656
|
-
|
|
1657
|
-
| lambda_expr
|
|
1486
|
+
expression: walrus_assign (KW_IF expression KW_ELSE expression)?
|
|
1487
|
+
| lambda_expr
|
|
1658
1488
|
"""
|
|
1659
|
-
value = self.consume(
|
|
1489
|
+
value = self.consume(uni.Expr)
|
|
1660
1490
|
if self.match_token(Tok.KW_IF):
|
|
1661
|
-
condition = self.consume(
|
|
1491
|
+
condition = self.consume(uni.Expr)
|
|
1662
1492
|
self.consume_token(Tok.KW_ELSE)
|
|
1663
|
-
else_value = self.consume(
|
|
1664
|
-
return
|
|
1493
|
+
else_value = self.consume(uni.Expr)
|
|
1494
|
+
return uni.IfElseExpr(
|
|
1665
1495
|
value=value,
|
|
1666
1496
|
condition=condition,
|
|
1667
1497
|
else_value=else_value,
|
|
@@ -1669,33 +1499,52 @@ class JacParser(Pass):
|
|
|
1669
1499
|
)
|
|
1670
1500
|
return value
|
|
1671
1501
|
|
|
1672
|
-
def
|
|
1502
|
+
def concurrent_expr(self, _: None) -> uni.ConcurrentExpr | uni.Expr:
|
|
1673
1503
|
"""Grammar rule.
|
|
1674
1504
|
|
|
1675
|
-
|
|
1505
|
+
concurrent: (KW_FLOW | KW_WAIT)
|
|
1506
|
+
"""
|
|
1507
|
+
if (tok := self.match_token(Tok.KW_FLOW)) or (
|
|
1508
|
+
tok := self.match_token(Tok.KW_WAIT)
|
|
1509
|
+
):
|
|
1510
|
+
target = self.consume(uni.Expr)
|
|
1511
|
+
return uni.ConcurrentExpr(
|
|
1512
|
+
tok=tok,
|
|
1513
|
+
target=target,
|
|
1514
|
+
kid=self.cur_nodes,
|
|
1515
|
+
)
|
|
1516
|
+
else:
|
|
1517
|
+
return self.consume(uni.Expr)
|
|
1518
|
+
|
|
1519
|
+
def walrus_assign(self, _: None) -> uni.Expr:
|
|
1520
|
+
"""Grammar rule.
|
|
1521
|
+
|
|
1522
|
+
walrus_assign: (named_ref WALRUS_EQ)? pipe
|
|
1676
1523
|
"""
|
|
1677
1524
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1678
1525
|
|
|
1679
|
-
def lambda_expr(self, _: None) ->
|
|
1526
|
+
def lambda_expr(self, _: None) -> uni.LambdaExpr:
|
|
1680
1527
|
"""Grammar rule.
|
|
1681
1528
|
|
|
1682
|
-
|
|
1529
|
+
lambda_expr: KW_LAMBDA func_decl_params? (RETURN_HINT expression)? COLON expression
|
|
1683
1530
|
"""
|
|
1684
|
-
return_type:
|
|
1685
|
-
sig_kid: list[
|
|
1686
|
-
self.consume_token(Tok.
|
|
1687
|
-
params = self.match(
|
|
1531
|
+
return_type: uni.Expr | None = None
|
|
1532
|
+
sig_kid: list[uni.UniNode] = []
|
|
1533
|
+
self.consume_token(Tok.KW_LAMBDA)
|
|
1534
|
+
params = self.match(list)
|
|
1688
1535
|
if self.match_token(Tok.RETURN_HINT):
|
|
1689
|
-
return_type = self.consume(
|
|
1690
|
-
self.consume_token(Tok.
|
|
1691
|
-
body = self.consume(
|
|
1536
|
+
return_type = self.consume(uni.Expr)
|
|
1537
|
+
self.consume_token(Tok.COLON)
|
|
1538
|
+
body = self.consume(uni.Expr)
|
|
1692
1539
|
if params:
|
|
1693
|
-
sig_kid.
|
|
1540
|
+
sig_kid.extend(params)
|
|
1694
1541
|
if return_type:
|
|
1695
1542
|
sig_kid.append(return_type)
|
|
1696
1543
|
signature = (
|
|
1697
|
-
|
|
1698
|
-
params=
|
|
1544
|
+
uni.FuncSignature(
|
|
1545
|
+
params=(
|
|
1546
|
+
self.extract_from_list(params, uni.ParamVar) if params else []
|
|
1547
|
+
),
|
|
1699
1548
|
return_type=return_type,
|
|
1700
1549
|
kid=sig_kid,
|
|
1701
1550
|
)
|
|
@@ -1704,132 +1553,127 @@ class JacParser(Pass):
|
|
|
1704
1553
|
)
|
|
1705
1554
|
new_kid = [i for i in self.cur_nodes if i != params and i != return_type]
|
|
1706
1555
|
new_kid.insert(1, signature) if signature else None
|
|
1707
|
-
return
|
|
1556
|
+
return uni.LambdaExpr(
|
|
1708
1557
|
signature=signature,
|
|
1709
1558
|
body=body,
|
|
1710
1559
|
kid=new_kid,
|
|
1711
1560
|
)
|
|
1712
1561
|
|
|
1713
|
-
def pipe(self, _: None) ->
|
|
1562
|
+
def pipe(self, _: None) -> uni.Expr:
|
|
1714
1563
|
"""Grammar rule.
|
|
1715
1564
|
|
|
1716
|
-
pipe:
|
|
1717
|
-
| pipe_back
|
|
1565
|
+
pipe: (pipe PIPE_FWD)? pipe_back
|
|
1718
1566
|
"""
|
|
1719
1567
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1720
1568
|
|
|
1721
|
-
def pipe_back(self, _: None) ->
|
|
1569
|
+
def pipe_back(self, _: None) -> uni.Expr:
|
|
1722
1570
|
"""Grammar rule.
|
|
1723
1571
|
|
|
1724
|
-
pipe_back:
|
|
1725
|
-
| bitwise_or
|
|
1572
|
+
pipe_back: (pipe_back PIPE_BKWD)? bitwise_or
|
|
1726
1573
|
"""
|
|
1727
1574
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1728
1575
|
|
|
1729
|
-
def bitwise_or(self, _: None) ->
|
|
1576
|
+
def bitwise_or(self, _: None) -> uni.Expr:
|
|
1730
1577
|
"""Grammar rule.
|
|
1731
1578
|
|
|
1732
|
-
bitwise_or:
|
|
1733
|
-
| bitwise_xor
|
|
1579
|
+
bitwise_or: (bitwise_or BW_OR)? bitwise_xor
|
|
1734
1580
|
"""
|
|
1735
1581
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1736
1582
|
|
|
1737
|
-
def bitwise_xor(self, _: None) ->
|
|
1583
|
+
def bitwise_xor(self, _: None) -> uni.Expr:
|
|
1738
1584
|
"""Grammar rule.
|
|
1739
1585
|
|
|
1740
|
-
bitwise_xor:
|
|
1741
|
-
| bitwise_and
|
|
1586
|
+
bitwise_xor: (bitwise_xor BW_XOR)? bitwise_and
|
|
1742
1587
|
"""
|
|
1743
1588
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1744
1589
|
|
|
1745
|
-
def bitwise_and(self, _: None) ->
|
|
1590
|
+
def bitwise_and(self, _: None) -> uni.Expr:
|
|
1746
1591
|
"""Grammar rule.
|
|
1747
1592
|
|
|
1748
|
-
bitwise_and:
|
|
1749
|
-
| shift
|
|
1593
|
+
bitwise_and: (bitwise_and BW_AND)? shift
|
|
1750
1594
|
"""
|
|
1751
1595
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1752
1596
|
|
|
1753
|
-
def shift(self, _: None) ->
|
|
1597
|
+
def shift(self, _: None) -> uni.Expr:
|
|
1754
1598
|
"""Grammar rule.
|
|
1755
1599
|
|
|
1756
1600
|
shift: (shift (RSHIFT | LSHIFT))? logical_or
|
|
1757
1601
|
"""
|
|
1758
1602
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1759
1603
|
|
|
1760
|
-
def logical_or(self, _: None) ->
|
|
1604
|
+
def logical_or(self, _: None) -> uni.Expr:
|
|
1761
1605
|
"""Grammar rule.
|
|
1762
1606
|
|
|
1763
1607
|
logical_or: logical_and (KW_OR logical_and)*
|
|
1764
1608
|
"""
|
|
1765
|
-
value = self.consume(
|
|
1609
|
+
value = self.consume(uni.Expr)
|
|
1766
1610
|
if not (ops := self.match_token(Tok.KW_OR)):
|
|
1767
1611
|
return value
|
|
1768
1612
|
values: list = [value]
|
|
1769
|
-
while value := self.consume(
|
|
1613
|
+
while value := self.consume(uni.Expr):
|
|
1770
1614
|
values.append(value)
|
|
1771
1615
|
if not self.match_token(Tok.KW_OR):
|
|
1772
1616
|
break
|
|
1773
|
-
return
|
|
1617
|
+
return uni.BoolExpr(
|
|
1774
1618
|
op=ops,
|
|
1775
1619
|
values=values,
|
|
1776
1620
|
kid=self.cur_nodes,
|
|
1777
1621
|
)
|
|
1778
1622
|
|
|
1779
|
-
def logical_and(self, _: None) ->
|
|
1623
|
+
def logical_and(self, _: None) -> uni.Expr:
|
|
1780
1624
|
"""Grammar rule.
|
|
1781
1625
|
|
|
1782
1626
|
logical_and: logical_not (KW_AND logical_not)*
|
|
1783
1627
|
"""
|
|
1784
|
-
value = self.consume(
|
|
1628
|
+
value = self.consume(uni.Expr)
|
|
1785
1629
|
if not (ops := self.match_token(Tok.KW_AND)):
|
|
1786
1630
|
return value
|
|
1787
1631
|
values: list = [value]
|
|
1788
|
-
while value := self.consume(
|
|
1632
|
+
while value := self.consume(uni.Expr):
|
|
1789
1633
|
values.append(value)
|
|
1790
1634
|
if not self.match_token(Tok.KW_AND):
|
|
1791
1635
|
break
|
|
1792
|
-
return
|
|
1636
|
+
return uni.BoolExpr(
|
|
1793
1637
|
op=ops,
|
|
1794
1638
|
values=values,
|
|
1795
1639
|
kid=self.cur_nodes,
|
|
1796
1640
|
)
|
|
1797
1641
|
|
|
1798
|
-
def logical_not(self, _: None) ->
|
|
1642
|
+
def logical_not(self, _: None) -> uni.Expr:
|
|
1799
1643
|
"""Grammar rule.
|
|
1800
1644
|
|
|
1801
1645
|
logical_not: NOT logical_not | compare
|
|
1802
1646
|
"""
|
|
1803
1647
|
if op := self.match_token(Tok.NOT):
|
|
1804
|
-
operand = self.consume(
|
|
1805
|
-
return
|
|
1648
|
+
operand = self.consume(uni.Expr)
|
|
1649
|
+
return uni.UnaryExpr(
|
|
1806
1650
|
op=op,
|
|
1807
1651
|
operand=operand,
|
|
1808
1652
|
kid=self.cur_nodes,
|
|
1809
1653
|
)
|
|
1810
|
-
return self.consume(
|
|
1654
|
+
return self.consume(uni.Expr)
|
|
1811
1655
|
|
|
1812
|
-
def compare(self, _: None) ->
|
|
1656
|
+
def compare(self, _: None) -> uni.Expr:
|
|
1813
1657
|
"""Grammar rule.
|
|
1814
1658
|
|
|
1815
1659
|
compare: (arithmetic cmp_op)* arithmetic
|
|
1816
1660
|
"""
|
|
1817
1661
|
ops: list = []
|
|
1818
1662
|
rights: list = []
|
|
1819
|
-
left = self.consume(
|
|
1820
|
-
while op := self.match(
|
|
1663
|
+
left = self.consume(uni.Expr)
|
|
1664
|
+
while op := self.match(uni.Token):
|
|
1821
1665
|
ops.append(op)
|
|
1822
|
-
rights.append(self.consume(
|
|
1666
|
+
rights.append(self.consume(uni.Expr))
|
|
1823
1667
|
if not ops:
|
|
1824
1668
|
return left
|
|
1825
|
-
return
|
|
1669
|
+
return uni.CompareExpr(
|
|
1826
1670
|
left=left,
|
|
1827
1671
|
ops=ops,
|
|
1828
1672
|
rights=rights,
|
|
1829
1673
|
kid=self.cur_nodes,
|
|
1830
1674
|
)
|
|
1831
1675
|
|
|
1832
|
-
def cmp_op(self, _: None) ->
|
|
1676
|
+
def cmp_op(self, _: None) -> uni.Token:
|
|
1833
1677
|
"""Grammar rule.
|
|
1834
1678
|
|
|
1835
1679
|
cmp_op: KW_ISN
|
|
@@ -1843,23 +1687,23 @@ class JacParser(Pass):
|
|
|
1843
1687
|
| LT
|
|
1844
1688
|
| EE
|
|
1845
1689
|
"""
|
|
1846
|
-
return self.consume(
|
|
1690
|
+
return self.consume(uni.Token)
|
|
1847
1691
|
|
|
1848
|
-
def arithmetic(self, _: None) ->
|
|
1692
|
+
def arithmetic(self, _: None) -> uni.Expr:
|
|
1849
1693
|
"""Grammar rule.
|
|
1850
1694
|
|
|
1851
1695
|
arithmetic: (arithmetic (MINUS | PLUS))? term
|
|
1852
1696
|
"""
|
|
1853
1697
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1854
1698
|
|
|
1855
|
-
def term(self, _: None) ->
|
|
1699
|
+
def term(self, _: None) -> uni.Expr:
|
|
1856
1700
|
"""Grammar rule.
|
|
1857
1701
|
|
|
1858
1702
|
term: (term (MOD | DIV | FLOOR_DIV | STAR_MUL | DECOR_OP))? power
|
|
1859
1703
|
"""
|
|
1860
1704
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1861
1705
|
|
|
1862
|
-
def factor(self, _: None) ->
|
|
1706
|
+
def factor(self, _: None) -> uni.Expr:
|
|
1863
1707
|
"""Grammar rule.
|
|
1864
1708
|
|
|
1865
1709
|
factor: (BW_NOT | MINUS | PLUS) factor | connect
|
|
@@ -1869,123 +1713,120 @@ class JacParser(Pass):
|
|
|
1869
1713
|
or self.match_token(Tok.MINUS)
|
|
1870
1714
|
or self.match_token(Tok.PLUS)
|
|
1871
1715
|
):
|
|
1872
|
-
operand = self.consume(
|
|
1873
|
-
return
|
|
1716
|
+
operand = self.consume(uni.Expr)
|
|
1717
|
+
return uni.UnaryExpr(
|
|
1874
1718
|
op=op,
|
|
1875
1719
|
operand=operand,
|
|
1876
1720
|
kid=self.cur_nodes,
|
|
1877
1721
|
)
|
|
1878
1722
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1879
1723
|
|
|
1880
|
-
def power(self, _: None) ->
|
|
1724
|
+
def power(self, _: None) -> uni.Expr:
|
|
1881
1725
|
"""Grammar rule.
|
|
1882
1726
|
|
|
1883
1727
|
power: (power STAR_POW)? factor
|
|
1884
1728
|
"""
|
|
1885
1729
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1886
1730
|
|
|
1887
|
-
def connect(self, _: None) ->
|
|
1731
|
+
def connect(self, _: None) -> uni.Expr:
|
|
1888
1732
|
"""Grammar rule.
|
|
1889
1733
|
|
|
1890
1734
|
connect: (connect (connect_op | disconnect_op))? atomic_pipe
|
|
1891
1735
|
"""
|
|
1892
1736
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1893
1737
|
|
|
1894
|
-
def atomic_pipe(self, _: None) ->
|
|
1738
|
+
def atomic_pipe(self, _: None) -> uni.Expr:
|
|
1895
1739
|
"""Grammar rule.
|
|
1896
1740
|
|
|
1897
1741
|
atomic_pipe: (atomic_pipe A_PIPE_FWD)? atomic_pipe_back
|
|
1898
1742
|
"""
|
|
1899
1743
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1900
1744
|
|
|
1901
|
-
def atomic_pipe_back(self, _: None) ->
|
|
1745
|
+
def atomic_pipe_back(self, _: None) -> uni.Expr:
|
|
1902
1746
|
"""Grammar rule.
|
|
1903
1747
|
|
|
1904
1748
|
atomic_pipe_back: (atomic_pipe_back A_PIPE_BKWD)? ds_spawn
|
|
1905
1749
|
"""
|
|
1906
1750
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1907
1751
|
|
|
1908
|
-
def ds_spawn(self, _: None) ->
|
|
1752
|
+
def ds_spawn(self, _: None) -> uni.Expr:
|
|
1909
1753
|
"""Grammar rule.
|
|
1910
1754
|
|
|
1911
1755
|
ds_spawn: (ds_spawn KW_SPAWN)? unpack
|
|
1912
1756
|
"""
|
|
1913
1757
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1914
1758
|
|
|
1915
|
-
def unpack(self, _: None) ->
|
|
1759
|
+
def unpack(self, _: None) -> uni.Expr:
|
|
1916
1760
|
"""Grammar rule.
|
|
1917
1761
|
|
|
1918
1762
|
unpack: STAR_MUL? ref
|
|
1919
1763
|
"""
|
|
1920
1764
|
if op := self.match_token(Tok.STAR_MUL):
|
|
1921
|
-
operand = self.consume(
|
|
1922
|
-
return
|
|
1765
|
+
operand = self.consume(uni.Expr)
|
|
1766
|
+
return uni.UnaryExpr(
|
|
1923
1767
|
op=op,
|
|
1924
1768
|
operand=operand,
|
|
1925
1769
|
kid=self.cur_nodes,
|
|
1926
1770
|
)
|
|
1927
1771
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1928
1772
|
|
|
1929
|
-
def ref(self, _: None) ->
|
|
1773
|
+
def ref(self, _: None) -> uni.Expr:
|
|
1930
1774
|
"""Grammar rule.
|
|
1931
1775
|
|
|
1932
1776
|
ref: walrus_assign
|
|
1933
1777
|
| BW_AND walrus_assign
|
|
1934
1778
|
"""
|
|
1935
1779
|
if op := self.match_token(Tok.BW_AND):
|
|
1936
|
-
operand = self.consume(
|
|
1937
|
-
return
|
|
1780
|
+
operand = self.consume(uni.Expr)
|
|
1781
|
+
return uni.UnaryExpr(
|
|
1938
1782
|
op=op,
|
|
1939
1783
|
operand=operand,
|
|
1940
1784
|
kid=self.cur_nodes,
|
|
1941
1785
|
)
|
|
1942
1786
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1943
1787
|
|
|
1944
|
-
def pipe_call(self, _: None) ->
|
|
1788
|
+
def pipe_call(self, _: None) -> uni.Expr:
|
|
1945
1789
|
"""Grammar rule.
|
|
1946
1790
|
|
|
1947
|
-
pipe_call: atomic_chain
|
|
1948
|
-
| PIPE_FWD atomic_chain
|
|
1949
|
-
| A_PIPE_FWD atomic_chain
|
|
1950
|
-
| KW_SPAWN atomic_chain
|
|
1951
|
-
| KW_AWAIT atomic_chain
|
|
1791
|
+
pipe_call: (PIPE_FWD | A_PIPE_FWD | KW_SPAWN | KW_AWAIT)? atomic_chain
|
|
1952
1792
|
"""
|
|
1953
1793
|
if len(self.cur_nodes) == 2:
|
|
1954
1794
|
if self.match_token(Tok.KW_AWAIT):
|
|
1955
|
-
target = self.consume(
|
|
1956
|
-
return
|
|
1795
|
+
target = self.consume(uni.Expr)
|
|
1796
|
+
return uni.AwaitExpr(
|
|
1957
1797
|
target=target,
|
|
1958
1798
|
kid=self.cur_nodes,
|
|
1959
1799
|
)
|
|
1960
|
-
elif op := self.match(
|
|
1961
|
-
operand = self.consume(
|
|
1962
|
-
return
|
|
1800
|
+
elif op := self.match(uni.Token):
|
|
1801
|
+
operand = self.consume(uni.Expr)
|
|
1802
|
+
return uni.UnaryExpr(
|
|
1963
1803
|
op=op,
|
|
1964
1804
|
operand=operand,
|
|
1965
1805
|
kid=self.cur_nodes,
|
|
1966
1806
|
)
|
|
1967
1807
|
return self._binary_expr_unwind(self.cur_nodes)
|
|
1968
1808
|
|
|
1969
|
-
def aug_op(self, _: None) ->
|
|
1809
|
+
def aug_op(self, _: None) -> uni.Token:
|
|
1970
1810
|
"""Grammar rule.
|
|
1971
1811
|
|
|
1972
1812
|
aug_op: RSHIFT_EQ
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1813
|
+
| LSHIFT_EQ
|
|
1814
|
+
| BW_NOT_EQ
|
|
1815
|
+
| BW_XOR_EQ
|
|
1816
|
+
| BW_OR_EQ
|
|
1817
|
+
| BW_AND_EQ
|
|
1818
|
+
| MOD_EQ
|
|
1819
|
+
| DIV_EQ
|
|
1820
|
+
| FLOOR_DIV_EQ
|
|
1821
|
+
| MUL_EQ
|
|
1822
|
+
| SUB_EQ
|
|
1823
|
+
| ADD_EQ
|
|
1824
|
+
| MATMUL_EQ
|
|
1825
|
+
| STAR_POW_EQ
|
|
1985
1826
|
"""
|
|
1986
|
-
return self.consume(
|
|
1827
|
+
return self.consume(uni.Token)
|
|
1987
1828
|
|
|
1988
|
-
def atomic_chain(self, _: None) ->
|
|
1829
|
+
def atomic_chain(self, _: None) -> uni.Expr:
|
|
1989
1830
|
"""Grammar rule.
|
|
1990
1831
|
|
|
1991
1832
|
atomic_chain: atomic_chain NULL_OK? (filter_compr | assign_compr | index_slice)
|
|
@@ -1993,11 +1834,11 @@ class JacParser(Pass):
|
|
|
1993
1834
|
| (atomic_call | atom | edge_ref_chain)
|
|
1994
1835
|
"""
|
|
1995
1836
|
if len(self.cur_nodes) == 1:
|
|
1996
|
-
return self.consume(
|
|
1997
|
-
target = self.consume(
|
|
1837
|
+
return self.consume(uni.Expr)
|
|
1838
|
+
target = self.consume(uni.Expr)
|
|
1998
1839
|
is_null_ok = bool(self.match_token(Tok.NULL_OK))
|
|
1999
|
-
if right := self.match(
|
|
2000
|
-
return
|
|
1840
|
+
if right := self.match(uni.AtomExpr):
|
|
1841
|
+
return uni.AtomTrailer(
|
|
2001
1842
|
target=target,
|
|
2002
1843
|
right=right,
|
|
2003
1844
|
is_null_ok=is_null_ok,
|
|
@@ -2009,8 +1850,8 @@ class JacParser(Pass):
|
|
|
2009
1850
|
or self.match_token(Tok.DOT_FWD)
|
|
2010
1851
|
or self.consume_token(Tok.DOT)
|
|
2011
1852
|
)
|
|
2012
|
-
name = self.match(
|
|
2013
|
-
return
|
|
1853
|
+
name = self.match(uni.AtomExpr) or self.consume(uni.AtomTrailer)
|
|
1854
|
+
return uni.AtomTrailer(
|
|
2014
1855
|
target=(target if token.name != Tok.DOT_BKWD else name),
|
|
2015
1856
|
right=(name if token.name != Tok.DOT_BKWD else target),
|
|
2016
1857
|
is_null_ok=is_null_ok,
|
|
@@ -2018,26 +1859,30 @@ class JacParser(Pass):
|
|
|
2018
1859
|
kid=self.cur_nodes,
|
|
2019
1860
|
)
|
|
2020
1861
|
|
|
2021
|
-
def atomic_call(self, _: None) ->
|
|
1862
|
+
def atomic_call(self, _: None) -> uni.FuncCall:
|
|
2022
1863
|
"""Grammar rule.
|
|
2023
1864
|
|
|
2024
1865
|
atomic_call: atomic_chain LPAREN param_list? (KW_BY atomic_call)? RPAREN
|
|
2025
1866
|
"""
|
|
2026
|
-
genai_call:
|
|
2027
|
-
target = self.consume(
|
|
1867
|
+
genai_call: uni.FuncCall | None = None
|
|
1868
|
+
target = self.consume(uni.Expr)
|
|
2028
1869
|
self.consume_token(Tok.LPAREN)
|
|
2029
|
-
|
|
1870
|
+
params_sn = self.match(list)
|
|
2030
1871
|
if self.match_token(Tok.KW_BY):
|
|
2031
|
-
genai_call = self.consume(
|
|
1872
|
+
genai_call = self.consume(uni.FuncCall)
|
|
2032
1873
|
self.consume_token(Tok.RPAREN)
|
|
2033
|
-
return
|
|
1874
|
+
return uni.FuncCall(
|
|
2034
1875
|
target=target,
|
|
2035
|
-
params=
|
|
1876
|
+
params=(
|
|
1877
|
+
self.extract_from_list(params_sn, (uni.Expr, uni.KWPair)) # type: ignore[arg-type]
|
|
1878
|
+
if params_sn
|
|
1879
|
+
else []
|
|
1880
|
+
),
|
|
2036
1881
|
genai_call=genai_call,
|
|
2037
|
-
kid=self.
|
|
1882
|
+
kid=self.flat_cur_nodes,
|
|
2038
1883
|
)
|
|
2039
1884
|
|
|
2040
|
-
def index_slice(self, _: None) ->
|
|
1885
|
+
def index_slice(self, _: None) -> uni.IndexSlice:
|
|
2041
1886
|
"""Grammar rule.
|
|
2042
1887
|
|
|
2043
1888
|
index_slice: LSQUARE \
|
|
@@ -2047,44 +1892,39 @@ class JacParser(Pass):
|
|
|
2047
1892
|
| list_val
|
|
2048
1893
|
"""
|
|
2049
1894
|
if len(self.cur_nodes) == 1:
|
|
2050
|
-
index = self.consume(
|
|
2051
|
-
if
|
|
2052
|
-
|
|
2053
|
-
if len(index.values.items) == 1:
|
|
2054
|
-
expr = index.values.items[0] if index.values else None
|
|
1895
|
+
index = self.consume(uni.ListVal)
|
|
1896
|
+
if len(index.values) == 1:
|
|
1897
|
+
expr = index.values[0]
|
|
2055
1898
|
kid = self.cur_nodes
|
|
2056
1899
|
else:
|
|
2057
|
-
|
|
2058
|
-
items=[*index.values.items], delim=Tok.COMMA, kid=index.kid
|
|
2059
|
-
)
|
|
2060
|
-
expr = ast.TupleVal(values=sublist, kid=[sublist])
|
|
1900
|
+
expr = uni.TupleVal(values=index.values, kid=index.kid)
|
|
2061
1901
|
kid = [expr]
|
|
2062
|
-
return
|
|
2063
|
-
slices=[
|
|
1902
|
+
return uni.IndexSlice(
|
|
1903
|
+
slices=[uni.IndexSlice.Slice(start=expr, stop=None, step=None)],
|
|
2064
1904
|
is_range=False,
|
|
2065
1905
|
kid=kid,
|
|
2066
1906
|
)
|
|
2067
1907
|
else:
|
|
2068
1908
|
self.consume_token(Tok.LSQUARE)
|
|
2069
|
-
slices: list[
|
|
1909
|
+
slices: list[uni.IndexSlice.Slice] = []
|
|
2070
1910
|
while not self.match_token(Tok.RSQUARE):
|
|
2071
|
-
expr1 = self.match(
|
|
1911
|
+
expr1 = self.match(uni.Expr)
|
|
2072
1912
|
self.consume_token(Tok.COLON)
|
|
2073
|
-
expr2 = self.match(
|
|
1913
|
+
expr2 = self.match(uni.Expr)
|
|
2074
1914
|
expr3 = (
|
|
2075
|
-
self.match(
|
|
1915
|
+
self.match(uni.Expr) if self.match_token(Tok.COLON) else None
|
|
2076
1916
|
)
|
|
2077
1917
|
self.match_token(Tok.COMMA)
|
|
2078
1918
|
slices.append(
|
|
2079
|
-
|
|
1919
|
+
uni.IndexSlice.Slice(start=expr1, stop=expr2, step=expr3)
|
|
2080
1920
|
)
|
|
2081
|
-
return
|
|
1921
|
+
return uni.IndexSlice(
|
|
2082
1922
|
slices=slices,
|
|
2083
1923
|
is_range=True,
|
|
2084
1924
|
kid=self.cur_nodes,
|
|
2085
1925
|
)
|
|
2086
1926
|
|
|
2087
|
-
def atom(self, _: None) ->
|
|
1927
|
+
def atom(self, _: None) -> uni.Expr:
|
|
2088
1928
|
"""Grammar rule.
|
|
2089
1929
|
|
|
2090
1930
|
atom: named_ref
|
|
@@ -2094,41 +1934,42 @@ class JacParser(Pass):
|
|
|
2094
1934
|
| type_ref
|
|
2095
1935
|
"""
|
|
2096
1936
|
if self.match_token(Tok.LPAREN):
|
|
2097
|
-
value = self.match(
|
|
1937
|
+
value = self.match(uni.Expr) or self.consume(uni.YieldExpr)
|
|
2098
1938
|
self.consume_token(Tok.RPAREN)
|
|
2099
|
-
return
|
|
2100
|
-
return self.consume(
|
|
1939
|
+
return uni.AtomUnit(value=value, kid=self.cur_nodes)
|
|
1940
|
+
return self.consume(uni.AtomExpr)
|
|
2101
1941
|
|
|
2102
|
-
def yield_expr(self, _: None) ->
|
|
1942
|
+
def yield_expr(self, _: None) -> uni.YieldExpr:
|
|
2103
1943
|
"""Grammar rule.
|
|
2104
1944
|
|
|
2105
1945
|
yield_expr: KW_YIELD KW_FROM? expression
|
|
2106
1946
|
"""
|
|
2107
1947
|
self.consume_token(Tok.KW_YIELD)
|
|
2108
1948
|
is_with_from = bool(self.match_token(Tok.KW_FROM))
|
|
2109
|
-
expr = self.consume(
|
|
2110
|
-
return
|
|
1949
|
+
expr = self.consume(uni.Expr)
|
|
1950
|
+
return uni.YieldExpr(
|
|
2111
1951
|
expr=expr,
|
|
2112
1952
|
with_from=is_with_from,
|
|
2113
1953
|
kid=self.cur_nodes,
|
|
2114
1954
|
)
|
|
2115
1955
|
|
|
2116
|
-
def atom_literal(self, _: None) ->
|
|
1956
|
+
def atom_literal(self, _: None) -> uni.AtomExpr:
|
|
2117
1957
|
"""Grammar rule.
|
|
2118
1958
|
|
|
2119
1959
|
atom_literal: builtin_type
|
|
2120
1960
|
| NULL
|
|
2121
1961
|
| BOOL
|
|
2122
1962
|
| multistring
|
|
1963
|
+
| ELLIPSIS
|
|
2123
1964
|
| FLOAT
|
|
2124
1965
|
| OCT
|
|
2125
1966
|
| BIN
|
|
2126
1967
|
| HEX
|
|
2127
1968
|
| INT
|
|
2128
1969
|
"""
|
|
2129
|
-
return self.consume(
|
|
1970
|
+
return self.consume(uni.AtomExpr)
|
|
2130
1971
|
|
|
2131
|
-
def atom_collection(self, kid: list[
|
|
1972
|
+
def atom_collection(self, kid: list[uni.UniNode]) -> uni.AtomExpr:
|
|
2132
1973
|
"""Grammar rule.
|
|
2133
1974
|
|
|
2134
1975
|
atom_collection: dict_compr
|
|
@@ -2140,316 +1981,274 @@ class JacParser(Pass):
|
|
|
2140
1981
|
| tuple_val
|
|
2141
1982
|
| list_val
|
|
2142
1983
|
"""
|
|
2143
|
-
return self.consume(
|
|
1984
|
+
return self.consume(uni.AtomExpr)
|
|
2144
1985
|
|
|
2145
|
-
def multistring(self, _: None) ->
|
|
1986
|
+
def multistring(self, _: None) -> uni.AtomExpr:
|
|
2146
1987
|
"""Grammar rule.
|
|
2147
1988
|
|
|
2148
1989
|
multistring: (fstring | STRING)+
|
|
2149
1990
|
"""
|
|
2150
|
-
valid_strs = [self.match(
|
|
2151
|
-
while node := (self.match(
|
|
1991
|
+
valid_strs = [self.match(uni.String) or self.consume(uni.FString)]
|
|
1992
|
+
while node := (self.match(uni.String) or self.match(uni.FString)):
|
|
2152
1993
|
valid_strs.append(node)
|
|
2153
|
-
return
|
|
1994
|
+
return uni.MultiString(
|
|
2154
1995
|
strings=valid_strs,
|
|
2155
1996
|
kid=self.cur_nodes,
|
|
2156
1997
|
)
|
|
2157
1998
|
|
|
2158
|
-
def fstring(self, _: None) ->
|
|
1999
|
+
def fstring(self, _: None) -> uni.FString:
|
|
2159
2000
|
"""Grammar rule.
|
|
2160
2001
|
|
|
2161
2002
|
fstring: FSTR_START fstr_parts FSTR_END
|
|
2162
2003
|
| FSTR_SQ_START fstr_sq_parts FSTR_SQ_END
|
|
2163
2004
|
"""
|
|
2164
2005
|
self.match_token(Tok.FSTR_START) or self.consume_token(Tok.FSTR_SQ_START)
|
|
2165
|
-
target = self.match(
|
|
2006
|
+
target = self.match(list)
|
|
2166
2007
|
self.match_token(Tok.FSTR_END) or self.consume_token(Tok.FSTR_SQ_END)
|
|
2167
|
-
return
|
|
2168
|
-
parts=
|
|
2169
|
-
|
|
2008
|
+
return uni.FString(
|
|
2009
|
+
parts=(
|
|
2010
|
+
self.extract_from_list(target, (uni.String, uni.ExprStmt))
|
|
2011
|
+
if target
|
|
2012
|
+
else []
|
|
2013
|
+
),
|
|
2014
|
+
kid=self.flat_cur_nodes,
|
|
2170
2015
|
)
|
|
2171
2016
|
|
|
2172
|
-
def fstr_parts(self, _: None) ->
|
|
2017
|
+
def fstr_parts(self, _: None) -> list[uni.UniNode]:
|
|
2173
2018
|
"""Grammar rule.
|
|
2174
2019
|
|
|
2175
2020
|
fstr_parts: (FSTR_PIECE | FSTR_BESC | LBRACE expression RBRACE )*
|
|
2176
2021
|
"""
|
|
2177
|
-
valid_parts: list[
|
|
2022
|
+
valid_parts: list[uni.UniNode] = [
|
|
2178
2023
|
(
|
|
2179
2024
|
i
|
|
2180
|
-
if isinstance(i,
|
|
2181
|
-
else
|
|
2025
|
+
if isinstance(i, uni.String)
|
|
2026
|
+
else (
|
|
2027
|
+
uni.ExprStmt(expr=i, in_fstring=True, kid=[i])
|
|
2028
|
+
if isinstance(i, uni.Expr)
|
|
2029
|
+
else i
|
|
2030
|
+
)
|
|
2182
2031
|
)
|
|
2183
2032
|
for i in self.cur_nodes
|
|
2184
|
-
if isinstance(i, ast.Expr)
|
|
2185
2033
|
]
|
|
2186
|
-
return
|
|
2187
|
-
items=valid_parts,
|
|
2188
|
-
delim=None,
|
|
2189
|
-
kid=valid_parts,
|
|
2190
|
-
)
|
|
2034
|
+
return valid_parts
|
|
2191
2035
|
|
|
2192
|
-
def fstr_sq_parts(self, _: None) ->
|
|
2036
|
+
def fstr_sq_parts(self, _: None) -> list[uni.UniNode]:
|
|
2193
2037
|
"""Grammar rule.
|
|
2194
2038
|
|
|
2195
2039
|
fstr_sq_parts: (FSTR_SQ_PIECE | FSTR_BESC | LBRACE expression RBRACE )*
|
|
2196
2040
|
"""
|
|
2197
|
-
valid_parts: list[
|
|
2041
|
+
valid_parts: list[uni.UniNode] = [
|
|
2198
2042
|
(
|
|
2199
2043
|
i
|
|
2200
|
-
if isinstance(i,
|
|
2201
|
-
else
|
|
2044
|
+
if isinstance(i, uni.String)
|
|
2045
|
+
else (
|
|
2046
|
+
uni.ExprStmt(expr=i, in_fstring=True, kid=[i])
|
|
2047
|
+
if isinstance(i, uni.Expr)
|
|
2048
|
+
else i
|
|
2049
|
+
)
|
|
2202
2050
|
)
|
|
2203
2051
|
for i in self.cur_nodes
|
|
2204
|
-
if isinstance(i, ast.Expr)
|
|
2205
2052
|
]
|
|
2206
|
-
return
|
|
2207
|
-
items=valid_parts,
|
|
2208
|
-
delim=None,
|
|
2209
|
-
kid=valid_parts,
|
|
2210
|
-
)
|
|
2053
|
+
return valid_parts
|
|
2211
2054
|
|
|
2212
|
-
def list_val(self, _: None) ->
|
|
2055
|
+
def list_val(self, _: None) -> uni.ListVal:
|
|
2213
2056
|
"""Grammar rule.
|
|
2214
2057
|
|
|
2215
2058
|
list_val: LSQUARE (expr_list COMMA?)? RSQUARE
|
|
2216
2059
|
"""
|
|
2217
2060
|
self.consume_token(Tok.LSQUARE)
|
|
2218
|
-
|
|
2061
|
+
values_node = self.match(list)
|
|
2219
2062
|
self.match_token(Tok.COMMA)
|
|
2220
2063
|
self.consume_token(Tok.RSQUARE)
|
|
2221
|
-
|
|
2064
|
+
values = (
|
|
2065
|
+
self.extract_from_list(values_node, uni.Expr) if values_node else []
|
|
2066
|
+
)
|
|
2067
|
+
return uni.ListVal(
|
|
2222
2068
|
values=values,
|
|
2223
|
-
kid=self.
|
|
2069
|
+
kid=self.flat_cur_nodes,
|
|
2224
2070
|
)
|
|
2225
2071
|
|
|
2226
|
-
def tuple_val(self, _: None) ->
|
|
2072
|
+
def tuple_val(self, _: None) -> uni.TupleVal:
|
|
2227
2073
|
"""Grammar rule.
|
|
2228
2074
|
|
|
2229
2075
|
tuple_val: LPAREN tuple_list? RPAREN
|
|
2230
2076
|
"""
|
|
2231
2077
|
self.consume_token(Tok.LPAREN)
|
|
2232
|
-
target = self.match(
|
|
2078
|
+
target = self.match(list)
|
|
2233
2079
|
self.consume_token(Tok.RPAREN)
|
|
2234
|
-
return
|
|
2235
|
-
values=
|
|
2236
|
-
|
|
2080
|
+
return uni.TupleVal(
|
|
2081
|
+
values=(
|
|
2082
|
+
self.extract_from_list(target, (uni.Expr, uni.KWPair))
|
|
2083
|
+
if target
|
|
2084
|
+
else []
|
|
2085
|
+
),
|
|
2086
|
+
kid=self.flat_cur_nodes,
|
|
2237
2087
|
)
|
|
2238
2088
|
|
|
2239
|
-
def set_val(self, _: None) ->
|
|
2089
|
+
def set_val(self, _: None) -> uni.SetVal:
|
|
2240
2090
|
"""Grammar rule.
|
|
2241
2091
|
|
|
2242
2092
|
set_val: LBRACE expr_list COMMA? RBRACE
|
|
2243
2093
|
"""
|
|
2244
2094
|
self.match_token(Tok.LBRACE)
|
|
2245
|
-
expr_list = self.match(
|
|
2095
|
+
expr_list = self.match(list)
|
|
2246
2096
|
self.match_token(Tok.COMMA)
|
|
2247
2097
|
self.match_token(Tok.RBRACE)
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2098
|
+
values = self.extract_from_list(expr_list, uni.Expr) if expr_list else []
|
|
2099
|
+
return uni.SetVal(
|
|
2100
|
+
values=values,
|
|
2101
|
+
kid=self.flat_cur_nodes,
|
|
2251
2102
|
)
|
|
2252
2103
|
|
|
2253
|
-
def expr_list(self, kid: list[
|
|
2104
|
+
def expr_list(self, kid: list[uni.UniNode]) -> list[uni.UniNode]:
|
|
2254
2105
|
"""Grammar rule.
|
|
2255
2106
|
|
|
2256
2107
|
expr_list: (expr_list COMMA)? expression
|
|
2257
2108
|
"""
|
|
2258
|
-
|
|
2259
|
-
if consume := self.match(ast.SubNodeList):
|
|
2260
|
-
comma = self.consume_token(Tok.COMMA)
|
|
2261
|
-
new_kid.extend([*consume.kid, comma])
|
|
2262
|
-
expr = self.consume(ast.Expr)
|
|
2263
|
-
new_kid.extend([expr])
|
|
2264
|
-
valid_kid = [i for i in new_kid if isinstance(i, ast.Expr)]
|
|
2265
|
-
return ast.SubNodeList[ast.Expr](
|
|
2266
|
-
items=valid_kid,
|
|
2267
|
-
delim=Tok.COMMA,
|
|
2268
|
-
kid=new_kid,
|
|
2269
|
-
)
|
|
2109
|
+
return self.flat_cur_nodes
|
|
2270
2110
|
|
|
2271
|
-
def kw_expr_list(self, kid: list[
|
|
2111
|
+
def kw_expr_list(self, kid: list[uni.UniNode]) -> list[uni.UniNode]:
|
|
2272
2112
|
"""Grammar rule.
|
|
2273
2113
|
|
|
2274
2114
|
kw_expr_list: (kw_expr_list COMMA)? kw_expr
|
|
2275
2115
|
"""
|
|
2276
|
-
|
|
2277
|
-
comma = self.consume_token(Tok.COMMA)
|
|
2278
|
-
expr = self.consume(ast.KWPair)
|
|
2279
|
-
new_kid = [*consume.kid, comma, expr]
|
|
2280
|
-
else:
|
|
2281
|
-
expr = self.consume(ast.KWPair)
|
|
2282
|
-
new_kid = [expr]
|
|
2283
|
-
valid_kid = [i for i in new_kid if isinstance(i, ast.KWPair)]
|
|
2284
|
-
return ast.SubNodeList[ast.KWPair](
|
|
2285
|
-
items=valid_kid,
|
|
2286
|
-
delim=Tok.COMMA,
|
|
2287
|
-
kid=new_kid,
|
|
2288
|
-
)
|
|
2116
|
+
return self.flat_cur_nodes
|
|
2289
2117
|
|
|
2290
|
-
def kw_expr(self, _: None) ->
|
|
2118
|
+
def kw_expr(self, _: None) -> uni.KWPair:
|
|
2291
2119
|
"""Grammar rule.
|
|
2292
2120
|
|
|
2293
2121
|
kw_expr: named_ref EQ expression | STAR_POW expression
|
|
2294
2122
|
"""
|
|
2295
2123
|
if self.match_token(Tok.STAR_POW):
|
|
2296
|
-
value = self.consume(
|
|
2124
|
+
value = self.consume(uni.Expr)
|
|
2297
2125
|
key = None
|
|
2298
2126
|
else:
|
|
2299
|
-
key = self.consume(
|
|
2127
|
+
key = self.consume(uni.Name)
|
|
2300
2128
|
self.consume_token(Tok.EQ)
|
|
2301
|
-
value = self.consume(
|
|
2302
|
-
return
|
|
2129
|
+
value = self.consume(uni.Expr)
|
|
2130
|
+
return uni.KWPair(
|
|
2303
2131
|
key=key,
|
|
2304
2132
|
value=value,
|
|
2305
2133
|
kid=self.cur_nodes,
|
|
2306
2134
|
)
|
|
2307
2135
|
|
|
2308
|
-
def name_list(self, _: None) ->
|
|
2136
|
+
def name_list(self, _: None) -> list[uni.UniNode]:
|
|
2309
2137
|
"""Grammar rule.
|
|
2310
2138
|
|
|
2311
2139
|
name_list: (named_ref COMMA)* named_ref
|
|
2312
2140
|
"""
|
|
2313
|
-
|
|
2314
|
-
while self.match_token(Tok.COMMA):
|
|
2315
|
-
valid_kid.append(self.consume(ast.Name))
|
|
2316
|
-
return ast.SubNodeList[ast.Name](
|
|
2317
|
-
items=valid_kid,
|
|
2318
|
-
delim=Tok.COMMA,
|
|
2319
|
-
kid=self.cur_nodes,
|
|
2320
|
-
)
|
|
2141
|
+
return self.flat_cur_nodes
|
|
2321
2142
|
|
|
2322
|
-
def tuple_list(self, _: None) ->
|
|
2143
|
+
def tuple_list(self, _: None) -> list[uni.UniNode]:
|
|
2323
2144
|
"""Grammar rule.
|
|
2324
2145
|
|
|
2325
|
-
tuple_list: expression COMMA expr_list
|
|
2146
|
+
tuple_list: expression COMMA expr_list COMMA kw_expr_list COMMA?
|
|
2326
2147
|
| expression COMMA kw_expr_list COMMA?
|
|
2327
|
-
| expression COMMA expr_list
|
|
2148
|
+
| expression COMMA expr_list COMMA?
|
|
2328
2149
|
| expression COMMA
|
|
2329
2150
|
| kw_expr_list COMMA?
|
|
2330
2151
|
"""
|
|
2331
|
-
|
|
2332
|
-
comma = self.match_token(Tok.COMMA)
|
|
2333
|
-
if comma:
|
|
2334
|
-
first_expr.kid.append(comma)
|
|
2335
|
-
return first_expr
|
|
2336
|
-
expr = self.consume(ast.Expr)
|
|
2337
|
-
self.consume_token(Tok.COMMA)
|
|
2338
|
-
second_expr = self.match(ast.SubNodeList)
|
|
2339
|
-
self.match_token(Tok.COMMA)
|
|
2340
|
-
kw_expr_list = self.match(ast.SubNodeList)
|
|
2341
|
-
self.match_token(Tok.COMMA)
|
|
2342
|
-
expr_list: list = []
|
|
2343
|
-
if second_expr:
|
|
2344
|
-
expr_list = second_expr.kid
|
|
2345
|
-
if kw_expr_list:
|
|
2346
|
-
expr_list = [*expr_list, *kw_expr_list.kid]
|
|
2347
|
-
expr_list = [expr, *expr_list]
|
|
2348
|
-
valid_kid = [i for i in expr_list if isinstance(i, (ast.Expr, ast.KWPair))]
|
|
2349
|
-
return ast.SubNodeList[ast.Expr | ast.KWPair](
|
|
2350
|
-
items=valid_kid,
|
|
2351
|
-
delim=Tok.COMMA,
|
|
2352
|
-
kid=self.cur_nodes,
|
|
2353
|
-
)
|
|
2152
|
+
return self.flat_cur_nodes
|
|
2354
2153
|
|
|
2355
|
-
def dict_val(self, _: None) ->
|
|
2154
|
+
def dict_val(self, _: None) -> uni.DictVal:
|
|
2356
2155
|
"""Grammar rule.
|
|
2357
2156
|
|
|
2358
2157
|
dict_val: LBRACE ((kv_pair COMMA)* kv_pair COMMA?)? RBRACE
|
|
2359
2158
|
"""
|
|
2360
2159
|
self.consume_token(Tok.LBRACE)
|
|
2361
2160
|
kv_pairs: list = []
|
|
2362
|
-
while item := self.match(
|
|
2161
|
+
while item := self.match(uni.KVPair):
|
|
2363
2162
|
kv_pairs.append(item)
|
|
2364
2163
|
self.match_token(Tok.COMMA)
|
|
2365
2164
|
self.consume_token(Tok.RBRACE)
|
|
2366
|
-
return
|
|
2165
|
+
return uni.DictVal(
|
|
2367
2166
|
kv_pairs=kv_pairs,
|
|
2368
2167
|
kid=self.cur_nodes,
|
|
2369
2168
|
)
|
|
2370
2169
|
|
|
2371
|
-
def kv_pair(self, _: None) ->
|
|
2170
|
+
def kv_pair(self, _: None) -> uni.KVPair:
|
|
2372
2171
|
"""Grammar rule.
|
|
2373
2172
|
|
|
2374
2173
|
kv_pair: expression COLON expression | STAR_POW expression
|
|
2375
2174
|
"""
|
|
2376
2175
|
if self.match_token(Tok.STAR_POW):
|
|
2377
|
-
value = self.consume(
|
|
2378
|
-
return
|
|
2176
|
+
value = self.consume(uni.Expr)
|
|
2177
|
+
return uni.KVPair(
|
|
2379
2178
|
key=None,
|
|
2380
2179
|
value=value,
|
|
2381
2180
|
kid=self.cur_nodes,
|
|
2382
2181
|
)
|
|
2383
|
-
key = self.consume(
|
|
2182
|
+
key = self.consume(uni.Expr)
|
|
2384
2183
|
self.consume_token(Tok.COLON)
|
|
2385
|
-
value = self.consume(
|
|
2386
|
-
return
|
|
2184
|
+
value = self.consume(uni.Expr)
|
|
2185
|
+
return uni.KVPair(
|
|
2387
2186
|
key=key,
|
|
2388
2187
|
value=value,
|
|
2389
2188
|
kid=self.cur_nodes,
|
|
2390
2189
|
)
|
|
2391
2190
|
|
|
2392
|
-
def list_compr(self, _: None) ->
|
|
2191
|
+
def list_compr(self, _: None) -> uni.ListCompr:
|
|
2393
2192
|
"""Grammar rule.
|
|
2394
2193
|
|
|
2395
2194
|
list_compr: LSQUARE expression inner_compr+ RSQUARE
|
|
2396
2195
|
"""
|
|
2397
2196
|
self.consume_token(Tok.LSQUARE)
|
|
2398
|
-
out_expr = self.consume(
|
|
2399
|
-
comprs = self.consume_many(
|
|
2197
|
+
out_expr = self.consume(uni.Expr)
|
|
2198
|
+
comprs = self.consume_many(uni.InnerCompr)
|
|
2400
2199
|
self.consume_token(Tok.RSQUARE)
|
|
2401
|
-
return
|
|
2200
|
+
return uni.ListCompr(
|
|
2402
2201
|
out_expr=out_expr,
|
|
2403
2202
|
compr=comprs,
|
|
2404
2203
|
kid=self.cur_nodes,
|
|
2405
2204
|
)
|
|
2406
2205
|
|
|
2407
|
-
def gen_compr(self, _: None) ->
|
|
2206
|
+
def gen_compr(self, _: None) -> uni.GenCompr:
|
|
2408
2207
|
"""Grammar rule.
|
|
2409
2208
|
|
|
2410
2209
|
gen_compr: LPAREN expression inner_compr+ RPAREN
|
|
2411
2210
|
"""
|
|
2412
2211
|
self.consume_token(Tok.LPAREN)
|
|
2413
|
-
out_expr = self.consume(
|
|
2414
|
-
comprs = self.consume_many(
|
|
2212
|
+
out_expr = self.consume(uni.Expr)
|
|
2213
|
+
comprs = self.consume_many(uni.InnerCompr)
|
|
2415
2214
|
self.consume_token(Tok.RPAREN)
|
|
2416
|
-
return
|
|
2215
|
+
return uni.GenCompr(
|
|
2417
2216
|
out_expr=out_expr,
|
|
2418
2217
|
compr=comprs,
|
|
2419
2218
|
kid=self.cur_nodes,
|
|
2420
2219
|
)
|
|
2421
2220
|
|
|
2422
|
-
def set_compr(self, _: None) ->
|
|
2221
|
+
def set_compr(self, _: None) -> uni.SetCompr:
|
|
2423
2222
|
"""Grammar rule.
|
|
2424
2223
|
|
|
2425
2224
|
set_compr: LBRACE expression inner_compr+ RBRACE
|
|
2426
2225
|
"""
|
|
2427
2226
|
self.consume_token(Tok.LBRACE)
|
|
2428
|
-
out_expr = self.consume(
|
|
2429
|
-
comprs = self.consume_many(
|
|
2227
|
+
out_expr = self.consume(uni.Expr)
|
|
2228
|
+
comprs = self.consume_many(uni.InnerCompr)
|
|
2430
2229
|
self.consume_token(Tok.RBRACE)
|
|
2431
|
-
return
|
|
2230
|
+
return uni.SetCompr(
|
|
2432
2231
|
out_expr=out_expr,
|
|
2433
2232
|
compr=comprs,
|
|
2434
2233
|
kid=self.cur_nodes,
|
|
2435
2234
|
)
|
|
2436
2235
|
|
|
2437
|
-
def dict_compr(self, _: None) ->
|
|
2236
|
+
def dict_compr(self, _: None) -> uni.DictCompr:
|
|
2438
2237
|
"""Grammar rule.
|
|
2439
2238
|
|
|
2440
2239
|
dict_compr: LBRACE kv_pair inner_compr+ RBRACE
|
|
2441
2240
|
"""
|
|
2442
2241
|
self.consume_token(Tok.LBRACE)
|
|
2443
|
-
kv_pair = self.consume(
|
|
2444
|
-
comprs = self.consume_many(
|
|
2242
|
+
kv_pair = self.consume(uni.KVPair)
|
|
2243
|
+
comprs = self.consume_many(uni.InnerCompr)
|
|
2445
2244
|
self.consume_token(Tok.RBRACE)
|
|
2446
|
-
return
|
|
2245
|
+
return uni.DictCompr(
|
|
2447
2246
|
kv_pair=kv_pair,
|
|
2448
2247
|
compr=comprs,
|
|
2449
2248
|
kid=self.cur_nodes,
|
|
2450
2249
|
)
|
|
2451
2250
|
|
|
2452
|
-
def inner_compr(self, _: None) ->
|
|
2251
|
+
def inner_compr(self, _: None) -> uni.InnerCompr:
|
|
2453
2252
|
"""Grammar rule.
|
|
2454
2253
|
|
|
2455
2254
|
inner_compr: KW_ASYNC? KW_FOR atomic_chain KW_IN pipe_call (KW_IF walrus_assign)*
|
|
@@ -2457,12 +2256,12 @@ class JacParser(Pass):
|
|
|
2457
2256
|
conditional: list = []
|
|
2458
2257
|
is_async = bool(self.match_token(Tok.KW_ASYNC))
|
|
2459
2258
|
self.consume_token(Tok.KW_FOR)
|
|
2460
|
-
target = self.consume(
|
|
2259
|
+
target = self.consume(uni.Expr)
|
|
2461
2260
|
self.consume_token(Tok.KW_IN)
|
|
2462
|
-
collection = self.consume(
|
|
2261
|
+
collection = self.consume(uni.Expr)
|
|
2463
2262
|
while self.match_token(Tok.KW_IF):
|
|
2464
|
-
conditional.append(self.consume(
|
|
2465
|
-
return
|
|
2263
|
+
conditional.append(self.consume(uni.Expr))
|
|
2264
|
+
return uni.InnerCompr(
|
|
2466
2265
|
is_async=is_async,
|
|
2467
2266
|
target=target,
|
|
2468
2267
|
collection=collection,
|
|
@@ -2470,293 +2269,106 @@ class JacParser(Pass):
|
|
|
2470
2269
|
kid=self.cur_nodes,
|
|
2471
2270
|
)
|
|
2472
2271
|
|
|
2473
|
-
def param_list(self, _: None) ->
|
|
2272
|
+
def param_list(self, _: None) -> list[uni.UniNode]:
|
|
2474
2273
|
"""Grammar rule.
|
|
2475
2274
|
|
|
2476
2275
|
param_list: expr_list COMMA kw_expr_list COMMA?
|
|
2477
2276
|
| kw_expr_list COMMA?
|
|
2478
2277
|
| expr_list COMMA?
|
|
2479
2278
|
"""
|
|
2480
|
-
|
|
2481
|
-
expr_list = self.consume(ast.SubNodeList)
|
|
2482
|
-
if len(self.cur_nodes) > 2:
|
|
2483
|
-
self.consume_token(Tok.COMMA)
|
|
2484
|
-
kw_expr_list = self.consume(ast.SubNodeList)
|
|
2485
|
-
ends_comma = self.match_token(Tok.COMMA)
|
|
2486
|
-
if kw_expr_list:
|
|
2487
|
-
valid_kid = [
|
|
2488
|
-
i
|
|
2489
|
-
for i in [*expr_list.items, *kw_expr_list.items]
|
|
2490
|
-
if isinstance(i, (ast.Expr, ast.KWPair))
|
|
2491
|
-
]
|
|
2492
|
-
return ast.SubNodeList[ast.Expr | ast.KWPair](
|
|
2493
|
-
items=valid_kid,
|
|
2494
|
-
delim=Tok.COMMA,
|
|
2495
|
-
kid=self.cur_nodes,
|
|
2496
|
-
)
|
|
2497
|
-
else:
|
|
2498
|
-
if ends_comma:
|
|
2499
|
-
expr_list.kid.append(ends_comma)
|
|
2500
|
-
return expr_list
|
|
2501
|
-
|
|
2502
|
-
def assignment_list(self, _: None) -> ast.SubNodeList[ast.Assignment]:
|
|
2503
|
-
"""Grammar rule.
|
|
2504
|
-
|
|
2505
|
-
assignment_list: assignment_list COMMA assignment | assignment
|
|
2506
|
-
"""
|
|
2507
|
-
if consume := self.match(ast.SubNodeList):
|
|
2508
|
-
comma = self.consume_token(Tok.COMMA)
|
|
2509
|
-
assign = self.consume(ast.Assignment)
|
|
2510
|
-
new_kid = [*consume.kid, comma, assign]
|
|
2511
|
-
else:
|
|
2512
|
-
assign = self.consume(ast.Assignment)
|
|
2513
|
-
new_kid = [assign]
|
|
2514
|
-
valid_kid = [i for i in new_kid if isinstance(i, ast.Assignment)]
|
|
2515
|
-
return ast.SubNodeList[ast.Assignment](
|
|
2516
|
-
items=valid_kid,
|
|
2517
|
-
delim=Tok.COMMA,
|
|
2518
|
-
kid=new_kid,
|
|
2519
|
-
)
|
|
2520
|
-
|
|
2521
|
-
def arch_ref(self, kid: list[ast.AstNode]) -> ast.ArchRef:
|
|
2522
|
-
"""Grammar rule.
|
|
2523
|
-
|
|
2524
|
-
arch_ref: object_ref
|
|
2525
|
-
| walker_ref
|
|
2526
|
-
| edge_ref
|
|
2527
|
-
| node_ref
|
|
2528
|
-
| type_ref
|
|
2529
|
-
"""
|
|
2530
|
-
return self.consume(ast.ArchRef)
|
|
2531
|
-
|
|
2532
|
-
def node_ref(self, kid: list[ast.AstNode]) -> ast.ArchRef:
|
|
2533
|
-
"""Grammar rule.
|
|
2534
|
-
|
|
2535
|
-
node_ref: NODE_OP NAME
|
|
2536
|
-
"""
|
|
2537
|
-
arch_type = self.consume(ast.Token)
|
|
2538
|
-
arch_name = self.consume(ast.NameAtom)
|
|
2539
|
-
return ast.ArchRef(
|
|
2540
|
-
arch_type=arch_type,
|
|
2541
|
-
arch_name=arch_name,
|
|
2542
|
-
kid=self.cur_nodes,
|
|
2543
|
-
)
|
|
2544
|
-
|
|
2545
|
-
def edge_ref(self, kid: list[ast.AstNode]) -> ast.ArchRef:
|
|
2546
|
-
"""Grammar rule.
|
|
2547
|
-
|
|
2548
|
-
edge_ref: EDGE_OP NAME
|
|
2549
|
-
"""
|
|
2550
|
-
arch_type = self.consume(ast.Token)
|
|
2551
|
-
arch_name = self.consume(ast.NameAtom)
|
|
2552
|
-
return ast.ArchRef(
|
|
2553
|
-
arch_type=arch_type,
|
|
2554
|
-
arch_name=arch_name,
|
|
2555
|
-
kid=self.cur_nodes,
|
|
2556
|
-
)
|
|
2279
|
+
return self.flat_cur_nodes
|
|
2557
2280
|
|
|
2558
|
-
def
|
|
2281
|
+
def assignment_list(self, _: None) -> list[uni.UniNode]:
|
|
2559
2282
|
"""Grammar rule.
|
|
2560
2283
|
|
|
2561
|
-
|
|
2284
|
+
assignment_list: (assignment_list COMMA)? (assignment | NAME)
|
|
2562
2285
|
"""
|
|
2563
|
-
arch_type = self.consume(ast.Token)
|
|
2564
|
-
arch_name = self.consume(ast.NameAtom)
|
|
2565
|
-
return ast.ArchRef(
|
|
2566
|
-
arch_type=arch_type,
|
|
2567
|
-
arch_name=arch_name,
|
|
2568
|
-
kid=self.cur_nodes,
|
|
2569
|
-
)
|
|
2570
2286
|
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
"""
|
|
2576
|
-
arch_type = self.consume(ast.Token)
|
|
2577
|
-
arch_name = self.consume(ast.NameAtom)
|
|
2578
|
-
return ast.ArchRef(
|
|
2579
|
-
arch_type=arch_type,
|
|
2580
|
-
arch_name=arch_name,
|
|
2581
|
-
kid=self.cur_nodes,
|
|
2582
|
-
)
|
|
2583
|
-
|
|
2584
|
-
def object_ref(self, kid: list[ast.AstNode]) -> ast.ArchRef:
|
|
2585
|
-
"""Grammar rule.
|
|
2287
|
+
def name_to_assign(name_consume: uni.NameAtom) -> uni.Assignment:
|
|
2288
|
+
return uni.Assignment(
|
|
2289
|
+
target=[name_consume], value=None, type_tag=None, kid=[name_consume]
|
|
2290
|
+
)
|
|
2586
2291
|
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2292
|
+
if self.match(list):
|
|
2293
|
+
self.consume_token(Tok.COMMA)
|
|
2294
|
+
if self.match(uni.Assignment):
|
|
2295
|
+
pass
|
|
2296
|
+
elif name_consume := self.match(uni.NameAtom):
|
|
2297
|
+
self.cur_nodes[self.node_idx - 1] = name_to_assign(name_consume)
|
|
2298
|
+
else:
|
|
2299
|
+
assign = self.consume(uni.Assignment)
|
|
2300
|
+
self.cur_nodes[self.node_idx - 1] = assign
|
|
2301
|
+
return self.flat_cur_nodes
|
|
2596
2302
|
|
|
2597
|
-
def type_ref(self, kid: list[
|
|
2303
|
+
def type_ref(self, kid: list[uni.UniNode]) -> uni.TypeRef:
|
|
2598
2304
|
"""Grammar rule.
|
|
2599
2305
|
|
|
2600
2306
|
type_ref: TYPE_OP (named_ref | builtin_type)
|
|
2601
2307
|
"""
|
|
2602
|
-
|
|
2603
|
-
arch_name = self.consume(
|
|
2604
|
-
return
|
|
2605
|
-
|
|
2606
|
-
arch_name=arch_name,
|
|
2607
|
-
kid=self.cur_nodes,
|
|
2608
|
-
)
|
|
2609
|
-
|
|
2610
|
-
def enum_ref(self, kid: list[ast.AstNode]) -> ast.ArchRef:
|
|
2611
|
-
"""Grammar rule.
|
|
2612
|
-
|
|
2613
|
-
enum_ref: ENUM_OP NAME
|
|
2614
|
-
"""
|
|
2615
|
-
arch_type = self.consume(ast.Token)
|
|
2616
|
-
arch_name = self.consume(ast.NameAtom)
|
|
2617
|
-
return ast.ArchRef(
|
|
2618
|
-
arch_type=arch_type,
|
|
2619
|
-
arch_name=arch_name,
|
|
2620
|
-
kid=self.cur_nodes,
|
|
2621
|
-
)
|
|
2622
|
-
|
|
2623
|
-
def ability_ref(self, _: None) -> ast.ArchRef:
|
|
2624
|
-
"""Grammar rule.
|
|
2625
|
-
|
|
2626
|
-
ability_ref: ABILITY_OP (special_ref | name_ref)
|
|
2627
|
-
"""
|
|
2628
|
-
arch_type = self.consume_token(Tok.ABILITY_OP)
|
|
2629
|
-
arch_name = self.consume(ast.NameAtom)
|
|
2630
|
-
return ast.ArchRef(
|
|
2631
|
-
arch_type=arch_type,
|
|
2632
|
-
arch_name=arch_name,
|
|
2308
|
+
self.consume(uni.Token)
|
|
2309
|
+
arch_name = self.consume(uni.NameAtom)
|
|
2310
|
+
return uni.TypeRef(
|
|
2311
|
+
target=arch_name,
|
|
2633
2312
|
kid=self.cur_nodes,
|
|
2634
2313
|
)
|
|
2635
2314
|
|
|
2636
|
-
def
|
|
2637
|
-
"""Grammar rule.
|
|
2638
|
-
|
|
2639
|
-
arch_or_ability_chain: arch_or_ability_chain? (ability_ref | arch_ref)
|
|
2640
|
-
"""
|
|
2641
|
-
consume = self.match(ast.ArchRefChain)
|
|
2642
|
-
name = self.consume(ast.ArchRef)
|
|
2643
|
-
new_kid = [*consume.kid, name] if consume else [name]
|
|
2644
|
-
valid_kid = [i for i in new_kid if isinstance(i, ast.ArchRef)]
|
|
2645
|
-
return ast.ArchRefChain(
|
|
2646
|
-
archs=valid_kid,
|
|
2647
|
-
kid=new_kid,
|
|
2648
|
-
)
|
|
2649
|
-
|
|
2650
|
-
def abil_to_arch_chain(self, _: None) -> ast.ArchRefChain:
|
|
2651
|
-
"""Grammar rule.
|
|
2652
|
-
|
|
2653
|
-
abil_to_arch_chain: arch_or_ability_chain? arch_ref
|
|
2654
|
-
"""
|
|
2655
|
-
arch_chain = self.match(ast.ArchRefChain)
|
|
2656
|
-
arch_ref = self.consume(ast.ArchRef)
|
|
2657
|
-
if arch_chain:
|
|
2658
|
-
return ast.ArchRefChain(
|
|
2659
|
-
archs=[*arch_chain.archs, arch_ref],
|
|
2660
|
-
kid=[*arch_chain.kid, arch_ref],
|
|
2661
|
-
)
|
|
2662
|
-
return ast.ArchRefChain(
|
|
2663
|
-
archs=[arch_ref],
|
|
2664
|
-
kid=[arch_ref],
|
|
2665
|
-
)
|
|
2666
|
-
|
|
2667
|
-
def arch_to_abil_chain(self, _: None) -> ast.ArchRefChain:
|
|
2315
|
+
def edge_ref_chain(self, _: None) -> uni.EdgeRefTrailer:
|
|
2668
2316
|
"""Grammar rule.
|
|
2669
2317
|
|
|
2670
|
-
|
|
2318
|
+
LSQUARE (KW_NODE| KW_EDGE)? expression? (edge_op_ref (filter_compr | expression)?)+ RSQUARE
|
|
2671
2319
|
"""
|
|
2672
|
-
arch_chain = self.match(ast.ArchRefChain)
|
|
2673
|
-
abil_ref = self.consume(ast.ArchRef)
|
|
2674
|
-
if arch_chain:
|
|
2675
|
-
return ast.ArchRefChain(
|
|
2676
|
-
archs=[*arch_chain.archs, abil_ref],
|
|
2677
|
-
kid=[*arch_chain.kid, abil_ref],
|
|
2678
|
-
)
|
|
2679
|
-
return ast.ArchRefChain(
|
|
2680
|
-
archs=[abil_ref],
|
|
2681
|
-
kid=[abil_ref],
|
|
2682
|
-
)
|
|
2683
|
-
|
|
2684
|
-
def arch_to_enum_chain(self, _: None) -> ast.ArchRefChain:
|
|
2685
|
-
"""Grammar rule.
|
|
2686
|
-
|
|
2687
|
-
arch_to_enum_chain: arch_or_ability_chain? enum_ref
|
|
2688
|
-
"""
|
|
2689
|
-
arch_chain = self.match(ast.ArchRefChain)
|
|
2690
|
-
enum_ref = self.consume(ast.ArchRef)
|
|
2691
|
-
if arch_chain:
|
|
2692
|
-
return ast.ArchRefChain(
|
|
2693
|
-
archs=[*arch_chain.archs, enum_ref],
|
|
2694
|
-
kid=[*arch_chain.kid, enum_ref],
|
|
2695
|
-
)
|
|
2696
|
-
return ast.ArchRefChain(
|
|
2697
|
-
archs=[enum_ref],
|
|
2698
|
-
kid=[enum_ref],
|
|
2699
|
-
)
|
|
2700
|
-
|
|
2701
|
-
def edge_ref_chain(self, _: None) -> ast.EdgeRefTrailer:
|
|
2702
|
-
"""Grammar rule.
|
|
2703
|
-
|
|
2704
|
-
(EDGE_OP|NODE_OP)? LSQUARE expression? (edge_op_ref (filter_compr | expression)?)+ RSQUARE
|
|
2705
|
-
"""
|
|
2706
|
-
edges_only = bool(self.match_token(Tok.EDGE_OP))
|
|
2707
|
-
self.match_token(Tok.NODE_OP)
|
|
2708
2320
|
self.consume_token(Tok.LSQUARE)
|
|
2321
|
+
edges_only = bool(self.match_token(Tok.KW_EDGE))
|
|
2322
|
+
self.match_token(Tok.KW_NODE)
|
|
2709
2323
|
valid_chain = []
|
|
2710
|
-
if expr := self.match(
|
|
2324
|
+
if expr := self.match(uni.Expr):
|
|
2711
2325
|
valid_chain.append(expr)
|
|
2712
|
-
valid_chain.extend(self.match_many(
|
|
2326
|
+
valid_chain.extend(self.match_many(uni.Expr))
|
|
2713
2327
|
self.consume_token(Tok.RSQUARE)
|
|
2714
|
-
return
|
|
2328
|
+
return uni.EdgeRefTrailer(
|
|
2715
2329
|
chain=valid_chain,
|
|
2716
2330
|
edges_only=edges_only,
|
|
2717
2331
|
kid=self.cur_nodes,
|
|
2718
2332
|
)
|
|
2719
2333
|
|
|
2720
|
-
def edge_op_ref(self, kid: list[
|
|
2334
|
+
def edge_op_ref(self, kid: list[uni.UniNode]) -> uni.EdgeOpRef:
|
|
2721
2335
|
"""Grammar rule.
|
|
2722
2336
|
|
|
2723
2337
|
edge_op_ref: (edge_any | edge_from | edge_to)
|
|
2724
2338
|
"""
|
|
2725
|
-
return self.consume(
|
|
2339
|
+
return self.consume(uni.EdgeOpRef)
|
|
2726
2340
|
|
|
2727
|
-
def edge_to(self, _: None) ->
|
|
2341
|
+
def edge_to(self, _: None) -> uni.EdgeOpRef:
|
|
2728
2342
|
"""Grammar rule.
|
|
2729
2343
|
|
|
2730
|
-
edge_to: ARROW_R_P1 typed_filter_compare_list ARROW_R_P2
|
|
2731
|
-
| ARROW_R
|
|
2344
|
+
edge_to: ARROW_R | ARROW_R_P1 typed_filter_compare_list ARROW_R_P2
|
|
2732
2345
|
"""
|
|
2733
2346
|
if self.match_token(Tok.ARROW_R):
|
|
2734
2347
|
fcond = None
|
|
2735
2348
|
else:
|
|
2736
2349
|
self.consume_token(Tok.ARROW_R_P1)
|
|
2737
|
-
fcond = self.consume(
|
|
2350
|
+
fcond = self.consume(uni.FilterCompr)
|
|
2738
2351
|
self.consume_token(Tok.ARROW_R_P2)
|
|
2739
|
-
return
|
|
2352
|
+
return uni.EdgeOpRef(
|
|
2740
2353
|
filter_cond=fcond, edge_dir=EdgeDir.OUT, kid=self.cur_nodes
|
|
2741
2354
|
)
|
|
2742
2355
|
|
|
2743
|
-
def edge_from(self, _: None) ->
|
|
2356
|
+
def edge_from(self, _: None) -> uni.EdgeOpRef:
|
|
2744
2357
|
"""Grammar rule.
|
|
2745
2358
|
|
|
2746
|
-
edge_from: ARROW_L_P1 typed_filter_compare_list ARROW_L_P2
|
|
2747
|
-
| ARROW_L
|
|
2359
|
+
edge_from: ARROW_L | ARROW_L_P1 typed_filter_compare_list ARROW_L_P2
|
|
2748
2360
|
"""
|
|
2749
2361
|
if self.match_token(Tok.ARROW_L):
|
|
2750
2362
|
fcond = None
|
|
2751
2363
|
else:
|
|
2752
2364
|
self.consume_token(Tok.ARROW_L_P1)
|
|
2753
|
-
fcond = self.consume(
|
|
2365
|
+
fcond = self.consume(uni.FilterCompr)
|
|
2754
2366
|
self.consume_token(Tok.ARROW_L_P2)
|
|
2755
|
-
return
|
|
2367
|
+
return uni.EdgeOpRef(
|
|
2756
2368
|
filter_cond=fcond, edge_dir=EdgeDir.IN, kid=self.cur_nodes
|
|
2757
2369
|
)
|
|
2758
2370
|
|
|
2759
|
-
def edge_any(self, _: None) ->
|
|
2371
|
+
def edge_any(self, _: None) -> uni.EdgeOpRef:
|
|
2760
2372
|
"""Grammar rule.
|
|
2761
2373
|
|
|
2762
2374
|
edge_any: ARROW_L_P1 typed_filter_compare_list ARROW_R_P2
|
|
@@ -2766,128 +2378,129 @@ class JacParser(Pass):
|
|
|
2766
2378
|
fcond = None
|
|
2767
2379
|
else:
|
|
2768
2380
|
self.consume_token(Tok.ARROW_L_P1)
|
|
2769
|
-
fcond = self.consume(
|
|
2381
|
+
fcond = self.consume(uni.FilterCompr)
|
|
2770
2382
|
self.consume_token(Tok.ARROW_R_P2)
|
|
2771
|
-
return
|
|
2383
|
+
return uni.EdgeOpRef(
|
|
2772
2384
|
filter_cond=fcond, edge_dir=EdgeDir.ANY, kid=self.cur_nodes
|
|
2773
2385
|
)
|
|
2774
2386
|
|
|
2775
|
-
def connect_op(self, _: None) ->
|
|
2387
|
+
def connect_op(self, _: None) -> uni.ConnectOp:
|
|
2776
2388
|
"""Grammar rule.
|
|
2777
2389
|
|
|
2778
2390
|
connect_op: connect_from | connect_to | connect_any
|
|
2779
2391
|
"""
|
|
2780
|
-
return self.consume(
|
|
2392
|
+
return self.consume(uni.ConnectOp)
|
|
2781
2393
|
|
|
2782
|
-
def disconnect_op(self, kid: list[
|
|
2394
|
+
def disconnect_op(self, kid: list[uni.UniNode]) -> uni.DisconnectOp:
|
|
2783
2395
|
"""Grammar rule.
|
|
2784
2396
|
|
|
2785
|
-
disconnect_op:
|
|
2397
|
+
disconnect_op: KW_DELETE edge_op_ref
|
|
2786
2398
|
"""
|
|
2787
|
-
if isinstance(kid[1],
|
|
2788
|
-
return
|
|
2399
|
+
if isinstance(kid[1], uni.EdgeOpRef):
|
|
2400
|
+
return uni.DisconnectOp(
|
|
2789
2401
|
edge_spec=kid[1],
|
|
2790
2402
|
kid=kid,
|
|
2791
2403
|
)
|
|
2792
2404
|
else:
|
|
2793
2405
|
raise self.ice()
|
|
2794
2406
|
|
|
2795
|
-
def connect_to(self, _: None) ->
|
|
2407
|
+
def connect_to(self, _: None) -> uni.ConnectOp:
|
|
2796
2408
|
"""Grammar rule.
|
|
2797
2409
|
|
|
2798
|
-
connect_to: CARROW_R_P1 expression (COLON kw_expr_list)? CARROW_R_P2
|
|
2799
|
-
| CARROW_R
|
|
2410
|
+
connect_to: CARROW_R | CARROW_R_P1 expression (COLON kw_expr_list)? CARROW_R_P2
|
|
2800
2411
|
"""
|
|
2801
|
-
conn_type:
|
|
2802
|
-
conn_assign_sub:
|
|
2412
|
+
conn_type: uni.Expr | None = None
|
|
2413
|
+
conn_assign_sub: list[uni.UniNode] | None = None
|
|
2803
2414
|
if self.match_token(Tok.CARROW_R_P1):
|
|
2804
|
-
conn_type = self.consume(
|
|
2415
|
+
conn_type = self.consume(uni.Expr)
|
|
2805
2416
|
conn_assign_sub = (
|
|
2806
|
-
self.consume(
|
|
2807
|
-
if self.match_token(Tok.COLON)
|
|
2808
|
-
else None
|
|
2417
|
+
self.consume(list) if self.match_token(Tok.COLON) else None
|
|
2809
2418
|
)
|
|
2810
2419
|
self.consume_token(Tok.CARROW_R_P2)
|
|
2811
2420
|
else:
|
|
2812
2421
|
self.consume_token(Tok.CARROW_R)
|
|
2813
2422
|
conn_assign = (
|
|
2814
|
-
|
|
2423
|
+
uni.AssignCompr(
|
|
2424
|
+
assigns=self.extract_from_list(conn_assign_sub, uni.KWPair),
|
|
2425
|
+
kid=conn_assign_sub,
|
|
2426
|
+
)
|
|
2815
2427
|
if conn_assign_sub
|
|
2816
2428
|
else None
|
|
2817
2429
|
)
|
|
2818
2430
|
if conn_assign:
|
|
2819
2431
|
self.cur_nodes[3] = conn_assign
|
|
2820
|
-
return
|
|
2432
|
+
return uni.ConnectOp(
|
|
2821
2433
|
conn_type=conn_type,
|
|
2822
2434
|
conn_assign=conn_assign,
|
|
2823
2435
|
edge_dir=EdgeDir.OUT,
|
|
2824
|
-
kid=self.
|
|
2436
|
+
kid=self.flat_cur_nodes,
|
|
2825
2437
|
)
|
|
2826
2438
|
|
|
2827
|
-
def connect_from(self, _: None) ->
|
|
2439
|
+
def connect_from(self, _: None) -> uni.ConnectOp:
|
|
2828
2440
|
"""Grammar rule.
|
|
2829
2441
|
|
|
2830
|
-
connect_from: CARROW_L_P1 expression (COLON kw_expr_list)? CARROW_L_P2
|
|
2831
|
-
| CARROW_L
|
|
2442
|
+
connect_from: CARROW_L | CARROW_L_P1 expression (COLON kw_expr_list)? CARROW_L_P2
|
|
2832
2443
|
"""
|
|
2833
|
-
conn_type:
|
|
2834
|
-
conn_assign_sub:
|
|
2444
|
+
conn_type: uni.Expr | None = None
|
|
2445
|
+
conn_assign_sub: list[uni.UniNode] | None = None
|
|
2835
2446
|
if self.match_token(Tok.CARROW_L_P1):
|
|
2836
|
-
conn_type = self.consume(
|
|
2447
|
+
conn_type = self.consume(uni.Expr)
|
|
2837
2448
|
conn_assign_sub = (
|
|
2838
|
-
self.consume(
|
|
2839
|
-
if self.match_token(Tok.COLON)
|
|
2840
|
-
else None
|
|
2449
|
+
self.consume(list) if self.match_token(Tok.COLON) else None
|
|
2841
2450
|
)
|
|
2842
2451
|
self.consume_token(Tok.CARROW_L_P2)
|
|
2843
2452
|
else:
|
|
2844
2453
|
self.consume_token(Tok.CARROW_L)
|
|
2845
2454
|
conn_assign = (
|
|
2846
|
-
|
|
2455
|
+
uni.AssignCompr(
|
|
2456
|
+
assigns=self.extract_from_list(conn_assign_sub, uni.KWPair),
|
|
2457
|
+
kid=conn_assign_sub,
|
|
2458
|
+
)
|
|
2847
2459
|
if conn_assign_sub
|
|
2848
2460
|
else None
|
|
2849
2461
|
)
|
|
2850
2462
|
if conn_assign:
|
|
2851
2463
|
self.cur_nodes[3] = conn_assign
|
|
2852
|
-
return
|
|
2464
|
+
return uni.ConnectOp(
|
|
2853
2465
|
conn_type=conn_type,
|
|
2854
2466
|
conn_assign=conn_assign,
|
|
2855
2467
|
edge_dir=EdgeDir.IN,
|
|
2856
|
-
kid=self.
|
|
2468
|
+
kid=self.flat_cur_nodes,
|
|
2857
2469
|
)
|
|
2858
2470
|
|
|
2859
|
-
def connect_any(self, _: None) ->
|
|
2471
|
+
def connect_any(self, _: None) -> uni.ConnectOp:
|
|
2860
2472
|
"""Grammar rule.
|
|
2861
2473
|
|
|
2862
2474
|
connect_any: CARROW_BI | CARROW_L_P1 expression (COLON kw_expr_list)? CARROW_R_P2
|
|
2863
2475
|
"""
|
|
2864
|
-
conn_type:
|
|
2865
|
-
conn_assign_sub:
|
|
2476
|
+
conn_type: uni.Expr | None = None
|
|
2477
|
+
conn_assign_sub: list[uni.UniNode] | None = None
|
|
2866
2478
|
if self.match_token(Tok.CARROW_L_P1):
|
|
2867
|
-
conn_type = self.consume(
|
|
2479
|
+
conn_type = self.consume(uni.Expr)
|
|
2868
2480
|
conn_assign_sub = (
|
|
2869
|
-
self.consume(
|
|
2870
|
-
if self.match_token(Tok.COLON)
|
|
2871
|
-
else None
|
|
2481
|
+
self.consume(list) if self.match_token(Tok.COLON) else None
|
|
2872
2482
|
)
|
|
2873
2483
|
self.consume_token(Tok.CARROW_R_P2)
|
|
2874
2484
|
else:
|
|
2875
2485
|
self.consume_token(Tok.CARROW_BI)
|
|
2876
2486
|
conn_assign = (
|
|
2877
|
-
|
|
2487
|
+
uni.AssignCompr(
|
|
2488
|
+
assigns=self.extract_from_list(conn_assign_sub, uni.KWPair),
|
|
2489
|
+
kid=conn_assign_sub,
|
|
2490
|
+
)
|
|
2878
2491
|
if conn_assign_sub
|
|
2879
2492
|
else None
|
|
2880
2493
|
)
|
|
2881
2494
|
if conn_assign:
|
|
2882
2495
|
self.cur_nodes[3] = conn_assign
|
|
2883
|
-
return
|
|
2496
|
+
return uni.ConnectOp(
|
|
2884
2497
|
conn_type=conn_type,
|
|
2885
2498
|
conn_assign=conn_assign,
|
|
2886
2499
|
edge_dir=EdgeDir.ANY,
|
|
2887
|
-
kid=self.
|
|
2500
|
+
kid=self.flat_cur_nodes,
|
|
2888
2501
|
)
|
|
2889
2502
|
|
|
2890
|
-
def filter_compr(self, _: None) ->
|
|
2503
|
+
def filter_compr(self, _: None) -> uni.FilterCompr:
|
|
2891
2504
|
"""Grammar rule.
|
|
2892
2505
|
|
|
2893
2506
|
filter_compr: LPAREN NULL_OK filter_compare_list RPAREN
|
|
@@ -2897,149 +2510,141 @@ class JacParser(Pass):
|
|
|
2897
2510
|
self.consume_token(Tok.LPAREN)
|
|
2898
2511
|
if self.match_token(Tok.TYPE_OP):
|
|
2899
2512
|
self.consume_token(Tok.NULL_OK)
|
|
2900
|
-
f_type = self.consume(
|
|
2513
|
+
f_type = self.consume(uni.FilterCompr)
|
|
2901
2514
|
f_type.add_kids_left(kid[:3])
|
|
2902
2515
|
f_type.add_kids_right(kid[4:])
|
|
2903
2516
|
self.consume_token(Tok.RPAREN)
|
|
2904
2517
|
return f_type
|
|
2905
2518
|
self.consume_token(Tok.NULL_OK)
|
|
2906
|
-
|
|
2519
|
+
compares_list = self.consume(list)
|
|
2907
2520
|
self.consume_token(Tok.RPAREN)
|
|
2908
|
-
return
|
|
2909
|
-
compares=
|
|
2521
|
+
return uni.FilterCompr(
|
|
2522
|
+
compares=self.extract_from_list(compares_list, uni.CompareExpr),
|
|
2910
2523
|
f_type=None,
|
|
2911
|
-
kid=self.
|
|
2524
|
+
kid=self.flat_cur_nodes,
|
|
2912
2525
|
)
|
|
2913
2526
|
|
|
2914
|
-
def filter_compare_list(self, _: None) ->
|
|
2527
|
+
def filter_compare_list(self, _: None) -> list[uni.UniNode]:
|
|
2915
2528
|
"""Grammar rule.
|
|
2916
2529
|
|
|
2917
2530
|
filter_compare_list: (filter_compare_list COMMA)? filter_compare_item
|
|
2918
2531
|
"""
|
|
2919
|
-
|
|
2920
|
-
comma = self.consume_token(Tok.COMMA)
|
|
2921
|
-
expr = self.consume(ast.CompareExpr)
|
|
2922
|
-
new_kid = [*consume.kid, comma, expr]
|
|
2923
|
-
else:
|
|
2924
|
-
expr = self.consume(ast.CompareExpr)
|
|
2925
|
-
new_kid = [expr]
|
|
2926
|
-
valid_kid = [i for i in new_kid if isinstance(i, ast.CompareExpr)]
|
|
2927
|
-
return ast.SubNodeList[ast.CompareExpr](
|
|
2928
|
-
items=valid_kid,
|
|
2929
|
-
delim=Tok.COMMA,
|
|
2930
|
-
kid=new_kid,
|
|
2931
|
-
)
|
|
2532
|
+
return self.flat_cur_nodes
|
|
2932
2533
|
|
|
2933
|
-
def typed_filter_compare_list(self, _: None) ->
|
|
2534
|
+
def typed_filter_compare_list(self, _: None) -> uni.FilterCompr:
|
|
2934
2535
|
"""Grammar rule.
|
|
2935
2536
|
|
|
2936
2537
|
typed_filter_compare_list: expression (COLON filter_compare_list)?
|
|
2937
2538
|
"""
|
|
2938
|
-
|
|
2939
|
-
expr = self.consume(
|
|
2539
|
+
compares_list: list[uni.UniNode] | None = None
|
|
2540
|
+
expr = self.consume(uni.Expr)
|
|
2940
2541
|
if self.match_token(Tok.COLON):
|
|
2941
|
-
|
|
2942
|
-
return
|
|
2542
|
+
compares_list = self.consume(list)
|
|
2543
|
+
return uni.FilterCompr(
|
|
2544
|
+
compares=self.extract_from_list(compares_list or [], uni.CompareExpr),
|
|
2545
|
+
f_type=expr,
|
|
2546
|
+
kid=self.flat_cur_nodes,
|
|
2547
|
+
)
|
|
2943
2548
|
|
|
2944
|
-
def filter_compare_item(self, _: None) ->
|
|
2549
|
+
def filter_compare_item(self, _: None) -> uni.CompareExpr:
|
|
2945
2550
|
"""Grammar rule.
|
|
2946
2551
|
|
|
2947
2552
|
filter_compare_item: name_ref cmp_op expression
|
|
2948
2553
|
"""
|
|
2949
|
-
name_ref = self.consume(
|
|
2950
|
-
cmp_op = self.consume(
|
|
2951
|
-
expr = self.consume(
|
|
2952
|
-
return
|
|
2554
|
+
name_ref = self.consume(uni.Name)
|
|
2555
|
+
cmp_op = self.consume(uni.Token)
|
|
2556
|
+
expr = self.consume(uni.Expr)
|
|
2557
|
+
return uni.CompareExpr(
|
|
2953
2558
|
left=name_ref, ops=[cmp_op], rights=[expr], kid=self.cur_nodes
|
|
2954
2559
|
)
|
|
2955
2560
|
|
|
2956
|
-
def assign_compr(self, _: None) ->
|
|
2561
|
+
def assign_compr(self, _: None) -> uni.AssignCompr:
|
|
2957
2562
|
"""Grammar rule.
|
|
2958
2563
|
|
|
2959
2564
|
filter_compr: LPAREN EQ kw_expr_list RPAREN
|
|
2960
2565
|
"""
|
|
2961
2566
|
self.consume_token(Tok.LPAREN)
|
|
2962
2567
|
self.consume_token(Tok.EQ)
|
|
2963
|
-
|
|
2568
|
+
assigns_sn = self.extract_from_list(self.consume(list), uni.KWPair)
|
|
2964
2569
|
self.consume_token(Tok.RPAREN)
|
|
2965
|
-
return
|
|
2570
|
+
return uni.AssignCompr(assigns=assigns_sn, kid=self.flat_cur_nodes)
|
|
2966
2571
|
|
|
2967
|
-
def match_stmt(self, _: None) ->
|
|
2572
|
+
def match_stmt(self, _: None) -> uni.MatchStmt:
|
|
2968
2573
|
"""Grammar rule.
|
|
2969
2574
|
|
|
2970
|
-
match_stmt: KW_MATCH
|
|
2575
|
+
match_stmt: KW_MATCH expression LBRACE match_case_block+ RBRACE
|
|
2971
2576
|
"""
|
|
2972
2577
|
self.consume_token(Tok.KW_MATCH)
|
|
2973
|
-
target = self.consume(
|
|
2578
|
+
target = self.consume(uni.Expr)
|
|
2974
2579
|
self.consume_token(Tok.LBRACE)
|
|
2975
|
-
cases = [self.consume(
|
|
2976
|
-
while case := self.match(
|
|
2580
|
+
cases = [self.consume(uni.MatchCase)]
|
|
2581
|
+
while case := self.match(uni.MatchCase):
|
|
2977
2582
|
cases.append(case)
|
|
2978
2583
|
self.consume_token(Tok.RBRACE)
|
|
2979
|
-
return
|
|
2584
|
+
return uni.MatchStmt(
|
|
2980
2585
|
target=target,
|
|
2981
2586
|
cases=cases,
|
|
2982
2587
|
kid=self.cur_nodes,
|
|
2983
2588
|
)
|
|
2984
2589
|
|
|
2985
|
-
def match_case_block(self, _: None) ->
|
|
2590
|
+
def match_case_block(self, _: None) -> uni.MatchCase:
|
|
2986
2591
|
"""Grammar rule.
|
|
2987
2592
|
|
|
2988
|
-
match_case_block: KW_CASE pattern_seq (KW_IF expression)? COLON
|
|
2593
|
+
match_case_block: KW_CASE pattern_seq (KW_IF expression)? COLON statement+
|
|
2989
2594
|
"""
|
|
2990
|
-
guard:
|
|
2595
|
+
guard: uni.Expr | None = None
|
|
2991
2596
|
self.consume_token(Tok.KW_CASE)
|
|
2992
|
-
pattern = self.consume(
|
|
2597
|
+
pattern = self.consume(uni.MatchPattern)
|
|
2993
2598
|
if self.match_token(Tok.KW_IF):
|
|
2994
|
-
guard = self.consume(
|
|
2599
|
+
guard = self.consume(uni.Expr)
|
|
2995
2600
|
self.consume_token(Tok.COLON)
|
|
2996
|
-
stmts = [self.consume(
|
|
2997
|
-
while stmt := self.match(
|
|
2601
|
+
stmts = [self.consume(uni.CodeBlockStmt)]
|
|
2602
|
+
while stmt := self.match(uni.CodeBlockStmt):
|
|
2998
2603
|
stmts.append(stmt)
|
|
2999
|
-
return
|
|
2604
|
+
return uni.MatchCase(
|
|
3000
2605
|
pattern=pattern,
|
|
3001
2606
|
guard=guard,
|
|
3002
2607
|
body=stmts,
|
|
3003
2608
|
kid=self.cur_nodes,
|
|
3004
2609
|
)
|
|
3005
2610
|
|
|
3006
|
-
def pattern_seq(self, _: None) ->
|
|
2611
|
+
def pattern_seq(self, _: None) -> uni.MatchPattern:
|
|
3007
2612
|
"""Grammar rule.
|
|
3008
2613
|
|
|
3009
2614
|
pattern_seq: (or_pattern | as_pattern)
|
|
3010
2615
|
"""
|
|
3011
|
-
return self.consume(
|
|
2616
|
+
return self.consume(uni.MatchPattern)
|
|
3012
2617
|
|
|
3013
|
-
def or_pattern(self, _: None) ->
|
|
2618
|
+
def or_pattern(self, _: None) -> uni.MatchPattern:
|
|
3014
2619
|
"""Grammar rule.
|
|
3015
2620
|
|
|
3016
2621
|
or_pattern: (pattern BW_OR)* pattern
|
|
3017
2622
|
"""
|
|
3018
|
-
patterns: list = [self.consume(
|
|
2623
|
+
patterns: list = [self.consume(uni.MatchPattern)]
|
|
3019
2624
|
while self.match_token(Tok.BW_OR):
|
|
3020
|
-
patterns.append(self.consume(
|
|
2625
|
+
patterns.append(self.consume(uni.MatchPattern))
|
|
3021
2626
|
if len(patterns) == 1:
|
|
3022
2627
|
return patterns[0]
|
|
3023
|
-
return
|
|
2628
|
+
return uni.MatchOr(
|
|
3024
2629
|
patterns=patterns,
|
|
3025
2630
|
kid=self.cur_nodes,
|
|
3026
2631
|
)
|
|
3027
2632
|
|
|
3028
|
-
def as_pattern(self, _: None) ->
|
|
2633
|
+
def as_pattern(self, _: None) -> uni.MatchPattern:
|
|
3029
2634
|
"""Grammar rule.
|
|
3030
2635
|
|
|
3031
|
-
as_pattern:
|
|
2636
|
+
as_pattern: or_pattern KW_AS NAME
|
|
3032
2637
|
"""
|
|
3033
|
-
pattern = self.consume(
|
|
2638
|
+
pattern = self.consume(uni.MatchPattern)
|
|
3034
2639
|
self.consume_token(Tok.KW_AS)
|
|
3035
|
-
name = self.consume(
|
|
3036
|
-
return
|
|
2640
|
+
name = self.consume(uni.NameAtom)
|
|
2641
|
+
return uni.MatchAs(
|
|
3037
2642
|
pattern=pattern,
|
|
3038
2643
|
name=name,
|
|
3039
2644
|
kid=self.cur_nodes,
|
|
3040
2645
|
)
|
|
3041
2646
|
|
|
3042
|
-
def pattern(self, kid: list[
|
|
2647
|
+
def pattern(self, kid: list[uni.UniNode]) -> uni.MatchPattern:
|
|
3043
2648
|
"""Grammar rule.
|
|
3044
2649
|
|
|
3045
2650
|
pattern: literal_pattern
|
|
@@ -3048,122 +2653,125 @@ class JacParser(Pass):
|
|
|
3048
2653
|
| mapping_pattern
|
|
3049
2654
|
| class_pattern
|
|
3050
2655
|
"""
|
|
3051
|
-
return self.consume(
|
|
2656
|
+
return self.consume(uni.MatchPattern)
|
|
3052
2657
|
|
|
3053
|
-
def literal_pattern(self, _: None) ->
|
|
2658
|
+
def literal_pattern(self, _: None) -> uni.MatchPattern:
|
|
3054
2659
|
"""Grammar rule.
|
|
3055
2660
|
|
|
3056
2661
|
literal_pattern: (INT | FLOAT | multistring)
|
|
3057
2662
|
"""
|
|
3058
|
-
value = self.consume(
|
|
3059
|
-
return
|
|
2663
|
+
value = self.consume(uni.Expr)
|
|
2664
|
+
return uni.MatchValue(
|
|
3060
2665
|
value=value,
|
|
3061
2666
|
kid=self.cur_nodes,
|
|
3062
2667
|
)
|
|
3063
2668
|
|
|
3064
|
-
def singleton_pattern(self, _: None) ->
|
|
2669
|
+
def singleton_pattern(self, _: None) -> uni.MatchPattern:
|
|
3065
2670
|
"""Grammar rule.
|
|
3066
2671
|
|
|
3067
2672
|
singleton_pattern: (NULL | BOOL)
|
|
3068
2673
|
"""
|
|
3069
|
-
value = self.match(
|
|
3070
|
-
return
|
|
2674
|
+
value = self.match(uni.Null) or self.consume(uni.Bool)
|
|
2675
|
+
return uni.MatchSingleton(
|
|
3071
2676
|
value=value,
|
|
3072
2677
|
kid=self.cur_nodes,
|
|
3073
2678
|
)
|
|
3074
2679
|
|
|
3075
|
-
def capture_pattern(self, _: None) ->
|
|
2680
|
+
def capture_pattern(self, _: None) -> uni.MatchPattern:
|
|
3076
2681
|
"""Grammar rule.
|
|
3077
2682
|
|
|
3078
2683
|
capture_pattern: NAME
|
|
3079
2684
|
"""
|
|
3080
|
-
name = self.consume(
|
|
2685
|
+
name = self.consume(uni.Name)
|
|
3081
2686
|
if name.sym_name == "_":
|
|
3082
|
-
return
|
|
2687
|
+
return uni.MatchWild(
|
|
3083
2688
|
kid=self.cur_nodes,
|
|
3084
2689
|
)
|
|
3085
|
-
return
|
|
2690
|
+
return uni.MatchAs(
|
|
3086
2691
|
name=name,
|
|
3087
2692
|
pattern=None,
|
|
3088
2693
|
kid=self.cur_nodes,
|
|
3089
2694
|
)
|
|
3090
2695
|
|
|
3091
|
-
def sequence_pattern(self, _: None) ->
|
|
2696
|
+
def sequence_pattern(self, _: None) -> uni.MatchPattern:
|
|
3092
2697
|
"""Grammar rule.
|
|
3093
2698
|
|
|
3094
2699
|
sequence_pattern: LSQUARE list_inner_pattern (COMMA list_inner_pattern)* RSQUARE
|
|
3095
2700
|
| LPAREN list_inner_pattern (COMMA list_inner_pattern)* RPAREN
|
|
3096
2701
|
"""
|
|
3097
2702
|
self.consume_token(Tok.LSQUARE) or self.consume_token(Tok.LPAREN)
|
|
3098
|
-
patterns = [self.consume(
|
|
2703
|
+
patterns = [self.consume(uni.MatchPattern)]
|
|
3099
2704
|
while self.match_token(Tok.COMMA):
|
|
3100
|
-
patterns.append(self.consume(
|
|
2705
|
+
patterns.append(self.consume(uni.MatchPattern))
|
|
3101
2706
|
self.consume_token(Tok.RSQUARE) or self.consume_token(Tok.RPAREN)
|
|
3102
|
-
return
|
|
2707
|
+
return uni.MatchSequence(
|
|
3103
2708
|
values=patterns,
|
|
3104
2709
|
kid=self.cur_nodes,
|
|
3105
2710
|
)
|
|
3106
2711
|
|
|
3107
|
-
def mapping_pattern(self, _: None) ->
|
|
2712
|
+
def mapping_pattern(self, _: None) -> uni.MatchMapping:
|
|
3108
2713
|
"""Grammar rule.
|
|
3109
2714
|
|
|
3110
2715
|
mapping_pattern: LBRACE (dict_inner_pattern (COMMA dict_inner_pattern)*)? RBRACE
|
|
3111
2716
|
"""
|
|
3112
2717
|
self.consume_token(Tok.LBRACE)
|
|
3113
|
-
patterns = [self.match(
|
|
2718
|
+
patterns = [self.match(uni.MatchKVPair) or self.consume(uni.MatchStar)]
|
|
3114
2719
|
while self.match_token(Tok.COMMA):
|
|
3115
2720
|
patterns.append(
|
|
3116
|
-
self.match(
|
|
2721
|
+
self.match(uni.MatchKVPair) or self.consume(uni.MatchStar)
|
|
3117
2722
|
)
|
|
3118
2723
|
self.consume_token(Tok.RBRACE)
|
|
3119
|
-
return
|
|
2724
|
+
return uni.MatchMapping(
|
|
3120
2725
|
values=patterns,
|
|
3121
2726
|
kid=self.cur_nodes,
|
|
3122
2727
|
)
|
|
3123
2728
|
|
|
3124
|
-
def list_inner_pattern(self, _: None) ->
|
|
2729
|
+
def list_inner_pattern(self, _: None) -> uni.MatchPattern:
|
|
3125
2730
|
"""Grammar rule.
|
|
3126
2731
|
|
|
3127
2732
|
list_inner_pattern: (pattern_seq | STAR_MUL NAME)
|
|
3128
2733
|
"""
|
|
3129
2734
|
if self.match_token(Tok.STAR_MUL):
|
|
3130
|
-
name = self.consume(
|
|
3131
|
-
return
|
|
2735
|
+
name = self.consume(uni.Name)
|
|
2736
|
+
return uni.MatchStar(
|
|
3132
2737
|
is_list=True,
|
|
3133
2738
|
name=name,
|
|
3134
2739
|
kid=self.cur_nodes,
|
|
3135
2740
|
)
|
|
3136
|
-
return self.consume(
|
|
2741
|
+
return self.consume(uni.MatchPattern)
|
|
3137
2742
|
|
|
3138
|
-
def dict_inner_pattern(self, _: None) ->
|
|
2743
|
+
def dict_inner_pattern(self, _: None) -> uni.MatchKVPair | uni.MatchStar:
|
|
3139
2744
|
"""Grammar rule.
|
|
3140
2745
|
|
|
3141
|
-
dict_inner_pattern: (
|
|
2746
|
+
dict_inner_pattern: (literal_pattern COLON pattern_seq | STAR_POW NAME)
|
|
3142
2747
|
"""
|
|
3143
2748
|
if self.match_token(Tok.STAR_POW):
|
|
3144
|
-
name = self.consume(
|
|
3145
|
-
return
|
|
2749
|
+
name = self.consume(uni.Name)
|
|
2750
|
+
return uni.MatchStar(
|
|
3146
2751
|
is_list=False,
|
|
3147
2752
|
name=name,
|
|
3148
2753
|
kid=self.cur_nodes,
|
|
3149
2754
|
)
|
|
3150
|
-
pattern = self.consume(
|
|
2755
|
+
pattern = self.consume(uni.MatchPattern)
|
|
3151
2756
|
self.consume_token(Tok.COLON)
|
|
3152
|
-
value = self.consume(
|
|
3153
|
-
return
|
|
2757
|
+
value = self.consume(uni.MatchPattern)
|
|
2758
|
+
return uni.MatchKVPair(key=pattern, value=value, kid=self.cur_nodes)
|
|
3154
2759
|
|
|
3155
|
-
def class_pattern(self, _: None) ->
|
|
2760
|
+
def class_pattern(self, _: None) -> uni.MatchArch:
|
|
3156
2761
|
"""Grammar rule.
|
|
3157
2762
|
|
|
3158
2763
|
class_pattern: NAME (DOT NAME)* LPAREN kw_pattern_list? RPAREN
|
|
3159
2764
|
| NAME (DOT NAME)* LPAREN pattern_list (COMMA kw_pattern_list)? RPAREN
|
|
3160
2765
|
"""
|
|
3161
|
-
|
|
3162
|
-
|
|
2766
|
+
name_idx = 0
|
|
2767
|
+
cur_element = self.consume(uni.NameAtom)
|
|
2768
|
+
name_idx += 1
|
|
2769
|
+
trailer: uni.AtomTrailer | None = None
|
|
3163
2770
|
while dot := self.match_token(Tok.DOT):
|
|
3164
2771
|
target = trailer if trailer else cur_element
|
|
3165
|
-
right = self.consume(
|
|
3166
|
-
|
|
2772
|
+
right = self.consume(uni.NameAtom)
|
|
2773
|
+
name_idx += 2
|
|
2774
|
+
trailer = uni.AtomTrailer(
|
|
3167
2775
|
target=target,
|
|
3168
2776
|
right=right,
|
|
3169
2777
|
is_attr=True,
|
|
@@ -3171,92 +2779,65 @@ class JacParser(Pass):
|
|
|
3171
2779
|
kid=[target, dot, right],
|
|
3172
2780
|
)
|
|
3173
2781
|
name = trailer if trailer else cur_element
|
|
3174
|
-
if not isinstance(name, (
|
|
2782
|
+
if not isinstance(name, (uni.NameAtom, uni.AtomTrailer)):
|
|
3175
2783
|
raise TypeError(
|
|
3176
2784
|
f"Expected name to be either NameAtom or AtomTrailer, got {type(name)}"
|
|
3177
2785
|
)
|
|
3178
|
-
|
|
3179
|
-
first = self.match(
|
|
3180
|
-
second =
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
)
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
first
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
second
|
|
3193
|
-
if (second and isinstance(second.items[0], ast.MatchKVPair))
|
|
3194
|
-
else (
|
|
3195
|
-
first
|
|
3196
|
-
if (first and isinstance(first.items[0], ast.MatchKVPair))
|
|
3197
|
-
else None
|
|
3198
|
-
)
|
|
3199
|
-
)
|
|
3200
|
-
kid_nodes: list = [name, lparen]
|
|
3201
|
-
if arg:
|
|
3202
|
-
kid_nodes.append(arg)
|
|
3203
|
-
if kw:
|
|
3204
|
-
kid_nodes.extend([comma, kw]) if comma else kid_nodes.append(kw)
|
|
3205
|
-
elif kw:
|
|
3206
|
-
kid_nodes.append(kw)
|
|
3207
|
-
kid_nodes.append(rparen)
|
|
3208
|
-
return ast.MatchArch(
|
|
2786
|
+
self.consume_token(Tok.LPAREN)
|
|
2787
|
+
first = self.match(list)
|
|
2788
|
+
second: list[uni.UniNode] | None = None
|
|
2789
|
+
has_kw = bool(first and any(isinstance(i, uni.MatchKVPair) for i in first))
|
|
2790
|
+
if first and not has_kw and self.match_token(Tok.COMMA):
|
|
2791
|
+
second = self.consume(list)
|
|
2792
|
+
self.consume_token(Tok.RPAREN)
|
|
2793
|
+
if has_kw:
|
|
2794
|
+
arg = None
|
|
2795
|
+
kw_list = first
|
|
2796
|
+
else:
|
|
2797
|
+
arg = first
|
|
2798
|
+
kw_list = second
|
|
2799
|
+
return uni.MatchArch(
|
|
3209
2800
|
name=name,
|
|
3210
|
-
arg_patterns=
|
|
3211
|
-
|
|
3212
|
-
|
|
2801
|
+
arg_patterns=(
|
|
2802
|
+
self.extract_from_list(arg, uni.MatchPattern) if arg else None
|
|
2803
|
+
),
|
|
2804
|
+
kw_patterns=(
|
|
2805
|
+
self.extract_from_list(kw_list, uni.MatchKVPair)
|
|
2806
|
+
if kw_list
|
|
2807
|
+
else None
|
|
2808
|
+
),
|
|
2809
|
+
kid=[name, *self.flat_cur_nodes[name_idx:]],
|
|
3213
2810
|
)
|
|
3214
2811
|
|
|
3215
|
-
def pattern_list(self, _: None) ->
|
|
2812
|
+
def pattern_list(self, _: None) -> list[uni.UniNode]:
|
|
3216
2813
|
"""Grammar rule.
|
|
3217
2814
|
|
|
3218
2815
|
pattern_list: (pattern_list COMMA)? pattern_seq
|
|
3219
2816
|
"""
|
|
3220
|
-
|
|
3221
|
-
comma = self.consume_token(Tok.COMMA)
|
|
3222
|
-
pattern = self.consume(ast.MatchPattern)
|
|
3223
|
-
else:
|
|
3224
|
-
pattern = self.consume(ast.MatchPattern)
|
|
3225
|
-
new_kid = [*consume.kid, comma, pattern] if consume else [pattern]
|
|
3226
|
-
valid_kid = [i for i in new_kid if isinstance(i, ast.MatchPattern)]
|
|
3227
|
-
return ast.SubNodeList[ast.MatchPattern](
|
|
3228
|
-
items=valid_kid,
|
|
3229
|
-
delim=Tok.COMMA,
|
|
3230
|
-
kid=new_kid,
|
|
3231
|
-
)
|
|
2817
|
+
return self.flat_cur_nodes
|
|
3232
2818
|
|
|
3233
|
-
def kw_pattern_list(self, _: None) ->
|
|
2819
|
+
def kw_pattern_list(self, _: None) -> list[uni.UniNode]:
|
|
3234
2820
|
"""Grammar rule.
|
|
3235
2821
|
|
|
3236
2822
|
kw_pattern_list: (kw_pattern_list COMMA)? named_ref EQ pattern_seq
|
|
3237
2823
|
"""
|
|
3238
|
-
new_kid: list = []
|
|
3239
|
-
if consume := self.match(
|
|
2824
|
+
new_kid: list[uni.UniNode] = []
|
|
2825
|
+
if consume := self.match(list):
|
|
3240
2826
|
comma = self.consume_token(Tok.COMMA)
|
|
3241
|
-
new_kid.extend([*consume
|
|
3242
|
-
name = self.consume(
|
|
2827
|
+
new_kid.extend([*consume, comma])
|
|
2828
|
+
name = self.consume(uni.NameAtom)
|
|
3243
2829
|
eq = self.consume_token(Tok.EQ)
|
|
3244
|
-
value = self.consume(
|
|
3245
|
-
new_kid.
|
|
3246
|
-
|
|
3247
|
-
)
|
|
3248
|
-
valid_kid = [i for i in new_kid if isinstance(i, ast.MatchKVPair)]
|
|
3249
|
-
return ast.SubNodeList[ast.MatchKVPair](
|
|
3250
|
-
items=valid_kid,
|
|
3251
|
-
delim=Tok.COMMA,
|
|
3252
|
-
kid=new_kid,
|
|
2830
|
+
value = self.consume(uni.MatchPattern)
|
|
2831
|
+
new_kid.append(
|
|
2832
|
+
uni.MatchKVPair(key=name, value=value, kid=[name, eq, value])
|
|
3253
2833
|
)
|
|
2834
|
+
return new_kid
|
|
3254
2835
|
|
|
3255
|
-
def __default_token__(self, token: jl.Token) ->
|
|
2836
|
+
def __default_token__(self, token: jl.Token) -> uni.Token:
|
|
3256
2837
|
"""Token handler."""
|
|
3257
|
-
ret_type =
|
|
2838
|
+
ret_type = uni.Token
|
|
3258
2839
|
if token.type in [Tok.NAME, Tok.KWESC_NAME]:
|
|
3259
|
-
ret_type =
|
|
2840
|
+
ret_type = uni.Name
|
|
3260
2841
|
if token.type in [
|
|
3261
2842
|
Tok.KW_INIT,
|
|
3262
2843
|
Tok.KW_POST_INIT,
|
|
@@ -3264,33 +2845,34 @@ class JacParser(Pass):
|
|
|
3264
2845
|
Tok.KW_SUPER,
|
|
3265
2846
|
Tok.KW_SELF,
|
|
3266
2847
|
Tok.KW_HERE,
|
|
2848
|
+
Tok.KW_VISITOR,
|
|
3267
2849
|
]:
|
|
3268
|
-
ret_type =
|
|
2850
|
+
ret_type = uni.Name
|
|
3269
2851
|
elif token.type == Tok.SEMI:
|
|
3270
|
-
ret_type =
|
|
2852
|
+
ret_type = uni.Semi
|
|
3271
2853
|
elif token.type == Tok.NULL:
|
|
3272
|
-
ret_type =
|
|
2854
|
+
ret_type = uni.Null
|
|
3273
2855
|
elif token.type == Tok.ELLIPSIS:
|
|
3274
|
-
ret_type =
|
|
2856
|
+
ret_type = uni.Ellipsis
|
|
3275
2857
|
elif token.type == Tok.FLOAT:
|
|
3276
|
-
ret_type =
|
|
2858
|
+
ret_type = uni.Float
|
|
3277
2859
|
elif token.type in [Tok.INT, Tok.INT, Tok.HEX, Tok.BIN, Tok.OCT]:
|
|
3278
|
-
ret_type =
|
|
2860
|
+
ret_type = uni.Int
|
|
3279
2861
|
elif token.type in [
|
|
3280
2862
|
Tok.STRING,
|
|
3281
2863
|
Tok.FSTR_BESC,
|
|
3282
2864
|
Tok.FSTR_PIECE,
|
|
3283
2865
|
Tok.FSTR_SQ_PIECE,
|
|
3284
2866
|
]:
|
|
3285
|
-
ret_type =
|
|
2867
|
+
ret_type = uni.String
|
|
3286
2868
|
if token.type == Tok.FSTR_BESC:
|
|
3287
2869
|
token.value = token.value[1:]
|
|
3288
2870
|
elif token.type == Tok.BOOL:
|
|
3289
|
-
ret_type =
|
|
2871
|
+
ret_type = uni.Bool
|
|
3290
2872
|
elif token.type == Tok.PYNLINE and isinstance(token.value, str):
|
|
3291
2873
|
token.value = token.value.replace("::py::", "")
|
|
3292
2874
|
ret = ret_type(
|
|
3293
|
-
orig_src=self.parse_ref.
|
|
2875
|
+
orig_src=self.parse_ref.ir_in,
|
|
3294
2876
|
name=token.type,
|
|
3295
2877
|
value=token.value[2:] if token.type == Tok.KWESC_NAME else token.value,
|
|
3296
2878
|
line=token.line if token.line is not None else 0,
|
|
@@ -3300,7 +2882,7 @@ class JacParser(Pass):
|
|
|
3300
2882
|
pos_start=token.start_pos if token.start_pos is not None else 0,
|
|
3301
2883
|
pos_end=token.end_pos if token.end_pos is not None else 0,
|
|
3302
2884
|
)
|
|
3303
|
-
if isinstance(ret,
|
|
2885
|
+
if isinstance(ret, uni.Name):
|
|
3304
2886
|
if token.type == Tok.KWESC_NAME:
|
|
3305
2887
|
ret.is_kwesc = True
|
|
3306
2888
|
if ret.value in keyword.kwlist:
|
|
@@ -3310,3 +2892,41 @@ class JacParser(Pass):
|
|
|
3310
2892
|
raise err
|
|
3311
2893
|
self.terminals.append(ret)
|
|
3312
2894
|
return ret
|
|
2895
|
+
|
|
2896
|
+
def event_clause(self, _: None) -> uni.EventSignature:
|
|
2897
|
+
"""Grammar rule.
|
|
2898
|
+
|
|
2899
|
+
event_clause: KW_WITH expression? (KW_EXIT | KW_ENTRY) (RETURN_HINT expression)?
|
|
2900
|
+
"""
|
|
2901
|
+
return_spec: uni.Expr | None = None
|
|
2902
|
+
self.consume_token(Tok.KW_WITH)
|
|
2903
|
+
type_specs = self.match(uni.Expr)
|
|
2904
|
+
event = self.match_token(Tok.KW_EXIT) or self.consume_token(Tok.KW_ENTRY)
|
|
2905
|
+
if self.match_token(Tok.RETURN_HINT):
|
|
2906
|
+
return_spec = self.consume(uni.Expr)
|
|
2907
|
+
return uni.EventSignature(
|
|
2908
|
+
event=event,
|
|
2909
|
+
arch_tag_info=type_specs,
|
|
2910
|
+
return_type=return_spec,
|
|
2911
|
+
kid=self.cur_nodes,
|
|
2912
|
+
)
|
|
2913
|
+
|
|
2914
|
+
def block_tail(self, _: None) -> list[uni.CodeBlockStmt] | uni.FuncCall:
|
|
2915
|
+
"""Grammar rule.
|
|
2916
|
+
|
|
2917
|
+
block_tail: code_block | KW_BY atomic_call SEMI | KW_ABSTRACT? SEMI
|
|
2918
|
+
"""
|
|
2919
|
+
# Try to match code_block first
|
|
2920
|
+
if code_block := self.match(list):
|
|
2921
|
+
return code_block
|
|
2922
|
+
|
|
2923
|
+
# Otherwise, it must be KW_BY atomic_call SEMI
|
|
2924
|
+
by_token = self.consume_token(Tok.KW_BY)
|
|
2925
|
+
func_call = self.consume(uni.FuncCall)
|
|
2926
|
+
semi_token = self.consume_token(Tok.SEMI)
|
|
2927
|
+
|
|
2928
|
+
# Add the tokens to the function call's kid array
|
|
2929
|
+
func_call.add_kids_left([by_token])
|
|
2930
|
+
func_call.add_kids_right([semi_token])
|
|
2931
|
+
|
|
2932
|
+
return func_call
|