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