From 970fb5650c51f83939cc04f84a715008d2f9b048 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Sat, 8 Apr 2023 16:59:02 +0200 Subject: [PATCH 01/16] Use ruff_text_size --- Cargo.lock | 3228 ++++---------------------- Cargo.toml | 129 +- compiler/ast/Cargo.toml | 4 +- compiler/ast/src/ast_gen.rs | 71 +- compiler/ast/src/constant.rs | 32 +- compiler/ast/src/lib.rs | 5 +- compiler/ast/src/unparse.rs | 534 ----- compiler/core/Cargo.toml | 2 + compiler/core/src/error.rs | 67 +- compiler/core/src/lib.rs | 2 +- compiler/core/src/text_size.rs | 505 ++++ compiler/parser/Cargo.toml | 3 +- compiler/parser/python.lalrpop | 4 +- compiler/parser/src/function.rs | 2 +- compiler/parser/src/lexer.rs | 45 +- compiler/parser/src/lib.rs | 1 + compiler/parser/src/parser.rs | 11 +- compiler/parser/src/string.rs | 33 +- compiler/parser/src/token.rs | 9 +- ruff_text_size/Cargo.toml | 19 + ruff_text_size/src/lib.rs | 34 + ruff_text_size/src/range.rs | 537 +++++ ruff_text_size/src/schemars_impls.rs | 33 + ruff_text_size/src/serde_impls.rs | 47 + ruff_text_size/src/size.rs | 161 ++ ruff_text_size/src/traits.rs | 37 + ruff_text_size/tests/auto_traits.rs | 18 + ruff_text_size/tests/constructors.rs | 24 + ruff_text_size/tests/indexing.rs | 8 + ruff_text_size/tests/main.rs | 79 + ruff_text_size/tests/serde.rs | 83 + 31 files changed, 2254 insertions(+), 3513 deletions(-) delete mode 100644 compiler/ast/src/unparse.rs create mode 100644 compiler/core/src/text_size.rs create mode 100644 ruff_text_size/Cargo.toml create mode 100644 ruff_text_size/src/lib.rs create mode 100644 ruff_text_size/src/range.rs create mode 100644 ruff_text_size/src/schemars_impls.rs create mode 100644 ruff_text_size/src/serde_impls.rs create mode 100644 ruff_text_size/src/size.rs create mode 100644 ruff_text_size/src/traits.rs create mode 100644 ruff_text_size/tests/auto_traits.rs create mode 100644 ruff_text_size/tests/constructors.rs create mode 100644 ruff_text_size/tests/indexing.rs create mode 100644 ruff_text_size/tests/main.rs create mode 100644 ruff_text_size/tests/serde.rs diff --git a/Cargo.lock b/Cargo.lock index 23dcc4b2dc..a76f86d7f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,24 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "adler32" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" - [[package]] name = "ahash" version = "0.7.6" @@ -40,51 +22,12 @@ dependencies = [ "memchr", ] -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - [[package]] name = "anyhow" version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" -[[package]] -name = "approx" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" -dependencies = [ - "num-traits", -] - -[[package]] -name = "arrayvec" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" - -[[package]] -name = "ascii" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" - [[package]] name = "ascii-canvas" version = "3.0.0" @@ -94,38 +37,12 @@ dependencies = [ "term", ] -[[package]] -name = "atomic" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b88d82667eca772c4aa12f0f1348b3ae643424c8876448f3f7bd5787032e234c" -dependencies = [ - "autocfg", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - [[package]] name = "bit-set" version = "0.5.3" @@ -147,2823 +64,765 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "blake2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest", -] - -[[package]] -name = "block-buffer" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" -dependencies = [ - "generic-array", -] - [[package]] name = "bstr" version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" dependencies = [ - "lazy_static 1.4.0", + "lazy_static", "memchr", "regex-automata", ] [[package]] -name = "bumpalo" -version = "3.12.0" +name = "cc" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" [[package]] -name = "byteorder" -version = "1.4.3" +name = "cfg-if" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] -name = "bzip2" -version = "0.4.4" +name = "console" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +checksum = "c3d79fbe8970a77e3e34151cc13d3b3e248aa0faaecb9f6091fa07ebefe5ad60" dependencies = [ - "bzip2-sys", + "encode_unicode", + "lazy_static", "libc", + "windows-sys 0.42.0", ] [[package]] -name = "bzip2-sys" -version = "0.1.11+1.0.8" +name = "crunchy" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" -dependencies = [ - "cc", - "libc", - "pkg-config", -] +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] -name = "caseless" -version = "0.2.1" +name = "diff" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808dab3318747be122cb31d36de18d4d1c81277a76f8332a02b81a3d73463d7f" -dependencies = [ - "regex", - "unicode-normalization", -] +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" [[package]] -name = "cast" -version = "0.3.0" +name = "dirs-next" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] [[package]] -name = "cc" -version = "1.0.79" +name = "dirs-sys-next" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] [[package]] -name = "cfg-if" -version = "1.0.0" +name = "dyn-clone" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" [[package]] -name = "chrono" -version = "0.4.23" +name = "either" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" -dependencies = [ - "iana-time-zone", - "js-sys", - "num-integer", - "num-traits", - "time", - "wasm-bindgen", - "winapi", -] +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] -name = "clap" -version = "2.34.0" +name = "ena" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +checksum = "d7402b94a93c24e742487327a7cd839dc9d36fec9de9fb25b09f2dae459f36c3" dependencies = [ - "ansi_term", - "atty", - "bitflags", - "strsim", - "textwrap 0.11.0", - "unicode-width", - "vec_map", + "log", ] [[package]] -name = "clipboard-win" -version = "4.5.0" +name = "encode_unicode" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7191c27c2357d9b7ef96baac1773290d4ca63b24205b82a3fd8a0637afcf0362" -dependencies = [ - "error-code", - "str-buf", - "winapi", -] +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] -name = "codespan-reporting" -version = "0.11.1" +name = "errno" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ - "termcolor", - "unicode-width", + "errno-dragonfly", + "libc", + "windows-sys 0.48.0", ] [[package]] -name = "console" -version = "0.15.5" +name = "errno-dragonfly" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d79fbe8970a77e3e34151cc13d3b3e248aa0faaecb9f6091fa07ebefe5ad60" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" dependencies = [ - "encode_unicode", - "lazy_static 1.4.0", + "cc", "libc", - "windows-sys 0.42.0", ] [[package]] -name = "console_error_panic_hook" -version = "0.1.7" +name = "fixedbitset" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" -dependencies = [ - "cfg-if", - "wasm-bindgen", -] +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] -name = "core-foundation" -version = "0.9.3" +name = "getrandom" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ - "core-foundation-sys", + "cfg-if", "libc", + "wasi", ] [[package]] -name = "core-foundation-sys" -version = "0.8.3" +name = "hashbrown" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] -name = "cpufeatures" -version = "0.2.5" +name = "hermit-abi" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" -dependencies = [ - "libc", -] +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" [[package]] -name = "cpython" -version = "0.7.1" +name = "indexmap" +version = "1.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3052106c29da7390237bc2310c1928335733b286287754ea85e6093d2495280e" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ - "libc", - "num-traits", - "paste", - "python3-sys", + "autocfg", + "hashbrown", ] [[package]] -name = "cranelift" -version = "0.88.2" +name = "insta" +version = "1.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea1b0c164043c16a8ece6813eef609ac2262a32a0bb0f5ed6eecf5d7bfb79ba8" +checksum = "fea5b3894afe466b4bcf0388630fc15e11938a6074af0cd637c825ba2ec8a099" dependencies = [ - "cranelift-codegen", - "cranelift-frontend", + "console", + "lazy_static", + "linked-hash-map", + "similar", + "yaml-rust", ] [[package]] -name = "cranelift-bforest" -version = "0.88.2" +name = "io-lifetimes" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52056f6d0584484b57fa6c1a65c1fcb15f3780d8b6a758426d9e3084169b2ddd" +checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" dependencies = [ - "cranelift-entity", + "hermit-abi", + "libc", + "windows-sys 0.48.0", ] [[package]] -name = "cranelift-codegen" -version = "0.88.2" +name = "is-terminal" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fed94c8770dc25d01154c3ffa64ed0b3ba9d583736f305fed7beebe5d9cf74" +checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ - "arrayvec", - "bumpalo", - "cranelift-bforest", - "cranelift-codegen-meta", - "cranelift-codegen-shared", - "cranelift-entity", - "cranelift-isle", - "log", - "regalloc2", - "smallvec", - "target-lexicon", + "hermit-abi", + "io-lifetimes", + "rustix", + "windows-sys 0.48.0", ] [[package]] -name = "cranelift-codegen-meta" -version = "0.88.2" +name = "itertools" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c451b81faf237d11c7e4f3165eeb6bac61112762c5cfe7b4c0fb7241474358f" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ - "cranelift-codegen-shared", + "either", ] [[package]] -name = "cranelift-codegen-shared" -version = "0.88.2" +name = "itoa" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c940133198426d26128f08be2b40b0bd117b84771fd36798969c4d712d81fc" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] -name = "cranelift-entity" -version = "0.88.2" +name = "lalrpop" +version = "0.19.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87a0f1b2fdc18776956370cf8d9b009ded3f855350c480c1c52142510961f352" +checksum = "f34313ec00c2eb5c3c87ca6732ea02dcf3af99c3ff7a8fb622ffb99c9d860a87" +dependencies = [ + "ascii-canvas", + "bit-set", + "diff", + "ena", + "is-terminal", + "itertools", + "lalrpop-util", + "petgraph", + "pico-args", + "regex", + "regex-syntax", + "string_cache", + "term", + "tiny-keccak", + "unicode-xid", +] [[package]] -name = "cranelift-frontend" -version = "0.88.2" +name = "lalrpop-util" +version = "0.19.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34897538b36b216cc8dd324e73263596d51b8cf610da6498322838b2546baf8a" +checksum = "e5c1f7869c94d214466c5fd432dfed12c379fd87786768d36455892d46b18edd" dependencies = [ - "cranelift-codegen", - "log", - "smallvec", - "target-lexicon", + "regex", ] [[package]] -name = "cranelift-isle" -version = "0.88.2" +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.141" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b2629a569fae540f16a76b70afcc87ad7decb38dc28fa6c648ac73b51e78470" +checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" [[package]] -name = "cranelift-jit" -version = "0.88.2" +name = "linked-hash-map" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "625be33ce54cf906c408f5ad9d08caa6e2a09e52d05fd0bd1bd95b132bfbba73" -dependencies = [ - "anyhow", - "cranelift-codegen", - "cranelift-entity", - "cranelift-module", - "cranelift-native", - "libc", - "log", - "region", - "target-lexicon", - "windows-sys 0.36.1", -] +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] -name = "cranelift-module" -version = "0.88.2" +name = "linux-raw-sys" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "883f8d42e07fd6b283941688f6c41a9e3b97fbf2b4ddcfb2756e675b86dc5edb" -dependencies = [ - "anyhow", - "cranelift-codegen", -] +checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f" [[package]] -name = "cranelift-native" -version = "0.88.2" +name = "lock_api" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20937dab4e14d3e225c5adfc9c7106bafd4ac669bdb43027b911ff794c6fb318" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" dependencies = [ - "cranelift-codegen", - "libc", - "target-lexicon", + "autocfg", + "scopeguard", ] [[package]] -name = "crc32fast" -version = "1.3.2" +name = "log" +version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ "cfg-if", ] [[package]] -name = "criterion" -version = "0.3.6" +name = "lz4_flex" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b01d6de93b2b6c65e17c634a26653a29d107b3c98c607c765bf38d041531cd8f" +checksum = "1a8cbbb2831780bc3b9c15a41f5b49222ef756b6730a95f3decfdd15903eb5a3" dependencies = [ - "atty", - "cast", - "clap", - "criterion-plot", - "csv", - "itertools", - "lazy_static 1.4.0", - "num-traits", - "oorandom", - "plotters", - "rayon", - "regex", - "serde", - "serde_cbor", - "serde_derive", - "serde_json", - "tinytemplate", - "walkdir", + "twox-hash", ] [[package]] -name = "criterion-plot" -version = "0.4.5" +name = "memchr" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876" -dependencies = [ - "cast", - "itertools", -] +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] -name = "crossbeam-channel" -version = "0.5.6" +name = "new_debug_unreachable" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] +checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" [[package]] -name = "crossbeam-deque" -version = "0.8.2" +name = "num-bigint" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" dependencies = [ - "cfg-if", - "crossbeam-epoch", - "crossbeam-utils", + "autocfg", + "num-integer", + "num-traits", ] [[package]] -name = "crossbeam-epoch" -version = "0.9.13" +name = "num-complex" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" +checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" dependencies = [ - "autocfg", - "cfg-if", - "crossbeam-utils", - "memoffset 0.7.1", - "scopeguard", + "num-traits", ] [[package]] -name = "crossbeam-utils" -version = "0.8.14" +name = "num-integer" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ - "cfg-if", + "autocfg", + "num-traits", ] [[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-common" -version = "0.1.6" +name = "num-traits" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ - "generic-array", - "typenum", + "autocfg", ] [[package]] -name = "csv" -version = "1.2.0" +name = "once_cell" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af91f40b7355f82b0a891f50e70399475945bb0b0da4f1700ce60761c9d3e359" -dependencies = [ - "csv-core", - "itoa", - "ryu", - "serde", -] +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] -name = "csv-core" -version = "0.1.10" +name = "parking_lot" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ - "memchr", + "lock_api", + "parking_lot_core", ] [[package]] -name = "cxx" -version = "1.0.91" +name = "parking_lot_core" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-sys 0.45.0", ] [[package]] -name = "cxx-build" -version = "1.0.91" +name = "petgraph" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690" +checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn", + "fixedbitset", + "indexmap", ] [[package]] -name = "cxxbridge-flags" -version = "1.0.91" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.91" +name = "phf" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892" +checksum = "928c6535de93548188ef63bb7c4036bd415cd8f36ad25af44b9789b2ee72a48c" dependencies = [ - "proc-macro2", - "quote", - "syn", + "phf_shared 0.11.1", ] [[package]] -name = "diff" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" - -[[package]] -name = "digest" -version = "0.10.6" +name = "phf_codegen" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "a56ac890c5e3ca598bbdeaa99964edb5b0258a583a9eb6ef4e89fc85d9224770" dependencies = [ - "block-buffer", - "crypto-common", - "subtle", + "phf_generator", + "phf_shared 0.11.1", ] [[package]] -name = "dirs-next" -version = "2.0.0" +name = "phf_generator" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +checksum = "b1181c94580fa345f50f19d738aaa39c0ed30a600d95cb2d3e23f94266f14fbf" dependencies = [ - "cfg-if", - "dirs-sys-next", + "phf_shared 0.11.1", + "rand", ] [[package]] -name = "dirs-sys-next" -version = "0.1.2" +name = "phf_shared" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" dependencies = [ - "libc", - "redox_users", - "winapi", + "siphasher", ] [[package]] -name = "dns-lookup" -version = "1.0.8" +name = "phf_shared" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53ecafc952c4528d9b51a458d1a8904b81783feff9fde08ab6ed2545ff396872" +checksum = "e1fb5f6f826b772a8d4c0394209441e7d37cbbb967ae9c7e0e8134365c9ee676" dependencies = [ - "cfg-if", - "libc", - "socket2", - "winapi", + "siphasher", ] [[package]] -name = "dyn-clone" -version = "1.0.10" +name = "pico-args" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" +checksum = "db8bcd96cb740d03149cbad5518db9fd87126a10ab519c011893b1754134c468" [[package]] -name = "either" -version = "1.8.1" +name = "precomputed-hash" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] -name = "ena" -version = "0.14.0" +name = "proc-macro2" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7402b94a93c24e742487327a7cd839dc9d36fec9de9fb25b09f2dae459f36c3" +checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" dependencies = [ - "log", + "unicode-ident", ] [[package]] -name = "encode_unicode" -version = "0.3.6" +name = "quote" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +dependencies = [ + "proc-macro2", +] [[package]] -name = "endian-type" -version = "0.1.2" +name = "rand" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "rand_core", +] [[package]] -name = "env_logger" -version = "0.9.3" +name = "rand_core" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" -dependencies = [ - "atty", - "log", - "termcolor", -] +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" [[package]] -name = "errno" -version = "0.3.1" +name = "redox_syscall" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", + "bitflags", ] [[package]] -name = "errno-dragonfly" -version = "0.1.2" +name = "redox_users" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "cc", - "libc", + "getrandom", + "redox_syscall", + "thiserror", ] [[package]] -name = "error-code" -version = "2.3.1" +name = "regex" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64f18991e7bf11e7ffee451b5318b5c1a73c52d0d0ada6e5a3017c8c1ced6a21" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ - "libc", - "str-buf", + "aho-corasick", + "memchr", + "regex-syntax", ] [[package]] -name = "exitcode" -version = "1.1.2" +name = "regex-automata" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de853764b47027c2e862a995c34978ffa63c1501f2e15f987ba11bd4f9bba193" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" [[package]] -name = "fd-lock" -version = "3.0.12" +name = "regex-syntax" +version = "0.6.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39ae6b3d9530211fb3b12a95374b8b0823be812f53d09e18c5675c0146b09642" +checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" + +[[package]] +name = "ruff_text_size" +version = "0.0.0" dependencies = [ - "cfg-if", - "rustix", - "windows-sys 0.48.0", + "schemars", + "serde", + "serde_test", + "static_assertions", ] [[package]] -name = "fixedbitset" -version = "0.4.2" +name = "rustc-hash" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] -name = "flame" -version = "0.2.2" +name = "rustix" +version = "0.37.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc2706461e1ee94f55cab2ed2e3d34ae9536cfa830358ef80acff1a3dacab30" +checksum = "85597d61f83914ddeba6a47b3b8ffe7365107221c2e557ed94426489fefb5f77" dependencies = [ - "lazy_static 0.2.11", - "serde", - "serde_derive", - "serde_json", - "thread-id", + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.48.0", ] [[package]] -name = "flamer" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36b732da54fd4ea34452f2431cf464ac7be94ca4b339c9cd3d3d12eb06fe7aab" +name = "rustpython-ast" +version = "0.2.0" dependencies = [ - "flame", - "quote", - "syn", + "num-bigint", + "ruff_text_size", ] [[package]] -name = "flamescope" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3cc29a6c0dfa26d3a0e80021edda5671eeed79381130897737cdd273ea18909" +name = "rustpython-compiler-core" +version = "0.2.0" dependencies = [ - "flame", - "indexmap", + "bitflags", + "bstr", + "itertools", + "lz4_flex", + "num-bigint", + "num-complex", + "ruff_text_size", "serde", - "serde_json", ] [[package]] -name = "flate2" -version = "1.0.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" -dependencies = [ - "crc32fast", - "libz-sys", - "miniz_oxide", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - -[[package]] -name = "generic-array" -version = "0.14.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "gethostname" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "getrandom" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", - "wasm-bindgen", -] - -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "half" -version = "1.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hexf-parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.53" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "winapi", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" -dependencies = [ - "cxx", - "cxx-build", -] - -[[package]] -name = "indexmap" -version = "1.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" -dependencies = [ - "autocfg", - "hashbrown", -] - -[[package]] -name = "insta" -version = "1.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea5b3894afe466b4bcf0388630fc15e11938a6074af0cd637c825ba2ec8a099" -dependencies = [ - "console", - "lazy_static 1.4.0", - "linked-hash-map", - "similar", - "yaml-rust", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" -dependencies = [ - "hermit-abi 0.3.1", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "is-macro" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c068d4c6b922cd6284c609cfa6dec0e41615c9c5a1a4ba729a970d8daba05fb" -dependencies = [ - "Inflector", - "pmutil", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "is-terminal" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" -dependencies = [ - "hermit-abi 0.3.1", - "io-lifetimes", - "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" - -[[package]] -name = "js-sys" -version = "0.3.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "keccak" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" -dependencies = [ - "cpufeatures", -] - -[[package]] -name = "lalrpop" -version = "0.19.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f34313ec00c2eb5c3c87ca6732ea02dcf3af99c3ff7a8fb622ffb99c9d860a87" -dependencies = [ - "ascii-canvas", - "bit-set", - "diff", - "ena", - "is-terminal", - "itertools", - "lalrpop-util", - "petgraph", - "pico-args", - "regex", - "regex-syntax", - "string_cache", - "term", - "tiny-keccak", - "unicode-xid", -] - -[[package]] -name = "lalrpop-util" -version = "0.19.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c1f7869c94d214466c5fd432dfed12c379fd87786768d36455892d46b18edd" -dependencies = [ - "regex", -] - -[[package]] -name = "lazy_static" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "lexical-parse-float" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683b3a5ebd0130b8fb52ba0bdc718cc56815b6a097e28ae5a6997d0ad17dc05f" -dependencies = [ - "lexical-parse-integer", - "lexical-util", - "static_assertions", -] - -[[package]] -name = "lexical-parse-integer" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d0994485ed0c312f6d965766754ea177d07f9c00c9b82a5ee62ed5b47945ee9" -dependencies = [ - "lexical-util", - "static_assertions", -] - -[[package]] -name = "lexical-util" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5255b9ff16ff898710eb9eb63cb39248ea8a5bb036bea8085b1a767ff6c4e3fc" -dependencies = [ - "static_assertions", -] - -[[package]] -name = "libc" -version = "0.2.141" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" - -[[package]] -name = "libffi" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cb06d5b4c428f3cd682943741c39ed4157ae989fffe1094a08eaf7c4014cf60" -dependencies = [ - "libc", - "libffi-sys", -] - -[[package]] -name = "libffi-sys" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11c6f11e063a27ffe040a9d15f0b661bf41edc2383b7ae0e0ad5a7e7d53d9da3" -dependencies = [ - "cc", -] - -[[package]] -name = "libsqlite3-sys" -version = "0.25.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29f835d03d717946d28b1d1ed632eb6f0e24a299388ee623d0c23118d3e8a7fa" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "libz-sys" -version = "1.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "link-cplusplus" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" -dependencies = [ - "cc", -] - -[[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - -[[package]] -name = "linux-raw-sys" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f" - -[[package]] -name = "lock_api" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "lz4_flex" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a8cbbb2831780bc3b9c15a41f5b49222ef756b6730a95f3decfdd15903eb5a3" -dependencies = [ - "twox-hash", -] - -[[package]] -name = "mac_address" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b238e3235c8382b7653c6408ed1b08dd379bdb9fdf990fb0bbae3db2cc0ae963" -dependencies = [ - "nix 0.23.2", - "winapi", -] - -[[package]] -name = "mach" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" -dependencies = [ - "libc", -] - -[[package]] -name = "maplit" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" - -[[package]] -name = "matches" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" - -[[package]] -name = "md-5" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" -dependencies = [ - "digest", -] - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "memmap2" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc" -dependencies = [ - "libc", -] - -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - -[[package]] -name = "memoffset" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" -dependencies = [ - "autocfg", -] - -[[package]] -name = "miniz_oxide" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" -dependencies = [ - "adler", -] - -[[package]] -name = "mt19937" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ca7f22ed370d5991a9caec16a83187e865bc8a532f889670337d5a5689e3a1" -dependencies = [ - "rand_core", -] - -[[package]] -name = "new_debug_unreachable" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" - -[[package]] -name = "nibble_vec" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" -dependencies = [ - "smallvec", -] - -[[package]] -name = "nix" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c" -dependencies = [ - "bitflags", - "cc", - "cfg-if", - "libc", - "memoffset 0.6.5", -] - -[[package]] -name = "nix" -version = "0.26.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" -dependencies = [ - "bitflags", - "cfg-if", - "libc", - "memoffset 0.7.1", - "pin-utils", - "static_assertions", -] - -[[package]] -name = "nom8" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" -dependencies = [ - "memchr", -] - -[[package]] -name = "num-bigint" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-complex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" -dependencies = [ - "autocfg", - "num-bigint", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" -dependencies = [ - "hermit-abi 0.2.6", - "libc", -] - -[[package]] -name = "num_enum" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d829733185c1ca374f17e52b762f24f535ec625d2cc1f070e34c8a9068f341b" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2be1598bf1c313dcdd12092e3f1920f463462525a21b7b4e11b4168353d0123e" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "once_cell" -version = "1.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" - -[[package]] -name = "oorandom" -version = "11.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" - -[[package]] -name = "openssl" -version = "0.10.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "518915b97df115dd36109bfa429a48b8f737bd05508cf9588977b599648926d2" -dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-src" -version = "111.25.0+1.1.1t" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3173cd3626c43e3854b1b727422a276e568d9ec5fe8cec197822cf52cfb743d6" -dependencies = [ - "cc", -] - -[[package]] -name = "openssl-sys" -version = "0.9.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "666416d899cf077260dac8698d60a60b435a46d57e82acb1be3d0dad87284e5b" -dependencies = [ - "autocfg", - "cc", - "libc", - "openssl-src", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "optional" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978aa494585d3ca4ad74929863093e87cac9790d81fe7aba2b3dc2890643a0fc" - -[[package]] -name = "page_size" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eebde548fbbf1ea81a99b128872779c437752fb99f217c45245e1a61dcd9edcd" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall 0.2.16", - "smallvec", - "windows-sys 0.45.0", -] - -[[package]] -name = "paste" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" - -[[package]] -name = "petgraph" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" -dependencies = [ - "fixedbitset", - "indexmap", -] - -[[package]] -name = "phf" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "928c6535de93548188ef63bb7c4036bd415cd8f36ad25af44b9789b2ee72a48c" -dependencies = [ - "phf_shared 0.11.1", -] - -[[package]] -name = "phf_codegen" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56ac890c5e3ca598bbdeaa99964edb5b0258a583a9eb6ef4e89fc85d9224770" -dependencies = [ - "phf_generator", - "phf_shared 0.11.1", -] - -[[package]] -name = "phf_generator" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1181c94580fa345f50f19d738aaa39c0ed30a600d95cb2d3e23f94266f14fbf" -dependencies = [ - "phf_shared 0.11.1", - "rand", -] - -[[package]] -name = "phf_shared" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" -dependencies = [ - "siphasher", -] - -[[package]] -name = "phf_shared" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1fb5f6f826b772a8d4c0394209441e7d37cbbb967ae9c7e0e8134365c9ee676" -dependencies = [ - "siphasher", -] - -[[package]] -name = "pico-args" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8bcd96cb740d03149cbad5518db9fd87126a10ab519c011893b1754134c468" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" - -[[package]] -name = "plotters" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b639e642295546c50fcd545198c9d64ee2a38620a628724a3b266d5fbf97" -dependencies = [ - "num-traits", - "plotters-backend", - "plotters-svg", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "plotters-backend" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "193228616381fecdc1224c62e96946dfbc73ff4384fba576e052ff8c1bea8142" - -[[package]] -name = "plotters-svg" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a81d2759aae1dae668f783c308bc5c8ebd191ff4184aaa1b37f65a6ae5a56f" -dependencies = [ - "plotters-backend", -] - -[[package]] -name = "pmutil" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3894e5d549cccbe44afecf72922f277f603cd4bb0219c8342631ef18fffbe004" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" - -[[package]] -name = "proc-macro-crate" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" -dependencies = [ - "once_cell", - "toml_edit", -] - -[[package]] -name = "proc-macro2" -version = "1.0.51" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "puruspe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b7e158a385023d209d6d5f2585c4b468f6dcb3dd5aca9b75c4f1678c05bb375" - -[[package]] -name = "python3-sys" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f8b50d72fb3015735aa403eebf19bbd72c093bfeeae24ee798be5f2f1aab52" -dependencies = [ - "libc", - "regex", -] - -[[package]] -name = "quote" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - -[[package]] -name = "radix_trie" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" -dependencies = [ - "endian-type", - "nibble_vec", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rayon" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "356a0625f1954f730c0201cdab48611198dc6ce21f4acff55089b5a78e6e835b" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-utils", - "num_cpus", -] - -[[package]] -name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags", -] - -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom", - "redox_syscall 0.2.16", - "thiserror", -] - -[[package]] -name = "regalloc2" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d43a209257d978ef079f3d446331d0f1794f5e0fc19b306a199983857833a779" -dependencies = [ - "fxhash", - "log", - "slice-group-by", - "smallvec", -] - -[[package]] -name = "regex" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" - -[[package]] -name = "regex-syntax" -version = "0.6.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" - -[[package]] -name = "region" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877e54ea2adcd70d80e9179344c97f93ef0dffd6b03e1f4529e6e83ab2fa9ae0" -dependencies = [ - "bitflags", - "libc", - "mach", - "winapi", -] - -[[package]] -name = "result-like" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b80fe0296795a96913be20558326b797a187bb3986ce84ed82dee0fb7414428" -dependencies = [ - "result-like-derive", -] - -[[package]] -name = "result-like-derive" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a29c8a4ac7839f1dcb8b899263b501e0d6932f210300c8a0d271323727b35c1" -dependencies = [ - "pmutil", - "proc-macro2", - "quote", - "syn", - "syn-ext", -] - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - -[[package]] -name = "rustix" -version = "0.37.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85597d61f83914ddeba6a47b3b8ffe7365107221c2e557ed94426489fefb5f77" -dependencies = [ - "bitflags", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys", - "windows-sys 0.48.0", -] - -[[package]] -name = "rustpython" -version = "0.2.0" -dependencies = [ - "atty", - "cfg-if", - "clap", - "cpython", - "criterion", - "dirs-next", - "env_logger", - "flame", - "flamescope", - "libc", - "log", - "python3-sys", - "rustpython-compiler", - "rustpython-parser", - "rustpython-pylib", - "rustpython-stdlib", - "rustpython-vm", - "rustyline", -] - -[[package]] -name = "rustpython-ast" -version = "0.2.0" -dependencies = [ - "num-bigint", - "rustpython-common", - "rustpython-compiler-core", -] - -[[package]] -name = "rustpython-codegen" -version = "0.2.0" -dependencies = [ - "ahash", - "bitflags", - "indexmap", - "insta", - "itertools", - "log", - "num-complex", - "num-traits", - "rustpython-ast", - "rustpython-compiler-core", - "rustpython-parser", -] - -[[package]] -name = "rustpython-common" -version = "0.2.0" -dependencies = [ - "ascii", - "bitflags", - "bstr", - "cfg-if", - "hexf-parse", - "itertools", - "lexical-parse-float", - "libc", - "lock_api", - "num-bigint", - "num-complex", - "num-traits", - "once_cell", - "parking_lot", - "radium", - "rand", - "siphasher", - "unic-ucd-category", - "volatile", - "widestring", -] - -[[package]] -name = "rustpython-compiler" -version = "0.2.0" -dependencies = [ - "rustpython-codegen", - "rustpython-compiler-core", - "rustpython-parser", -] - -[[package]] -name = "rustpython-compiler-core" -version = "0.2.0" -dependencies = [ - "bitflags", - "bstr", - "itertools", - "lz4_flex", - "num-bigint", - "num-complex", - "serde", -] - -[[package]] -name = "rustpython-derive" -version = "0.2.0" -dependencies = [ - "rustpython-compiler", - "rustpython-derive-impl", - "syn", -] - -[[package]] -name = "rustpython-derive-impl" -version = "0.2.0" -dependencies = [ - "indexmap", - "itertools", - "maplit", - "once_cell", - "proc-macro2", - "quote", - "rustpython-compiler-core", - "rustpython-doc", - "syn", - "syn-ext", - "textwrap 0.15.2", -] - -[[package]] -name = "rustpython-doc" -version = "0.1.0" -source = "git+https://github.com/RustPython/__doc__?branch=main#d927debd491e4c45b88e953e6e50e4718e0f2965" -dependencies = [ - "once_cell", -] - -[[package]] -name = "rustpython-jit" -version = "0.2.0" -dependencies = [ - "approx", - "cranelift", - "cranelift-jit", - "cranelift-module", - "libffi", - "num-traits", - "rustpython-compiler-core", - "rustpython-derive", - "thiserror", -] - -[[package]] -name = "rustpython-parser" -version = "0.2.0" -dependencies = [ - "ahash", - "anyhow", - "insta", - "itertools", - "lalrpop", - "lalrpop-util", - "log", - "num-bigint", - "num-traits", - "phf", - "phf_codegen", - "rustc-hash", - "rustpython-ast", - "rustpython-compiler-core", - "serde", - "tiny-keccak", - "unic-emoji-char", - "unic-ucd-ident", - "unicode_names2", -] - -[[package]] -name = "rustpython-pylib" -version = "0.2.0" -dependencies = [ - "glob", - "rustpython-compiler-core", - "rustpython-derive", -] - -[[package]] -name = "rustpython-stdlib" -version = "0.2.0" -dependencies = [ - "adler32", - "ahash", - "ascii", - "base64", - "blake2", - "bzip2", - "cfg-if", - "crc32fast", - "crossbeam-utils", - "csv-core", - "digest", - "dns-lookup", - "dyn-clone", - "flate2", - "foreign-types-shared", - "gethostname", - "hex", - "hmac", - "itertools", - "libc", - "libsqlite3-sys", - "libz-sys", - "mac_address", - "md-5", - "memchr", - "memmap2", - "mt19937", - "nix 0.26.2", - "num-bigint", - "num-complex", - "num-integer", - "num-rational", - "num-traits", - "num_enum", - "once_cell", - "openssl", - "openssl-probe", - "openssl-sys", - "page_size", - "parking_lot", - "paste", - "puruspe", - "rand", - "rand_core", - "rustpython-common", - "rustpython-derive", - "rustpython-vm", - "schannel", - "sha-1", - "sha2", - "sha3", - "socket2", - "system-configuration", - "termios", - "ucd", - "unic-char-property", - "unic-normal", - "unic-ucd-age", - "unic-ucd-bidi", - "unic-ucd-category", - "unic-ucd-ident", - "unicode-casing", - "unicode_names2", - "uuid", - "widestring", - "winapi", - "xml-rs", -] - -[[package]] -name = "rustpython-vm" -version = "0.2.0" -dependencies = [ - "ahash", - "ascii", - "atty", - "bitflags", - "bstr", - "caseless", - "cfg-if", - "chrono", - "crossbeam-utils", - "exitcode", - "flame", - "flamer", - "getrandom", - "glob", - "half", - "hex", - "indexmap", - "is-macro", - "itertools", - "libc", - "log", - "memchr", - "memoffset 0.6.5", - "nix 0.26.2", - "num-bigint", - "num-complex", - "num-integer", - "num-rational", - "num-traits", - "num_cpus", - "num_enum", - "once_cell", - "optional", - "parking_lot", - "paste", - "rand", - "result-like", - "rustc_version", - "rustpython-ast", - "rustpython-codegen", - "rustpython-common", - "rustpython-compiler", - "rustpython-compiler-core", - "rustpython-derive", - "rustpython-jit", - "rustpython-parser", - "rustyline", - "schannel", - "serde", - "sre-engine", - "static_assertions", - "strum", - "strum_macros", - "thiserror", - "thread_local", - "timsort", - "uname", - "unic-ucd-bidi", - "unic-ucd-category", - "unic-ucd-ident", - "unicode-casing", - "unicode_names2", - "wasm-bindgen", - "which", - "widestring", - "winapi", - "windows", - "winreg", -] - -[[package]] -name = "rustpython_wasm" -version = "0.2.0" -dependencies = [ - "console_error_panic_hook", - "js-sys", - "rustpython-common", - "rustpython-parser", - "rustpython-pylib", - "rustpython-stdlib", - "rustpython-vm", - "serde", - "serde-wasm-bindgen", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "rustversion" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" - -[[package]] -name = "rustyline" -version = "11.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfc8644681285d1fb67a467fb3021bfea306b99b4146b166a1fe3ada965eece" -dependencies = [ - "bitflags", - "cfg-if", - "clipboard-win", - "dirs-next", - "fd-lock", - "libc", - "log", - "memchr", - "nix 0.26.2", - "radix_trie", - "scopeguard", - "unicode-segmentation", - "unicode-width", - "utf8parse", - "winapi", -] - -[[package]] -name = "ryu" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "schannel" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" -dependencies = [ - "windows-sys 0.42.0", -] - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "scratch" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" - -[[package]] -name = "semver" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" - -[[package]] -name = "serde" -version = "1.0.152" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde-wasm-bindgen" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "618365e8e586c22123d692b72a7d791d5ee697817b65a218cdf12a98870af0f7" -dependencies = [ - "fnv", - "js-sys", - "serde", - "wasm-bindgen", -] - -[[package]] -name = "serde_cbor" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" -dependencies = [ - "half", - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.152" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha-1" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sha2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sha3" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" -dependencies = [ - "digest", - "keccak", -] - -[[package]] -name = "similar" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf" - -[[package]] -name = "siphasher" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" - -[[package]] -name = "slice-group-by" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec" - -[[package]] -name = "smallvec" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" - -[[package]] -name = "socket2" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "sre-engine" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a490c5c46c35dba9a6f5e7ee8e4d67e775eb2d2da0f115750b8d10e1c1ac2d28" -dependencies = [ - "bitflags", - "num_enum", - "optional", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "str-buf" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0" - -[[package]] -name = "string_cache" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213494b7a2b503146286049378ce02b482200519accc31872ee8be91fa820a08" -dependencies = [ - "new_debug_unreachable", - "once_cell", - "parking_lot", - "phf_shared 0.10.0", - "precomputed-hash", -] - -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - -[[package]] -name = "strum" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" - -[[package]] -name = "strum_macros" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "rustversion", - "syn", -] - -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "syn" -version = "1.0.107" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn-ext" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b86cb2b68c5b3c078cac02588bc23f3c04bb828c5d3aedd17980876ec6a7be6" -dependencies = [ - "syn", -] - -[[package]] -name = "system-configuration" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75182f12f490e953596550b65ee31bda7c8e043d9386174b353bda50838c3fd" -dependencies = [ - "bitflags", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "target-lexicon" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5" - -[[package]] -name = "term" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" -dependencies = [ - "dirs-next", - "rustversion", - "winapi", -] - -[[package]] -name = "termcolor" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "termios" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "411c5bf740737c7918b8b1fe232dca4dc9f8e754b8ad5e20966814001ed0ac6b" +name = "rustpython-parser" +version = "0.2.0" dependencies = [ - "libc", + "ahash", + "anyhow", + "insta", + "itertools", + "lalrpop", + "lalrpop-util", + "log", + "num-bigint", + "num-traits", + "phf", + "phf_codegen", + "ruff_text_size", + "rustc-hash", + "rustpython-ast", + "rustpython-compiler-core", + "serde", + "tiny-keccak", + "unic-emoji-char", + "unic-ucd-ident", + "unicode_names2", ] [[package]] -name = "textwrap" -version = "0.11.0" +name = "rustversion" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] +checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" [[package]] -name = "textwrap" -version = "0.15.2" +name = "ryu" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7b3e525a49ec206798b40326a44121291b530c963cfb01018f63e135bac543d" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] -name = "thiserror" -version = "1.0.38" +name = "schemars" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +checksum = "02c613288622e5f0c3fdc5dbd4db1c5fbe752746b1d1a56a0630b78fd00de44f" dependencies = [ - "thiserror-impl", + "dyn-clone", + "schemars_derive", + "serde", + "serde_json", ] [[package]] -name = "thiserror-impl" -version = "1.0.38" +name = "schemars_derive" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +checksum = "109da1e6b197438deb6db99952990c7f959572794b80ff93707d55a232545e7c" dependencies = [ "proc-macro2", "quote", + "serde_derive_internals", "syn", ] [[package]] -name = "thread-id" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fbf4c9d56b320106cd64fd024dadfa0be7cb4706725fc44a7d7ce952d820c1" -dependencies = [ - "libc", - "redox_syscall 0.1.57", - "winapi", -] - -[[package]] -name = "thread_local" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" -dependencies = [ - "cfg-if", - "once_cell", -] - -[[package]] -name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", -] - -[[package]] -name = "timsort" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cb4fa83bb73adf1c7219f4fe4bf3c0ac5635e4e51e070fad5df745a41bedfb8" - -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - -[[package]] -name = "tinytemplate" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" -dependencies = [ - "serde", - "serde_json", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "toml_datetime" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" - -[[package]] -name = "toml_edit" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" -dependencies = [ - "indexmap", - "nom8", - "toml_datetime", -] - -[[package]] -name = "twox-hash" -version = "1.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" -dependencies = [ - "cfg-if", - "static_assertions", -] - -[[package]] -name = "typenum" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" - -[[package]] -name = "ucd" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe4fa6e588762366f1eb4991ce59ad1b93651d0b769dfb4e4d1c5c4b943d1159" - -[[package]] -name = "uname" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b72f89f0ca32e4db1c04e2a72f5345d59796d4866a1ee0609084569f73683dc8" -dependencies = [ - "libc", -] - -[[package]] -name = "unic-char-property" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221" -dependencies = [ - "unic-char-range", -] - -[[package]] -name = "unic-char-range" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc" - -[[package]] -name = "unic-common" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" - -[[package]] -name = "unic-emoji-char" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b07221e68897210270a38bde4babb655869637af0f69407f96053a34f76494d" -dependencies = [ - "unic-char-property", - "unic-char-range", - "unic-ucd-version", -] - -[[package]] -name = "unic-normal" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f09d64d33589a94628bc2aeb037f35c2e25f3f049c7348b5aa5580b48e6bba62" -dependencies = [ - "unic-ucd-normal", -] - -[[package]] -name = "unic-ucd-age" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8cfdfe71af46b871dc6af2c24fcd360e2f3392ee4c5111877f2947f311671c" -dependencies = [ - "unic-char-property", - "unic-char-range", - "unic-ucd-version", -] - -[[package]] -name = "unic-ucd-bidi" -version = "0.9.0" +name = "scopeguard" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1d568b51222484e1f8209ce48caa6b430bf352962b877d592c29ab31fb53d8c" -dependencies = [ - "unic-char-property", - "unic-char-range", - "unic-ucd-version", -] +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] -name = "unic-ucd-category" -version = "0.9.0" +name = "serde" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b8d4591f5fcfe1bd4453baaf803c40e1b1e69ff8455c47620440b46efef91c0" -dependencies = [ - "matches", - "unic-char-property", - "unic-char-range", - "unic-ucd-version", +checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +dependencies = [ + "serde_derive", ] [[package]] -name = "unic-ucd-hangul" -version = "0.9.0" +name = "serde_derive" +version = "1.0.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1dc690e19010e1523edb9713224cba5ef55b54894fe33424439ec9a40c0054" +checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" dependencies = [ - "unic-ucd-version", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "unic-ucd-ident" -version = "0.9.0" +name = "serde_derive_internals" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e230a37c0381caa9219d67cf063aa3a375ffed5bf541a452db16e744bdab6987" +checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" dependencies = [ - "unic-char-property", - "unic-char-range", - "unic-ucd-version", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "unic-ucd-normal" -version = "0.9.0" +name = "serde_json" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86aed873b8202d22b13859dda5fe7c001d271412c31d411fd9b827e030569410" +checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" dependencies = [ - "unic-char-property", - "unic-char-range", - "unic-ucd-hangul", - "unic-ucd-version", + "itoa", + "ryu", + "serde", ] [[package]] -name = "unic-ucd-version" -version = "0.9.0" +name = "serde_test" +version = "1.0.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4" +checksum = "3c95a500e3923258f7fc3a16bf29934e403aef5ca1096e184d85e3b1926675e8" dependencies = [ - "unic-common", + "serde", ] [[package]] -name = "unicode-casing" -version = "0.1.0" +name = "similar" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "623f59e6af2a98bdafeb93fa277ac8e1e40440973001ca15cf4ae1541cd16d56" +checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf" [[package]] -name = "unicode-ident" -version = "1.0.6" +name = "siphasher" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" [[package]] -name = "unicode-normalization" -version = "0.1.22" +name = "smallvec" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] -name = "unicode-segmentation" -version = "1.10.1" +name = "static_assertions" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] -name = "unicode-width" -version = "0.1.10" +name = "string_cache" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "213494b7a2b503146286049378ce02b482200519accc31872ee8be91fa820a08" +dependencies = [ + "new_debug_unreachable", + "once_cell", + "parking_lot", + "phf_shared 0.10.0", + "precomputed-hash", +] [[package]] -name = "unicode-xid" -version = "0.2.4" +name = "syn" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] -name = "unicode_names2" -version = "0.6.0" -source = "git+https://github.com/youknowone/unicode_names2.git?rev=4ce16aa85cbcdd9cc830410f1a72ef9a235f2fde#4ce16aa85cbcdd9cc830410f1a72ef9a235f2fde" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ - "phf", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "utf8parse" -version = "0.2.0" +name = "term" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936e4b492acfd135421d8dca4b1aa80a7bfc26e702ef3af710e0752684df5372" +checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" +dependencies = [ + "dirs-next", + "rustversion", + "winapi", +] [[package]] -name = "uuid" -version = "1.3.0" +name = "thiserror" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ - "atomic", - "getrandom", - "rand", - "uuid-macro-internal", + "thiserror-impl", ] [[package]] -name = "uuid-macro-internal" -version = "1.3.0" +name = "thiserror-impl" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1b300a878652a387d2a0de915bdae8f1a548f0c6d45e072fe2688794b656cc9" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ "proc-macro2", "quote", @@ -2971,144 +830,107 @@ dependencies = [ ] [[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "volatile" -version = "0.3.0" +name = "tiny-keccak" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8e76fae08f03f96e166d2dfda232190638c10e0383841252416f9cfe2ae60e6" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] [[package]] -name = "walkdir" -version = "2.3.2" +name = "twox-hash" +version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "same-file", - "winapi", - "winapi-util", + "cfg-if", + "static_assertions", ] [[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" +name = "unic-char-property" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" +checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221" +dependencies = [ + "unic-char-range", +] [[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +name = "unic-char-range" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc" [[package]] -name = "wasm-bindgen" -version = "0.2.84" +name = "unic-common" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] +checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" [[package]] -name = "wasm-bindgen-backend" -version = "0.2.84" +name = "unic-emoji-char" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +checksum = "0b07221e68897210270a38bde4babb655869637af0f69407f96053a34f76494d" dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", + "unic-char-property", + "unic-char-range", + "unic-ucd-version", ] [[package]] -name = "wasm-bindgen-futures" -version = "0.4.34" +name = "unic-ucd-ident" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" +checksum = "e230a37c0381caa9219d67cf063aa3a375ffed5bf541a452db16e744bdab6987" dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", + "unic-char-property", + "unic-char-range", + "unic-ucd-version", ] [[package]] -name = "wasm-bindgen-macro" -version = "0.2.84" +name = "unic-ucd-version" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4" dependencies = [ - "quote", - "wasm-bindgen-macro-support", + "unic-common", ] [[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.84" +name = "unicode-ident" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] -name = "wasm-bindgen-shared" -version = "0.2.84" +name = "unicode-xid" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] -name = "web-sys" -version = "0.3.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +name = "unicode_names2" +version = "0.6.0" +source = "git+https://github.com/youknowone/unicode_names2.git?rev=4ce16aa85cbcdd9cc830410f1a72ef9a235f2fde#4ce16aa85cbcdd9cc830410f1a72ef9a235f2fde" dependencies = [ - "js-sys", - "wasm-bindgen", + "phf", ] [[package]] -name = "which" -version = "4.4.0" +name = "version_check" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" -dependencies = [ - "either", - "libc", - "once_cell", -] +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] -name = "widestring" -version = "0.5.1" +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "winapi" @@ -3126,47 +948,12 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1c4bd0a50ac6020f65184721f758dba47bb9fbc2133df715ec74a237b26794a" -dependencies = [ - "windows_aarch64_msvc 0.39.0", - "windows_i686_gnu 0.39.0", - "windows_i686_msvc 0.39.0", - "windows_x86_64_gnu 0.39.0", - "windows_x86_64_msvc 0.39.0", -] - -[[package]] -name = "windows-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" -dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", -] - [[package]] name = "windows-sys" version = "0.42.0" @@ -3242,18 +1029,6 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec7711666096bd4096ffa835238905bb33fb87267910e154b18b44eaabb340f2" - [[package]] name = "windows_aarch64_msvc" version = "0.42.1" @@ -3266,18 +1041,6 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - -[[package]] -name = "windows_i686_gnu" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "763fc57100a5f7042e3057e7e8d9bdd7860d330070251a73d003563a3bb49e1b" - [[package]] name = "windows_i686_gnu" version = "0.42.1" @@ -3290,18 +1053,6 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - -[[package]] -name = "windows_i686_msvc" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bc7cbfe58828921e10a9f446fcaaf649204dcfe6c1ddd712c5eebae6bda1106" - [[package]] name = "windows_i686_msvc" version = "0.42.1" @@ -3314,18 +1065,6 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6868c165637d653ae1e8dc4d82c25d4f97dd6605eaa8d784b5c6e0ab2a252b65" - [[package]] name = "windows_x86_64_gnu" version = "0.42.1" @@ -3350,18 +1089,6 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" -[[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e4d40883ae9cae962787ca76ba76390ffa29214667a111db9e0a1ad8377e809" - [[package]] name = "windows_x86_64_msvc" version = "0.42.1" @@ -3374,21 +1101,6 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" -[[package]] -name = "winreg" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" -dependencies = [ - "winapi", -] - -[[package]] -name = "xml-rs" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" - [[package]] name = "yaml-rust" version = "0.4.5" diff --git a/Cargo.toml b/Cargo.toml index a34f5a3949..5caf902530 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,19 +1,18 @@ -[package] -name = "rustpython" -version = "0.2.0" -authors = ["RustPython Team"] -edition = "2021" -rust-version = "1.67.1" -description = "A python interpreter written in rust." -repository = "https://github.com/RustPython/RustPython" -license = "MIT" -include = ["LICENSE", "Cargo.toml", "src/**/*.rs"] +#[package] +#name = "rustpython" +#version = "0.2.0" +#authors = ["RustPython Team"] +#edition = "2021" +#rust-version = "1.67.1" +#description = "A python interpreter written in rust." +#repository = "https://github.com/RustPython/RustPython" +#license = "MIT" +#include = ["LICENSE", "Cargo.toml", "src/**/*.rs"] [workspace] resolver = "2" members = [ - "compiler", "compiler/ast", "compiler/core", "compiler/codegen", "compiler/parser", - ".", "common", "derive", "jit", "vm", "pylib", "stdlib", "wasm/lib", "derive-impl", + "ruff_text_size", "compiler/ast", "compiler/parser" ] [workspace.dependencies] @@ -56,59 +55,59 @@ thread_local = "1.1.4" unicode_names2 = { version = "0.6.0", git = "https://github.com/youknowone/unicode_names2.git", rev = "4ce16aa85cbcdd9cc830410f1a72ef9a235f2fde" } widestring = "0.5.1" -[features] -default = ["threading", "stdlib", "zlib", "importlib", "encodings", "rustpython-parser/lalrpop"] -importlib = ["rustpython-vm/importlib"] -encodings = ["rustpython-vm/encodings"] -stdlib = ["rustpython-stdlib", "rustpython-pylib"] -flame-it = ["rustpython-vm/flame-it", "flame", "flamescope"] -freeze-stdlib = ["rustpython-vm/freeze-stdlib", "rustpython-pylib?/freeze-stdlib"] -jit = ["rustpython-vm/jit"] -threading = ["rustpython-vm/threading", "rustpython-stdlib/threading"] -zlib = ["stdlib", "rustpython-stdlib/zlib"] -bz2 = ["stdlib", "rustpython-stdlib/bz2"] -ssl = ["rustpython-stdlib/ssl"] -ssl-vendor = ["rustpython-stdlib/ssl-vendor"] - -[dependencies] -rustpython-compiler = { path = "compiler", version = "0.2.0" } -rustpython-parser = { path = "compiler/parser", version = "0.2.0" } -rustpython-pylib = { path = "pylib", optional = true, default-features = false } -rustpython-stdlib = { path = "stdlib", optional = true, default-features = false } -rustpython-vm = { path = "vm", version = "0.2.0", default-features = false, features = ["compiler"] } - -atty = { workspace = true } -cfg-if = { workspace = true } -log = { workspace = true } -flame = { workspace = true, optional = true } - -clap = "2.34" -dirs = { package = "dirs-next", version = "2.0.0" } -env_logger = { version = "0.9.0", default-features = false, features = ["atty", "termcolor"] } -flamescope = { version = "0.1.2", optional = true } - -[target.'cfg(windows)'.dependencies] -libc = { workspace = true } - -[target.'cfg(not(target_arch = "wasm32"))'.dependencies] -rustyline = { workspace = true } - -[dev-dependencies] -cpython = "0.7.0" -criterion = "0.3.5" -python3-sys = "0.7.0" - -[[bench]] -name = "execution" -harness = false - -[[bench]] -name = "microbenchmarks" -harness = false - -[[bin]] -name = "rustpython" -path = "src/main.rs" +#[features] +#default = ["threading", "stdlib", "zlib", "importlib", "encodings", "rustpython-parser/lalrpop"] +#importlib = ["rustpython-vm/importlib"] +#encodings = ["rustpython-vm/encodings"] +#stdlib = ["rustpython-stdlib", "rustpython-pylib"] +#flame-it = ["rustpython-vm/flame-it", "flame", "flamescope"] +#freeze-stdlib = ["rustpython-vm/freeze-stdlib", "rustpython-pylib?/freeze-stdlib"] +#jit = ["rustpython-vm/jit"] +#threading = ["rustpython-vm/threading", "rustpython-stdlib/threading"] +#zlib = ["stdlib", "rustpython-stdlib/zlib"] +#bz2 = ["stdlib", "rustpython-stdlib/bz2"] +#ssl = ["rustpython-stdlib/ssl"] +#ssl-vendor = ["rustpython-stdlib/ssl-vendor"] + +#[dependencies] +#rustpython-compiler = { path = "compiler", version = "0.2.0" } +#rustpython-parser = { path = "compiler/parser", version = "0.2.0" } +#rustpython-pylib = { path = "pylib", optional = true, default-features = false } +#rustpython-stdlib = { path = "stdlib", optional = true, default-features = false } +#rustpython-vm = { path = "vm", version = "0.2.0", default-features = false, features = ["compiler"] } + +#atty = { workspace = true } +#cfg-if = { workspace = true } +#log = { workspace = true } +#flame = { workspace = true, optional = true } +# +#clap = "2.34" +#dirs = { package = "dirs-next", version = "2.0.0" } +#env_logger = { version = "0.9.0", default-features = false, features = ["atty", "termcolor"] } +#flamescope = { version = "0.1.2", optional = true } +# +#[target.'cfg(windows)'.dependencies] +#libc = { workspace = true } +# +#[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +#rustyline = { workspace = true } +# +#[dev-dependencies] +#cpython = "0.7.0" +#criterion = "0.3.5" +#python3-sys = "0.7.0" + +#[[bench]] +#name = "execution" +#harness = false +# +#[[bench]] +#name = "microbenchmarks" +#harness = false +# +#[[bin]] +#name = "rustpython" +#path = "src/main.rs" [profile.dev.package."*"] opt-level = 3 diff --git a/compiler/ast/Cargo.toml b/compiler/ast/Cargo.toml index bb280f48ff..5e2122d72f 100644 --- a/compiler/ast/Cargo.toml +++ b/compiler/ast/Cargo.toml @@ -11,10 +11,8 @@ license = "MIT" default = ["constant-optimization", "fold"] constant-optimization = ["fold"] fold = [] -unparse = ["rustpython-common"] [dependencies] -rustpython-compiler-core = { path = "../core", version = "0.2.0" } -rustpython-common = { path = "../../common", version = "0.2.0", optional = true } +ruff_text_size = { path = "../../ruff_text_size" } num-bigint = { workspace = true } diff --git a/compiler/ast/src/ast_gen.rs b/compiler/ast/src/ast_gen.rs index 6771dd0eb5..435b71cb0f 100644 --- a/compiler/ast/src/ast_gen.rs +++ b/compiler/ast/src/ast_gen.rs @@ -3,40 +3,78 @@ #![allow(clippy::derive_partial_eq_without_eq)] pub use crate::constant::*; -pub use crate::Location; +use ruff_text_size::{TextRange, TextSize}; +use std::ops::Deref; type Ident = String; #[derive(Clone, Debug, PartialEq)] pub struct Located { - pub location: Location, - pub end_location: Option, + pub range: TextRange, pub custom: U, pub node: T, } -impl Located { - pub fn new(location: Location, end_location: Location, node: T) -> Self { +impl Located { + pub fn new(location: TextSize, end_location: TextSize, node: T) -> Self + where + U: Default, + { Self { - location, - end_location: Some(end_location), - custom: (), + custom: U::default(), + range: TextRange::new(location, end_location), node, } } - pub const fn start(&self) -> Location { - self.location + pub fn with_range(node: T, range: TextRange) -> Self + where + U: Default, + { + Self { + range, + custom: U::default(), + node, + } + } + + #[inline] + pub const fn start(&self) -> TextSize { + self.range.start() + } + + #[inline] + pub fn custom(&self) -> &U { + &self.custom + } + + #[inline] + pub fn node(&self) -> &T { + &self.node + } + + #[inline] + pub fn into_node(self) -> T { + self.node + } + + #[inline] + pub fn into_custom(self) -> U { + self.custom + } + + #[inline] + pub const fn range(&self) -> TextRange { + self.range } - /// Returns the node's [`end_location`](Located::end_location) or [`location`](Located::start) if - /// [`end_location`](Located::end_location) is `None`. - pub fn end(&self) -> Location { - self.end_location.unwrap_or(self.location) + #[inline] + pub const fn end(&self) -> TextSize { + self.range.end() } } -impl std::ops::Deref for Located { +impl Deref for Located { type Target = T; fn deref(&self) -> &Self::Target { @@ -554,8 +592,7 @@ pub mod fold { ) -> Result, F::Error> { Ok(Located { custom: folder.map_user(node.custom)?, - location: node.location, - end_location: node.end_location, + range: node.range, node: f(folder, node.node)?, }) } diff --git a/compiler/ast/src/constant.rs b/compiler/ast/src/constant.rs index 6099272efd..93436f1ea2 100644 --- a/compiler/ast/src/constant.rs +++ b/compiler/ast/src/constant.rs @@ -1,5 +1,4 @@ use num_bigint::BigInt; -pub use rustpython_compiler_core::ConversionFlag; #[derive(Clone, Debug, PartialEq)] pub enum Constant { @@ -122,8 +121,7 @@ impl crate::fold::Fold for ConstantOptimizer { Ok(crate::Expr { node: expr, custom: node.custom, - location: node.location, - end_location: node.end_location, + range: node.range, }) } _ => crate::fold::fold_expr(self, node), @@ -134,25 +132,23 @@ impl crate::fold::Fold for ConstantOptimizer { #[cfg(test)] mod tests { use super::*; + use ruff_text_size::TextRange; #[cfg(feature = "constant-optimization")] #[test] fn test_constant_opt() { use crate::{fold::Fold, *}; - let start = Default::default(); - let end = None; + let range = TextRange::default(); let custom = (); let ast = Located { - location: start, - end_location: end, + range, custom, node: ExprKind::Tuple { ctx: ExprContext::Load, elts: vec![ Located { - location: start, - end_location: end, + range, custom, node: ExprKind::Constant { value: BigInt::from(1).into(), @@ -160,8 +156,7 @@ mod tests { }, }, Located { - location: start, - end_location: end, + range, custom, node: ExprKind::Constant { value: BigInt::from(2).into(), @@ -169,15 +164,13 @@ mod tests { }, }, Located { - location: start, - end_location: end, + range, custom, node: ExprKind::Tuple { ctx: ExprContext::Load, elts: vec![ Located { - location: start, - end_location: end, + range, custom, node: ExprKind::Constant { value: BigInt::from(3).into(), @@ -185,8 +178,7 @@ mod tests { }, }, Located { - location: start, - end_location: end, + range, custom, node: ExprKind::Constant { value: BigInt::from(4).into(), @@ -194,8 +186,7 @@ mod tests { }, }, Located { - location: start, - end_location: end, + range, custom, node: ExprKind::Constant { value: BigInt::from(5).into(), @@ -214,8 +205,7 @@ mod tests { assert_eq!( new_ast, Located { - location: start, - end_location: end, + range, custom, node: ExprKind::Constant { value: Constant::Tuple(vec![ diff --git a/compiler/ast/src/lib.rs b/compiler/ast/src/lib.rs index d668bede69..b69862a689 100644 --- a/compiler/ast/src/lib.rs +++ b/compiler/ast/src/lib.rs @@ -3,10 +3,9 @@ mod constant; #[cfg(feature = "fold")] mod fold_helpers; mod impls; -#[cfg(feature = "unparse")] -mod unparse; pub use ast_gen::*; -pub use rustpython_compiler_core::Location; + +pub use ruff_text_size::TextSize as Location; pub type Suite = Vec>; diff --git a/compiler/ast/src/unparse.rs b/compiler/ast/src/unparse.rs deleted file mode 100644 index 081c2a9241..0000000000 --- a/compiler/ast/src/unparse.rs +++ /dev/null @@ -1,534 +0,0 @@ -use crate::{ - Arg, Arguments, Boolop, Cmpop, Comprehension, Constant, ConversionFlag, Expr, ExprKind, - Operator, -}; -use std::fmt; - -mod precedence { - macro_rules! precedence { - ($($op:ident,)*) => { - precedence!(@0, $($op,)*); - }; - (@$i:expr, $op1:ident, $($op:ident,)*) => { - pub const $op1: u8 = $i; - precedence!(@$i + 1, $($op,)*); - }; - (@$i:expr,) => {}; - } - precedence!( - TUPLE, TEST, OR, AND, NOT, CMP, // "EXPR" = - BOR, BXOR, BAND, SHIFT, ARITH, TERM, FACTOR, POWER, AWAIT, ATOM, - ); - pub const EXPR: u8 = BOR; -} - -#[repr(transparent)] -struct Unparser<'a> { - f: fmt::Formatter<'a>, -} -impl<'a> Unparser<'a> { - fn new<'b>(f: &'b mut fmt::Formatter<'a>) -> &'b mut Unparser<'a> { - unsafe { &mut *(f as *mut fmt::Formatter<'a> as *mut Unparser<'a>) } - } - - fn p(&mut self, s: &str) -> fmt::Result { - self.f.write_str(s) - } - fn p_if(&mut self, cond: bool, s: &str) -> fmt::Result { - if cond { - self.f.write_str(s)?; - } - Ok(()) - } - fn p_delim(&mut self, first: &mut bool, s: &str) -> fmt::Result { - self.p_if(!std::mem::take(first), s) - } - fn write_fmt(&mut self, f: fmt::Arguments<'_>) -> fmt::Result { - self.f.write_fmt(f) - } - - fn unparse_expr(&mut self, ast: &Expr, level: u8) -> fmt::Result { - macro_rules! op_prec { - ($op_ty:ident, $x:expr, $enu:path, $($var:ident($op:literal, $prec:ident)),*$(,)?) => { - match $x { - $(<$enu>::$var => (op_prec!(@space $op_ty, $op), precedence::$prec),)* - } - }; - (@space bin, $op:literal) => { - concat!(" ", $op, " ") - }; - (@space un, $op:literal) => { - $op - }; - } - macro_rules! group_if { - ($lvl:expr, $body:block) => {{ - let group = level > $lvl; - self.p_if(group, "(")?; - let ret = $body; - self.p_if(group, ")")?; - ret - }}; - } - match &ast.node { - ExprKind::BoolOp { op, values } => { - let (op, prec) = op_prec!(bin, op, Boolop, And("and", AND), Or("or", OR)); - group_if!(prec, { - let mut first = true; - for val in values { - self.p_delim(&mut first, op)?; - self.unparse_expr(val, prec + 1)?; - } - }) - } - ExprKind::NamedExpr { target, value } => { - group_if!(precedence::TUPLE, { - self.unparse_expr(target, precedence::ATOM)?; - self.p(" := ")?; - self.unparse_expr(value, precedence::ATOM)?; - }) - } - ExprKind::BinOp { left, op, right } => { - let right_associative = matches!(op, Operator::Pow); - let (op, prec) = op_prec!( - bin, - op, - Operator, - Add("+", ARITH), - Sub("-", ARITH), - Mult("*", TERM), - MatMult("@", TERM), - Div("/", TERM), - Mod("%", TERM), - Pow("**", POWER), - LShift("<<", SHIFT), - RShift(">>", SHIFT), - BitOr("|", BOR), - BitXor("^", BXOR), - BitAnd("&", BAND), - FloorDiv("//", TERM), - ); - group_if!(prec, { - self.unparse_expr(left, prec + right_associative as u8)?; - self.p(op)?; - self.unparse_expr(right, prec + !right_associative as u8)?; - }) - } - ExprKind::UnaryOp { op, operand } => { - let (op, prec) = op_prec!( - un, - op, - crate::Unaryop, - Invert("~", FACTOR), - Not("not ", NOT), - UAdd("+", FACTOR), - USub("-", FACTOR) - ); - group_if!(prec, { - self.p(op)?; - self.unparse_expr(operand, prec)?; - }) - } - ExprKind::Lambda { args, body } => { - group_if!(precedence::TEST, { - let pos = args.args.len() + args.posonlyargs.len(); - self.p(if pos > 0 { "lambda " } else { "lambda" })?; - self.unparse_args(args)?; - write!(self, ": {}", **body)?; - }) - } - ExprKind::IfExp { test, body, orelse } => { - group_if!(precedence::TEST, { - self.unparse_expr(body, precedence::TEST + 1)?; - self.p(" if ")?; - self.unparse_expr(test, precedence::TEST + 1)?; - self.p(" else ")?; - self.unparse_expr(orelse, precedence::TEST)?; - }) - } - ExprKind::Dict { keys, values } => { - self.p("{")?; - let mut first = true; - let (packed, unpacked) = values.split_at(keys.len()); - for (k, v) in keys.iter().zip(packed) { - self.p_delim(&mut first, ", ")?; - if let Some(k) = k { - write!(self, "{}: {}", *k, *v)?; - } else { - write!(self, "**{}", *v)?; - } - } - for d in unpacked { - self.p_delim(&mut first, ", ")?; - write!(self, "**{}", *d)?; - } - self.p("}")?; - } - ExprKind::Set { elts } => { - self.p("{")?; - let mut first = true; - for v in elts { - self.p_delim(&mut first, ", ")?; - self.unparse_expr(v, precedence::TEST)?; - } - self.p("}")?; - } - ExprKind::ListComp { elt, generators } => { - self.p("[")?; - self.unparse_expr(elt, precedence::TEST)?; - self.unparse_comp(generators)?; - self.p("]")?; - } - ExprKind::SetComp { elt, generators } => { - self.p("{")?; - self.unparse_expr(elt, precedence::TEST)?; - self.unparse_comp(generators)?; - self.p("}")?; - } - ExprKind::DictComp { - key, - value, - generators, - } => { - self.p("{")?; - self.unparse_expr(key, precedence::TEST)?; - self.p(": ")?; - self.unparse_expr(value, precedence::TEST)?; - self.unparse_comp(generators)?; - self.p("}")?; - } - ExprKind::GeneratorExp { elt, generators } => { - self.p("(")?; - self.unparse_expr(elt, precedence::TEST)?; - self.unparse_comp(generators)?; - self.p(")")?; - } - ExprKind::Await { value } => { - group_if!(precedence::AWAIT, { - self.p("await ")?; - self.unparse_expr(value, precedence::ATOM)?; - }) - } - ExprKind::Yield { value } => { - if let Some(value) = value { - write!(self, "(yield {})", **value)?; - } else { - self.p("(yield)")?; - } - } - ExprKind::YieldFrom { value } => { - write!(self, "(yield from {})", **value)?; - } - ExprKind::Compare { - left, - ops, - comparators, - } => { - group_if!(precedence::CMP, { - let new_lvl = precedence::CMP + 1; - self.unparse_expr(left, new_lvl)?; - for (op, cmp) in ops.iter().zip(comparators) { - let op = match op { - Cmpop::Eq => " == ", - Cmpop::NotEq => " != ", - Cmpop::Lt => " < ", - Cmpop::LtE => " <= ", - Cmpop::Gt => " > ", - Cmpop::GtE => " >= ", - Cmpop::Is => " is ", - Cmpop::IsNot => " is not ", - Cmpop::In => " in ", - Cmpop::NotIn => " not in ", - }; - self.p(op)?; - self.unparse_expr(cmp, new_lvl)?; - } - }) - } - ExprKind::Call { - func, - args, - keywords, - } => { - self.unparse_expr(func, precedence::ATOM)?; - self.p("(")?; - if let ( - [Expr { - node: ExprKind::GeneratorExp { elt, generators }, - .. - }], - [], - ) = (&**args, &**keywords) - { - // make sure a single genexpr doesn't get double parens - self.unparse_expr(elt, precedence::TEST)?; - self.unparse_comp(generators)?; - } else { - let mut first = true; - for arg in args { - self.p_delim(&mut first, ", ")?; - self.unparse_expr(arg, precedence::TEST)?; - } - for kw in keywords { - self.p_delim(&mut first, ", ")?; - if let Some(arg) = &kw.node.arg { - self.p(arg)?; - self.p("=")?; - } else { - self.p("**")?; - } - self.unparse_expr(&kw.node.value, precedence::TEST)?; - } - } - self.p(")")?; - } - ExprKind::FormattedValue { - value, - conversion, - format_spec, - } => self.unparse_formatted(value, *conversion, format_spec.as_deref())?, - ExprKind::JoinedStr { values } => self.unparse_joined_str(values, false)?, - ExprKind::Constant { value, kind } => { - if let Some(kind) = kind { - self.p(kind)?; - } - assert_eq!(f64::MAX_10_EXP, 308); - let inf_str = "1e309"; - match value { - Constant::Float(f) if f.is_infinite() => self.p(inf_str)?, - Constant::Complex { real, imag } - if real.is_infinite() || imag.is_infinite() => - { - self.p(&value.to_string().replace("inf", inf_str))? - } - _ => fmt::Display::fmt(value, &mut self.f)?, - } - } - ExprKind::Attribute { value, attr, .. } => { - self.unparse_expr(value, precedence::ATOM)?; - let period = if let ExprKind::Constant { - value: Constant::Int(_), - .. - } = &value.node - { - " ." - } else { - "." - }; - self.p(period)?; - self.p(attr)?; - } - ExprKind::Subscript { value, slice, .. } => { - self.unparse_expr(value, precedence::ATOM)?; - let mut lvl = precedence::TUPLE; - if let ExprKind::Tuple { elts, .. } = &slice.node { - if elts - .iter() - .any(|expr| matches!(expr.node, ExprKind::Starred { .. })) - { - lvl += 1 - } - } - self.p("[")?; - self.unparse_expr(slice, lvl)?; - self.p("]")?; - } - ExprKind::Starred { value, .. } => { - self.p("*")?; - self.unparse_expr(value, precedence::EXPR)?; - } - ExprKind::Name { id, .. } => self.p(id)?, - ExprKind::List { elts, .. } => { - self.p("[")?; - let mut first = true; - for elt in elts { - self.p_delim(&mut first, ", ")?; - self.unparse_expr(elt, precedence::TEST)?; - } - self.p("]")?; - } - ExprKind::Tuple { elts, .. } => { - if elts.is_empty() { - self.p("()")?; - } else { - group_if!(precedence::TUPLE, { - let mut first = true; - for elt in elts { - self.p_delim(&mut first, ", ")?; - self.unparse_expr(elt, precedence::TEST)?; - } - self.p_if(elts.len() == 1, ",")?; - }) - } - } - ExprKind::Slice { lower, upper, step } => { - if let Some(lower) = lower { - self.unparse_expr(lower, precedence::TEST)?; - } - self.p(":")?; - if let Some(upper) = upper { - self.unparse_expr(upper, precedence::TEST)?; - } - if let Some(step) = step { - self.p(":")?; - self.unparse_expr(step, precedence::TEST)?; - } - } - } - Ok(()) - } - - fn unparse_args(&mut self, args: &Arguments) -> fmt::Result { - let mut first = true; - let defaults_start = args.posonlyargs.len() + args.args.len() - args.defaults.len(); - for (i, arg) in args.posonlyargs.iter().chain(&args.args).enumerate() { - self.p_delim(&mut first, ", ")?; - self.unparse_arg(arg)?; - if let Some(i) = i.checked_sub(defaults_start) { - write!(self, "={}", &args.defaults[i])?; - } - self.p_if(i + 1 == args.posonlyargs.len(), ", /")?; - } - if args.vararg.is_some() || !args.kwonlyargs.is_empty() { - self.p_delim(&mut first, ", ")?; - self.p("*")?; - } - if let Some(vararg) = &args.vararg { - self.unparse_arg(vararg)?; - } - let defaults_start = args.kwonlyargs.len() - args.kw_defaults.len(); - for (i, kwarg) in args.kwonlyargs.iter().enumerate() { - self.p_delim(&mut first, ", ")?; - self.unparse_arg(kwarg)?; - if let Some(default) = i - .checked_sub(defaults_start) - .and_then(|i| args.kw_defaults.get(i)) - { - write!(self, "={default}")?; - } - } - if let Some(kwarg) = &args.kwarg { - self.p_delim(&mut first, ", ")?; - self.p("**")?; - self.unparse_arg(kwarg)?; - } - Ok(()) - } - fn unparse_arg(&mut self, arg: &Arg) -> fmt::Result { - self.p(&arg.node.arg)?; - if let Some(ann) = &arg.node.annotation { - write!(self, ": {}", **ann)?; - } - Ok(()) - } - - fn unparse_comp(&mut self, generators: &[Comprehension]) -> fmt::Result { - for comp in generators { - self.p(if comp.is_async > 0 { - " async for " - } else { - " for " - })?; - self.unparse_expr(&comp.target, precedence::TUPLE)?; - self.p(" in ")?; - self.unparse_expr(&comp.iter, precedence::TEST + 1)?; - for cond in &comp.ifs { - self.p(" if ")?; - self.unparse_expr(cond, precedence::TEST + 1)?; - } - } - Ok(()) - } - - fn unparse_fstring_body(&mut self, values: &[Expr], is_spec: bool) -> fmt::Result { - for value in values { - self.unparse_fstring_elem(value, is_spec)?; - } - Ok(()) - } - - fn unparse_formatted( - &mut self, - val: &Expr, - conversion: usize, - spec: Option<&Expr>, - ) -> fmt::Result { - let buffered = to_string_fmt(|f| Unparser::new(f).unparse_expr(val, precedence::TEST + 1)); - let brace = if buffered.starts_with('{') { - // put a space to avoid escaping the bracket - "{ " - } else { - "{" - }; - self.p(brace)?; - self.p(&buffered)?; - drop(buffered); - - if conversion != ConversionFlag::None as usize { - self.p("!")?; - let buf = &[conversion as u8]; - let c = std::str::from_utf8(buf).unwrap(); - self.p(c)?; - } - - if let Some(spec) = spec { - self.p(":")?; - self.unparse_fstring_elem(spec, true)?; - } - - self.p("}")?; - - Ok(()) - } - - fn unparse_fstring_elem(&mut self, expr: &Expr, is_spec: bool) -> fmt::Result { - match &expr.node { - ExprKind::Constant { value, .. } => { - if let Constant::Str(s) = value { - self.unparse_fstring_str(s) - } else { - unreachable!() - } - } - ExprKind::JoinedStr { values } => self.unparse_joined_str(values, is_spec), - ExprKind::FormattedValue { - value, - conversion, - format_spec, - } => self.unparse_formatted(value, *conversion, format_spec.as_deref()), - _ => unreachable!(), - } - } - - fn unparse_fstring_str(&mut self, s: &str) -> fmt::Result { - let s = s.replace('{', "{{").replace('}', "}}"); - self.p(&s) - } - - fn unparse_joined_str(&mut self, values: &[Expr], is_spec: bool) -> fmt::Result { - if is_spec { - self.unparse_fstring_body(values, is_spec) - } else { - self.p("f")?; - let body = to_string_fmt(|f| Unparser::new(f).unparse_fstring_body(values, is_spec)); - fmt::Display::fmt(&rustpython_common::str::repr(&body), &mut self.f) - } - } -} - -impl fmt::Display for Expr { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - Unparser::new(f).unparse_expr(self, precedence::TEST) - } -} - -fn to_string_fmt(f: impl FnOnce(&mut fmt::Formatter) -> fmt::Result) -> String { - use std::cell::Cell; - struct Fmt(Cell>); - impl fmt::Result> fmt::Display for Fmt { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - self.0.take().unwrap()(f) - } - } - Fmt(Cell::new(Some(f))).to_string() -} diff --git a/compiler/core/Cargo.toml b/compiler/core/Cargo.toml index 79622a9569..119bfe6ce5 100644 --- a/compiler/core/Cargo.toml +++ b/compiler/core/Cargo.toml @@ -14,5 +14,7 @@ itertools = { workspace = true } num-bigint = { workspace = true } num-complex = { workspace = true } serde = { version = "1.0.133", optional = true, default-features = false, features = ["derive"] } +ruff_text_size = { path = "../../ruff_text_size" } lz4_flex = "0.9.2" + diff --git a/compiler/core/src/error.rs b/compiler/core/src/error.rs index 813ca9832f..d62f704951 100644 --- a/compiler/core/src/error.rs +++ b/compiler/core/src/error.rs @@ -1,11 +1,11 @@ -use crate::Location; +use ruff_text_size::TextSize; use std::error::Error as StdError; use std::fmt::Display; #[derive(Debug, PartialEq, Eq)] pub struct BaseError { pub error: T, - pub location: Location, + pub location: TextSize, pub source_path: String, } @@ -31,7 +31,12 @@ where T: std::fmt::Display, { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - self.location.fmt_with(f, &self.error) + write!( + f, + "{} at byte offset {}", + &self.error, + u32::from(self.location) + ) } } @@ -58,59 +63,3 @@ impl BaseError { BaseError::from(self) } } - -#[derive(Debug)] -pub struct CompileError { - pub body: BaseError, - pub statement: Option, -} - -impl StdError for CompileError { - fn source(&self) -> Option<&(dyn StdError + 'static)> { - self.body.source() - } -} - -impl std::ops::Deref for CompileError { - type Target = BaseError; - fn deref(&self) -> &Self::Target { - &self.body - } -} - -impl std::fmt::Display for CompileError -where - T: std::fmt::Display, -{ - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - let loc = self.location; - if let Some(ref stmt) = self.statement { - // visualize the error when location and statement are provided - loc.fmt_with(f, &self.error)?; - write!(f, "\n{stmt}{arrow:>pad$}", pad = loc.column(), arrow = "^") - } else { - loc.fmt_with(f, &self.error) - } - } -} - -impl CompileError { - pub fn from(error: BaseError, source: &str) -> Self - where - T: From, - { - let statement = get_statement(source, error.location); - CompileError { - body: error.into(), - statement, - } - } -} - -fn get_statement(source: &str, loc: Location) -> Option { - if loc.column() == 0 || loc.row() == 0 { - return None; - } - let line = source.split('\n').nth(loc.row() - 1)?.to_owned(); - Some(line + "\n") -} diff --git a/compiler/core/src/lib.rs b/compiler/core/src/lib.rs index c431095f4a..d527d8c9ba 100644 --- a/compiler/core/src/lib.rs +++ b/compiler/core/src/lib.rs @@ -8,6 +8,6 @@ pub mod marshal; mod mode; pub use bytecode::*; -pub use error::{BaseError, CompileError}; +pub use error::BaseError; pub use location::Location; pub use mode::Mode; diff --git a/compiler/core/src/text_size.rs b/compiler/core/src/text_size.rs new file mode 100644 index 0000000000..b1a0d9782c --- /dev/null +++ b/compiler/core/src/text_size.rs @@ -0,0 +1,505 @@ +#[cfg(feature = "serde")] +use serde::{Deserialize, Serialize}; +use std::cmp; +use std::cmp::Ordering; +use std::convert::TryFrom; +use std::num::TryFromIntError; +use std::ops::{Add, AddAssign, Bound, Index, IndexMut, Range, RangeBounds, Sub, SubAssign}; + +pub type Location = TextSize; + +/// Source code location. +#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Default, Hash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] +pub struct TextSize(u32); + +impl TextSize { + pub fn fmt_with( + &self, + f: &mut std::fmt::Formatter, + e: &impl std::fmt::Display, + ) -> std::fmt::Result { + write!(f, "{} at offset {}", e, self.0) + } + + #[inline] + pub const fn new(offset: u32) -> Self { + Self(offset) + } + + #[inline] + pub const fn zero() -> Self { + Self(0) + } + + #[inline] + pub fn newline(&mut self) { + self.0 += 1; + } + + #[inline] + pub fn of(text_len: T) -> Self + where + T: TextLen, + { + text_len.text_len() + } + + #[inline] + pub const fn saturating_sub(self, rhs: TextSize) -> TextSize { + TextSize(self.0.saturating_sub(rhs.0)) + } + + #[inline] + pub const fn saturating_add(self, rhs: TextSize) -> TextSize { + TextSize(self.0.saturating_add(rhs.0)) + } + + #[inline] + pub fn checked_add(self, rhs: TextSize) -> Option { + self.0.checked_add(rhs.0).map(TextSize) + } + + /// Checked subtraction. Returns `None` if overflow occurred. + #[inline] + pub fn checked_sub(self, rhs: TextSize) -> Option { + self.0.checked_sub(rhs.0).map(TextSize) + } +} + +impl TryFrom for TextSize { + type Error = TryFromIntError; + + fn try_from(value: usize) -> Result { + Ok(Location::new(u32::try_from(value)?)) + } +} + +impl From for Location { + fn from(value: u32) -> Self { + TextSize(value) + } +} + +impl From for u32 { + fn from(value: TextSize) -> Self { + value.0 + } +} + +impl From for usize { + fn from(value: TextSize) -> Self { + value.0 as usize + } +} + +impl Add for TextSize { + type Output = TextSize; + + #[inline] + fn add(self, rhs: TextSize) -> Self::Output { + TextSize(self.0 + rhs.0) + } +} + +impl Add for &TextSize { + type Output = TextSize; + + fn add(self, rhs: TextSize) -> Self::Output { + TextSize(self.0 + rhs.0) + } +} + +impl Add<&TextSize> for TextSize { + type Output = TextSize; + + fn add(self, rhs: &TextSize) -> Self::Output { + TextSize(self.0 + rhs.0) + } +} + +impl Sub for TextSize { + type Output = TextSize; + + #[inline] + fn sub(self, rhs: TextSize) -> Self::Output { + TextSize(self.0 - rhs.0) + } +} + +impl Sub for &TextSize { + type Output = TextSize; + + fn sub(self, rhs: TextSize) -> Self::Output { + TextSize(self.0 - rhs.0) + } +} + +impl Sub<&TextSize> for TextSize { + type Output = TextSize; + + fn sub(self, rhs: &TextSize) -> Self::Output { + TextSize(self.0 - rhs.0) + } +} + +impl std::ops::AddAssign for TextSize +where + TextSize: Add, +{ + #[inline] + fn add_assign(&mut self, rhs: A) { + *self = *self + rhs; + } +} + +impl std::ops::SubAssign for TextSize +where + TextSize: Sub, +{ + #[inline] + fn sub_assign(&mut self, rhs: S) { + *self = *self - rhs; + } +} + +pub trait TextLen { + fn text_len(&self) -> TextSize; +} + +impl TextLen for &str { + fn text_len(&self) -> TextSize { + TextSize::try_from(self.len()).unwrap() + } +} + +impl TextLen for String { + fn text_len(&self) -> TextSize { + self.as_str().text_len() + } +} + +impl TextLen for char { + fn text_len(&self) -> TextSize { + TextSize::new(self.len_utf8() as u32) + } +} + +#[derive(Copy, Clone, Eq, PartialEq, Hash, Default)] +pub struct TextRange { + start: TextSize, + end: TextSize, +} + +impl TextRange { + #[inline] + pub fn new(start: TextSize, end: TextSize) -> Self { + assert!(start <= end); + + Self { start, end } + } + + #[inline] + pub fn at(offset: TextSize, length: TextSize) -> Self { + Self { + start: offset, + end: offset + length, + } + } + + #[inline] + pub fn empty(offset: TextSize) -> Self { + Self { + start: offset, + end: offset, + } + } + + #[inline] + pub fn up_to(end: TextSize) -> Self { + Self { + start: TextSize::zero(), + end, + } + } + + #[inline] + pub const fn start(self) -> TextSize { + self.start + } + + #[inline] + pub const fn end(self) -> TextSize { + self.end + } + + #[inline] + pub const fn len(self) -> TextSize { + TextSize::new(self.end.0 - self.start.0) + } + + #[inline] + pub const fn is_empty(self) -> bool { + self.len().0 == 0 + } + + #[inline] + pub const fn contains(self, offset: TextSize) -> bool { + self.start.0 <= offset.0 && offset.0 < self.end.0 + } + + #[inline] + pub const fn contains_inclusive(self, offset: TextSize) -> bool { + self.start.0 <= offset.0 && offset.0 <= self.end.0 + } + + #[inline] + pub const fn contains_range(self, other: TextRange) -> bool { + self.start.0 <= other.start.0 && other.end.0 <= self.end.0 + } + + /// The range covered by both ranges, if it exists. + /// If the ranges touch but do not overlap, the output range is empty. + /// + /// # Examples + /// + /// ```rust + /// # use text_size::*; + /// assert_eq!( + /// TextRange::intersect( + /// TextRange::new(0.into(), 10.into()), + /// TextRange::new(5.into(), 15.into()), + /// ), + /// Some(TextRange::new(5.into(), 10.into())), + /// ); + /// ``` + #[inline] + pub fn intersect(self, other: TextRange) -> Option { + let start = cmp::max(self.start(), other.start()); + let end = cmp::min(self.end(), other.end()); + if end < start { + return None; + } + Some(TextRange::new(start, end)) + } + + /// Extends the range to cover `other` as well. + /// + /// # Examples + /// + /// ```rust + /// # use text_size::*; + /// assert_eq!( + /// TextRange::cover( + /// TextRange::new(0.into(), 5.into()), + /// TextRange::new(15.into(), 20.into()), + /// ), + /// TextRange::new(0.into(), 20.into()), + /// ); + /// ``` + #[inline] + pub fn cover(self, other: TextRange) -> TextRange { + let start = cmp::min(self.start(), other.start()); + let end = cmp::max(self.end(), other.end()); + TextRange::new(start, end) + } + + /// Extends the range to cover `other` offsets as well. + /// + /// # Examples + /// + /// ```rust + /// # use text_size::*; + /// assert_eq!( + /// TextRange::empty(0.into()).cover_offset(20.into()), + /// TextRange::new(0.into(), 20.into()), + /// ) + /// ``` + #[inline] + pub fn cover_offset(self, offset: TextSize) -> TextRange { + self.cover(TextRange::empty(offset)) + } + + /// Add an offset to this range. + /// + /// Note that this is not appropriate for changing where a `TextRange` is + /// within some string; rather, it is for changing the reference anchor + /// that the `TextRange` is measured against. + /// + /// The unchecked version (`Add::add`) will _always_ panic on overflow, + /// in contrast to primitive integers, which check in debug mode only. + #[inline] + pub fn checked_add(self, offset: TextSize) -> Option { + Some(TextRange { + start: self.start.checked_add(offset)?, + end: self.end.checked_add(offset)?, + }) + } + + /// Subtract an offset from this range. + /// + /// Note that this is not appropriate for changing where a `TextRange` is + /// within some string; rather, it is for changing the reference anchor + /// that the `TextRange` is measured against. + /// + /// The unchecked version (`Sub::sub`) will _always_ panic on overflow, + /// in contrast to primitive integers, which check in debug mode only. + #[inline] + pub fn checked_sub(self, offset: TextSize) -> Option { + Some(TextRange { + start: self.start.checked_sub(offset)?, + end: self.end.checked_sub(offset)?, + }) + } + + /// Relative order of the two ranges (overlapping ranges are considered + /// equal). + /// + /// + /// This is useful when, for example, binary searching an array of disjoint + /// ranges. + /// + /// # Examples + /// + /// ``` + /// # use text_size::*; + /// # use std::cmp::Ordering; + /// + /// let a = TextRange::new(0.into(), 3.into()); + /// let b = TextRange::new(4.into(), 5.into()); + /// assert_eq!(a.ordering(b), Ordering::Less); + /// + /// let a = TextRange::new(0.into(), 3.into()); + /// let b = TextRange::new(3.into(), 5.into()); + /// assert_eq!(a.ordering(b), Ordering::Less); + /// + /// let a = TextRange::new(0.into(), 3.into()); + /// let b = TextRange::new(2.into(), 5.into()); + /// assert_eq!(a.ordering(b), Ordering::Equal); + /// + /// let a = TextRange::new(0.into(), 3.into()); + /// let b = TextRange::new(2.into(), 2.into()); + /// assert_eq!(a.ordering(b), Ordering::Equal); + /// + /// let a = TextRange::new(2.into(), 3.into()); + /// let b = TextRange::new(2.into(), 2.into()); + /// assert_eq!(a.ordering(b), Ordering::Greater); + /// ``` + #[inline] + pub fn ordering(self, other: TextRange) -> Ordering { + if self.end() <= other.start() { + Ordering::Less + } else if other.end() <= self.start() { + Ordering::Greater + } else { + Ordering::Equal + } + } +} + +impl Index for str { + type Output = str; + + fn index(&self, index: TextRange) -> &Self::Output { + &self[usize::from(index.start)..usize::from(index.end)] + } +} + +impl IndexMut for str { + fn index_mut(&mut self, index: TextRange) -> &mut Self::Output { + &mut self[usize::from(index.start)..usize::from(index.end)] + } +} + +impl Index for String { + type Output = str; + + fn index(&self, index: TextRange) -> &Self::Output { + &self[usize::from(index.start)..usize::from(index.end)] + } +} + +impl IndexMut for String { + fn index_mut(&mut self, index: TextRange) -> &mut Self::Output { + &mut self[usize::from(index.start)..usize::from(index.end)] + } +} + +impl RangeBounds for TextRange { + fn start_bound(&self) -> Bound<&TextSize> { + Bound::Included(&self.start) + } + + fn end_bound(&self) -> Bound<&TextSize> { + Bound::Excluded(&self.end) + } +} + +impl From for Range +where + T: From, +{ + #[inline] + fn from(r: TextRange) -> Self { + r.start().into()..r.end().into() + } +} + +impl Add for TextRange { + type Output = TextRange; + #[inline] + fn add(self, offset: TextSize) -> TextRange { + self.checked_add(offset) + .expect("TextRange +offset overflowed") + } +} + +impl Add for &TextRange { + type Output = TextRange; + #[inline] + fn add(self, offset: TextSize) -> TextRange { + *self + offset + } +} + +impl Sub for TextRange { + type Output = TextRange; + #[inline] + fn sub(self, offset: TextSize) -> TextRange { + self.checked_sub(offset) + .expect("TextRange +offset overflowed") + } +} + +impl Sub for &TextRange { + type Output = TextRange; + #[inline] + fn sub(self, offset: TextSize) -> TextRange { + *self - offset + } +} + +impl AddAssign for TextRange +where + TextRange: Add, +{ + #[inline] + fn add_assign(&mut self, rhs: A) { + *self = *self + rhs + } +} + +impl SubAssign for TextRange +where + TextRange: Sub, +{ + #[inline] + fn sub_assign(&mut self, rhs: S) { + *self = *self - rhs + } +} + +#[cfg(test)] +mod tests { + use super::*; +} diff --git a/compiler/parser/Cargo.toml b/compiler/parser/Cargo.toml index 0568fbb23c..9c89733004 100644 --- a/compiler/parser/Cargo.toml +++ b/compiler/parser/Cargo.toml @@ -21,6 +21,7 @@ tiny-keccak = { version = "2", features = ["sha3"] } [dependencies] rustpython-ast = { path = "../ast", version = "0.2.0" } rustpython-compiler-core = { path = "../core", version = "0.2.0" } +ruff_text_size = { path = "../../ruff_text_size" } ahash = { workspace = true } itertools = { workspace = true } @@ -31,7 +32,7 @@ unicode_names2 = { workspace = true } unic-emoji-char = "0.9.0" unic-ucd-ident = "0.9.0" -lalrpop-util = "0.19.8" +lalrpop-util = "0.19.9" phf = "0.11.1" rustc-hash = "1.1.0" serde = { version = "1.0.133", optional = true, default-features = false, features = ["derive"] } diff --git a/compiler/parser/python.lalrpop b/compiler/parser/python.lalrpop index 45113a3c8f..1b5c25e22c 100644 --- a/compiler/parser/python.lalrpop +++ b/compiler/parser/python.lalrpop @@ -519,7 +519,7 @@ ClosedPattern: ast::Pattern = { SequencePattern: ast::PatternKind = { // A single-item tuple is a special case: it's a group pattern, _not_ a sequence pattern. - "(" ")" => pattern.node, + "(" ")" => pattern.into_node(), "(" ")" => ast::PatternKind::MatchSequence { patterns: vec![], }, @@ -1554,7 +1554,7 @@ Atom: ast::Expr = { }, "(" >> ",")?> )*> ")" =>? { if left.is_none() && right.is_empty() && trailing_comma.is_none() { - if matches!(mid.node, ast::ExprKind::Starred { .. }) { + if matches!(mid.node(), ast::ExprKind::Starred { .. }) { Err(LexicalError{ error: LexicalErrorType::OtherError("cannot use starred expression here".to_string()), location: mid.start(), diff --git a/compiler/parser/src/function.rs b/compiler/parser/src/function.rs index 17b9882bf1..fa4c96f37f 100644 --- a/compiler/parser/src/function.rs +++ b/compiler/parser/src/function.rs @@ -146,7 +146,7 @@ pub(crate) fn parse_args(func_args: Vec) -> Result bool { - matches!(exp.node, ast::ExprKind::Starred { .. }) + matches!(exp.node(), ast::ExprKind::Starred { .. }) } #[cfg(test)] diff --git a/compiler/parser/src/lexer.rs b/compiler/parser/src/lexer.rs index 38b1d53e5a..fb81cce2af 100644 --- a/compiler/parser/src/lexer.rs +++ b/compiler/parser/src/lexer.rs @@ -7,7 +7,7 @@ //! The primary function in this module is [`lex`], which takes a string slice //! and returns an iterator over the tokens in the source code. The tokens are currently returned //! as a `Result`, where [`Spanned`] is a tuple containing the -//! start and end [`Location`] and a [`Tok`] denoting the token. +//! start and end [`TextSize`] and a [`Tok`] denoting the token. //! //! # Example //! @@ -21,18 +21,13 @@ //! //! for (start, token, end) in tokens { //! println!( -//! "{0},{1}-{2},{3:<5} {token:?}", -//! start.row(), -//! start.column(), -//! end.row(), -//! end.column(), +//! "{start:?}-{end:?} {token:?}", //! ); //! } //! ``` //! //! [Lexical analysis]: https://docs.python.org/3/reference/lexical_analysis.html use crate::{ - ast::Location, mode::Mode, soft_keywords::SoftKeywordTransformer, string::FStringErrorType, @@ -41,6 +36,7 @@ use crate::{ use log::trace; use num_bigint::BigInt; use num_traits::{Num, Zero}; +use ruff_text_size::{TextLen, TextSize}; use std::{char, cmp::Ordering, ops::Index, slice::SliceIndex, str::FromStr}; use unic_emoji_char::is_emoji_presentation; use unic_ucd_ident::{is_xid_continue, is_xid_start}; @@ -57,7 +53,7 @@ impl IndentationLevel { fn compare_strict( &self, other: &IndentationLevel, - location: Location, + location: TextSize, ) -> Result { // We only know for sure that we're smaller or bigger if tabs // and spaces both differ in the same direction. Otherwise we're @@ -178,7 +174,7 @@ pub struct Lexer> { // Pending list of tokens to be returned. pending: Vec, // The current location. - location: Location, + location: TextSize, } // generated in build.rs, in gen_phf() @@ -187,7 +183,7 @@ pub static KEYWORDS: phf::Map<&'static str, Tok> = include!(concat!(env!("OUT_DIR"), "/keywords.rs")); /// Contains a Token along with its start and end location. -pub type Spanned = (Location, Tok, Location); +pub type Spanned = (TextSize, Tok, TextSize); /// The result of lexing a token. pub type LexResult = Result; @@ -207,7 +203,7 @@ pub type LexResult = Result; /// ``` #[inline] pub fn lex(source: &str, mode: Mode) -> impl Iterator + '_ { - lex_located(source, mode, Location::default()) + lex_located(source, mode, TextSize::default()) } /// Create a new lexer from a source string, starting at a given location. @@ -215,7 +211,7 @@ pub fn lex(source: &str, mode: Mode) -> impl Iterator + '_ { pub fn lex_located( source: &str, mode: Mode, - start_location: Location, + start_location: TextSize, ) -> impl Iterator + '_ { SoftKeywordTransformer::new(Lexer::new(source.chars(), start_location), mode) } @@ -226,7 +222,7 @@ where { /// Create a new lexer from T and a starting location. You probably want to use /// [`lex`] instead. - pub fn new(input: T, start: Location) -> Self { + pub fn new(input: T, start: TextSize) -> Self { let mut lxr = Lexer { at_begin_of_line: true, nesting: 0, @@ -306,7 +302,7 @@ where } /// Lex a hex/octal/decimal/binary number without a decimal point. - fn lex_number_radix(&mut self, start_pos: Location, radix: u32) -> LexResult { + fn lex_number_radix(&mut self, start_pos: TextSize, radix: u32) -> LexResult { let value_text = self.radix_run(radix); let end_pos = self.get_pos(); let value = BigInt::from_str_radix(&value_text, radix).map_err(|e| LexicalError { @@ -469,7 +465,7 @@ where /// Lex a string literal. fn lex_string(&mut self, kind: StringKind) -> LexResult { let start_pos = self.get_pos(); - for _ in 0..kind.prefix_len() { + for _ in 0..u32::from(kind.prefix_len()) { self.next_char(); } let quote_char = self.next_char().unwrap(); @@ -1155,25 +1151,26 @@ where let mut c = self.window[0]; self.window.slide(); match c { - Some('\n') => { - self.location.newline(); - } Some('\r') => { if self.window[0] == Some('\n') { + self.location += TextSize::from(1); self.window.slide(); } - self.location.newline(); + + self.location += TextSize::from(1); c = Some('\n'); } - _ => { - self.location.go_right(); + #[allow(unused_variables)] + Some(c) => { + self.location += c.text_len(); } + _ => {} } c } // Helper function to retrieve the current position. - fn get_pos(&self) -> Location { + fn get_pos(&self) -> TextSize { self.location } @@ -1218,12 +1215,12 @@ pub struct LexicalError { /// The type of error that occurred. pub error: LexicalErrorType, /// The location of the error. - pub location: Location, + pub location: TextSize, } impl LexicalError { /// Creates a new `LexicalError` with the given error type and location. - pub fn new(error: LexicalErrorType, location: Location) -> Self { + pub fn new(error: LexicalErrorType, location: TextSize) -> Self { Self { error, location } } } diff --git a/compiler/parser/src/lib.rs b/compiler/parser/src/lib.rs index 9516932b49..be2bd62453 100644 --- a/compiler/parser/src/lib.rs +++ b/compiler/parser/src/lib.rs @@ -113,6 +113,7 @@ #![doc(html_root_url = "https://docs.rs/rustpython-parser/")] pub use rustpython_ast as ast; +pub use rustpython_compiler_core::ConversionFlag; mod function; // Skip flattening lexer to distinguish from full parser diff --git a/compiler/parser/src/parser.rs b/compiler/parser/src/parser.rs index b9c0bc0ade..a53c5d316e 100644 --- a/compiler/parser/src/parser.rs +++ b/compiler/parser/src/parser.rs @@ -23,6 +23,7 @@ use itertools::Itertools; use std::iter; pub(super) use lalrpop_util::ParseError as LalrpopError; +use ruff_text_size::TextSize; /// Parse a full Python program usually consisting of multiple lines. /// @@ -69,7 +70,7 @@ pub fn parse_program(source: &str, source_path: &str) -> Result Result { - parse_expression_located(source, path, Location::new(1, 0)) + parse_expression_located(source, path, Location::default()) } /// Parses a Python expression from a given location. @@ -85,7 +86,7 @@ pub fn parse_expression(source: &str, path: &str) -> Result", Location::new(5, 20)); +/// let expr = parse_expression_located("1 + 2", "", Location::from(400)); /// assert!(expr.is_ok()); /// ``` pub fn parse_expression_located( @@ -131,7 +132,7 @@ pub fn parse_expression_located( /// assert!(program.is_ok()); /// ``` pub fn parse(source: &str, mode: Mode, source_path: &str) -> Result { - parse_located(source, mode, source_path, Location::new(1, 0)) + parse_located(source, mode, source_path, Location::default()) } /// Parse the given Python source code using the specified [`Mode`] and [`Location`]. @@ -153,7 +154,7 @@ pub fn parse(source: &str, mode: Mode, source_path: &str) -> Result", Location::new(1, 0)); +/// let program = parse_located(source, Mode::Module, "", Location::from(0)); /// assert!(program.is_ok()); /// ``` pub fn parse_located( @@ -246,7 +247,7 @@ fn parse_error_from_lalrpop( let expected = (expected.len() == 1).then(|| expected[0].clone()); ParseError { error: ParseErrorType::UnrecognizedToken(token.1, expected), - location: token.0.with_col_offset(1), + location: token.0 + TextSize::from(1), source_path, } } diff --git a/compiler/parser/src/string.rs b/compiler/parser/src/string.rs index 14f5ce1caa..b81cd3158d 100644 --- a/compiler/parser/src/string.rs +++ b/compiler/parser/src/string.rs @@ -4,12 +4,14 @@ // regular strings. Since the parser has no definition of f-string formats (Pending PEP 701) // we have to do the parsing here, manually. use crate::{ - ast::{Constant, ConversionFlag, Expr, ExprKind, Location}, + ast::{Constant, Expr, ExprKind, Location}, lexer::{LexicalError, LexicalErrorType}, parser::{parse_expression_located, LalrpopError, ParseError, ParseErrorType}, token::{StringKind, Tok}, }; use itertools::Itertools; +use ruff_text_size::{TextLen, TextSize}; +use rustpython_compiler_core::ConversionFlag; // unicode_name2 does not expose `MAX_NAME_LENGTH`, so we replicate that constant here, fix #3798 const MAX_UNICODE_NAME: usize = 88; @@ -30,26 +32,25 @@ impl<'a> StringParser<'a> { start: Location, end: Location, ) -> Self { - let offset = kind.prefix_len() + if triple_quoted { 3 } else { 1 }; + let offset = kind.prefix_len() + + if triple_quoted { + TextSize::from(3) + } else { + TextSize::from(1) + }; Self { chars: source.chars().peekable(), kind, start, end, - location: start.with_col_offset(offset), + location: start + offset, } } #[inline] fn next_char(&mut self) -> Option { - let Some(c) = self.chars.next() else { - return None - }; - if c == '\n' { - self.location.newline(); - } else { - self.location.go_right(); - } + let c = self.chars.next()?; + self.location += c.text_len(); Some(c) } @@ -527,7 +528,8 @@ impl<'a> StringParser<'a> { fn parse_fstring_expr(source: &str, location: Location) -> Result { let fstring_body = format!("({source})"); - parse_expression_located(&fstring_body, "", location.with_col_offset(-1)) + let start = location - Location::from(1); + parse_expression_located(&fstring_body, "", start) } fn parse_string( @@ -567,7 +569,7 @@ pub(crate) fn parse_strings( let mut content: Vec = vec![]; for (start, (source, kind, triple_quoted), end) in values { for value in parse_string(&source, kind, triple_quoted, start, end)? { - match value.node { + match value.into_node() { ExprKind::Constant { value: Constant::Bytes(value), .. @@ -590,7 +592,7 @@ pub(crate) fn parse_strings( let mut content: Vec = vec![]; for (start, (source, kind, triple_quoted), end) in values { for value in parse_string(&source, kind, triple_quoted, start, end)? { - match value.node { + match value.into_node() { ExprKind::Constant { value: Constant::Str(value), .. @@ -754,6 +756,7 @@ impl From for LalrpopError { } } +#[cfg(not(feature = "byte_offsets"))] #[cfg(test)] mod tests { use super::*; @@ -765,7 +768,7 @@ mod tests { StringKind::FString, false, Location::default(), - Location::default().with_col_offset(source.len() + 3), // 3 for prefix and quotes + Location::default() + source.text_len() + Location::from(3), // 3 for prefix and quotes ) .parse() } diff --git a/compiler/parser/src/token.rs b/compiler/parser/src/token.rs index 42b0991514..50a07e6c52 100644 --- a/compiler/parser/src/token.rs +++ b/compiler/parser/src/token.rs @@ -5,6 +5,7 @@ //! //! [CPython source]: https://github.com/python/cpython/blob/dfc2e065a2e71011017077e549cd2f9bf4944c54/Include/internal/pycore_token.h use num_bigint::BigInt; +use ruff_text_size::TextSize; use std::fmt; /// The set of tokens the Python source code can be tokenized in. @@ -401,12 +402,12 @@ impl StringKind { } /// Returns the number of characters in the prefix. - pub fn prefix_len(&self) -> usize { + pub fn prefix_len(&self) -> TextSize { use StringKind::*; match self { - String => 0, - RawString | FString | Unicode | Bytes => 1, - RawFString | RawBytes => 2, + String => TextSize::from(0), + RawString | FString | Unicode | Bytes => TextSize::from(1), + RawFString | RawBytes => TextSize::from(2), } } } diff --git a/ruff_text_size/Cargo.toml b/ruff_text_size/Cargo.toml new file mode 100644 index 0000000000..dc45da3f84 --- /dev/null +++ b/ruff_text_size/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "ruff_text_size" +version = "0.0.0" +publish = false +edition = "2021" +rust-version = "1.67.1" + +[dependencies] +serde = { workspace = true, optional = true, default_features = false } +schemars = { version = "0.8.12", optional = true } + +[dev-dependencies] +serde_test = { version = "1.0.152" } +static_assertions = { version = "1.1.0" } + +[[test]] +name = "serde" +path = "tests/serde.rs" +required-features = ["serde"] diff --git a/ruff_text_size/src/lib.rs b/ruff_text_size/src/lib.rs new file mode 100644 index 0000000000..fd27c65523 --- /dev/null +++ b/ruff_text_size/src/lib.rs @@ -0,0 +1,34 @@ +//! Newtypes for working with text sizes/ranges in a more type-safe manner. +//! +//! This library can help with two things: +//! * Reducing storage requirements for offsets and ranges, under the +//! assumption that 32 bits is enough. +//! * Providing standard vocabulary types for applications where text ranges +//! are pervasive. +//! +//! However, you should not use this library simply because you work with +//! strings. In the overwhelming majority of cases, using `usize` and +//! `std::ops::Range` is better. In particular, if you are publishing a +//! library, using only std types in the interface would make it more +//! interoperable. Similarly, if you are writing something like a lexer, which +//! produces, but does not *store* text ranges, then sticking to `usize` would +//! be better. +//! +//! Minimal Supported Rust Version: latest stable. + +#![forbid(unsafe_code)] +#![warn(missing_debug_implementations, missing_docs)] + +mod range; +mod size; +mod traits; + +#[cfg(feature = "schemars")] +mod schemars_impls; +#[cfg(feature = "serde")] +mod serde_impls; + +pub use crate::{range::TextRange, size::TextSize, traits::TextLen}; + +#[cfg(target_pointer_width = "16")] +compile_error!("text-size assumes usize >= u32 and does not work on 16-bit targets"); diff --git a/ruff_text_size/src/range.rs b/ruff_text_size/src/range.rs new file mode 100644 index 0000000000..107b79d3dc --- /dev/null +++ b/ruff_text_size/src/range.rs @@ -0,0 +1,537 @@ +use cmp::Ordering; + +use { + crate::TextSize, + std::{ + cmp, fmt, + ops::{Add, AddAssign, Bound, Index, IndexMut, Range, RangeBounds, Sub, SubAssign}, + }, +}; + +/// A range in text, represented as a pair of [`TextSize`][struct@TextSize]. +/// +/// It is a logic error for `start` to be greater than `end`. +#[derive(Default, Copy, Clone, Eq, PartialEq, Hash)] +pub struct TextRange { + // Invariant: start <= end + start: TextSize, + end: TextSize, +} + +impl fmt::Debug for TextRange { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}..{}", self.start().raw, self.end().raw) + } +} + +impl TextRange { + /// Creates a new `TextRange` with the given `start` and `end` (`start..end`). + /// + /// # Panics + /// + /// Panics if `end < start`. + /// + /// # Examples + /// + /// ```rust + /// # use ruff_text_size::*; + /// let start = TextSize::from(5); + /// let end = TextSize::from(10); + /// let range = TextRange::new(start, end); + /// + /// assert_eq!(range.start(), start); + /// assert_eq!(range.end(), end); + /// assert_eq!(range.len(), end - start); + /// ``` + #[inline] + pub fn new(start: TextSize, end: TextSize) -> TextRange { + assert!(start <= end); + TextRange { start, end } + } + + /// Create a new `TextRange` with the given `offset` and `len` (`offset..offset + len`). + /// + /// # Examples + /// + /// ```rust + /// # use ruff_text_size::*; + /// let text = "0123456789"; + /// + /// let offset = TextSize::from(2); + /// let length = TextSize::from(5); + /// let range = TextRange::at(offset, length); + /// + /// assert_eq!(range, TextRange::new(offset, offset + length)); + /// assert_eq!(&text[range], "23456") + /// ``` + #[inline] + pub fn at(offset: TextSize, len: TextSize) -> TextRange { + TextRange::new(offset, offset + len) + } + + /// Create a zero-length range at the specified offset (`offset..offset`). + /// + /// # Examples + /// + /// ```rust + /// # use ruff_text_size::*; + /// let point: TextSize; + /// # point = TextSize::from(3); + /// let range = TextRange::empty(point); + /// assert!(range.is_empty()); + /// assert_eq!(range, TextRange::new(point, point)); + /// ``` + #[inline] + pub fn empty(offset: TextSize) -> TextRange { + TextRange { + start: offset, + end: offset, + } + } + + /// Create a range up to the given end (`..end`). + /// + /// # Examples + /// + /// ```rust + /// # use ruff_text_size::*; + /// let point: TextSize; + /// # point = TextSize::from(12); + /// let range = TextRange::up_to(point); + /// + /// assert_eq!(range.len(), point); + /// assert_eq!(range, TextRange::new(0.into(), point)); + /// assert_eq!(range, TextRange::at(0.into(), point)); + /// ``` + #[inline] + pub fn up_to(end: TextSize) -> TextRange { + TextRange { + start: 0.into(), + end, + } + } +} + +/// Identity methods. +impl TextRange { + /// The start point of this range. + #[inline] + pub const fn start(self) -> TextSize { + self.start + } + + /// The end point of this range. + #[inline] + pub const fn end(self) -> TextSize { + self.end + } + + /// The size of this range. + #[inline] + pub const fn len(self) -> TextSize { + // HACK for const fn: math on primitives only + TextSize { + raw: self.end().raw - self.start().raw, + } + } + + /// Check if this range is empty. + #[inline] + pub const fn is_empty(self) -> bool { + // HACK for const fn: math on primitives only + self.start().raw == self.end().raw + } +} + +/// Manipulation methods. +impl TextRange { + /// Check if this range contains an offset. + /// + /// The end index is considered excluded. + /// + /// # Examples + /// + /// ```rust + /// # use ruff_text_size::*; + /// let (start, end): (TextSize, TextSize); + /// # start = 10.into(); end = 20.into(); + /// let range = TextRange::new(start, end); + /// assert!(range.contains(start)); + /// assert!(!range.contains(end)); + /// ``` + #[inline] + pub fn contains(self, offset: TextSize) -> bool { + self.start() <= offset && offset < self.end() + } + + /// Check if this range contains an offset. + /// + /// The end index is considered included. + /// + /// # Examples + /// + /// ```rust + /// # use ruff_text_size::*; + /// let (start, end): (TextSize, TextSize); + /// # start = 10.into(); end = 20.into(); + /// let range = TextRange::new(start, end); + /// assert!(range.contains_inclusive(start)); + /// assert!(range.contains_inclusive(end)); + /// ``` + #[inline] + pub fn contains_inclusive(self, offset: TextSize) -> bool { + self.start() <= offset && offset <= self.end() + } + + /// Check if this range completely contains another range. + /// + /// # Examples + /// + /// ```rust + /// # use ruff_text_size::*; + /// let larger = TextRange::new(0.into(), 20.into()); + /// let smaller = TextRange::new(5.into(), 15.into()); + /// assert!(larger.contains_range(smaller)); + /// assert!(!smaller.contains_range(larger)); + /// + /// // a range always contains itself + /// assert!(larger.contains_range(larger)); + /// assert!(smaller.contains_range(smaller)); + /// ``` + #[inline] + pub fn contains_range(self, other: TextRange) -> bool { + self.start() <= other.start() && other.end() <= self.end() + } + + /// The range covered by both ranges, if it exists. + /// If the ranges touch but do not overlap, the output range is empty. + /// + /// # Examples + /// + /// ```rust + /// # use ruff_text_size::*; + /// assert_eq!( + /// TextRange::intersect( + /// TextRange::new(0.into(), 10.into()), + /// TextRange::new(5.into(), 15.into()), + /// ), + /// Some(TextRange::new(5.into(), 10.into())), + /// ); + /// ``` + #[inline] + pub fn intersect(self, other: TextRange) -> Option { + let start = cmp::max(self.start(), other.start()); + let end = cmp::min(self.end(), other.end()); + if end < start { + return None; + } + Some(TextRange::new(start, end)) + } + + /// Extends the range to cover `other` as well. + /// + /// # Examples + /// + /// ```rust + /// # use ruff_text_size::*; + /// assert_eq!( + /// TextRange::cover( + /// TextRange::new(0.into(), 5.into()), + /// TextRange::new(15.into(), 20.into()), + /// ), + /// TextRange::new(0.into(), 20.into()), + /// ); + /// ``` + #[inline] + #[must_use] + pub fn cover(self, other: TextRange) -> TextRange { + let start = cmp::min(self.start(), other.start()); + let end = cmp::max(self.end(), other.end()); + TextRange::new(start, end) + } + + /// Extends the range to cover `other` offsets as well. + /// + /// # Examples + /// + /// ```rust + /// # use ruff_text_size::*; + /// assert_eq!( + /// TextRange::empty(0.into()).cover_offset(20.into()), + /// TextRange::new(0.into(), 20.into()), + /// ) + /// ``` + #[inline] + #[must_use] + pub fn cover_offset(self, offset: TextSize) -> TextRange { + self.cover(TextRange::empty(offset)) + } + + /// Add an offset to this range. + /// + /// Note that this is not appropriate for changing where a `TextRange` is + /// within some string; rather, it is for changing the reference anchor + /// that the `TextRange` is measured against. + /// + /// The unchecked version (`Add::add`) will _always_ panic on overflow, + /// in contrast to primitive integers, which check in debug mode only. + #[inline] + pub fn checked_add(self, offset: TextSize) -> Option { + Some(TextRange { + start: self.start.checked_add(offset)?, + end: self.end.checked_add(offset)?, + }) + } + + /// Subtract an offset from this range. + /// + /// Note that this is not appropriate for changing where a `TextRange` is + /// within some string; rather, it is for changing the reference anchor + /// that the `TextRange` is measured against. + /// + /// The unchecked version (`Sub::sub`) will _always_ panic on overflow, + /// in contrast to primitive integers, which check in debug mode only. + #[inline] + pub fn checked_sub(self, offset: TextSize) -> Option { + Some(TextRange { + start: self.start.checked_sub(offset)?, + end: self.end.checked_sub(offset)?, + }) + } + + /// Relative order of the two ranges (overlapping ranges are considered + /// equal). + /// + /// + /// This is useful when, for example, binary searching an array of disjoint + /// ranges. + /// + /// # Examples + /// + /// ``` + /// # use ruff_text_size::*; + /// # use std::cmp::Ordering; + /// + /// let a = TextRange::new(0.into(), 3.into()); + /// let b = TextRange::new(4.into(), 5.into()); + /// assert_eq!(a.ordering(b), Ordering::Less); + /// + /// let a = TextRange::new(0.into(), 3.into()); + /// let b = TextRange::new(3.into(), 5.into()); + /// assert_eq!(a.ordering(b), Ordering::Less); + /// + /// let a = TextRange::new(0.into(), 3.into()); + /// let b = TextRange::new(2.into(), 5.into()); + /// assert_eq!(a.ordering(b), Ordering::Equal); + /// + /// let a = TextRange::new(0.into(), 3.into()); + /// let b = TextRange::new(2.into(), 2.into()); + /// assert_eq!(a.ordering(b), Ordering::Equal); + /// + /// let a = TextRange::new(2.into(), 3.into()); + /// let b = TextRange::new(2.into(), 2.into()); + /// assert_eq!(a.ordering(b), Ordering::Greater); + /// ``` + #[inline] + pub fn ordering(self, other: TextRange) -> Ordering { + if self.end() <= other.start() { + Ordering::Less + } else if other.end() <= self.start() { + Ordering::Greater + } else { + Ordering::Equal + } + } + + /// Subtracts an offset from the start position. + /// + /// + /// ## Panics + /// If `start - amount` is less than zero. + /// + /// ## Examples + /// + /// ``` + /// use ruff_text_size::{TextRange, TextSize}; + /// + /// let range = TextRange::new(TextSize::from(5), TextSize::from(10)); + /// assert_eq!(range.sub_start(TextSize::from(2)), TextRange::new(TextSize::from(3), TextSize::from(10))); + /// ``` + #[inline] + #[must_use] + pub fn sub_start(&self, amount: TextSize) -> TextRange { + TextRange::new(self.start() - amount, self.end()) + } + + /// Adds an offset to the start position. + /// + /// ## Panics + /// If `start + amount > end` + /// + /// ## Examples + /// + /// ``` + /// use ruff_text_size::{TextRange, TextSize}; + /// + /// let range = TextRange::new(TextSize::from(5), TextSize::from(10)); + /// assert_eq!(range.add_start(TextSize::from(3)), TextRange::new(TextSize::from(8), TextSize::from(10))); + /// ``` + #[inline] + #[must_use] + pub fn add_start(&self, amount: TextSize) -> TextRange { + TextRange::new(self.start() + amount, self.end()) + } + + /// Subtracts an offset from the end position. + /// + /// + /// ## Panics + /// If `end - amount < 0` or `end - amount < start` + /// + /// ## Examples + /// + /// ``` + /// use ruff_text_size::{TextRange, TextSize}; + /// + /// let range = TextRange::new(TextSize::from(5), TextSize::from(10)); + /// assert_eq!(range.sub_end(TextSize::from(2)), TextRange::new(TextSize::from(5), TextSize::from(8))); + /// ``` + #[inline] + #[must_use] + pub fn sub_end(&self, amount: TextSize) -> TextRange { + TextRange::new(self.start(), self.end() - amount) + } + + /// Adds an offset to the end position. + /// + /// + /// ## Panics + /// If `end + amount > u32::MAX` + /// + /// ## Examples + /// + /// ``` + /// use ruff_text_size::{TextRange, TextSize}; + /// + /// let range = TextRange::new(TextSize::from(5), TextSize::from(10)); + /// assert_eq!(range.add_end(TextSize::from(2)), TextRange::new(TextSize::from(5), TextSize::from(12))); + /// ``` + #[inline] + #[must_use] + pub fn add_end(&self, amount: TextSize) -> TextRange { + TextRange::new(self.start(), self.end() + amount) + } +} + +impl Index for str { + type Output = str; + #[inline] + fn index(&self, index: TextRange) -> &str { + &self[Range::::from(index)] + } +} + +impl Index for String { + type Output = str; + #[inline] + fn index(&self, index: TextRange) -> &str { + &self[Range::::from(index)] + } +} + +impl IndexMut for str { + #[inline] + fn index_mut(&mut self, index: TextRange) -> &mut str { + &mut self[Range::::from(index)] + } +} + +impl IndexMut for String { + #[inline] + fn index_mut(&mut self, index: TextRange) -> &mut str { + &mut self[Range::::from(index)] + } +} + +impl RangeBounds for TextRange { + fn start_bound(&self) -> Bound<&TextSize> { + Bound::Included(&self.start) + } + + fn end_bound(&self) -> Bound<&TextSize> { + Bound::Excluded(&self.end) + } +} + +impl From for Range +where + T: From, +{ + #[inline] + fn from(r: TextRange) -> Self { + r.start().into()..r.end().into() + } +} + +macro_rules! ops { + (impl $Op:ident for TextRange by fn $f:ident = $op:tt) => { + impl $Op<&TextSize> for TextRange { + type Output = TextRange; + #[inline] + fn $f(self, other: &TextSize) -> TextRange { + self $op *other + } + } + impl $Op for &TextRange + where + TextRange: $Op, + { + type Output = TextRange; + #[inline] + fn $f(self, other: T) -> TextRange { + *self $op other + } + } + }; +} + +impl Add for TextRange { + type Output = TextRange; + #[inline] + fn add(self, offset: TextSize) -> TextRange { + self.checked_add(offset) + .expect("TextRange +offset overflowed") + } +} + +impl Sub for TextRange { + type Output = TextRange; + #[inline] + fn sub(self, offset: TextSize) -> TextRange { + self.checked_sub(offset) + .expect("TextRange -offset overflowed") + } +} + +ops!(impl Add for TextRange by fn add = +); +ops!(impl Sub for TextRange by fn sub = -); + +impl AddAssign for TextRange +where + TextRange: Add, +{ + #[inline] + fn add_assign(&mut self, rhs: A) { + *self = *self + rhs; + } +} + +impl SubAssign for TextRange +where + TextRange: Sub, +{ + #[inline] + fn sub_assign(&mut self, rhs: S) { + *self = *self - rhs; + } +} diff --git a/ruff_text_size/src/schemars_impls.rs b/ruff_text_size/src/schemars_impls.rs new file mode 100644 index 0000000000..a1c7fa3618 --- /dev/null +++ b/ruff_text_size/src/schemars_impls.rs @@ -0,0 +1,33 @@ +//! This module implements the [`JsonSchema`] trait from the `schemars` crate for +//! [`TextSize`] and [`TextRange`] if the `schemars` feature is enabled. This trait +//! exposes meta-information on how a given type is serialized and deserialized +//! using `serde`, and is currently used to generate autocomplete information +//! for the `rome.json` configuration file and TypeScript types for the node.js +//! bindings to the Workspace API + +use crate::{TextRange, TextSize}; +use schemars::{gen::SchemaGenerator, schema::Schema, JsonSchema}; + +impl JsonSchema for TextSize { + fn schema_name() -> String { + String::from("TextSize") + } + + fn json_schema(gen: &mut SchemaGenerator) -> Schema { + // TextSize is represented as a raw u32, see serde_impls.rs for the + // actual implementation + ::json_schema(gen) + } +} + +impl JsonSchema for TextRange { + fn schema_name() -> String { + String::from("TextRange") + } + + fn json_schema(gen: &mut SchemaGenerator) -> Schema { + // TextSize is represented as (TextSize, TextSize), see serde_impls.rs + // for the actual implementation + <(TextSize, TextSize)>::json_schema(gen) + } +} diff --git a/ruff_text_size/src/serde_impls.rs b/ruff_text_size/src/serde_impls.rs new file mode 100644 index 0000000000..b6885d674a --- /dev/null +++ b/ruff_text_size/src/serde_impls.rs @@ -0,0 +1,47 @@ +use { + crate::{TextRange, TextSize}, + serde::{de, Deserialize, Deserializer, Serialize, Serializer}, +}; + +impl Serialize for TextSize { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + self.raw.serialize(serializer) + } +} + +impl<'de> Deserialize<'de> for TextSize { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + u32::deserialize(deserializer).map(TextSize::from) + } +} + +impl Serialize for TextRange { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + (self.start(), self.end()).serialize(serializer) + } +} + +impl<'de> Deserialize<'de> for TextRange { + #[allow(clippy::nonminimal_bool)] + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let (start, end) = Deserialize::deserialize(deserializer)?; + if !(start <= end) { + return Err(de::Error::custom(format!( + "invalid range: {start:?}..{end:?}" + ))); + } + Ok(TextRange::new(start, end)) + } +} diff --git a/ruff_text_size/src/size.rs b/ruff_text_size/src/size.rs new file mode 100644 index 0000000000..e9a378ee1d --- /dev/null +++ b/ruff_text_size/src/size.rs @@ -0,0 +1,161 @@ +use { + crate::TextLen, + std::{ + convert::TryFrom, + fmt, iter, + num::TryFromIntError, + ops::{Add, AddAssign, Sub, SubAssign}, + u32, + }, +}; + +/// A measure of text length. Also, equivalently, an index into text. +/// +/// This is a UTF-8 bytes offset stored as `u32`, but +/// most clients should treat it as an opaque measure. +/// +/// For cases that need to escape `TextSize` and return to working directly +/// with primitive integers, `TextSize` can be converted losslessly to/from +/// `u32` via [`From`] conversions as well as losslessly be converted [`Into`] +/// `usize`. The `usize -> TextSize` direction can be done via [`TryFrom`]. +/// +/// These escape hatches are primarily required for unit testing and when +/// converting from UTF-8 size to another coordinate space, such as UTF-16. +#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub struct TextSize { + pub(crate) raw: u32, +} + +impl fmt::Debug for TextSize { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}", self.raw) + } +} + +impl TextSize { + /// The text size of some primitive text-like object. + /// + /// Accepts `char`, `&str`, and `&String`. + /// + /// # Examples + /// + /// ```rust + /// # use ruff_text_size::*; + /// let char_size = TextSize::of('🦀'); + /// assert_eq!(char_size, TextSize::from(4)); + /// + /// let str_size = TextSize::of("rust-analyzer"); + /// assert_eq!(str_size, TextSize::from(13)); + /// ``` + #[inline] + pub fn of(text: T) -> TextSize { + text.text_len() + } +} + +/// Methods to act like a primitive integer type, where reasonably applicable. +// Last updated for parity with Rust 1.42.0. +impl TextSize { + /// Checked addition. Returns `None` if overflow occurred. + #[inline] + pub fn checked_add(self, rhs: TextSize) -> Option { + self.raw.checked_add(rhs.raw).map(|raw| TextSize { raw }) + } + + /// Checked subtraction. Returns `None` if overflow occurred. + #[inline] + pub fn checked_sub(self, rhs: TextSize) -> Option { + self.raw.checked_sub(rhs.raw).map(|raw| TextSize { raw }) + } +} + +impl From for TextSize { + #[inline] + fn from(raw: u32) -> Self { + TextSize { raw } + } +} + +impl From for u32 { + #[inline] + fn from(value: TextSize) -> Self { + value.raw + } +} + +impl TryFrom for TextSize { + type Error = TryFromIntError; + #[inline] + fn try_from(value: usize) -> Result { + Ok(u32::try_from(value)?.into()) + } +} + +impl From for usize { + #[inline] + fn from(value: TextSize) -> Self { + value.raw as usize + } +} + +macro_rules! ops { + (impl $Op:ident for TextSize by fn $f:ident = $op:tt) => { + impl $Op for TextSize { + type Output = TextSize; + #[inline] + fn $f(self, other: TextSize) -> TextSize { + TextSize { raw: self.raw $op other.raw } + } + } + impl $Op<&TextSize> for TextSize { + type Output = TextSize; + #[inline] + fn $f(self, other: &TextSize) -> TextSize { + self $op *other + } + } + impl $Op for &TextSize + where + TextSize: $Op, + { + type Output = TextSize; + #[inline] + fn $f(self, other: T) -> TextSize { + *self $op other + } + } + }; +} + +ops!(impl Add for TextSize by fn add = +); +ops!(impl Sub for TextSize by fn sub = -); + +impl AddAssign for TextSize +where + TextSize: Add, +{ + #[inline] + fn add_assign(&mut self, rhs: A) { + *self = *self + rhs; + } +} + +impl SubAssign for TextSize +where + TextSize: Sub, +{ + #[inline] + fn sub_assign(&mut self, rhs: S) { + *self = *self - rhs; + } +} + +impl iter::Sum for TextSize +where + TextSize: Add, +{ + #[inline] + fn sum>(iter: I) -> TextSize { + iter.fold(0.into(), Add::add) + } +} diff --git a/ruff_text_size/src/traits.rs b/ruff_text_size/src/traits.rs new file mode 100644 index 0000000000..3f5261bfd8 --- /dev/null +++ b/ruff_text_size/src/traits.rs @@ -0,0 +1,37 @@ +use {crate::TextSize, std::convert::TryInto}; + +use priv_in_pub::Sealed; +mod priv_in_pub { + pub trait Sealed {} +} + +/// Primitives with a textual length that can be passed to [`TextSize::of`]. +pub trait TextLen: Copy + Sealed { + /// The textual length of this primitive. + fn text_len(self) -> TextSize; +} + +impl Sealed for &'_ str {} +impl TextLen for &'_ str { + #[inline] + fn text_len(self) -> TextSize { + self.len().try_into().unwrap() + } +} + +impl Sealed for &'_ String {} +impl TextLen for &'_ String { + #[inline] + fn text_len(self) -> TextSize { + self.as_str().text_len() + } +} + +impl Sealed for char {} +impl TextLen for char { + #[inline] + #[allow(clippy::cast_possible_truncation)] + fn text_len(self) -> TextSize { + (self.len_utf8() as u32).into() + } +} diff --git a/ruff_text_size/tests/auto_traits.rs b/ruff_text_size/tests/auto_traits.rs new file mode 100644 index 0000000000..6adf8bd2d6 --- /dev/null +++ b/ruff_text_size/tests/auto_traits.rs @@ -0,0 +1,18 @@ +use { + ruff_text_size::{TextRange, TextSize}, + static_assertions::assert_impl_all, + std::{ + fmt::Debug, + hash::Hash, + marker::{Send, Sync}, + panic::{RefUnwindSafe, UnwindSafe}, + }, +}; + +// auto traits +assert_impl_all!(TextSize: Send, Sync, Unpin, UnwindSafe, RefUnwindSafe); +assert_impl_all!(TextRange: Send, Sync, Unpin, UnwindSafe, RefUnwindSafe); + +// common traits +assert_impl_all!(TextSize: Copy, Debug, Default, Hash, Ord); +assert_impl_all!(TextRange: Copy, Debug, Default, Hash, Eq); diff --git a/ruff_text_size/tests/constructors.rs b/ruff_text_size/tests/constructors.rs new file mode 100644 index 0000000000..8ee2fde942 --- /dev/null +++ b/ruff_text_size/tests/constructors.rs @@ -0,0 +1,24 @@ +use ruff_text_size::TextSize; + +#[derive(Copy, Clone)] +struct BadRope<'a>(&'a [&'a str]); + +impl BadRope<'_> { + fn text_len(self) -> TextSize { + self.0.iter().copied().map(TextSize::of).sum() + } +} + +#[test] +fn main() { + let x: char = 'c'; + let _ = TextSize::of(x); + + let x: &str = "hello"; + let _ = TextSize::of(x); + + let x: &String = &"hello".into(); + let _ = TextSize::of(x); + + let _ = BadRope(&[""]).text_len(); +} diff --git a/ruff_text_size/tests/indexing.rs b/ruff_text_size/tests/indexing.rs new file mode 100644 index 0000000000..e7205fdeea --- /dev/null +++ b/ruff_text_size/tests/indexing.rs @@ -0,0 +1,8 @@ +use ruff_text_size::TextRange; + +#[test] +fn main() { + let range = TextRange::default(); + let _ = &""[range]; + let _ = &String::new()[range]; +} diff --git a/ruff_text_size/tests/main.rs b/ruff_text_size/tests/main.rs new file mode 100644 index 0000000000..8d8dd091e9 --- /dev/null +++ b/ruff_text_size/tests/main.rs @@ -0,0 +1,79 @@ +use { + ruff_text_size::{TextRange, TextSize}, + std::ops, +}; + +fn size(x: u32) -> TextSize { + TextSize::from(x) +} + +fn range(x: ops::Range) -> TextRange { + TextRange::new(x.start.into(), x.end.into()) +} + +#[test] +fn sum() { + let xs: Vec = vec![size(0), size(1), size(2)]; + assert_eq!(xs.iter().sum::(), size(3)); + assert_eq!(xs.into_iter().sum::(), size(3)); +} + +#[test] +fn math() { + assert_eq!(size(10) + size(5), size(15)); + assert_eq!(size(10) - size(5), size(5)); +} + +#[test] +fn checked_math() { + assert_eq!(size(1).checked_add(size(1)), Some(size(2))); + assert_eq!(size(1).checked_sub(size(1)), Some(size(0))); + assert_eq!(size(1).checked_sub(size(2)), None); + assert_eq!(size(!0).checked_add(size(1)), None); +} + +#[test] +#[rustfmt::skip] +fn contains() { + assert!( range(2..4).contains_range(range(2..3))); + assert!( ! range(2..4).contains_range(range(1..3))); +} + +#[test] +fn intersect() { + assert_eq!(range(1..2).intersect(range(2..3)), Some(range(2..2))); + assert_eq!(range(1..5).intersect(range(2..3)), Some(range(2..3))); + assert_eq!(range(1..2).intersect(range(3..4)), None); +} + +#[test] +fn cover() { + assert_eq!(range(1..2).cover(range(2..3)), range(1..3)); + assert_eq!(range(1..5).cover(range(2..3)), range(1..5)); + assert_eq!(range(1..2).cover(range(4..5)), range(1..5)); +} + +#[test] +fn cover_offset() { + assert_eq!(range(1..3).cover_offset(size(0)), range(0..3)); + assert_eq!(range(1..3).cover_offset(size(1)), range(1..3)); + assert_eq!(range(1..3).cover_offset(size(2)), range(1..3)); + assert_eq!(range(1..3).cover_offset(size(3)), range(1..3)); + assert_eq!(range(1..3).cover_offset(size(4)), range(1..4)); +} + +#[test] +#[rustfmt::skip] +fn contains_point() { + assert!( ! range(1..3).contains(size(0))); + assert!( range(1..3).contains(size(1))); + assert!( range(1..3).contains(size(2))); + assert!( ! range(1..3).contains(size(3))); + assert!( ! range(1..3).contains(size(4))); + + assert!( ! range(1..3).contains_inclusive(size(0))); + assert!( range(1..3).contains_inclusive(size(1))); + assert!( range(1..3).contains_inclusive(size(2))); + assert!( range(1..3).contains_inclusive(size(3))); + assert!( ! range(1..3).contains_inclusive(size(4))); +} diff --git a/ruff_text_size/tests/serde.rs b/ruff_text_size/tests/serde.rs new file mode 100644 index 0000000000..0d8f9d4a6a --- /dev/null +++ b/ruff_text_size/tests/serde.rs @@ -0,0 +1,83 @@ +use { + ruff_text_size::{TextRange, TextSize}, + serde_test::{assert_de_tokens_error, assert_tokens, Token}, + std::ops, +}; + +fn size(x: u32) -> TextSize { + TextSize::from(x) +} + +fn range(x: ops::Range) -> TextRange { + TextRange::new(x.start.into(), x.end.into()) +} + +#[test] +fn size_serialization() { + assert_tokens(&size(00), &[Token::U32(00)]); + assert_tokens(&size(10), &[Token::U32(10)]); + assert_tokens(&size(20), &[Token::U32(20)]); + assert_tokens(&size(30), &[Token::U32(30)]); +} + +#[test] +fn range_serialization() { + assert_tokens( + &range(00..10), + &[ + Token::Tuple { len: 2 }, + Token::U32(00), + Token::U32(10), + Token::TupleEnd, + ], + ); + assert_tokens( + &range(10..20), + &[ + Token::Tuple { len: 2 }, + Token::U32(10), + Token::U32(20), + Token::TupleEnd, + ], + ); + assert_tokens( + &range(20..30), + &[ + Token::Tuple { len: 2 }, + Token::U32(20), + Token::U32(30), + Token::TupleEnd, + ], + ); + assert_tokens( + &range(30..40), + &[ + Token::Tuple { len: 2 }, + Token::U32(30), + Token::U32(40), + Token::TupleEnd, + ], + ); +} + +#[test] +fn invalid_range_deserialization() { + assert_tokens::( + &range(62..92), + &[ + Token::Tuple { len: 2 }, + Token::U32(62), + Token::U32(92), + Token::TupleEnd, + ], + ); + assert_de_tokens_error::( + &[ + Token::Tuple { len: 2 }, + Token::U32(92), + Token::U32(62), + Token::TupleEnd, + ], + "invalid range: 92..62", + ); +} From 56a5bf7b46007c1d31eaac3656ef4c2a15cfa18e Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Sat, 8 Apr 2023 21:19:56 +0200 Subject: [PATCH 02/16] Small improvements --- compiler/core/src/text_size.rs | 505 --------------------------------- ruff_text_size/Cargo.toml | 7 +- ruff_text_size/src/range.rs | 4 +- ruff_text_size/src/size.rs | 6 +- 4 files changed, 12 insertions(+), 510 deletions(-) delete mode 100644 compiler/core/src/text_size.rs diff --git a/compiler/core/src/text_size.rs b/compiler/core/src/text_size.rs deleted file mode 100644 index b1a0d9782c..0000000000 --- a/compiler/core/src/text_size.rs +++ /dev/null @@ -1,505 +0,0 @@ -#[cfg(feature = "serde")] -use serde::{Deserialize, Serialize}; -use std::cmp; -use std::cmp::Ordering; -use std::convert::TryFrom; -use std::num::TryFromIntError; -use std::ops::{Add, AddAssign, Bound, Index, IndexMut, Range, RangeBounds, Sub, SubAssign}; - -pub type Location = TextSize; - -/// Source code location. -#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Default, Hash)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] -pub struct TextSize(u32); - -impl TextSize { - pub fn fmt_with( - &self, - f: &mut std::fmt::Formatter, - e: &impl std::fmt::Display, - ) -> std::fmt::Result { - write!(f, "{} at offset {}", e, self.0) - } - - #[inline] - pub const fn new(offset: u32) -> Self { - Self(offset) - } - - #[inline] - pub const fn zero() -> Self { - Self(0) - } - - #[inline] - pub fn newline(&mut self) { - self.0 += 1; - } - - #[inline] - pub fn of(text_len: T) -> Self - where - T: TextLen, - { - text_len.text_len() - } - - #[inline] - pub const fn saturating_sub(self, rhs: TextSize) -> TextSize { - TextSize(self.0.saturating_sub(rhs.0)) - } - - #[inline] - pub const fn saturating_add(self, rhs: TextSize) -> TextSize { - TextSize(self.0.saturating_add(rhs.0)) - } - - #[inline] - pub fn checked_add(self, rhs: TextSize) -> Option { - self.0.checked_add(rhs.0).map(TextSize) - } - - /// Checked subtraction. Returns `None` if overflow occurred. - #[inline] - pub fn checked_sub(self, rhs: TextSize) -> Option { - self.0.checked_sub(rhs.0).map(TextSize) - } -} - -impl TryFrom for TextSize { - type Error = TryFromIntError; - - fn try_from(value: usize) -> Result { - Ok(Location::new(u32::try_from(value)?)) - } -} - -impl From for Location { - fn from(value: u32) -> Self { - TextSize(value) - } -} - -impl From for u32 { - fn from(value: TextSize) -> Self { - value.0 - } -} - -impl From for usize { - fn from(value: TextSize) -> Self { - value.0 as usize - } -} - -impl Add for TextSize { - type Output = TextSize; - - #[inline] - fn add(self, rhs: TextSize) -> Self::Output { - TextSize(self.0 + rhs.0) - } -} - -impl Add for &TextSize { - type Output = TextSize; - - fn add(self, rhs: TextSize) -> Self::Output { - TextSize(self.0 + rhs.0) - } -} - -impl Add<&TextSize> for TextSize { - type Output = TextSize; - - fn add(self, rhs: &TextSize) -> Self::Output { - TextSize(self.0 + rhs.0) - } -} - -impl Sub for TextSize { - type Output = TextSize; - - #[inline] - fn sub(self, rhs: TextSize) -> Self::Output { - TextSize(self.0 - rhs.0) - } -} - -impl Sub for &TextSize { - type Output = TextSize; - - fn sub(self, rhs: TextSize) -> Self::Output { - TextSize(self.0 - rhs.0) - } -} - -impl Sub<&TextSize> for TextSize { - type Output = TextSize; - - fn sub(self, rhs: &TextSize) -> Self::Output { - TextSize(self.0 - rhs.0) - } -} - -impl std::ops::AddAssign for TextSize -where - TextSize: Add, -{ - #[inline] - fn add_assign(&mut self, rhs: A) { - *self = *self + rhs; - } -} - -impl std::ops::SubAssign for TextSize -where - TextSize: Sub, -{ - #[inline] - fn sub_assign(&mut self, rhs: S) { - *self = *self - rhs; - } -} - -pub trait TextLen { - fn text_len(&self) -> TextSize; -} - -impl TextLen for &str { - fn text_len(&self) -> TextSize { - TextSize::try_from(self.len()).unwrap() - } -} - -impl TextLen for String { - fn text_len(&self) -> TextSize { - self.as_str().text_len() - } -} - -impl TextLen for char { - fn text_len(&self) -> TextSize { - TextSize::new(self.len_utf8() as u32) - } -} - -#[derive(Copy, Clone, Eq, PartialEq, Hash, Default)] -pub struct TextRange { - start: TextSize, - end: TextSize, -} - -impl TextRange { - #[inline] - pub fn new(start: TextSize, end: TextSize) -> Self { - assert!(start <= end); - - Self { start, end } - } - - #[inline] - pub fn at(offset: TextSize, length: TextSize) -> Self { - Self { - start: offset, - end: offset + length, - } - } - - #[inline] - pub fn empty(offset: TextSize) -> Self { - Self { - start: offset, - end: offset, - } - } - - #[inline] - pub fn up_to(end: TextSize) -> Self { - Self { - start: TextSize::zero(), - end, - } - } - - #[inline] - pub const fn start(self) -> TextSize { - self.start - } - - #[inline] - pub const fn end(self) -> TextSize { - self.end - } - - #[inline] - pub const fn len(self) -> TextSize { - TextSize::new(self.end.0 - self.start.0) - } - - #[inline] - pub const fn is_empty(self) -> bool { - self.len().0 == 0 - } - - #[inline] - pub const fn contains(self, offset: TextSize) -> bool { - self.start.0 <= offset.0 && offset.0 < self.end.0 - } - - #[inline] - pub const fn contains_inclusive(self, offset: TextSize) -> bool { - self.start.0 <= offset.0 && offset.0 <= self.end.0 - } - - #[inline] - pub const fn contains_range(self, other: TextRange) -> bool { - self.start.0 <= other.start.0 && other.end.0 <= self.end.0 - } - - /// The range covered by both ranges, if it exists. - /// If the ranges touch but do not overlap, the output range is empty. - /// - /// # Examples - /// - /// ```rust - /// # use text_size::*; - /// assert_eq!( - /// TextRange::intersect( - /// TextRange::new(0.into(), 10.into()), - /// TextRange::new(5.into(), 15.into()), - /// ), - /// Some(TextRange::new(5.into(), 10.into())), - /// ); - /// ``` - #[inline] - pub fn intersect(self, other: TextRange) -> Option { - let start = cmp::max(self.start(), other.start()); - let end = cmp::min(self.end(), other.end()); - if end < start { - return None; - } - Some(TextRange::new(start, end)) - } - - /// Extends the range to cover `other` as well. - /// - /// # Examples - /// - /// ```rust - /// # use text_size::*; - /// assert_eq!( - /// TextRange::cover( - /// TextRange::new(0.into(), 5.into()), - /// TextRange::new(15.into(), 20.into()), - /// ), - /// TextRange::new(0.into(), 20.into()), - /// ); - /// ``` - #[inline] - pub fn cover(self, other: TextRange) -> TextRange { - let start = cmp::min(self.start(), other.start()); - let end = cmp::max(self.end(), other.end()); - TextRange::new(start, end) - } - - /// Extends the range to cover `other` offsets as well. - /// - /// # Examples - /// - /// ```rust - /// # use text_size::*; - /// assert_eq!( - /// TextRange::empty(0.into()).cover_offset(20.into()), - /// TextRange::new(0.into(), 20.into()), - /// ) - /// ``` - #[inline] - pub fn cover_offset(self, offset: TextSize) -> TextRange { - self.cover(TextRange::empty(offset)) - } - - /// Add an offset to this range. - /// - /// Note that this is not appropriate for changing where a `TextRange` is - /// within some string; rather, it is for changing the reference anchor - /// that the `TextRange` is measured against. - /// - /// The unchecked version (`Add::add`) will _always_ panic on overflow, - /// in contrast to primitive integers, which check in debug mode only. - #[inline] - pub fn checked_add(self, offset: TextSize) -> Option { - Some(TextRange { - start: self.start.checked_add(offset)?, - end: self.end.checked_add(offset)?, - }) - } - - /// Subtract an offset from this range. - /// - /// Note that this is not appropriate for changing where a `TextRange` is - /// within some string; rather, it is for changing the reference anchor - /// that the `TextRange` is measured against. - /// - /// The unchecked version (`Sub::sub`) will _always_ panic on overflow, - /// in contrast to primitive integers, which check in debug mode only. - #[inline] - pub fn checked_sub(self, offset: TextSize) -> Option { - Some(TextRange { - start: self.start.checked_sub(offset)?, - end: self.end.checked_sub(offset)?, - }) - } - - /// Relative order of the two ranges (overlapping ranges are considered - /// equal). - /// - /// - /// This is useful when, for example, binary searching an array of disjoint - /// ranges. - /// - /// # Examples - /// - /// ``` - /// # use text_size::*; - /// # use std::cmp::Ordering; - /// - /// let a = TextRange::new(0.into(), 3.into()); - /// let b = TextRange::new(4.into(), 5.into()); - /// assert_eq!(a.ordering(b), Ordering::Less); - /// - /// let a = TextRange::new(0.into(), 3.into()); - /// let b = TextRange::new(3.into(), 5.into()); - /// assert_eq!(a.ordering(b), Ordering::Less); - /// - /// let a = TextRange::new(0.into(), 3.into()); - /// let b = TextRange::new(2.into(), 5.into()); - /// assert_eq!(a.ordering(b), Ordering::Equal); - /// - /// let a = TextRange::new(0.into(), 3.into()); - /// let b = TextRange::new(2.into(), 2.into()); - /// assert_eq!(a.ordering(b), Ordering::Equal); - /// - /// let a = TextRange::new(2.into(), 3.into()); - /// let b = TextRange::new(2.into(), 2.into()); - /// assert_eq!(a.ordering(b), Ordering::Greater); - /// ``` - #[inline] - pub fn ordering(self, other: TextRange) -> Ordering { - if self.end() <= other.start() { - Ordering::Less - } else if other.end() <= self.start() { - Ordering::Greater - } else { - Ordering::Equal - } - } -} - -impl Index for str { - type Output = str; - - fn index(&self, index: TextRange) -> &Self::Output { - &self[usize::from(index.start)..usize::from(index.end)] - } -} - -impl IndexMut for str { - fn index_mut(&mut self, index: TextRange) -> &mut Self::Output { - &mut self[usize::from(index.start)..usize::from(index.end)] - } -} - -impl Index for String { - type Output = str; - - fn index(&self, index: TextRange) -> &Self::Output { - &self[usize::from(index.start)..usize::from(index.end)] - } -} - -impl IndexMut for String { - fn index_mut(&mut self, index: TextRange) -> &mut Self::Output { - &mut self[usize::from(index.start)..usize::from(index.end)] - } -} - -impl RangeBounds for TextRange { - fn start_bound(&self) -> Bound<&TextSize> { - Bound::Included(&self.start) - } - - fn end_bound(&self) -> Bound<&TextSize> { - Bound::Excluded(&self.end) - } -} - -impl From for Range -where - T: From, -{ - #[inline] - fn from(r: TextRange) -> Self { - r.start().into()..r.end().into() - } -} - -impl Add for TextRange { - type Output = TextRange; - #[inline] - fn add(self, offset: TextSize) -> TextRange { - self.checked_add(offset) - .expect("TextRange +offset overflowed") - } -} - -impl Add for &TextRange { - type Output = TextRange; - #[inline] - fn add(self, offset: TextSize) -> TextRange { - *self + offset - } -} - -impl Sub for TextRange { - type Output = TextRange; - #[inline] - fn sub(self, offset: TextSize) -> TextRange { - self.checked_sub(offset) - .expect("TextRange +offset overflowed") - } -} - -impl Sub for &TextRange { - type Output = TextRange; - #[inline] - fn sub(self, offset: TextSize) -> TextRange { - *self - offset - } -} - -impl AddAssign for TextRange -where - TextRange: Add, -{ - #[inline] - fn add_assign(&mut self, rhs: A) { - *self = *self + rhs - } -} - -impl SubAssign for TextRange -where - TextRange: Sub, -{ - #[inline] - fn sub_assign(&mut self, rhs: S) { - *self = *self - rhs - } -} - -#[cfg(test)] -mod tests { - use super::*; -} diff --git a/ruff_text_size/Cargo.toml b/ruff_text_size/Cargo.toml index dc45da3f84..d3ce185167 100644 --- a/ruff_text_size/Cargo.toml +++ b/ruff_text_size/Cargo.toml @@ -6,14 +6,17 @@ edition = "2021" rust-version = "1.67.1" [dependencies] -serde = { workspace = true, optional = true, default_features = false } +serde = { version="1.0.152", optional = true, default_features = false } schemars = { version = "0.8.12", optional = true } [dev-dependencies] serde_test = { version = "1.0.152" } static_assertions = { version = "1.1.0" } +[features] +serde = ["dep:serde"] + [[test]] name = "serde" path = "tests/serde.rs" -required-features = ["serde"] +required-features = ["serde"] \ No newline at end of file diff --git a/ruff_text_size/src/range.rs b/ruff_text_size/src/range.rs index 107b79d3dc..32048178e0 100644 --- a/ruff_text_size/src/range.rs +++ b/ruff_text_size/src/range.rs @@ -44,8 +44,8 @@ impl TextRange { /// assert_eq!(range.len(), end - start); /// ``` #[inline] - pub fn new(start: TextSize, end: TextSize) -> TextRange { - assert!(start <= end); + pub const fn new(start: TextSize, end: TextSize) -> TextRange { + assert!(start.raw <= end.raw); TextRange { start, end } } diff --git a/ruff_text_size/src/size.rs b/ruff_text_size/src/size.rs index e9a378ee1d..844f86cff8 100644 --- a/ruff_text_size/src/size.rs +++ b/ruff_text_size/src/size.rs @@ -33,6 +33,10 @@ impl fmt::Debug for TextSize { } impl TextSize { + pub const fn from_u32(offset: u32) -> Self { + Self { raw: offset} + } + /// The text size of some primitive text-like object. /// /// Accepts `char`, `&str`, and `&String`. @@ -72,7 +76,7 @@ impl TextSize { impl From for TextSize { #[inline] fn from(raw: u32) -> Self { - TextSize { raw } + TextSize::from_u32(raw) } } From ed8a58a3a866560ce14391d2e74820a06fcad193 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Fri, 14 Apr 2023 19:27:35 +0200 Subject: [PATCH 03/16] Fix BOM handling, document `TextSize::new` --- compiler/parser/src/lexer.rs | 1 + ruff_text_size/src/size.rs | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/compiler/parser/src/lexer.rs b/compiler/parser/src/lexer.rs index fb81cce2af..9560cdb6de 100644 --- a/compiler/parser/src/lexer.rs +++ b/compiler/parser/src/lexer.rs @@ -240,6 +240,7 @@ where // spell-checker:ignore feff if let Some('\u{feff}') = lxr.window[0] { lxr.window.slide(); + lxr.location += '\u{feff}'.text_len(); } lxr } diff --git a/ruff_text_size/src/size.rs b/ruff_text_size/src/size.rs index 844f86cff8..ee8bfe856f 100644 --- a/ruff_text_size/src/size.rs +++ b/ruff_text_size/src/size.rs @@ -33,7 +33,15 @@ impl fmt::Debug for TextSize { } impl TextSize { - pub const fn from_u32(offset: u32) -> Self { + /// Creates a new `TextSize` at the given `offset`. + /// + /// # Examples + /// + /// ```rust + /// # use ruff_text_size::*; + /// assert_eq!(TextSize::from(4), TextSize::new(4)); + /// ``` + pub const fn new(offset: u32) -> Self { Self { raw: offset} } @@ -76,7 +84,7 @@ impl TextSize { impl From for TextSize { #[inline] fn from(raw: u32) -> Self { - TextSize::from_u32(raw) + TextSize::new(raw) } } From bbe783ff38d3c806c3c64f72a1b318d6c9becce9 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Fri, 14 Apr 2023 19:35:07 +0200 Subject: [PATCH 04/16] Document `Located` --- compiler/ast/src/ast_gen.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compiler/ast/src/ast_gen.rs b/compiler/ast/src/ast_gen.rs index 435b71cb0f..bbf8431815 100644 --- a/compiler/ast/src/ast_gen.rs +++ b/compiler/ast/src/ast_gen.rs @@ -27,6 +27,7 @@ impl Located { } } + /// Creates a new node that spans the position specified by `range`. pub fn with_range(node: T, range: TextRange) -> Self where U: Default, @@ -38,6 +39,7 @@ impl Located { } } + /// Returns the absolute start position of the node from the beginning of the document. #[inline] pub const fn start(&self) -> TextSize { self.range.start() @@ -48,11 +50,13 @@ impl Located { &self.custom } + /// Returns the node #[inline] pub fn node(&self) -> &T { &self.node } + /// Consumes self and returns the node. #[inline] pub fn into_node(self) -> T { self.node @@ -63,11 +67,13 @@ impl Located { self.custom } + /// Returns the `range` of the node. The range offsets are absolute to the start of the document. #[inline] pub const fn range(&self) -> TextRange { self.range } + /// Returns the absolute position at which the node ends in the source document. #[inline] pub const fn end(&self) -> TextSize { self.range.end() From 4be55ad1ebd9ed9ae3944e3a1af476b4df7563f2 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Fri, 14 Apr 2023 22:07:10 +0200 Subject: [PATCH 05/16] Remove `ast::Location` export --- compiler/ast/src/lib.rs | 2 -- compiler/parser/python.lalrpop | 4 ++-- compiler/parser/src/function.rs | 6 ++---- compiler/parser/src/lib.rs | 3 +++ compiler/parser/src/parser.rs | 4 +++- compiler/parser/src/string.rs | 3 ++- ruff_text_size/src/size.rs | 2 +- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/compiler/ast/src/lib.rs b/compiler/ast/src/lib.rs index b69862a689..d60f8d0747 100644 --- a/compiler/ast/src/lib.rs +++ b/compiler/ast/src/lib.rs @@ -6,6 +6,4 @@ mod impls; pub use ast_gen::*; -pub use ruff_text_size::TextSize as Location; - pub type Suite = Vec>; diff --git a/compiler/parser/python.lalrpop b/compiler/parser/python.lalrpop index 1b5c25e22c..0b18f5c2e3 100644 --- a/compiler/parser/python.lalrpop +++ b/compiler/parser/python.lalrpop @@ -1721,7 +1721,7 @@ ArgumentList: ArgumentList = { } }; -FunctionArgument: (Option<(ast::Location, ast::Location, Option)>, ast::Expr) = { +FunctionArgument: (Option<(crate::Location, crate::Location, Option)>, ast::Expr) = { => { let expr = match c { Some(c) => ast::Expr::new( @@ -1776,7 +1776,7 @@ Identifier: String = => s; // Hook external lexer: extern { - type Location = ast::Location; + type Location = crate::Location; type Error = LexicalError; enum token::Tok { diff --git a/compiler/parser/src/function.rs b/compiler/parser/src/function.rs index fa4c96f37f..1bb0016d50 100644 --- a/compiler/parser/src/function.rs +++ b/compiler/parser/src/function.rs @@ -4,6 +4,7 @@ use crate::{ ast, lexer::{LexicalError, LexicalErrorType}, }; +use ruff_text_size::TextSize; use rustc_hash::FxHashSet; pub(crate) struct ArgumentList { @@ -83,10 +84,7 @@ pub(crate) fn parse_params( Ok((pos_only, names, defaults)) } -type FunctionArgument = ( - Option<(ast::Location, ast::Location, Option)>, - ast::Expr, -); +type FunctionArgument = (Option<(TextSize, TextSize, Option)>, ast::Expr); // Parse arguments as supplied during a function/lambda *call*. pub(crate) fn parse_args(func_args: Vec) -> Result { diff --git a/compiler/parser/src/lib.rs b/compiler/parser/src/lib.rs index be2bd62453..2235afe6ac 100644 --- a/compiler/parser/src/lib.rs +++ b/compiler/parser/src/lib.rs @@ -127,10 +127,13 @@ mod context; mod soft_keywords; mod token; +type Location = TextSize; + pub use mode::Mode; pub use parser::{ parse, parse_expression, parse_expression_located, parse_located, parse_program, parse_tokens, ParseError, ParseErrorType, }; +use ruff_text_size::TextSize; pub use string::FStringErrorType; pub use token::{StringKind, Tok}; diff --git a/compiler/parser/src/parser.rs b/compiler/parser/src/parser.rs index a53c5d316e..2627a96c4b 100644 --- a/compiler/parser/src/parser.rs +++ b/compiler/parser/src/parser.rs @@ -13,11 +13,12 @@ //! [`Mode`]: crate::mode use crate::{ - ast::{self, Location}, + ast::{self}, lexer::{self, LexResult, LexicalError, LexicalErrorType}, mode::Mode, python, token::Tok, + Location, }; use itertools::Itertools; use std::iter; @@ -224,6 +225,7 @@ fn parse_error_from_lalrpop( source_path: &str, ) -> ParseError { let source_path = source_path.to_owned(); + match err { // TODO: Are there cases where this isn't an EOF? LalrpopError::InvalidToken { location } => ParseError { diff --git a/compiler/parser/src/string.rs b/compiler/parser/src/string.rs index b81cd3158d..d5eda859b5 100644 --- a/compiler/parser/src/string.rs +++ b/compiler/parser/src/string.rs @@ -4,10 +4,11 @@ // regular strings. Since the parser has no definition of f-string formats (Pending PEP 701) // we have to do the parsing here, manually. use crate::{ - ast::{Constant, Expr, ExprKind, Location}, + ast::{Constant, Expr, ExprKind}, lexer::{LexicalError, LexicalErrorType}, parser::{parse_expression_located, LalrpopError, ParseError, ParseErrorType}, token::{StringKind, Tok}, + Location, }; use itertools::Itertools; use ruff_text_size::{TextLen, TextSize}; diff --git a/ruff_text_size/src/size.rs b/ruff_text_size/src/size.rs index ee8bfe856f..7b7765b789 100644 --- a/ruff_text_size/src/size.rs +++ b/ruff_text_size/src/size.rs @@ -42,7 +42,7 @@ impl TextSize { /// assert_eq!(TextSize::from(4), TextSize::new(4)); /// ``` pub const fn new(offset: u32) -> Self { - Self { raw: offset} + Self { raw: offset } } /// The text size of some primitive text-like object. From c2c89361330c3871a712214cd5e65c6c6cefef5a Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Sat, 15 Apr 2023 16:27:31 +0200 Subject: [PATCH 06/16] Use `TextRange` for tokens --- compiler/parser/src/lexer.rs | 137 +++++++++++++++------------ compiler/parser/src/parser.rs | 10 +- compiler/parser/src/soft_keywords.rs | 10 +- 3 files changed, 87 insertions(+), 70 deletions(-) diff --git a/compiler/parser/src/lexer.rs b/compiler/parser/src/lexer.rs index 9560cdb6de..4c0b55c405 100644 --- a/compiler/parser/src/lexer.rs +++ b/compiler/parser/src/lexer.rs @@ -36,7 +36,7 @@ use crate::{ use log::trace; use num_bigint::BigInt; use num_traits::{Num, Zero}; -use ruff_text_size::{TextLen, TextSize}; +use ruff_text_size::{TextLen, TextRange, TextSize}; use std::{char, cmp::Ordering, ops::Index, slice::SliceIndex, str::FromStr}; use unic_emoji_char::is_emoji_presentation; use unic_ucd_ident::{is_xid_continue, is_xid_start}; @@ -182,8 +182,8 @@ pub struct Lexer> { pub static KEYWORDS: phf::Map<&'static str, Tok> = include!(concat!(env!("OUT_DIR"), "/keywords.rs")); -/// Contains a Token along with its start and end location. -pub type Spanned = (TextSize, Tok, TextSize); +/// Contains a Token along with its `range`. +pub type Spanned = (Tok, TextRange); /// The result of lexing a token. pub type LexResult = Result; @@ -270,9 +270,9 @@ where let end_pos = self.get_pos(); if let Some(tok) = KEYWORDS.get(&name) { - Ok((start_pos, tok.clone(), end_pos)) + Ok((tok.clone(), TextRange::new(start_pos, end_pos))) } else { - Ok((start_pos, Tok::Name { name }, end_pos)) + Ok((Tok::Name { name }, TextRange::new(start_pos, end_pos))) } } @@ -310,7 +310,7 @@ where error: LexicalErrorType::OtherError(format!("{e:?}")), location: start_pos, })?; - Ok((start_pos, Tok::Int { value }, end_pos)) + Ok((Tok::Int { value }, TextRange::new(start_pos, end_pos))) } /// Lex a normal number, that is, no octal, hex or binary number. @@ -367,16 +367,15 @@ where self.next_char(); let end_pos = self.get_pos(); Ok(( - start_pos, Tok::Complex { real: 0.0, imag: value, }, - end_pos, + TextRange::new(start_pos, end_pos), )) } else { let end_pos = self.get_pos(); - Ok((start_pos, Tok::Float { value }, end_pos)) + Ok((Tok::Float { value }, TextRange::new(start_pos, end_pos))) } } else { // Parse trailing 'j': @@ -384,7 +383,10 @@ where self.next_char(); let end_pos = self.get_pos(); let imag = f64::from_str(&value_text).unwrap(); - Ok((start_pos, Tok::Complex { real: 0.0, imag }, end_pos)) + Ok(( + Tok::Complex { real: 0.0, imag }, + TextRange::new(start_pos, end_pos), + )) } else { let end_pos = self.get_pos(); let value = value_text.parse::().unwrap(); @@ -395,7 +397,7 @@ where location: self.get_pos(), }); } - Ok((start_pos, Tok::Int { value }, end_pos)) + Ok((Tok::Int { value }, TextRange::new(start_pos, end_pos))) } } } @@ -455,7 +457,7 @@ where match self.window[0] { Some('\n' | '\r') | None => { let end_pos = self.get_pos(); - return Ok((start_pos, Tok::Comment(value), end_pos)); + return Ok((Tok::Comment(value), TextRange::new(start_pos, end_pos))); } Some(_) => {} } @@ -535,7 +537,7 @@ where kind, triple_quoted, }; - Ok((start_pos, tok, end_pos)) + Ok((tok, TextRange::new(start_pos, end_pos))) } // Checks if the character c is a valid starting character as described @@ -661,7 +663,7 @@ where // New indentation level: self.indentations.push(indentation_level); let tok_pos = self.get_pos(); - self.emit((tok_pos, Tok::Indent, tok_pos)); + self.emit((Tok::Indent, TextRange::empty(tok_pos))); } Ordering::Less => { // One or more dedentations @@ -675,7 +677,7 @@ where Ordering::Less => { self.indentations.pop(); let tok_pos = self.get_pos(); - self.emit((tok_pos, Tok::Dedent, tok_pos)); + self.emit((Tok::Dedent, TextRange::empty(tok_pos))); } Ordering::Equal => { // We arrived at proper level of indentation. @@ -720,16 +722,16 @@ where // Next, insert a trailing newline, if required. if !self.at_begin_of_line { self.at_begin_of_line = true; - self.emit((tok_pos, Tok::Newline, tok_pos)); + self.emit((Tok::Newline, TextRange::empty(tok_pos))); } // Next, flush the indentation stack to zero. while !self.indentations.is_empty() { self.indentations.pop(); - self.emit((tok_pos, Tok::Dedent, tok_pos)); + self.emit((Tok::Dedent, TextRange::empty(tok_pos))); } - self.emit((tok_pos, Tok::EndOfFile, tok_pos)); + self.emit((Tok::EndOfFile, TextRange::empty(tok_pos))); } Ok(()) @@ -757,11 +759,11 @@ where Some('=') => { self.next_char(); let tok_end = self.get_pos(); - self.emit((tok_start, Tok::EqEqual, tok_end)); + self.emit((Tok::EqEqual, TextRange::new(tok_start, tok_end))); } _ => { let tok_end = self.get_pos(); - self.emit((tok_start, Tok::Equal, tok_end)); + self.emit((Tok::Equal, TextRange::new(tok_start, tok_end))); } } } @@ -771,10 +773,10 @@ where if let Some('=') = self.window[0] { self.next_char(); let tok_end = self.get_pos(); - self.emit((tok_start, Tok::PlusEqual, tok_end)); + self.emit((Tok::PlusEqual, TextRange::new(tok_start, tok_end))); } else { let tok_end = self.get_pos(); - self.emit((tok_start, Tok::Plus, tok_end)); + self.emit((Tok::Plus, TextRange::new(tok_start, tok_end))); } } '*' => { @@ -784,7 +786,7 @@ where Some('=') => { self.next_char(); let tok_end = self.get_pos(); - self.emit((tok_start, Tok::StarEqual, tok_end)); + self.emit((Tok::StarEqual, TextRange::new(tok_start, tok_end))); } Some('*') => { self.next_char(); @@ -792,17 +794,20 @@ where Some('=') => { self.next_char(); let tok_end = self.get_pos(); - self.emit((tok_start, Tok::DoubleStarEqual, tok_end)); + self.emit(( + Tok::DoubleStarEqual, + TextRange::new(tok_start, tok_end), + )); } _ => { let tok_end = self.get_pos(); - self.emit((tok_start, Tok::DoubleStar, tok_end)); + self.emit((Tok::DoubleStar, TextRange::new(tok_start, tok_end))); } } } _ => { let tok_end = self.get_pos(); - self.emit((tok_start, Tok::Star, tok_end)); + self.emit((Tok::Star, TextRange::new(tok_start, tok_end))); } } } @@ -813,7 +818,7 @@ where Some('=') => { self.next_char(); let tok_end = self.get_pos(); - self.emit((tok_start, Tok::SlashEqual, tok_end)); + self.emit((Tok::SlashEqual, TextRange::new(tok_start, tok_end))); } Some('/') => { self.next_char(); @@ -821,17 +826,20 @@ where Some('=') => { self.next_char(); let tok_end = self.get_pos(); - self.emit((tok_start, Tok::DoubleSlashEqual, tok_end)); + self.emit(( + Tok::DoubleSlashEqual, + TextRange::new(tok_start, tok_end), + )); } _ => { let tok_end = self.get_pos(); - self.emit((tok_start, Tok::DoubleSlash, tok_end)); + self.emit((Tok::DoubleSlash, TextRange::new(tok_start, tok_end))); } } } _ => { let tok_end = self.get_pos(); - self.emit((tok_start, Tok::Slash, tok_end)); + self.emit((Tok::Slash, TextRange::new(tok_start, tok_end))); } } } @@ -841,10 +849,10 @@ where if let Some('=') = self.window[0] { self.next_char(); let tok_end = self.get_pos(); - self.emit((tok_start, Tok::PercentEqual, tok_end)); + self.emit((Tok::PercentEqual, TextRange::new(tok_start, tok_end))); } else { let tok_end = self.get_pos(); - self.emit((tok_start, Tok::Percent, tok_end)); + self.emit((Tok::Percent, TextRange::new(tok_start, tok_end))); } } '|' => { @@ -853,10 +861,10 @@ where if let Some('=') = self.window[0] { self.next_char(); let tok_end = self.get_pos(); - self.emit((tok_start, Tok::VbarEqual, tok_end)); + self.emit((Tok::VbarEqual, TextRange::new(tok_start, tok_end))); } else { let tok_end = self.get_pos(); - self.emit((tok_start, Tok::Vbar, tok_end)); + self.emit((Tok::Vbar, TextRange::new(tok_start, tok_end))); } } '^' => { @@ -865,10 +873,10 @@ where if let Some('=') = self.window[0] { self.next_char(); let tok_end = self.get_pos(); - self.emit((tok_start, Tok::CircumflexEqual, tok_end)); + self.emit((Tok::CircumflexEqual, TextRange::new(tok_start, tok_end))); } else { let tok_end = self.get_pos(); - self.emit((tok_start, Tok::CircumFlex, tok_end)); + self.emit((Tok::CircumFlex, TextRange::new(tok_start, tok_end))); } } '&' => { @@ -877,10 +885,10 @@ where if let Some('=') = self.window[0] { self.next_char(); let tok_end = self.get_pos(); - self.emit((tok_start, Tok::AmperEqual, tok_end)); + self.emit((Tok::AmperEqual, TextRange::new(tok_start, tok_end))); } else { let tok_end = self.get_pos(); - self.emit((tok_start, Tok::Amper, tok_end)); + self.emit((Tok::Amper, TextRange::new(tok_start, tok_end))); } } '-' => { @@ -890,16 +898,16 @@ where Some('=') => { self.next_char(); let tok_end = self.get_pos(); - self.emit((tok_start, Tok::MinusEqual, tok_end)); + self.emit((Tok::MinusEqual, TextRange::new(tok_start, tok_end))); } Some('>') => { self.next_char(); let tok_end = self.get_pos(); - self.emit((tok_start, Tok::Rarrow, tok_end)); + self.emit((Tok::Rarrow, TextRange::new(tok_start, tok_end))); } _ => { let tok_end = self.get_pos(); - self.emit((tok_start, Tok::Minus, tok_end)); + self.emit((Tok::Minus, TextRange::new(tok_start, tok_end))); } } } @@ -909,10 +917,10 @@ where if let Some('=') = self.window[0] { self.next_char(); let tok_end = self.get_pos(); - self.emit((tok_start, Tok::AtEqual, tok_end)); + self.emit((Tok::AtEqual, TextRange::new(tok_start, tok_end))); } else { let tok_end = self.get_pos(); - self.emit((tok_start, Tok::At, tok_end)); + self.emit((Tok::At, TextRange::new(tok_start, tok_end))); } } '!' => { @@ -921,7 +929,7 @@ where if let Some('=') = self.window[0] { self.next_char(); let tok_end = self.get_pos(); - self.emit((tok_start, Tok::NotEqual, tok_end)); + self.emit((Tok::NotEqual, TextRange::new(tok_start, tok_end))); } else { return Err(LexicalError { error: LexicalErrorType::UnrecognizedToken { tok: '!' }, @@ -980,10 +988,10 @@ where if let Some('=') = self.window[0] { self.next_char(); let tok_end = self.get_pos(); - self.emit((tok_start, Tok::ColonEqual, tok_end)); + self.emit((Tok::ColonEqual, TextRange::new(tok_start, tok_end))); } else { let tok_end = self.get_pos(); - self.emit((tok_start, Tok::Colon, tok_end)); + self.emit((Tok::Colon, TextRange::new(tok_start, tok_end))); } } ';' => { @@ -999,22 +1007,25 @@ where Some('=') => { self.next_char(); let tok_end = self.get_pos(); - self.emit((tok_start, Tok::LeftShiftEqual, tok_end)); + self.emit(( + Tok::LeftShiftEqual, + TextRange::new(tok_start, tok_end), + )); } _ => { let tok_end = self.get_pos(); - self.emit((tok_start, Tok::LeftShift, tok_end)); + self.emit((Tok::LeftShift, TextRange::new(tok_start, tok_end))); } } } Some('=') => { self.next_char(); let tok_end = self.get_pos(); - self.emit((tok_start, Tok::LessEqual, tok_end)); + self.emit((Tok::LessEqual, TextRange::new(tok_start, tok_end))); } _ => { let tok_end = self.get_pos(); - self.emit((tok_start, Tok::Less, tok_end)); + self.emit((Tok::Less, TextRange::new(tok_start, tok_end))); } } } @@ -1028,22 +1039,25 @@ where Some('=') => { self.next_char(); let tok_end = self.get_pos(); - self.emit((tok_start, Tok::RightShiftEqual, tok_end)); + self.emit(( + Tok::RightShiftEqual, + TextRange::new(tok_start, tok_end), + )); } _ => { let tok_end = self.get_pos(); - self.emit((tok_start, Tok::RightShift, tok_end)); + self.emit((Tok::RightShift, TextRange::new(tok_start, tok_end))); } } } Some('=') => { self.next_char(); let tok_end = self.get_pos(); - self.emit((tok_start, Tok::GreaterEqual, tok_end)); + self.emit((Tok::GreaterEqual, TextRange::new(tok_start, tok_end))); } _ => { let tok_end = self.get_pos(); - self.emit((tok_start, Tok::Greater, tok_end)); + self.emit((Tok::Greater, TextRange::new(tok_start, tok_end))); } } } @@ -1061,10 +1075,10 @@ where self.next_char(); self.next_char(); let tok_end = self.get_pos(); - self.emit((tok_start, Tok::Ellipsis, tok_end)); + self.emit((Tok::Ellipsis, TextRange::new(tok_start, tok_end))); } else { let tok_end = self.get_pos(); - self.emit((tok_start, Tok::Dot, tok_end)); + self.emit((Tok::Dot, TextRange::new(tok_start, tok_end))); } } } @@ -1077,9 +1091,9 @@ where // non-logical newline: if self.nesting == 0 { self.at_begin_of_line = true; - self.emit((tok_start, Tok::Newline, tok_end)); + self.emit((Tok::Newline, TextRange::new(tok_start, tok_end))); } else { - self.emit((tok_start, Tok::NonLogicalNewline, tok_end)); + self.emit((Tok::NonLogicalNewline, TextRange::new(tok_start, tok_end))); } } ' ' | '\t' | '\x0C' => { @@ -1116,11 +1130,10 @@ where self.next_char(); let tok_end = self.get_pos(); self.emit(( - tok_start, Tok::Name { name: c.to_string(), }, - tok_end, + TextRange::new(tok_start, tok_end), )); } else { let c = self.next_char(); @@ -1144,7 +1157,7 @@ where std::hint::unreachable_unchecked() }); let tok_end = self.get_pos(); - self.emit((tok_start, ty, tok_end)); + self.emit((ty, TextRange::new(tok_start, tok_end))); } // Helper function to go to the next character coming up. @@ -1200,7 +1213,7 @@ where ); match token { - Ok((_, Tok::EndOfFile, _)) => None, + Ok((Tok::EndOfFile, _)) => None, r => Some(r), } } diff --git a/compiler/parser/src/parser.rs b/compiler/parser/src/parser.rs index 2627a96c4b..9cd7c7af92 100644 --- a/compiler/parser/src/parser.rs +++ b/compiler/parser/src/parser.rs @@ -188,12 +188,16 @@ pub fn parse_tokens( mode: Mode, source_path: &str, ) -> Result { - let marker_token = (Default::default(), mode.to_marker(), Default::default()); + let marker_token = (mode.to_marker(), Default::default()); let lexer = iter::once(Ok(marker_token)) .chain(lxr) - .filter_ok(|(_, tok, _)| !matches!(tok, Tok::Comment { .. } | Tok::NonLogicalNewline)); + .filter_ok(|(tok, _)| !matches!(tok, Tok::Comment { .. } | Tok::NonLogicalNewline)); python::TopParser::new() - .parse(lexer.into_iter()) + .parse( + lexer + .into_iter() + .map_ok(|(t, range)| (range.start(), t, range.end())), + ) .map_err(|e| parse_error_from_lalrpop(e, source_path)) } diff --git a/compiler/parser/src/soft_keywords.rs b/compiler/parser/src/soft_keywords.rs index c670fd1742..3a5eb41e91 100644 --- a/compiler/parser/src/soft_keywords.rs +++ b/compiler/parser/src/soft_keywords.rs @@ -42,7 +42,7 @@ where #[inline] fn next(&mut self) -> Option { let mut next = self.underlying.next(); - if let Some(Ok((start, tok, end))) = next.as_ref() { + if let Some(Ok((tok, range))) = next.as_ref() { // If the token is a `match` or `case` token, check if it's used as an identifier. // We assume every `match` or `case` is an identifier unless both of the following // conditions are met: @@ -54,13 +54,13 @@ where // type hints.) if matches!(tok, Tok::Match | Tok::Case) { if !self.start_of_line { - next = Some(Ok((*start, soft_to_name(tok), *end))); + next = Some(Ok((soft_to_name(tok), *range))); } else { let mut nesting = 0; let mut first = true; let mut seen_colon = false; let mut seen_lambda = false; - while let Some(Ok((_, tok, _))) = self.underlying.peek() { + while let Some(Ok((tok, _))) = self.underlying.peek() { match tok { Tok::Newline => break, Tok::Lambda if nesting == 0 => seen_lambda = true, @@ -78,14 +78,14 @@ where first = false; } if !seen_colon { - next = Some(Ok((*start, soft_to_name(tok), *end))); + next = Some(Ok((soft_to_name(tok), *range))); } } } } self.start_of_line = next.as_ref().map_or(false, |lex_result| { - lex_result.as_ref().map_or(false, |(_, tok, _)| { + lex_result.as_ref().map_or(false, |(tok, _)| { if matches!(tok, Tok::NonLogicalNewline | Tok::Comment { .. }) { self.start_of_line } else { From f7152407c8e98b9a1fb4a450cba1e32d096932bc Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Mon, 17 Apr 2023 10:16:29 +0200 Subject: [PATCH 07/16] Accept snapshot changes --- compiler/ast/src/constant.rs | 1 + compiler/parser/src/parser.rs | 16 +- ...rser__context__tests__ann_assign_name.snap | 44 +- ...ser__context__tests__assign_attribute.snap | 77 +- ...on_parser__context__tests__assign_for.snap | 77 +- ...n_parser__context__tests__assign_list.snap | 88 +- ...ser__context__tests__assign_list_comp.snap | 99 +- ...n_parser__context__tests__assign_name.snap | 66 +- ...er__context__tests__assign_named_expr.snap | 55 +- ...rser__context__tests__assign_set_comp.snap | 99 +- ...arser__context__tests__assign_starred.snap | 99 +- ...ser__context__tests__assign_subscript.snap | 88 +- ..._parser__context__tests__assign_tuple.snap | 88 +- ...n_parser__context__tests__assign_with.snap | 44 +- ..._context__tests__aug_assign_attribute.snap | 77 +- ...rser__context__tests__aug_assign_name.snap | 33 +- ..._context__tests__aug_assign_subscript.snap | 88 +- ...parser__context__tests__del_attribute.snap | 33 +- ...thon_parser__context__tests__del_name.snap | 22 +- ...parser__context__tests__del_subscript.snap | 44 +- ...unction__tests__function_kw_only_args.snap | 55 +- ...__function_kw_only_args_with_defaults.snap | 77 +- ...er__function__tests__function_no_args.snap | 22 +- ..._tests__function_pos_and_kw_only_args.snap | 88 +- ...on_pos_and_kw_only_args_with_defaults.snap | 110 +- ...w_only_args_with_defaults_and_varargs.snap | 121 +- ..._with_defaults_and_varargs_and_kwargs.snap | 132 +- ...r__function__tests__function_pos_args.snap | 55 +- ...ests__function_pos_args_with_defaults.snap | 77 +- ..._function__tests__lambda_kw_only_args.snap | 66 +- ...ts__lambda_kw_only_args_with_defaults.snap | 88 +- ...rser__function__tests__lambda_no_args.snap | 33 +- ...n__tests__lambda_pos_and_kw_only_args.snap | 88 +- ...ser__function__tests__lambda_pos_args.snap | 66 +- ..._tests__lambda_pos_args_with_defaults.snap | 88 +- ...parser__parser__tests__dict_unpacking.snap | 66 +- ..._tests__generator_expression_argument.snap | 209 +- ...stpython_parser__parser__tests__match.snap | 572 +- ...r__parser__tests__match_as_identifier.snap | 1243 +--- ...ser__parser__tests__parse_bool_op_and.snap | 33 +- ...rser__parser__tests__parse_bool_op_or.snap | 33 +- ...on_parser__parser__tests__parse_class.snap | 121 +- ...rser__tests__parse_dict_comprehension.snap | 55 +- ...ests__parse_double_list_comprehension.snap | 154 +- ...parser__parser__tests__parse_f_string.snap | 33 +- ..._tests__parse_generator_comprehension.snap | 44 +- ...er__parser__tests__parse_if_elif_else.snap | 110 +- ...parse_if_else_generator_comprehension.snap | 77 +- ...n_parser__parser__tests__parse_kwargs.snap | 66 +- ...n_parser__parser__tests__parse_lambda.snap | 77 +- ...rser__tests__parse_list_comprehension.snap | 44 +- ...ed_expression_generator_comprehension.snap | 88 +- ..._parser__parser__tests__parse_print_2.snap | 55 +- ...ser__parser__tests__parse_print_hello.snap | 44 +- ...n_parser__parser__tests__parse_string.snap | 22 +- ...n_parser__parser__tests__parse_tuples.snap | 77 +- ...stpython_parser__parser__tests__patma.snap | 5009 ++--------------- ...stpython_parser__parser__tests__slice.snap | 66 +- ...hon_parser__parser__tests__star_index.snap | 407 +- ...rustpython_parser__parser__tests__try.snap | 297 +- ...ython_parser__parser__tests__try_star.snap | 528 +- ...ser__parser__tests__variadic_generics.snap | 110 +- ...parser__parser__tests__with_statement.snap | 1496 +---- ...arser__string__tests__backspace_alias.snap | 22 +- ...hon_parser__string__tests__bell_alias.snap | 22 +- ..._string__tests__carriage_return_alias.snap | 22 +- ...r_tabulation_with_justification_alias.snap | 22 +- ...n_parser__string__tests__delete_alias.snap | 22 +- ...er__string__tests__double_quoted_byte.snap | 22 +- ...n_parser__string__tests__escape_alias.snap | 22 +- ...g__tests__escape_char_in_byte_literal.snap | 22 +- ...n_parser__string__tests__escape_octet.snap | 22 +- ...arser__string__tests__form_feed_alias.snap | 22 +- ...ing__tests__fstring_escaped_character.snap | 55 +- ...tring__tests__fstring_escaped_newline.snap | 55 +- ...ing__tests__fstring_line_continuation.snap | 55 +- ...__fstring_parse_self_documenting_base.snap | 44 +- ...ring_parse_self_documenting_base_more.snap | 110 +- ...fstring_parse_self_documenting_format.snap | 66 +- ...ing__tests__fstring_unescaped_newline.snap | 55 +- ...thon_parser__string__tests__hts_alias.snap | 22 +- ...tring__tests__parse_f_string_concat_1.snap | 33 +- ...tring__tests__parse_f_string_concat_2.snap | 33 +- ...tring__tests__parse_f_string_concat_3.snap | 55 +- ..._parser__string__tests__parse_fstring.snap | 55 +- ...__string__tests__parse_fstring_equals.snap | 44 +- ...ing__tests__parse_fstring_nested_spec.snap | 55 +- ...ring__tests__parse_fstring_not_equals.snap | 44 +- ..._tests__parse_fstring_not_nested_spec.snap | 44 +- ...ts__parse_fstring_self_doc_prec_space.snap | 44 +- ...parse_fstring_self_doc_trailing_space.snap | 44 +- ...ring__tests__parse_fstring_yield_expr.snap | 22 +- ...r__string__tests__parse_string_concat.snap | 22 +- ..._parse_string_triple_quotes_with_kind.snap | 22 +- ...ing__tests__parse_u_f_string_concat_1.snap | 33 +- ...ing__tests__parse_u_f_string_concat_2.snap | 33 +- ...tring__tests__parse_u_string_concat_1.snap | 22 +- ...tring__tests__parse_u_string_concat_2.snap | 22 +- ...er__string__tests__raw_byte_literal_1.snap | 22 +- ...er__string__tests__raw_byte_literal_2.snap | 22 +- ...on_parser__string__tests__raw_fstring.snap | 44 +- ...er__string__tests__single_quoted_byte.snap | 22 +- ...ing__tests__triple_quoted_raw_fstring.snap | 44 +- compiler/parser/src/string.rs | 3 +- 104 files changed, 1375 insertions(+), 13631 deletions(-) diff --git a/compiler/ast/src/constant.rs b/compiler/ast/src/constant.rs index 93436f1ea2..fee791ae41 100644 --- a/compiler/ast/src/constant.rs +++ b/compiler/ast/src/constant.rs @@ -140,6 +140,7 @@ mod tests { use crate::{fold::Fold, *}; let range = TextRange::default(); + #[allow(clippy::let_unit_value)] let custom = (); let ast = Located { range, diff --git a/compiler/parser/src/parser.rs b/compiler/parser/src/parser.rs index 9cd7c7af92..7704c2ada3 100644 --- a/compiler/parser/src/parser.rs +++ b/compiler/parser/src/parser.rs @@ -85,9 +85,10 @@ pub fn parse_expression(source: &str, path: &str) -> Result", Location::from(400)); +/// let expr = parse_expression_located("1 + 2", "", TextSize::from(400)); /// assert!(expr.is_ok()); /// ``` pub fn parse_expression_located( @@ -144,7 +145,8 @@ pub fn parse(source: &str, mode: Mode, source_path: &str) -> Result Result", Location::from(0)); +/// let program = parse_located(source, Mode::Module, "", TextSize::from(0)); /// assert!(program.is_ok()); /// ``` pub fn parse_located( @@ -583,9 +585,9 @@ except* OSError as e: fn test_modes() { let source = "a[0][1][2][3][4]"; - assert!(parse(&source, Mode::Expression, "").is_ok()); - assert!(parse(&source, Mode::Module, "").is_ok()); - assert!(parse(&source, Mode::Interactive, "").is_ok()); + assert!(parse(source, Mode::Expression, "").is_ok()); + assert!(parse(source, Mode::Module, "").is_ok()); + assert!(parse(source, Mode::Interactive, "").is_ok()); } #[test] diff --git a/compiler/parser/src/snapshots/rustpython_parser__context__tests__ann_assign_name.snap b/compiler/parser/src/snapshots/rustpython_parser__context__tests__ann_assign_name.snap index 78ccf76818..c514cd1dab 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__context__tests__ann_assign_name.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__context__tests__ann_assign_name.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 10, - }, - ), + range: 0..10, custom: (), node: AnnAssign { target: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 1, - }, - ), + range: 0..1, custom: (), node: Name { id: "x", @@ -34,16 +16,7 @@ expression: parse_ast }, }, annotation: Located { - location: Location { - row: 1, - column: 3, - }, - end_location: Some( - Location { - row: 1, - column: 6, - }, - ), + range: 3..6, custom: (), node: Name { id: "int", @@ -52,16 +25,7 @@ expression: parse_ast }, value: Some( Located { - location: Location { - row: 1, - column: 9, - }, - end_location: Some( - Location { - row: 1, - column: 10, - }, - ), + range: 9..10, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_attribute.snap b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_attribute.snap index 984cb7a37c..1c0378dfe1 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_attribute.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_attribute.snap @@ -4,43 +4,16 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 15, - }, - ), + range: 0..15, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 3, - }, - ), + range: 0..3, custom: (), node: Attribute { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 1, - }, - ), + range: 0..1, custom: (), node: Name { id: "x", @@ -53,30 +26,12 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 1, - column: 6, - }, - end_location: Some( - Location { - row: 1, - column: 15, - }, - ), + range: 6..15, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 1, - column: 7, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 7..8, custom: (), node: Constant { value: Int( @@ -86,16 +41,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 10, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 10..11, custom: (), node: Constant { value: Int( @@ -105,16 +51,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 13, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 13..14, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_for.snap b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_for.snap index 9dd280206e..1ad7e98b9e 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_for.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_for.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 24, - }, - ), + range: 0..24, custom: (), node: For { target: Located { - location: Location { - row: 1, - column: 4, - }, - end_location: Some( - Location { - row: 1, - column: 5, - }, - ), + range: 4..5, custom: (), node: Name { id: "x", @@ -34,30 +16,12 @@ expression: parse_ast }, }, iter: Located { - location: Location { - row: 1, - column: 9, - }, - end_location: Some( - Location { - row: 1, - column: 18, - }, - ), + range: 9..18, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 1, - column: 10, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 10..11, custom: (), node: Constant { value: Int( @@ -67,16 +31,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 13, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 13..14, custom: (), node: Constant { value: Int( @@ -86,16 +41,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 16, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 16..17, custom: (), node: Constant { value: Int( @@ -110,16 +56,7 @@ expression: parse_ast }, body: [ Located { - location: Location { - row: 1, - column: 20, - }, - end_location: Some( - Location { - row: 1, - column: 24, - }, - ), + range: 20..24, custom: (), node: Pass, }, diff --git a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_list.snap b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_list.snap index ea59293b53..513e8d8cb2 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_list.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_list.snap @@ -4,44 +4,17 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 18, - }, - ), + range: 0..18, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 6, - }, - ), + range: 0..6, custom: (), node: List { elts: [ Located { - location: Location { - row: 1, - column: 1, - }, - end_location: Some( - Location { - row: 1, - column: 2, - }, - ), + range: 1..2, custom: (), node: Name { id: "x", @@ -49,16 +22,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 4, - }, - end_location: Some( - Location { - row: 1, - column: 5, - }, - ), + range: 4..5, custom: (), node: Name { id: "y", @@ -71,30 +35,12 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 1, - column: 9, - }, - end_location: Some( - Location { - row: 1, - column: 18, - }, - ), + range: 9..18, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 1, - column: 10, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 10..11, custom: (), node: Constant { value: Int( @@ -104,16 +50,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 13, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 13..14, custom: (), node: Constant { value: Int( @@ -123,16 +60,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 16, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 16..17, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_list_comp.snap b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_list_comp.snap index 367f09a44f..29cacf26c3 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_list_comp.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_list_comp.snap @@ -4,30 +4,12 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 26, - }, - ), + range: 0..26, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 1, - }, - ), + range: 0..1, custom: (), node: Name { id: "x", @@ -36,29 +18,11 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 1, - column: 4, - }, - end_location: Some( - Location { - row: 1, - column: 26, - }, - ), + range: 4..26, custom: (), node: ListComp { elt: Located { - location: Location { - row: 1, - column: 5, - }, - end_location: Some( - Location { - row: 1, - column: 6, - }, - ), + range: 5..6, custom: (), node: Name { id: "y", @@ -68,16 +32,7 @@ expression: parse_ast generators: [ Comprehension { target: Located { - location: Location { - row: 1, - column: 11, - }, - end_location: Some( - Location { - row: 1, - column: 12, - }, - ), + range: 11..12, custom: (), node: Name { id: "y", @@ -85,30 +40,12 @@ expression: parse_ast }, }, iter: Located { - location: Location { - row: 1, - column: 16, - }, - end_location: Some( - Location { - row: 1, - column: 25, - }, - ), + range: 16..25, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 1, - column: 17, - }, - end_location: Some( - Location { - row: 1, - column: 18, - }, - ), + range: 17..18, custom: (), node: Constant { value: Int( @@ -118,16 +55,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 20, - }, - end_location: Some( - Location { - row: 1, - column: 21, - }, - ), + range: 20..21, custom: (), node: Constant { value: Int( @@ -137,16 +65,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 23, - }, - end_location: Some( - Location { - row: 1, - column: 24, - }, - ), + range: 23..24, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_name.snap b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_name.snap index 55d4e70dc1..4d3801c40a 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_name.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_name.snap @@ -4,30 +4,12 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 0..13, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 1, - }, - ), + range: 0..1, custom: (), node: Name { id: "x", @@ -36,30 +18,12 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 1, - column: 4, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 4..13, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 1, - column: 5, - }, - end_location: Some( - Location { - row: 1, - column: 6, - }, - ), + range: 5..6, custom: (), node: Constant { value: Int( @@ -69,16 +33,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 8, - }, - end_location: Some( - Location { - row: 1, - column: 9, - }, - ), + range: 8..9, custom: (), node: Constant { value: Int( @@ -88,16 +43,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 11, - }, - end_location: Some( - Location { - row: 1, - column: 12, - }, - ), + range: 11..12, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_named_expr.snap b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_named_expr.snap index 64ddb632e2..23928d07e9 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_named_expr.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_named_expr.snap @@ -4,42 +4,15 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 0..14, custom: (), node: If { test: Located { - location: Location { - row: 1, - column: 3, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 3..8, custom: (), node: NamedExpr { target: Located { - location: Location { - row: 1, - column: 3, - }, - end_location: Some( - Location { - row: 1, - column: 4, - }, - ), + range: 3..4, custom: (), node: Name { id: "x", @@ -47,16 +20,7 @@ expression: parse_ast }, }, value: Located { - location: Location { - row: 1, - column: 7, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 7..8, custom: (), node: Constant { value: Int( @@ -69,16 +33,7 @@ expression: parse_ast }, body: [ Located { - location: Location { - row: 1, - column: 10, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 10..14, custom: (), node: Pass, }, diff --git a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_set_comp.snap b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_set_comp.snap index 97ecaa081e..541626f64e 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_set_comp.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_set_comp.snap @@ -4,30 +4,12 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 26, - }, - ), + range: 0..26, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 1, - }, - ), + range: 0..1, custom: (), node: Name { id: "x", @@ -36,29 +18,11 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 1, - column: 4, - }, - end_location: Some( - Location { - row: 1, - column: 26, - }, - ), + range: 4..26, custom: (), node: SetComp { elt: Located { - location: Location { - row: 1, - column: 5, - }, - end_location: Some( - Location { - row: 1, - column: 6, - }, - ), + range: 5..6, custom: (), node: Name { id: "y", @@ -68,16 +32,7 @@ expression: parse_ast generators: [ Comprehension { target: Located { - location: Location { - row: 1, - column: 11, - }, - end_location: Some( - Location { - row: 1, - column: 12, - }, - ), + range: 11..12, custom: (), node: Name { id: "y", @@ -85,30 +40,12 @@ expression: parse_ast }, }, iter: Located { - location: Location { - row: 1, - column: 16, - }, - end_location: Some( - Location { - row: 1, - column: 25, - }, - ), + range: 16..25, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 1, - column: 17, - }, - end_location: Some( - Location { - row: 1, - column: 18, - }, - ), + range: 17..18, custom: (), node: Constant { value: Int( @@ -118,16 +55,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 20, - }, - end_location: Some( - Location { - row: 1, - column: 21, - }, - ), + range: 20..21, custom: (), node: Constant { value: Int( @@ -137,16 +65,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 23, - }, - end_location: Some( - Location { - row: 1, - column: 24, - }, - ), + range: 23..24, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_starred.snap b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_starred.snap index 015f9bdd7f..747daa554c 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_starred.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_starred.snap @@ -4,44 +4,17 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 19, - }, - ), + range: 0..19, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 0..7, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 1, - column: 1, - }, - end_location: Some( - Location { - row: 1, - column: 2, - }, - ), + range: 1..2, custom: (), node: Name { id: "x", @@ -49,29 +22,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 4, - }, - end_location: Some( - Location { - row: 1, - column: 6, - }, - ), + range: 4..6, custom: (), node: Starred { value: Located { - location: Location { - row: 1, - column: 5, - }, - end_location: Some( - Location { - row: 1, - column: 6, - }, - ), + range: 5..6, custom: (), node: Name { id: "y", @@ -87,30 +42,12 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 1, - column: 10, - }, - end_location: Some( - Location { - row: 1, - column: 19, - }, - ), + range: 10..19, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 1, - column: 11, - }, - end_location: Some( - Location { - row: 1, - column: 12, - }, - ), + range: 11..12, custom: (), node: Constant { value: Int( @@ -120,16 +57,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 14, - }, - end_location: Some( - Location { - row: 1, - column: 15, - }, - ), + range: 14..15, custom: (), node: Constant { value: Int( @@ -139,16 +67,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 17, - }, - end_location: Some( - Location { - row: 1, - column: 18, - }, - ), + range: 17..18, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_subscript.snap b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_subscript.snap index 756867c372..d80e85ac95 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_subscript.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_subscript.snap @@ -4,43 +4,16 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 16, - }, - ), + range: 0..16, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 4, - }, - ), + range: 0..4, custom: (), node: Subscript { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 1, - }, - ), + range: 0..1, custom: (), node: Name { id: "x", @@ -48,16 +21,7 @@ expression: parse_ast }, }, slice: Located { - location: Location { - row: 1, - column: 2, - }, - end_location: Some( - Location { - row: 1, - column: 3, - }, - ), + range: 2..3, custom: (), node: Name { id: "y", @@ -69,30 +33,12 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 1, - column: 7, - }, - end_location: Some( - Location { - row: 1, - column: 16, - }, - ), + range: 7..16, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 1, - column: 8, - }, - end_location: Some( - Location { - row: 1, - column: 9, - }, - ), + range: 8..9, custom: (), node: Constant { value: Int( @@ -102,16 +48,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 11, - }, - end_location: Some( - Location { - row: 1, - column: 12, - }, - ), + range: 11..12, custom: (), node: Constant { value: Int( @@ -121,16 +58,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 14, - }, - end_location: Some( - Location { - row: 1, - column: 15, - }, - ), + range: 14..15, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_tuple.snap b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_tuple.snap index c520427d93..a403c16c80 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_tuple.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_tuple.snap @@ -4,44 +4,17 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 18, - }, - ), + range: 0..18, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 6, - }, - ), + range: 0..6, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 1, - column: 1, - }, - end_location: Some( - Location { - row: 1, - column: 2, - }, - ), + range: 1..2, custom: (), node: Name { id: "x", @@ -49,16 +22,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 4, - }, - end_location: Some( - Location { - row: 1, - column: 5, - }, - ), + range: 4..5, custom: (), node: Name { id: "y", @@ -71,30 +35,12 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 1, - column: 9, - }, - end_location: Some( - Location { - row: 1, - column: 18, - }, - ), + range: 9..18, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 1, - column: 10, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 10..11, custom: (), node: Constant { value: Int( @@ -104,16 +50,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 13, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 13..14, custom: (), node: Constant { value: Int( @@ -123,16 +60,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 16, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 16..17, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_with.snap b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_with.snap index 100b672820..bbae7bebc8 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_with.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__context__tests__assign_with.snap @@ -4,31 +4,13 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 0..17, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 1, - column: 5, - }, - end_location: Some( - Location { - row: 1, - column: 6, - }, - ), + range: 5..6, custom: (), node: Constant { value: Int( @@ -39,16 +21,7 @@ expression: parse_ast }, optional_vars: Some( Located { - location: Location { - row: 1, - column: 10, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 10..11, custom: (), node: Name { id: "x", @@ -60,16 +33,7 @@ expression: parse_ast ], body: [ Located { - location: Location { - row: 1, - column: 13, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 13..17, custom: (), node: Pass, }, diff --git a/compiler/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_attribute.snap b/compiler/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_attribute.snap index 3e6e4b79db..9ad5f1b502 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_attribute.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_attribute.snap @@ -4,42 +4,15 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 16, - }, - ), + range: 0..16, custom: (), node: AugAssign { target: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 3, - }, - ), + range: 0..3, custom: (), node: Attribute { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 1, - }, - ), + range: 0..1, custom: (), node: Name { id: "x", @@ -52,30 +25,12 @@ expression: parse_ast }, op: Add, value: Located { - location: Location { - row: 1, - column: 7, - }, - end_location: Some( - Location { - row: 1, - column: 16, - }, - ), + range: 7..16, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 1, - column: 8, - }, - end_location: Some( - Location { - row: 1, - column: 9, - }, - ), + range: 8..9, custom: (), node: Constant { value: Int( @@ -85,16 +40,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 11, - }, - end_location: Some( - Location { - row: 1, - column: 12, - }, - ), + range: 11..12, custom: (), node: Constant { value: Int( @@ -104,16 +50,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 14, - }, - end_location: Some( - Location { - row: 1, - column: 15, - }, - ), + range: 14..15, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_name.snap b/compiler/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_name.snap index 0035310f1d..222e464b5b 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_name.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_name.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 6, - }, - ), + range: 0..6, custom: (), node: AugAssign { target: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 1, - }, - ), + range: 0..1, custom: (), node: Name { id: "x", @@ -35,16 +17,7 @@ expression: parse_ast }, op: Add, value: Located { - location: Location { - row: 1, - column: 5, - }, - end_location: Some( - Location { - row: 1, - column: 6, - }, - ), + range: 5..6, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_subscript.snap b/compiler/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_subscript.snap index 72fe61db27..3b4fb00e5e 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_subscript.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__context__tests__aug_assign_subscript.snap @@ -4,42 +4,15 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 0..17, custom: (), node: AugAssign { target: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 4, - }, - ), + range: 0..4, custom: (), node: Subscript { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 1, - }, - ), + range: 0..1, custom: (), node: Name { id: "x", @@ -47,16 +20,7 @@ expression: parse_ast }, }, slice: Located { - location: Location { - row: 1, - column: 2, - }, - end_location: Some( - Location { - row: 1, - column: 3, - }, - ), + range: 2..3, custom: (), node: Name { id: "y", @@ -68,30 +32,12 @@ expression: parse_ast }, op: Add, value: Located { - location: Location { - row: 1, - column: 8, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 8..17, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 1, - column: 9, - }, - end_location: Some( - Location { - row: 1, - column: 10, - }, - ), + range: 9..10, custom: (), node: Constant { value: Int( @@ -101,16 +47,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 12, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 12..13, custom: (), node: Constant { value: Int( @@ -120,16 +57,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 15, - }, - end_location: Some( - Location { - row: 1, - column: 16, - }, - ), + range: 15..16, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__context__tests__del_attribute.snap b/compiler/parser/src/snapshots/rustpython_parser__context__tests__del_attribute.snap index f44c23b557..99786f1be2 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__context__tests__del_attribute.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__context__tests__del_attribute.snap @@ -4,43 +4,16 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 0..7, custom: (), node: Delete { targets: [ Located { - location: Location { - row: 1, - column: 4, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 4..7, custom: (), node: Attribute { value: Located { - location: Location { - row: 1, - column: 4, - }, - end_location: Some( - Location { - row: 1, - column: 5, - }, - ), + range: 4..5, custom: (), node: Name { id: "x", diff --git a/compiler/parser/src/snapshots/rustpython_parser__context__tests__del_name.snap b/compiler/parser/src/snapshots/rustpython_parser__context__tests__del_name.snap index 56208d2069..2ec27c6e82 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__context__tests__del_name.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__context__tests__del_name.snap @@ -4,30 +4,12 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 5, - }, - ), + range: 0..5, custom: (), node: Delete { targets: [ Located { - location: Location { - row: 1, - column: 4, - }, - end_location: Some( - Location { - row: 1, - column: 5, - }, - ), + range: 4..5, custom: (), node: Name { id: "x", diff --git a/compiler/parser/src/snapshots/rustpython_parser__context__tests__del_subscript.snap b/compiler/parser/src/snapshots/rustpython_parser__context__tests__del_subscript.snap index dca2e7ceb4..6188d907de 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__context__tests__del_subscript.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__context__tests__del_subscript.snap @@ -4,43 +4,16 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 0..8, custom: (), node: Delete { targets: [ Located { - location: Location { - row: 1, - column: 4, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 4..8, custom: (), node: Subscript { value: Located { - location: Location { - row: 1, - column: 4, - }, - end_location: Some( - Location { - row: 1, - column: 5, - }, - ), + range: 4..5, custom: (), node: Name { id: "x", @@ -48,16 +21,7 @@ expression: parse_ast }, }, slice: Located { - location: Location { - row: 1, - column: 6, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 6..7, custom: (), node: Name { id: "y", diff --git a/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_kw_only_args.snap b/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_kw_only_args.snap index 2b990fa833..4f4a1e5de3 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_kw_only_args.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_kw_only_args.snap @@ -5,16 +5,7 @@ expression: parse_ast Ok( [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 23, - }, - ), + range: 0..23, custom: (), node: FunctionDef { name: "f", @@ -24,16 +15,7 @@ Ok( vararg: None, kwonlyargs: [ Located { - location: Location { - row: 1, - column: 9, - }, - end_location: Some( - Location { - row: 1, - column: 10, - }, - ), + range: 9..10, custom: (), node: ArgData { arg: "a", @@ -42,16 +24,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 12, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 12..13, custom: (), node: ArgData { arg: "b", @@ -60,16 +33,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 15, - }, - end_location: Some( - Location { - row: 1, - column: 16, - }, - ), + range: 15..16, custom: (), node: ArgData { arg: "c", @@ -84,16 +48,7 @@ Ok( }, body: [ Located { - location: Location { - row: 1, - column: 19, - }, - end_location: Some( - Location { - row: 1, - column: 23, - }, - ), + range: 19..23, custom: (), node: Pass, }, diff --git a/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_kw_only_args_with_defaults.snap b/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_kw_only_args_with_defaults.snap index 08fa27e467..e0f39412da 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_kw_only_args_with_defaults.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_kw_only_args_with_defaults.snap @@ -5,16 +5,7 @@ expression: parse_ast Ok( [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 29, - }, - ), + range: 0..29, custom: (), node: FunctionDef { name: "f", @@ -24,16 +15,7 @@ Ok( vararg: None, kwonlyargs: [ Located { - location: Location { - row: 1, - column: 9, - }, - end_location: Some( - Location { - row: 1, - column: 10, - }, - ), + range: 9..10, custom: (), node: ArgData { arg: "a", @@ -42,16 +24,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 12, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 12..13, custom: (), node: ArgData { arg: "b", @@ -60,16 +33,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 18, - }, - end_location: Some( - Location { - row: 1, - column: 19, - }, - ), + range: 18..19, custom: (), node: ArgData { arg: "c", @@ -80,16 +44,7 @@ Ok( ], kw_defaults: [ Located { - location: Location { - row: 1, - column: 14, - }, - end_location: Some( - Location { - row: 1, - column: 16, - }, - ), + range: 14..16, custom: (), node: Constant { value: Int( @@ -99,16 +54,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 20, - }, - end_location: Some( - Location { - row: 1, - column: 22, - }, - ), + range: 20..22, custom: (), node: Constant { value: Int( @@ -123,16 +69,7 @@ Ok( }, body: [ Located { - location: Location { - row: 1, - column: 25, - }, - end_location: Some( - Location { - row: 1, - column: 29, - }, - ), + range: 25..29, custom: (), node: Pass, }, diff --git a/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_no_args.snap b/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_no_args.snap index a8d08b9add..f499ba75b5 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_no_args.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_no_args.snap @@ -5,16 +5,7 @@ expression: parse_ast Ok( [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 0..13, custom: (), node: FunctionDef { name: "f", @@ -29,16 +20,7 @@ Ok( }, body: [ Located { - location: Location { - row: 1, - column: 9, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 9..13, custom: (), node: Pass, }, diff --git a/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_and_kw_only_args.snap b/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_and_kw_only_args.snap index 766a36b1ad..6000987603 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_and_kw_only_args.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_and_kw_only_args.snap @@ -5,16 +5,7 @@ expression: parse_ast Ok( [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 32, - }, - ), + range: 0..32, custom: (), node: FunctionDef { name: "f", @@ -22,16 +13,7 @@ Ok( posonlyargs: [], args: [ Located { - location: Location { - row: 1, - column: 6, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 6..7, custom: (), node: ArgData { arg: "a", @@ -40,16 +22,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 9, - }, - end_location: Some( - Location { - row: 1, - column: 10, - }, - ), + range: 9..10, custom: (), node: ArgData { arg: "b", @@ -58,16 +31,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 12, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 12..13, custom: (), node: ArgData { arg: "c", @@ -79,16 +43,7 @@ Ok( vararg: None, kwonlyargs: [ Located { - location: Location { - row: 1, - column: 18, - }, - end_location: Some( - Location { - row: 1, - column: 19, - }, - ), + range: 18..19, custom: (), node: ArgData { arg: "d", @@ -97,16 +52,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 21, - }, - end_location: Some( - Location { - row: 1, - column: 22, - }, - ), + range: 21..22, custom: (), node: ArgData { arg: "e", @@ -115,16 +61,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 24, - }, - end_location: Some( - Location { - row: 1, - column: 25, - }, - ), + range: 24..25, custom: (), node: ArgData { arg: "f", @@ -139,16 +76,7 @@ Ok( }, body: [ Located { - location: Location { - row: 1, - column: 28, - }, - end_location: Some( - Location { - row: 1, - column: 32, - }, - ), + range: 28..32, custom: (), node: Pass, }, diff --git a/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_and_kw_only_args_with_defaults.snap b/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_and_kw_only_args_with_defaults.snap index c6ff5e5d2c..05afabc378 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_and_kw_only_args_with_defaults.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_and_kw_only_args_with_defaults.snap @@ -5,16 +5,7 @@ expression: parse_ast Ok( [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 38, - }, - ), + range: 0..38, custom: (), node: FunctionDef { name: "f", @@ -22,16 +13,7 @@ Ok( posonlyargs: [], args: [ Located { - location: Location { - row: 1, - column: 6, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 6..7, custom: (), node: ArgData { arg: "a", @@ -40,16 +22,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 9, - }, - end_location: Some( - Location { - row: 1, - column: 10, - }, - ), + range: 9..10, custom: (), node: ArgData { arg: "b", @@ -58,16 +31,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 12, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 12..13, custom: (), node: ArgData { arg: "c", @@ -79,16 +43,7 @@ Ok( vararg: None, kwonlyargs: [ Located { - location: Location { - row: 1, - column: 18, - }, - end_location: Some( - Location { - row: 1, - column: 19, - }, - ), + range: 18..19, custom: (), node: ArgData { arg: "d", @@ -97,16 +52,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 21, - }, - end_location: Some( - Location { - row: 1, - column: 22, - }, - ), + range: 21..22, custom: (), node: ArgData { arg: "e", @@ -115,16 +61,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 27, - }, - end_location: Some( - Location { - row: 1, - column: 28, - }, - ), + range: 27..28, custom: (), node: ArgData { arg: "f", @@ -135,16 +72,7 @@ Ok( ], kw_defaults: [ Located { - location: Location { - row: 1, - column: 23, - }, - end_location: Some( - Location { - row: 1, - column: 25, - }, - ), + range: 23..25, custom: (), node: Constant { value: Int( @@ -154,16 +82,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 29, - }, - end_location: Some( - Location { - row: 1, - column: 31, - }, - ), + range: 29..31, custom: (), node: Constant { value: Int( @@ -178,16 +97,7 @@ Ok( }, body: [ Located { - location: Location { - row: 1, - column: 34, - }, - end_location: Some( - Location { - row: 1, - column: 38, - }, - ), + range: 34..38, custom: (), node: Pass, }, diff --git a/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_and_kw_only_args_with_defaults_and_varargs.snap b/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_and_kw_only_args_with_defaults_and_varargs.snap index 830a9c5298..889ad5b322 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_and_kw_only_args_with_defaults_and_varargs.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_and_kw_only_args_with_defaults_and_varargs.snap @@ -5,16 +5,7 @@ expression: parse_ast Ok( [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 42, - }, - ), + range: 0..42, custom: (), node: FunctionDef { name: "f", @@ -22,16 +13,7 @@ Ok( posonlyargs: [], args: [ Located { - location: Location { - row: 1, - column: 6, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 6..7, custom: (), node: ArgData { arg: "a", @@ -40,16 +22,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 9, - }, - end_location: Some( - Location { - row: 1, - column: 10, - }, - ), + range: 9..10, custom: (), node: ArgData { arg: "b", @@ -58,16 +31,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 12, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 12..13, custom: (), node: ArgData { arg: "c", @@ -78,16 +42,7 @@ Ok( ], vararg: Some( Located { - location: Location { - row: 1, - column: 16, - }, - end_location: Some( - Location { - row: 1, - column: 20, - }, - ), + range: 16..20, custom: (), node: ArgData { arg: "args", @@ -98,16 +53,7 @@ Ok( ), kwonlyargs: [ Located { - location: Location { - row: 1, - column: 22, - }, - end_location: Some( - Location { - row: 1, - column: 23, - }, - ), + range: 22..23, custom: (), node: ArgData { arg: "d", @@ -116,16 +62,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 25, - }, - end_location: Some( - Location { - row: 1, - column: 26, - }, - ), + range: 25..26, custom: (), node: ArgData { arg: "e", @@ -134,16 +71,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 31, - }, - end_location: Some( - Location { - row: 1, - column: 32, - }, - ), + range: 31..32, custom: (), node: ArgData { arg: "f", @@ -154,16 +82,7 @@ Ok( ], kw_defaults: [ Located { - location: Location { - row: 1, - column: 27, - }, - end_location: Some( - Location { - row: 1, - column: 29, - }, - ), + range: 27..29, custom: (), node: Constant { value: Int( @@ -173,16 +92,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 33, - }, - end_location: Some( - Location { - row: 1, - column: 35, - }, - ), + range: 33..35, custom: (), node: Constant { value: Int( @@ -197,16 +107,7 @@ Ok( }, body: [ Located { - location: Location { - row: 1, - column: 38, - }, - end_location: Some( - Location { - row: 1, - column: 42, - }, - ), + range: 38..42, custom: (), node: Pass, }, diff --git a/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_and_kw_only_args_with_defaults_and_varargs_and_kwargs.snap b/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_and_kw_only_args_with_defaults_and_varargs_and_kwargs.snap index fde81e980e..220902dfca 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_and_kw_only_args_with_defaults_and_varargs_and_kwargs.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_and_kw_only_args_with_defaults_and_varargs_and_kwargs.snap @@ -5,16 +5,7 @@ expression: parse_ast Ok( [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 52, - }, - ), + range: 0..52, custom: (), node: FunctionDef { name: "f", @@ -22,16 +13,7 @@ Ok( posonlyargs: [], args: [ Located { - location: Location { - row: 1, - column: 6, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 6..7, custom: (), node: ArgData { arg: "a", @@ -40,16 +22,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 9, - }, - end_location: Some( - Location { - row: 1, - column: 10, - }, - ), + range: 9..10, custom: (), node: ArgData { arg: "b", @@ -58,16 +31,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 12, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 12..13, custom: (), node: ArgData { arg: "c", @@ -78,16 +42,7 @@ Ok( ], vararg: Some( Located { - location: Location { - row: 1, - column: 16, - }, - end_location: Some( - Location { - row: 1, - column: 20, - }, - ), + range: 16..20, custom: (), node: ArgData { arg: "args", @@ -98,16 +53,7 @@ Ok( ), kwonlyargs: [ Located { - location: Location { - row: 1, - column: 22, - }, - end_location: Some( - Location { - row: 1, - column: 23, - }, - ), + range: 22..23, custom: (), node: ArgData { arg: "d", @@ -116,16 +62,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 25, - }, - end_location: Some( - Location { - row: 1, - column: 26, - }, - ), + range: 25..26, custom: (), node: ArgData { arg: "e", @@ -134,16 +71,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 31, - }, - end_location: Some( - Location { - row: 1, - column: 32, - }, - ), + range: 31..32, custom: (), node: ArgData { arg: "f", @@ -154,16 +82,7 @@ Ok( ], kw_defaults: [ Located { - location: Location { - row: 1, - column: 27, - }, - end_location: Some( - Location { - row: 1, - column: 29, - }, - ), + range: 27..29, custom: (), node: Constant { value: Int( @@ -173,16 +92,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 33, - }, - end_location: Some( - Location { - row: 1, - column: 35, - }, - ), + range: 33..35, custom: (), node: Constant { value: Int( @@ -194,16 +104,7 @@ Ok( ], kwarg: Some( Located { - location: Location { - row: 1, - column: 39, - }, - end_location: Some( - Location { - row: 1, - column: 45, - }, - ), + range: 39..45, custom: (), node: ArgData { arg: "kwargs", @@ -216,16 +117,7 @@ Ok( }, body: [ Located { - location: Location { - row: 1, - column: 48, - }, - end_location: Some( - Location { - row: 1, - column: 52, - }, - ), + range: 48..52, custom: (), node: Pass, }, diff --git a/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_args.snap b/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_args.snap index 251bba870a..f2423ce578 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_args.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_args.snap @@ -5,16 +5,7 @@ expression: parse_ast Ok( [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 20, - }, - ), + range: 0..20, custom: (), node: FunctionDef { name: "f", @@ -22,16 +13,7 @@ Ok( posonlyargs: [], args: [ Located { - location: Location { - row: 1, - column: 6, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 6..7, custom: (), node: ArgData { arg: "a", @@ -40,16 +22,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 9, - }, - end_location: Some( - Location { - row: 1, - column: 10, - }, - ), + range: 9..10, custom: (), node: ArgData { arg: "b", @@ -58,16 +31,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 12, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 12..13, custom: (), node: ArgData { arg: "c", @@ -84,16 +48,7 @@ Ok( }, body: [ Located { - location: Location { - row: 1, - column: 16, - }, - end_location: Some( - Location { - row: 1, - column: 20, - }, - ), + range: 16..20, custom: (), node: Pass, }, diff --git a/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_args_with_defaults.snap b/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_args_with_defaults.snap index 71b4bb8694..89767ee1fe 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_args_with_defaults.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__function__tests__function_pos_args_with_defaults.snap @@ -5,16 +5,7 @@ expression: parse_ast Ok( [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 26, - }, - ), + range: 0..26, custom: (), node: FunctionDef { name: "f", @@ -22,16 +13,7 @@ Ok( posonlyargs: [], args: [ Located { - location: Location { - row: 1, - column: 6, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 6..7, custom: (), node: ArgData { arg: "a", @@ -40,16 +22,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 9, - }, - end_location: Some( - Location { - row: 1, - column: 10, - }, - ), + range: 9..10, custom: (), node: ArgData { arg: "b", @@ -58,16 +31,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 15, - }, - end_location: Some( - Location { - row: 1, - column: 16, - }, - ), + range: 15..16, custom: (), node: ArgData { arg: "c", @@ -82,16 +46,7 @@ Ok( kwarg: None, defaults: [ Located { - location: Location { - row: 1, - column: 11, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 11..13, custom: (), node: Constant { value: Int( @@ -101,16 +56,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 17, - }, - end_location: Some( - Location { - row: 1, - column: 19, - }, - ), + range: 17..19, custom: (), node: Constant { value: Int( @@ -123,16 +69,7 @@ Ok( }, body: [ Located { - location: Location { - row: 1, - column: 22, - }, - end_location: Some( - Location { - row: 1, - column: 26, - }, - ), + range: 22..26, custom: (), node: Pass, }, diff --git a/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_kw_only_args.snap b/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_kw_only_args.snap index 59987372f8..e262447280 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_kw_only_args.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_kw_only_args.snap @@ -5,29 +5,11 @@ expression: parse_ast Ok( [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 20, - }, - ), + range: 0..20, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 20, - }, - ), + range: 0..20, custom: (), node: Lambda { args: Arguments { @@ -36,16 +18,7 @@ Ok( vararg: None, kwonlyargs: [ Located { - location: Location { - row: 1, - column: 10, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 10..11, custom: (), node: ArgData { arg: "a", @@ -54,16 +27,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 13, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 13..14, custom: (), node: ArgData { arg: "b", @@ -72,16 +36,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 16, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 16..17, custom: (), node: ArgData { arg: "c", @@ -95,16 +50,7 @@ Ok( defaults: [], }, body: Located { - location: Location { - row: 1, - column: 19, - }, - end_location: Some( - Location { - row: 1, - column: 20, - }, - ), + range: 19..20, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_kw_only_args_with_defaults.snap b/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_kw_only_args_with_defaults.snap index d48792dc11..56105997f8 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_kw_only_args_with_defaults.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_kw_only_args_with_defaults.snap @@ -5,29 +5,11 @@ expression: parse_ast Ok( [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 26, - }, - ), + range: 0..26, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 26, - }, - ), + range: 0..26, custom: (), node: Lambda { args: Arguments { @@ -36,16 +18,7 @@ Ok( vararg: None, kwonlyargs: [ Located { - location: Location { - row: 1, - column: 10, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 10..11, custom: (), node: ArgData { arg: "a", @@ -54,16 +27,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 13, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 13..14, custom: (), node: ArgData { arg: "b", @@ -72,16 +36,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 19, - }, - end_location: Some( - Location { - row: 1, - column: 20, - }, - ), + range: 19..20, custom: (), node: ArgData { arg: "c", @@ -92,16 +47,7 @@ Ok( ], kw_defaults: [ Located { - location: Location { - row: 1, - column: 15, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 15..17, custom: (), node: Constant { value: Int( @@ -111,16 +57,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 21, - }, - end_location: Some( - Location { - row: 1, - column: 23, - }, - ), + range: 21..23, custom: (), node: Constant { value: Int( @@ -134,16 +71,7 @@ Ok( defaults: [], }, body: Located { - location: Location { - row: 1, - column: 25, - }, - end_location: Some( - Location { - row: 1, - column: 26, - }, - ), + range: 25..26, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_no_args.snap b/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_no_args.snap index aab5ec4d50..75625ffd49 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_no_args.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_no_args.snap @@ -5,29 +5,11 @@ expression: parse_ast Ok( [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 9, - }, - ), + range: 0..9, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 9, - }, - ), + range: 0..9, custom: (), node: Lambda { args: Arguments { @@ -40,16 +22,7 @@ Ok( defaults: [], }, body: Located { - location: Location { - row: 1, - column: 8, - }, - end_location: Some( - Location { - row: 1, - column: 9, - }, - ), + range: 8..9, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_pos_and_kw_only_args.snap b/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_pos_and_kw_only_args.snap index 22f695b309..60800552a7 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_pos_and_kw_only_args.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_pos_and_kw_only_args.snap @@ -5,45 +5,18 @@ expression: parse_ast Ok( [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 26, - }, - ), + range: 0..26, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 26, - }, - ), + range: 0..26, custom: (), node: Lambda { args: Arguments { posonlyargs: [], args: [ Located { - location: Location { - row: 1, - column: 7, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 7..8, custom: (), node: ArgData { arg: "a", @@ -52,16 +25,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 10, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 10..11, custom: (), node: ArgData { arg: "b", @@ -70,16 +34,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 13, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 13..14, custom: (), node: ArgData { arg: "c", @@ -91,16 +46,7 @@ Ok( vararg: None, kwonlyargs: [ Located { - location: Location { - row: 1, - column: 19, - }, - end_location: Some( - Location { - row: 1, - column: 20, - }, - ), + range: 19..20, custom: (), node: ArgData { arg: "d", @@ -109,16 +55,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 22, - }, - end_location: Some( - Location { - row: 1, - column: 23, - }, - ), + range: 22..23, custom: (), node: ArgData { arg: "e", @@ -132,16 +69,7 @@ Ok( defaults: [], }, body: Located { - location: Location { - row: 1, - column: 25, - }, - end_location: Some( - Location { - row: 1, - column: 26, - }, - ), + range: 25..26, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_pos_args.snap b/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_pos_args.snap index f4ce79f978..e2345272ad 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_pos_args.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_pos_args.snap @@ -5,45 +5,18 @@ expression: parse_ast Ok( [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 0..17, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 0..17, custom: (), node: Lambda { args: Arguments { posonlyargs: [], args: [ Located { - location: Location { - row: 1, - column: 7, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 7..8, custom: (), node: ArgData { arg: "a", @@ -52,16 +25,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 10, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 10..11, custom: (), node: ArgData { arg: "b", @@ -70,16 +34,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 13, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 13..14, custom: (), node: ArgData { arg: "c", @@ -95,16 +50,7 @@ Ok( defaults: [], }, body: Located { - location: Location { - row: 1, - column: 16, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 16..17, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_pos_args_with_defaults.snap b/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_pos_args_with_defaults.snap index 01691aa7d8..c9920813d5 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_pos_args_with_defaults.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__function__tests__lambda_pos_args_with_defaults.snap @@ -5,45 +5,18 @@ expression: parse_ast Ok( [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 23, - }, - ), + range: 0..23, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 23, - }, - ), + range: 0..23, custom: (), node: Lambda { args: Arguments { posonlyargs: [], args: [ Located { - location: Location { - row: 1, - column: 7, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 7..8, custom: (), node: ArgData { arg: "a", @@ -52,16 +25,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 10, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 10..11, custom: (), node: ArgData { arg: "b", @@ -70,16 +34,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 16, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 16..17, custom: (), node: ArgData { arg: "c", @@ -94,16 +49,7 @@ Ok( kwarg: None, defaults: [ Located { - location: Location { - row: 1, - column: 12, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 12..14, custom: (), node: Constant { value: Int( @@ -113,16 +59,7 @@ Ok( }, }, Located { - location: Location { - row: 1, - column: 18, - }, - end_location: Some( - Location { - row: 1, - column: 20, - }, - ), + range: 18..20, custom: (), node: Constant { value: Int( @@ -134,16 +71,7 @@ Ok( ], }, body: Located { - location: Location { - row: 1, - column: 22, - }, - end_location: Some( - Location { - row: 1, - column: 23, - }, - ), + range: 22..23, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__dict_unpacking.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__dict_unpacking.snap index 212f737ee3..e7f1f2491f 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__dict_unpacking.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__dict_unpacking.snap @@ -3,31 +3,13 @@ source: compiler/parser/src/parser.rs expression: parse_ast --- Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 25, - }, - ), + range: 0..25, custom: (), node: Dict { keys: [ Some( Located { - location: Location { - row: 1, - column: 1, - }, - end_location: Some( - Location { - row: 1, - column: 4, - }, - ), + range: 1..4, custom: (), node: Constant { value: Str( @@ -40,16 +22,7 @@ Located { None, Some( Located { - location: Location { - row: 1, - column: 16, - }, - end_location: Some( - Location { - row: 1, - column: 19, - }, - ), + range: 16..19, custom: (), node: Constant { value: Str( @@ -62,16 +35,7 @@ Located { ], values: [ Located { - location: Location { - row: 1, - column: 6, - }, - end_location: Some( - Location { - row: 1, - column: 9, - }, - ), + range: 6..9, custom: (), node: Constant { value: Str( @@ -81,16 +45,7 @@ Located { }, }, Located { - location: Location { - row: 1, - column: 13, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 13..14, custom: (), node: Name { id: "c", @@ -98,16 +53,7 @@ Located { }, }, Located { - location: Location { - row: 1, - column: 21, - }, - end_location: Some( - Location { - row: 1, - column: 24, - }, - ), + range: 21..24, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__generator_expression_argument.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__generator_expression_argument.snap index 863ece4606..79d3c68770 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__generator_expression_argument.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__generator_expression_argument.snap @@ -3,42 +3,15 @@ source: compiler/parser/src/parser.rs expression: parse_ast --- Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 7, - column: 1, - }, - ), + range: 0..141, custom: (), node: Call { func: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 0..8, custom: (), node: Attribute { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 3, - }, - ), + range: 0..3, custom: (), node: Constant { value: Str( @@ -53,29 +26,11 @@ Located { }, args: [ Located { - location: Location { - row: 2, - column: 4, - }, - end_location: Some( - Location { - row: 6, - column: 5, - }, - ), + range: 14..139, custom: (), node: GeneratorExp { elt: Located { - location: Location { - row: 2, - column: 4, - }, - end_location: Some( - Location { - row: 2, - column: 7, - }, - ), + range: 14..17, custom: (), node: Name { id: "sql", @@ -85,16 +40,7 @@ Located { generators: [ Comprehension { target: Located { - location: Location { - row: 3, - column: 8, - }, - end_location: Some( - Location { - row: 3, - column: 11, - }, - ), + range: 26..29, custom: (), node: Name { id: "sql", @@ -102,43 +48,16 @@ Located { }, }, iter: Located { - location: Location { - row: 3, - column: 15, - }, - end_location: Some( - Location { - row: 6, - column: 5, - }, - ), + range: 33..139, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 4, - column: 8, - }, - end_location: Some( - Location { - row: 4, - column: 45, - }, - ), + range: 43..80, custom: (), node: IfExp { test: Located { - location: Location { - row: 4, - column: 30, - }, - end_location: Some( - Location { - row: 4, - column: 35, - }, - ), + range: 65..70, custom: (), node: Name { id: "limit", @@ -146,29 +65,11 @@ Located { }, }, body: Located { - location: Location { - row: 4, - column: 8, - }, - end_location: Some( - Location { - row: 4, - column: 26, - }, - ), + range: 43..61, custom: (), node: BinOp { left: Located { - location: Location { - row: 4, - column: 8, - }, - end_location: Some( - Location { - row: 4, - column: 18, - }, - ), + range: 43..53, custom: (), node: Constant { value: Str( @@ -179,16 +80,7 @@ Located { }, op: Mod, right: Located { - location: Location { - row: 4, - column: 21, - }, - end_location: Some( - Location { - row: 4, - column: 26, - }, - ), + range: 56..61, custom: (), node: Name { id: "limit", @@ -198,16 +90,7 @@ Located { }, }, orelse: Located { - location: Location { - row: 4, - column: 41, - }, - end_location: Some( - Location { - row: 4, - column: 45, - }, - ), + range: 76..80, custom: (), node: Constant { value: None, @@ -217,29 +100,11 @@ Located { }, }, Located { - location: Location { - row: 5, - column: 8, - }, - end_location: Some( - Location { - row: 5, - column: 50, - }, - ), + range: 90..132, custom: (), node: IfExp { test: Located { - location: Location { - row: 5, - column: 34, - }, - end_location: Some( - Location { - row: 5, - column: 40, - }, - ), + range: 116..122, custom: (), node: Name { id: "offset", @@ -247,29 +112,11 @@ Located { }, }, body: Located { - location: Location { - row: 5, - column: 9, - }, - end_location: Some( - Location { - row: 5, - column: 29, - }, - ), + range: 91..111, custom: (), node: BinOp { left: Located { - location: Location { - row: 5, - column: 9, - }, - end_location: Some( - Location { - row: 5, - column: 20, - }, - ), + range: 91..102, custom: (), node: Constant { value: Str( @@ -280,16 +127,7 @@ Located { }, op: Mod, right: Located { - location: Location { - row: 5, - column: 23, - }, - end_location: Some( - Location { - row: 5, - column: 29, - }, - ), + range: 105..111, custom: (), node: Name { id: "offset", @@ -299,16 +137,7 @@ Located { }, }, orelse: Located { - location: Location { - row: 5, - column: 46, - }, - end_location: Some( - Location { - row: 5, - column: 50, - }, - ), + range: 128..132, custom: (), node: Constant { value: None, diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__match.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__match.snap index 6bc9c16a73..ffea13319a 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__match.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__match.snap @@ -4,44 +4,17 @@ expression: parse_ast --- [ Located { - location: Location { - row: 2, - column: 0, - }, - end_location: Some( - Location { - row: 6, - column: 19, - }, - ), + range: 1..73, custom: (), node: Match { subject: Located { - location: Location { - row: 2, - column: 6, - }, - end_location: Some( - Location { - row: 2, - column: 17, - }, - ), + range: 7..18, custom: (), node: Dict { keys: [ Some( Located { - location: Location { - row: 2, - column: 7, - }, - end_location: Some( - Location { - row: 2, - column: 13, - }, - ), + range: 8..14, custom: (), node: Constant { value: Str( @@ -54,16 +27,7 @@ expression: parse_ast ], values: [ Located { - location: Location { - row: 2, - column: 15, - }, - end_location: Some( - Location { - row: 2, - column: 16, - }, - ), + range: 16..17, custom: (), node: Constant { value: Int( @@ -78,16 +42,7 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 3, - column: 9, - }, - end_location: Some( - Location { - row: 5, - column: 5, - }, - ), + range: 29..52, custom: (), node: MatchMapping { keys: [], @@ -100,42 +55,15 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 6, - column: 8, - }, - end_location: Some( - Location { - row: 6, - column: 19, - }, - ), + range: 62..73, custom: (), node: Expr { value: Located { - location: Location { - row: 6, - column: 8, - }, - end_location: Some( - Location { - row: 6, - column: 19, - }, - ), + range: 62..73, custom: (), node: Call { func: Located { - location: Location { - row: 6, - column: 8, - }, - end_location: Some( - Location { - row: 6, - column: 13, - }, - ), + range: 62..67, custom: (), node: Name { id: "print", @@ -144,16 +72,7 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 6, - column: 14, - }, - end_location: Some( - Location { - row: 6, - column: 18, - }, - ), + range: 68..72, custom: (), node: Name { id: "rest", @@ -172,44 +91,17 @@ expression: parse_ast }, }, Located { - location: Location { - row: 7, - column: 0, - }, - end_location: Some( - Location { - row: 11, - column: 20, - }, - ), + range: 74..177, custom: (), node: Match { subject: Located { - location: Location { - row: 7, - column: 6, - }, - end_location: Some( - Location { - row: 7, - column: 23, - }, - ), + range: 80..97, custom: (), node: Dict { keys: [ Some( Located { - location: Location { - row: 7, - column: 7, - }, - end_location: Some( - Location { - row: 7, - column: 14, - }, - ), + range: 81..88, custom: (), node: Constant { value: Str( @@ -222,16 +114,7 @@ expression: parse_ast ], values: [ Located { - location: Location { - row: 7, - column: 16, - }, - end_location: Some( - Location { - row: 7, - column: 22, - }, - ), + range: 90..96, custom: (), node: Constant { value: Str( @@ -246,30 +129,12 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 8, - column: 9, - }, - end_location: Some( - Location { - row: 10, - column: 5, - }, - ), + range: 108..155, custom: (), node: MatchMapping { keys: [ Located { - location: Location { - row: 9, - column: 8, - }, - end_location: Some( - Location { - row: 9, - column: 15, - }, - ), + range: 118..125, custom: (), node: Constant { value: Str( @@ -281,57 +146,21 @@ expression: parse_ast ], patterns: [ Located { - location: Location { - row: 9, - column: 17, - }, - end_location: Some( - Location { - row: 9, - column: 38, - }, - ), + range: 127..148, custom: (), node: MatchAs { pattern: Some( Located { - location: Location { - row: 9, - column: 17, - }, - end_location: Some( - Location { - row: 9, - column: 29, - }, - ), + range: 127..139, custom: (), node: MatchOr { patterns: [ Located { - location: Location { - row: 9, - column: 17, - }, - end_location: Some( - Location { - row: 9, - column: 22, - }, - ), + range: 127..132, custom: (), node: MatchClass { cls: Located { - location: Location { - row: 9, - column: 17, - }, - end_location: Some( - Location { - row: 9, - column: 20, - }, - ), + range: 127..130, custom: (), node: Name { id: "str", @@ -344,16 +173,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 9, - column: 25, - }, - end_location: Some( - Location { - row: 9, - column: 29, - }, - ), + range: 135..139, custom: (), node: MatchSingleton { value: None, @@ -375,42 +195,15 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 11, - column: 8, - }, - end_location: Some( - Location { - row: 11, - column: 20, - }, - ), + range: 165..177, custom: (), node: Expr { value: Located { - location: Location { - row: 11, - column: 8, - }, - end_location: Some( - Location { - row: 11, - column: 20, - }, - ), + range: 165..177, custom: (), node: Call { func: Located { - location: Location { - row: 11, - column: 8, - }, - end_location: Some( - Location { - row: 11, - column: 13, - }, - ), + range: 165..170, custom: (), node: Name { id: "print", @@ -419,16 +212,7 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 11, - column: 14, - }, - end_location: Some( - Location { - row: 11, - column: 19, - }, - ), + range: 171..176, custom: (), node: Name { id: "label", @@ -447,29 +231,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 12, - column: 0, - }, - end_location: Some( - Location { - row: 14, - column: 13, - }, - ), + range: 178..218, custom: (), node: Match { subject: Located { - location: Location { - row: 12, - column: 6, - }, - end_location: Some( - Location { - row: 12, - column: 7, - }, - ), + range: 184..185, custom: (), node: Name { id: "x", @@ -479,43 +245,16 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 13, - column: 9, - }, - end_location: Some( - Location { - row: 13, - column: 16, - }, - ), + range: 196..203, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 13, - column: 10, - }, - end_location: Some( - Location { - row: 13, - column: 11, - }, - ), + range: 197..198, custom: (), node: MatchValue { value: Located { - location: Location { - row: 13, - column: 10, - }, - end_location: Some( - Location { - row: 13, - column: 11, - }, - ), + range: 197..198, custom: (), node: Constant { value: Int( @@ -527,29 +266,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 13, - column: 13, - }, - end_location: Some( - Location { - row: 13, - column: 14, - }, - ), + range: 200..201, custom: (), node: MatchValue { value: Located { - location: Location { - row: 13, - column: 13, - }, - end_location: Some( - Location { - row: 13, - column: 14, - }, - ), + range: 200..201, custom: (), node: Constant { value: Int( @@ -566,30 +287,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 14, - column: 8, - }, - end_location: Some( - Location { - row: 14, - column: 13, - }, - ), + range: 213..218, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 14, - column: 8, - }, - end_location: Some( - Location { - row: 14, - column: 9, - }, - ), + range: 213..214, custom: (), node: Name { id: "y", @@ -598,16 +301,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 14, - column: 12, - }, - end_location: Some( - Location { - row: 14, - column: 13, - }, - ), + range: 217..218, custom: (), node: Constant { value: Int( @@ -625,29 +319,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 15, - column: 0, - }, - end_location: Some( - Location { - row: 17, - column: 13, - }, - ), + range: 219..259, custom: (), node: Match { subject: Located { - location: Location { - row: 15, - column: 6, - }, - end_location: Some( - Location { - row: 15, - column: 7, - }, - ), + range: 225..226, custom: (), node: Name { id: "x", @@ -657,43 +333,16 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 16, - column: 9, - }, - end_location: Some( - Location { - row: 16, - column: 16, - }, - ), + range: 237..244, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 16, - column: 10, - }, - end_location: Some( - Location { - row: 16, - column: 11, - }, - ), + range: 238..239, custom: (), node: MatchValue { value: Located { - location: Location { - row: 16, - column: 10, - }, - end_location: Some( - Location { - row: 16, - column: 11, - }, - ), + range: 238..239, custom: (), node: Constant { value: Int( @@ -705,29 +354,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 16, - column: 13, - }, - end_location: Some( - Location { - row: 16, - column: 14, - }, - ), + range: 241..242, custom: (), node: MatchValue { value: Located { - location: Location { - row: 16, - column: 13, - }, - end_location: Some( - Location { - row: 16, - column: 14, - }, - ), + range: 241..242, custom: (), node: Constant { value: Int( @@ -744,30 +375,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 17, - column: 8, - }, - end_location: Some( - Location { - row: 17, - column: 13, - }, - ), + range: 254..259, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 17, - column: 8, - }, - end_location: Some( - Location { - row: 17, - column: 9, - }, - ), + range: 254..255, custom: (), node: Name { id: "y", @@ -776,16 +389,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 17, - column: 12, - }, - end_location: Some( - Location { - row: 17, - column: 13, - }, - ), + range: 258..259, custom: (), node: Constant { value: Int( @@ -803,29 +407,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 18, - column: 0, - }, - end_location: Some( - Location { - row: 20, - column: 13, - }, - ), + range: 260..297, custom: (), node: Match { subject: Located { - location: Location { - row: 18, - column: 6, - }, - end_location: Some( - Location { - row: 18, - column: 7, - }, - ), + range: 266..267, custom: (), node: Name { id: "x", @@ -835,43 +421,16 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 19, - column: 9, - }, - end_location: Some( - Location { - row: 19, - column: 13, - }, - ), + range: 278..282, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 19, - column: 10, - }, - end_location: Some( - Location { - row: 19, - column: 11, - }, - ), + range: 279..280, custom: (), node: MatchValue { value: Located { - location: Location { - row: 19, - column: 10, - }, - end_location: Some( - Location { - row: 19, - column: 11, - }, - ), + range: 279..280, custom: (), node: Constant { value: Int( @@ -888,30 +447,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 20, - column: 8, - }, - end_location: Some( - Location { - row: 20, - column: 13, - }, - ), + range: 292..297, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 20, - column: 8, - }, - end_location: Some( - Location { - row: 20, - column: 9, - }, - ), + range: 292..293, custom: (), node: Name { id: "y", @@ -920,16 +461,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 20, - column: 12, - }, - end_location: Some( - Location { - row: 20, - column: 13, - }, - ), + range: 296..297, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__match_as_identifier.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__match_as_identifier.snap index 2fb15a7f14..da6ce70284 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__match_as_identifier.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__match_as_identifier.snap @@ -4,69 +4,24 @@ expression: parse_ast --- [ Located { - location: Location { - row: 2, - column: 0, - }, - end_location: Some( - Location { - row: 2, - column: 15, - }, - ), + range: 1..16, custom: (), node: Expr { value: Located { - location: Location { - row: 2, - column: 0, - }, - end_location: Some( - Location { - row: 2, - column: 15, - }, - ), + range: 1..16, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 2, - column: 0, - }, - end_location: Some( - Location { - row: 2, - column: 12, - }, - ), + range: 1..13, custom: (), node: BinOp { left: Located { - location: Location { - row: 2, - column: 0, - }, - end_location: Some( - Location { - row: 2, - column: 8, - }, - ), + range: 1..9, custom: (), node: BinOp { left: Located { - location: Location { - row: 2, - column: 0, - }, - end_location: Some( - Location { - row: 2, - column: 5, - }, - ), + range: 1..6, custom: (), node: Name { id: "match", @@ -75,16 +30,7 @@ expression: parse_ast }, op: Mult, right: Located { - location: Location { - row: 2, - column: 7, - }, - end_location: Some( - Location { - row: 2, - column: 8, - }, - ), + range: 8..9, custom: (), node: Name { id: "a", @@ -95,16 +41,7 @@ expression: parse_ast }, op: Add, right: Located { - location: Location { - row: 2, - column: 11, - }, - end_location: Some( - Location { - row: 2, - column: 12, - }, - ), + range: 12..13, custom: (), node: Name { id: "b", @@ -114,16 +51,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 2, - column: 14, - }, - end_location: Some( - Location { - row: 2, - column: 15, - }, - ), + range: 15..16, custom: (), node: Name { id: "c", @@ -137,56 +65,20 @@ expression: parse_ast }, }, Located { - location: Location { - row: 3, - column: 0, - }, - end_location: Some( - Location { - row: 3, - column: 17, - }, - ), + range: 42..59, custom: (), node: Expr { value: Located { - location: Location { - row: 3, - column: 0, - }, - end_location: Some( - Location { - row: 3, - column: 17, - }, - ), + range: 42..59, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 3, - column: 0, - }, - end_location: Some( - Location { - row: 3, - column: 14, - }, - ), + range: 42..56, custom: (), node: BinOp { left: Located { - location: Location { - row: 3, - column: 0, - }, - end_location: Some( - Location { - row: 3, - column: 5, - }, - ), + range: 42..47, custom: (), node: Name { id: "match", @@ -195,29 +87,11 @@ expression: parse_ast }, op: Mult, right: Located { - location: Location { - row: 3, - column: 8, - }, - end_location: Some( - Location { - row: 3, - column: 13, - }, - ), + range: 50..55, custom: (), node: BinOp { left: Located { - location: Location { - row: 3, - column: 8, - }, - end_location: Some( - Location { - row: 3, - column: 9, - }, - ), + range: 50..51, custom: (), node: Name { id: "a", @@ -226,16 +100,7 @@ expression: parse_ast }, op: Add, right: Located { - location: Location { - row: 3, - column: 12, - }, - end_location: Some( - Location { - row: 3, - column: 13, - }, - ), + range: 54..55, custom: (), node: Name { id: "b", @@ -247,16 +112,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 3, - column: 16, - }, - end_location: Some( - Location { - row: 3, - column: 17, - }, - ), + range: 58..59, custom: (), node: Name { id: "c", @@ -270,42 +126,15 @@ expression: parse_ast }, }, Located { - location: Location { - row: 4, - column: 0, - }, - end_location: Some( - Location { - row: 4, - column: 17, - }, - ), + range: 85..102, custom: (), node: Expr { value: Located { - location: Location { - row: 4, - column: 0, - }, - end_location: Some( - Location { - row: 4, - column: 17, - }, - ), + range: 85..102, custom: (), node: Call { func: Located { - location: Location { - row: 4, - column: 0, - }, - end_location: Some( - Location { - row: 4, - column: 5, - }, - ), + range: 85..90, custom: (), node: Name { id: "match", @@ -314,42 +143,15 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 4, - column: 7, - }, - end_location: Some( - Location { - row: 4, - column: 13, - }, - ), + range: 92..98, custom: (), node: Starred { value: Located { - location: Location { - row: 4, - column: 8, - }, - end_location: Some( - Location { - row: 4, - column: 13, - }, - ), + range: 93..98, custom: (), node: BinOp { left: Located { - location: Location { - row: 4, - column: 8, - }, - end_location: Some( - Location { - row: 4, - column: 9, - }, - ), + range: 93..94, custom: (), node: Name { id: "a", @@ -358,16 +160,7 @@ expression: parse_ast }, op: Add, right: Located { - location: Location { - row: 4, - column: 12, - }, - end_location: Some( - Location { - row: 4, - column: 13, - }, - ), + range: 97..98, custom: (), node: Name { id: "b", @@ -380,16 +173,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 4, - column: 15, - }, - end_location: Some( - Location { - row: 4, - column: 16, - }, - ), + range: 100..101, custom: (), node: Name { id: "c", @@ -403,55 +187,19 @@ expression: parse_ast }, }, Located { - location: Location { - row: 5, - column: 0, - }, - end_location: Some( - Location { - row: 5, - column: 16, - }, - ), + range: 129..145, custom: (), node: Expr { value: Located { - location: Location { - row: 5, - column: 0, - }, - end_location: Some( - Location { - row: 5, - column: 16, - }, - ), + range: 129..145, custom: (), node: BinOp { left: Located { - location: Location { - row: 5, - column: 0, - }, - end_location: Some( - Location { - row: 5, - column: 12, - }, - ), + range: 129..141, custom: (), node: BinOp { left: Located { - location: Location { - row: 5, - column: 0, - }, - end_location: Some( - Location { - row: 5, - column: 5, - }, - ), + range: 129..134, custom: (), node: Name { id: "match", @@ -460,29 +208,11 @@ expression: parse_ast }, op: Sub, right: Located { - location: Location { - row: 5, - column: 7, - }, - end_location: Some( - Location { - row: 5, - column: 12, - }, - ), + range: 136..141, custom: (), node: BinOp { left: Located { - location: Location { - row: 5, - column: 7, - }, - end_location: Some( - Location { - row: 5, - column: 8, - }, - ), + range: 136..137, custom: (), node: Name { id: "a", @@ -491,16 +221,7 @@ expression: parse_ast }, op: Mult, right: Located { - location: Location { - row: 5, - column: 11, - }, - end_location: Some( - Location { - row: 5, - column: 12, - }, - ), + range: 140..141, custom: (), node: Name { id: "b", @@ -513,16 +234,7 @@ expression: parse_ast }, op: Add, right: Located { - location: Location { - row: 5, - column: 15, - }, - end_location: Some( - Location { - row: 5, - column: 16, - }, - ), + range: 144..145, custom: (), node: Name { id: "c", @@ -534,55 +246,19 @@ expression: parse_ast }, }, Located { - location: Location { - row: 6, - column: 0, - }, - end_location: Some( - Location { - row: 6, - column: 18, - }, - ), + range: 172..190, custom: (), node: Expr { value: Located { - location: Location { - row: 6, - column: 0, - }, - end_location: Some( - Location { - row: 6, - column: 18, - }, - ), + range: 172..190, custom: (), node: BinOp { left: Located { - location: Location { - row: 6, - column: 0, - }, - end_location: Some( - Location { - row: 6, - column: 14, - }, - ), + range: 172..186, custom: (), node: BinOp { left: Located { - location: Location { - row: 6, - column: 0, - }, - end_location: Some( - Location { - row: 6, - column: 5, - }, - ), + range: 172..177, custom: (), node: Name { id: "match", @@ -591,29 +267,11 @@ expression: parse_ast }, op: Sub, right: Located { - location: Location { - row: 6, - column: 8, - }, - end_location: Some( - Location { - row: 6, - column: 13, - }, - ), + range: 180..185, custom: (), node: BinOp { left: Located { - location: Location { - row: 6, - column: 8, - }, - end_location: Some( - Location { - row: 6, - column: 9, - }, - ), + range: 180..181, custom: (), node: Name { id: "a", @@ -622,16 +280,7 @@ expression: parse_ast }, op: Mult, right: Located { - location: Location { - row: 6, - column: 12, - }, - end_location: Some( - Location { - row: 6, - column: 13, - }, - ), + range: 184..185, custom: (), node: Name { id: "b", @@ -644,16 +293,7 @@ expression: parse_ast }, op: Add, right: Located { - location: Location { - row: 6, - column: 17, - }, - end_location: Some( - Location { - row: 6, - column: 18, - }, - ), + range: 189..190, custom: (), node: Name { id: "c", @@ -665,68 +305,23 @@ expression: parse_ast }, }, Located { - location: Location { - row: 7, - column: 0, - }, - end_location: Some( - Location { - row: 7, - column: 18, - }, - ), + range: 217..235, custom: (), node: Expr { value: Located { - location: Location { - row: 7, - column: 0, - }, - end_location: Some( - Location { - row: 7, - column: 18, - }, - ), + range: 217..235, custom: (), node: BinOp { left: Located { - location: Location { - row: 7, - column: 0, - }, - end_location: Some( - Location { - row: 7, - column: 14, - }, - ), + range: 217..231, custom: (), node: BinOp { left: Located { - location: Location { - row: 7, - column: 0, - }, - end_location: Some( - Location { - row: 7, - column: 10, - }, - ), + range: 217..227, custom: (), node: Call { func: Located { - location: Location { - row: 7, - column: 0, - }, - end_location: Some( - Location { - row: 7, - column: 5, - }, - ), + range: 217..222, custom: (), node: Name { id: "match", @@ -735,30 +330,12 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 7, - column: 7, - }, - end_location: Some( - Location { - row: 7, - column: 9, - }, - ), + range: 224..226, custom: (), node: UnaryOp { op: USub, operand: Located { - location: Location { - row: 7, - column: 8, - }, - end_location: Some( - Location { - row: 7, - column: 9, - }, - ), + range: 225..226, custom: (), node: Name { id: "a", @@ -773,16 +350,7 @@ expression: parse_ast }, op: Mult, right: Located { - location: Location { - row: 7, - column: 13, - }, - end_location: Some( - Location { - row: 7, - column: 14, - }, - ), + range: 230..231, custom: (), node: Name { id: "b", @@ -793,16 +361,7 @@ expression: parse_ast }, op: Add, right: Located { - location: Location { - row: 7, - column: 17, - }, - end_location: Some( - Location { - row: 7, - column: 18, - }, - ), + range: 234..235, custom: (), node: Name { id: "c", @@ -814,55 +373,19 @@ expression: parse_ast }, }, Located { - location: Location { - row: 8, - column: 0, - }, - end_location: Some( - Location { - row: 8, - column: 10, - }, - ), + range: 263..273, custom: (), node: Expr { value: Located { - location: Location { - row: 8, - column: 0, - }, - end_location: Some( - Location { - row: 8, - column: 10, - }, - ), + range: 263..273, custom: (), node: Attribute { value: Located { - location: Location { - row: 8, - column: 0, - }, - end_location: Some( - Location { - row: 8, - column: 8, - }, - ), + range: 263..271, custom: (), node: Call { func: Located { - location: Location { - row: 8, - column: 0, - }, - end_location: Some( - Location { - row: 8, - column: 5, - }, - ), + range: 263..268, custom: (), node: Name { id: "match", @@ -880,55 +403,19 @@ expression: parse_ast }, }, Located { - location: Location { - row: 9, - column: 0, - }, - end_location: Some( - Location { - row: 9, - column: 12, - }, - ), + range: 290..302, custom: (), node: Expr { value: Located { - location: Location { - row: 9, - column: 0, - }, - end_location: Some( - Location { - row: 9, - column: 12, - }, - ), + range: 290..302, custom: (), node: Attribute { value: Located { - location: Location { - row: 9, - column: 0, - }, - end_location: Some( - Location { - row: 9, - column: 10, - }, - ), + range: 290..300, custom: (), node: Call { func: Located { - location: Location { - row: 9, - column: 0, - }, - end_location: Some( - Location { - row: 9, - column: 5, - }, - ), + range: 290..295, custom: (), node: Name { id: "match", @@ -937,16 +424,7 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 9, - column: 7, - }, - end_location: Some( - Location { - row: 9, - column: 9, - }, - ), + range: 297..299, custom: (), node: Tuple { elts: [], @@ -964,55 +442,19 @@ expression: parse_ast }, }, Located { - location: Location { - row: 10, - column: 0, - }, - end_location: Some( - Location { - row: 10, - column: 13, - }, - ), + range: 321..334, custom: (), node: Expr { value: Located { - location: Location { - row: 10, - column: 0, - }, - end_location: Some( - Location { - row: 10, - column: 13, - }, - ), + range: 321..334, custom: (), node: Attribute { value: Located { - location: Location { - row: 10, - column: 0, - }, - end_location: Some( - Location { - row: 10, - column: 11, - }, - ), + range: 321..332, custom: (), node: Call { func: Located { - location: Location { - row: 10, - column: 0, - }, - end_location: Some( - Location { - row: 10, - column: 5, - }, - ), + range: 321..326, custom: (), node: Name { id: "match", @@ -1021,16 +463,7 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 10, - column: 7, - }, - end_location: Some( - Location { - row: 10, - column: 9, - }, - ), + range: 328..330, custom: (), node: Tuple { elts: [], @@ -1048,55 +481,19 @@ expression: parse_ast }, }, Located { - location: Location { - row: 11, - column: 0, - }, - end_location: Some( - Location { - row: 11, - column: 11, - }, - ), + range: 353..364, custom: (), node: Expr { value: Located { - location: Location { - row: 11, - column: 0, - }, - end_location: Some( - Location { - row: 11, - column: 11, - }, - ), + range: 353..364, custom: (), node: Attribute { value: Located { - location: Location { - row: 11, - column: 0, - }, - end_location: Some( - Location { - row: 11, - column: 9, - }, - ), + range: 353..362, custom: (), node: Subscript { value: Located { - location: Location { - row: 11, - column: 0, - }, - end_location: Some( - Location { - row: 11, - column: 5, - }, - ), + range: 353..358, custom: (), node: Name { id: "match", @@ -1104,16 +501,7 @@ expression: parse_ast }, }, slice: Located { - location: Location { - row: 11, - column: 7, - }, - end_location: Some( - Location { - row: 11, - column: 8, - }, - ), + range: 360..361, custom: (), node: Name { id: "a", @@ -1130,55 +518,19 @@ expression: parse_ast }, }, Located { - location: Location { - row: 12, - column: 0, - }, - end_location: Some( - Location { - row: 12, - column: 12, - }, - ), + range: 382..394, custom: (), node: Expr { value: Located { - location: Location { - row: 12, - column: 0, - }, - end_location: Some( - Location { - row: 12, - column: 12, - }, - ), + range: 382..394, custom: (), node: Attribute { value: Located { - location: Location { - row: 12, - column: 0, - }, - end_location: Some( - Location { - row: 12, - column: 10, - }, - ), + range: 382..392, custom: (), node: Subscript { value: Located { - location: Location { - row: 12, - column: 0, - }, - end_location: Some( - Location { - row: 12, - column: 5, - }, - ), + range: 382..387, custom: (), node: Name { id: "match", @@ -1186,30 +538,12 @@ expression: parse_ast }, }, slice: Located { - location: Location { - row: 12, - column: 7, - }, - end_location: Some( - Location { - row: 12, - column: 9, - }, - ), + range: 389..391, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 12, - column: 7, - }, - end_location: Some( - Location { - row: 12, - column: 8, - }, - ), + range: 389..390, custom: (), node: Name { id: "a", @@ -1230,55 +564,19 @@ expression: parse_ast }, }, Located { - location: Location { - row: 13, - column: 0, - }, - end_location: Some( - Location { - row: 13, - column: 14, - }, - ), + range: 435..449, custom: (), node: Expr { value: Located { - location: Location { - row: 13, - column: 0, - }, - end_location: Some( - Location { - row: 13, - column: 14, - }, - ), + range: 435..449, custom: (), node: Attribute { value: Located { - location: Location { - row: 13, - column: 0, - }, - end_location: Some( - Location { - row: 13, - column: 12, - }, - ), + range: 435..447, custom: (), node: Subscript { value: Located { - location: Location { - row: 13, - column: 0, - }, - end_location: Some( - Location { - row: 13, - column: 5, - }, - ), + range: 435..440, custom: (), node: Name { id: "match", @@ -1286,30 +584,12 @@ expression: parse_ast }, }, slice: Located { - location: Location { - row: 13, - column: 7, - }, - end_location: Some( - Location { - row: 13, - column: 11, - }, - ), + range: 442..446, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 13, - column: 8, - }, - end_location: Some( - Location { - row: 13, - column: 9, - }, - ), + range: 443..444, custom: (), node: Name { id: "a", @@ -1330,55 +610,19 @@ expression: parse_ast }, }, Located { - location: Location { - row: 14, - column: 0, - }, - end_location: Some( - Location { - row: 15, - column: 6, - }, - ), + range: 470..487, custom: (), node: Expr { value: Located { - location: Location { - row: 14, - column: 0, - }, - end_location: Some( - Location { - row: 15, - column: 6, - }, - ), + range: 470..487, custom: (), node: Subscript { value: Located { - location: Location { - row: 14, - column: 0, - }, - end_location: Some( - Location { - row: 14, - column: 7, - }, - ), + range: 470..477, custom: (), node: Call { func: Located { - location: Location { - row: 14, - column: 0, - }, - end_location: Some( - Location { - row: 14, - column: 5, - }, - ), + range: 470..475, custom: (), node: Name { id: "match", @@ -1390,30 +634,12 @@ expression: parse_ast }, }, slice: Located { - location: Location { - row: 14, - column: 8, - }, - end_location: Some( - Location { - row: 15, - column: 5, - }, - ), + range: 478..486, custom: (), node: Slice { lower: Some( Located { - location: Location { - row: 14, - column: 8, - }, - end_location: Some( - Location { - row: 14, - column: 9, - }, - ), + range: 478..479, custom: (), node: Name { id: "a", @@ -1423,16 +649,7 @@ expression: parse_ast ), upper: Some( Located { - location: Location { - row: 15, - column: 4, - }, - end_location: Some( - Location { - row: 15, - column: 5, - }, - ), + range: 485..486, custom: (), node: Name { id: "b", @@ -1449,42 +666,15 @@ expression: parse_ast }, }, Located { - location: Location { - row: 16, - column: 0, - }, - end_location: Some( - Location { - row: 16, - column: 19, - }, - ), + range: 507..526, custom: (), node: If { test: Located { - location: Location { - row: 16, - column: 3, - }, - end_location: Some( - Location { - row: 16, - column: 13, - }, - ), + range: 510..520, custom: (), node: NamedExpr { target: Located { - location: Location { - row: 16, - column: 3, - }, - end_location: Some( - Location { - row: 16, - column: 8, - }, - ), + range: 510..515, custom: (), node: Name { id: "match", @@ -1492,16 +682,7 @@ expression: parse_ast }, }, value: Located { - location: Location { - row: 16, - column: 12, - }, - end_location: Some( - Location { - row: 16, - column: 13, - }, - ), + range: 519..520, custom: (), node: Constant { value: Int( @@ -1514,16 +695,7 @@ expression: parse_ast }, body: [ Located { - location: Location { - row: 16, - column: 15, - }, - end_location: Some( - Location { - row: 16, - column: 19, - }, - ), + range: 522..526, custom: (), node: Pass, }, @@ -1532,29 +704,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 17, - column: 0, - }, - end_location: Some( - Location { - row: 20, - column: 12, - }, - ), + range: 527..581, custom: (), node: Match { subject: Located { - location: Location { - row: 17, - column: 6, - }, - end_location: Some( - Location { - row: 17, - column: 11, - }, - ), + range: 533..538, custom: (), node: Name { id: "match", @@ -1564,29 +718,11 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 18, - column: 9, - }, - end_location: Some( - Location { - row: 18, - column: 10, - }, - ), + range: 549..550, custom: (), node: MatchValue { value: Located { - location: Location { - row: 18, - column: 9, - }, - end_location: Some( - Location { - row: 18, - column: 10, - }, - ), + range: 549..550, custom: (), node: Constant { value: Int( @@ -1600,16 +736,7 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 18, - column: 12, - }, - end_location: Some( - Location { - row: 18, - column: 16, - }, - ), + range: 552..556, custom: (), node: Pass, }, @@ -1617,29 +744,11 @@ expression: parse_ast }, MatchCase { pattern: Located { - location: Location { - row: 19, - column: 9, - }, - end_location: Some( - Location { - row: 19, - column: 10, - }, - ), + range: 566..567, custom: (), node: MatchValue { value: Located { - location: Location { - row: 19, - column: 9, - }, - end_location: Some( - Location { - row: 19, - column: 10, - }, - ), + range: 566..567, custom: (), node: Constant { value: Int( @@ -1653,16 +762,7 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 20, - column: 8, - }, - end_location: Some( - Location { - row: 20, - column: 12, - }, - ), + range: 577..581, custom: (), node: Pass, }, @@ -1672,30 +772,12 @@ expression: parse_ast }, }, Located { - location: Location { - row: 21, - column: 0, - }, - end_location: Some( - Location { - row: 21, - column: 36, - }, - ), + range: 582..618, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 21, - column: 0, - }, - end_location: Some( - Location { - row: 21, - column: 5, - }, - ), + range: 582..587, custom: (), node: Name { id: "match", @@ -1704,32 +786,14 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 21, - column: 8, - }, - end_location: Some( - Location { - row: 21, - column: 36, - }, - ), + range: 590..618, custom: (), node: Lambda { args: Arguments { posonlyargs: [], args: [ Located { - location: Location { - row: 21, - column: 15, - }, - end_location: Some( - Location { - row: 21, - column: 20, - }, - ), + range: 597..602, custom: (), node: ArgData { arg: "query", @@ -1745,29 +809,11 @@ expression: parse_ast defaults: [], }, body: Located { - location: Location { - row: 21, - column: 22, - }, - end_location: Some( - Location { - row: 21, - column: 36, - }, - ), + range: 604..618, custom: (), node: Compare { left: Located { - location: Location { - row: 21, - column: 22, - }, - end_location: Some( - Location { - row: 21, - column: 27, - }, - ), + range: 604..609, custom: (), node: Name { id: "query", @@ -1779,16 +825,7 @@ expression: parse_ast ], comparators: [ Located { - location: Location { - row: 21, - column: 31, - }, - end_location: Some( - Location { - row: 21, - column: 36, - }, - ), + range: 613..618, custom: (), node: Name { id: "event", @@ -1804,42 +841,15 @@ expression: parse_ast }, }, Located { - location: Location { - row: 22, - column: 0, - }, - end_location: Some( - Location { - row: 22, - column: 16, - }, - ), + range: 619..635, custom: (), node: Expr { value: Located { - location: Location { - row: 22, - column: 0, - }, - end_location: Some( - Location { - row: 22, - column: 16, - }, - ), + range: 619..635, custom: (), node: Call { func: Located { - location: Location { - row: 22, - column: 0, - }, - end_location: Some( - Location { - row: 22, - column: 5, - }, - ), + range: 619..624, custom: (), node: Name { id: "print", @@ -1848,29 +858,11 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 22, - column: 6, - }, - end_location: Some( - Location { - row: 22, - column: 15, - }, - ), + range: 625..634, custom: (), node: Call { func: Located { - location: Location { - row: 22, - column: 6, - }, - end_location: Some( - Location { - row: 22, - column: 11, - }, - ), + range: 625..630, custom: (), node: Name { id: "match", @@ -1879,16 +871,7 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 22, - column: 12, - }, - end_location: Some( - Location { - row: 22, - column: 14, - }, - ), + range: 631..633, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_bool_op_and.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_bool_op_and.snap index f0e856205c..89de4fea41 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_bool_op_and.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_bool_op_and.snap @@ -3,31 +3,13 @@ source: compiler/parser/src/parser.rs expression: parse_ast --- Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 0..7, custom: (), node: BoolOp { op: And, values: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 1, - }, - ), + range: 0..1, custom: (), node: Name { id: "x", @@ -35,16 +17,7 @@ Located { }, }, Located { - location: Location { - row: 1, - column: 6, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 6..7, custom: (), node: Name { id: "y", diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_bool_op_or.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_bool_op_or.snap index 5d5abad36d..7639b10c65 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_bool_op_or.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_bool_op_or.snap @@ -3,31 +3,13 @@ source: compiler/parser/src/parser.rs expression: parse_ast --- Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 6, - }, - ), + range: 0..6, custom: (), node: BoolOp { op: Or, values: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 1, - }, - ), + range: 0..1, custom: (), node: Name { id: "x", @@ -35,16 +17,7 @@ Located { }, }, Located { - location: Location { - row: 1, - column: 5, - }, - end_location: Some( - Location { - row: 1, - column: 6, - }, - ), + range: 5..6, custom: (), node: Name { id: "y", diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_class.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_class.snap index 22b15410b7..dce9330033 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_class.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_class.snap @@ -4,31 +4,13 @@ expression: "parse_program(source, \"\").unwrap()" --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 5, - column: 6, - }, - ), + range: 0..98, custom: (), node: ClassDef { name: "Foo", bases: [ Located { - location: Location { - row: 1, - column: 10, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 10..11, custom: (), node: Name { id: "A", @@ -36,16 +18,7 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 1, - column: 13, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 13..14, custom: (), node: Name { id: "B", @@ -56,16 +29,7 @@ expression: "parse_program(source, \"\").unwrap()" keywords: [], body: [ Located { - location: Location { - row: 2, - column: 1, - }, - end_location: Some( - Location { - row: 3, - column: 6, - }, - ), + range: 18..44, custom: (), node: FunctionDef { name: "__init__", @@ -73,16 +37,7 @@ expression: "parse_program(source, \"\").unwrap()" posonlyargs: [], args: [ Located { - location: Location { - row: 2, - column: 14, - }, - end_location: Some( - Location { - row: 2, - column: 18, - }, - ), + range: 31..35, custom: (), node: ArgData { arg: "self", @@ -99,16 +54,7 @@ expression: "parse_program(source, \"\").unwrap()" }, body: [ Located { - location: Location { - row: 3, - column: 2, - }, - end_location: Some( - Location { - row: 3, - column: 6, - }, - ), + range: 40..44, custom: (), node: Pass, }, @@ -119,16 +65,7 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 4, - column: 1, - }, - end_location: Some( - Location { - row: 5, - column: 6, - }, - ), + range: 46..98, custom: (), node: FunctionDef { name: "method_with_default", @@ -136,16 +73,7 @@ expression: "parse_program(source, \"\").unwrap()" posonlyargs: [], args: [ Located { - location: Location { - row: 4, - column: 25, - }, - end_location: Some( - Location { - row: 4, - column: 29, - }, - ), + range: 70..74, custom: (), node: ArgData { arg: "self", @@ -154,16 +82,7 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 4, - column: 31, - }, - end_location: Some( - Location { - row: 4, - column: 34, - }, - ), + range: 76..79, custom: (), node: ArgData { arg: "arg", @@ -178,16 +97,7 @@ expression: "parse_program(source, \"\").unwrap()" kwarg: None, defaults: [ Located { - location: Location { - row: 4, - column: 35, - }, - end_location: Some( - Location { - row: 4, - column: 44, - }, - ), + range: 80..89, custom: (), node: Constant { value: Str( @@ -200,16 +110,7 @@ expression: "parse_program(source, \"\").unwrap()" }, body: [ Located { - location: Location { - row: 5, - column: 2, - }, - end_location: Some( - Location { - row: 5, - column: 6, - }, - ), + range: 94..98, custom: (), node: Pass, }, diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_dict_comprehension.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_dict_comprehension.snap index 2c0bc513ba..2627b0611f 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_dict_comprehension.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_dict_comprehension.snap @@ -3,29 +3,11 @@ source: compiler/parser/src/parser.rs expression: parse_ast --- Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 19, - }, - ), + range: 0..19, custom: (), node: DictComp { key: Located { - location: Location { - row: 1, - column: 1, - }, - end_location: Some( - Location { - row: 1, - column: 3, - }, - ), + range: 1..3, custom: (), node: Name { id: "x1", @@ -33,16 +15,7 @@ Located { }, }, value: Located { - location: Location { - row: 1, - column: 5, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 5..7, custom: (), node: Name { id: "x2", @@ -52,16 +25,7 @@ Located { generators: [ Comprehension { target: Located { - location: Location { - row: 1, - column: 12, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 12..13, custom: (), node: Name { id: "y", @@ -69,16 +33,7 @@ Located { }, }, iter: Located { - location: Location { - row: 1, - column: 17, - }, - end_location: Some( - Location { - row: 1, - column: 18, - }, - ), + range: 17..18, custom: (), node: Name { id: "z", diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_double_list_comprehension.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_double_list_comprehension.snap index f8346b5c34..7a04aa6a19 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_double_list_comprehension.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_double_list_comprehension.snap @@ -3,29 +3,11 @@ source: compiler/parser/src/parser.rs expression: parse_ast --- Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 48, - }, - ), + range: 0..48, custom: (), node: ListComp { elt: Located { - location: Location { - row: 1, - column: 1, - }, - end_location: Some( - Location { - row: 1, - column: 2, - }, - ), + range: 1..2, custom: (), node: Name { id: "x", @@ -35,30 +17,12 @@ Located { generators: [ Comprehension { target: Located { - location: Location { - row: 1, - column: 7, - }, - end_location: Some( - Location { - row: 1, - column: 12, - }, - ), + range: 7..12, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 1, - column: 7, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 7..8, custom: (), node: Name { id: "y", @@ -66,16 +30,7 @@ Located { }, }, Located { - location: Location { - row: 1, - column: 10, - }, - end_location: Some( - Location { - row: 1, - column: 12, - }, - ), + range: 10..12, custom: (), node: Name { id: "y2", @@ -87,16 +42,7 @@ Located { }, }, iter: Located { - location: Location { - row: 1, - column: 16, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 16..17, custom: (), node: Name { id: "z", @@ -108,16 +54,7 @@ Located { }, Comprehension { target: Located { - location: Location { - row: 1, - column: 22, - }, - end_location: Some( - Location { - row: 1, - column: 23, - }, - ), + range: 22..23, custom: (), node: Name { id: "a", @@ -125,16 +62,7 @@ Located { }, }, iter: Located { - location: Location { - row: 1, - column: 27, - }, - end_location: Some( - Location { - row: 1, - column: 28, - }, - ), + range: 27..28, custom: (), node: Name { id: "b", @@ -143,29 +71,11 @@ Located { }, ifs: [ Located { - location: Location { - row: 1, - column: 32, - }, - end_location: Some( - Location { - row: 1, - column: 37, - }, - ), + range: 32..37, custom: (), node: Compare { left: Located { - location: Location { - row: 1, - column: 32, - }, - end_location: Some( - Location { - row: 1, - column: 33, - }, - ), + range: 32..33, custom: (), node: Name { id: "a", @@ -177,16 +87,7 @@ Located { ], comparators: [ Located { - location: Location { - row: 1, - column: 36, - }, - end_location: Some( - Location { - row: 1, - column: 37, - }, - ), + range: 36..37, custom: (), node: Constant { value: Int( @@ -199,29 +100,11 @@ Located { }, }, Located { - location: Location { - row: 1, - column: 41, - }, - end_location: Some( - Location { - row: 1, - column: 47, - }, - ), + range: 41..47, custom: (), node: Compare { left: Located { - location: Location { - row: 1, - column: 41, - }, - end_location: Some( - Location { - row: 1, - column: 42, - }, - ), + range: 41..42, custom: (), node: Name { id: "a", @@ -233,16 +116,7 @@ Located { ], comparators: [ Located { - location: Location { - row: 1, - column: 45, - }, - end_location: Some( - Location { - row: 1, - column: 47, - }, - ), + range: 45..47, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_f_string.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_f_string.snap index 14009d328c..ce2701450d 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_f_string.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_f_string.snap @@ -4,43 +4,16 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 0..14, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 0..14, custom: (), node: JoinedStr { values: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 0..14, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_generator_comprehension.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_generator_comprehension.snap index 89e05b2838..103d6bbf85 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_generator_comprehension.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_generator_comprehension.snap @@ -3,29 +3,11 @@ source: compiler/parser/src/parser.rs expression: parse_ast --- Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 0..14, custom: (), node: GeneratorExp { elt: Located { - location: Location { - row: 1, - column: 1, - }, - end_location: Some( - Location { - row: 1, - column: 2, - }, - ), + range: 1..2, custom: (), node: Name { id: "x", @@ -35,16 +17,7 @@ Located { generators: [ Comprehension { target: Located { - location: Location { - row: 1, - column: 7, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 7..8, custom: (), node: Name { id: "y", @@ -52,16 +25,7 @@ Located { }, }, iter: Located { - location: Location { - row: 1, - column: 12, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 12..13, custom: (), node: Name { id: "z", diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_if_elif_else.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_if_elif_else.snap index 26bd492b93..b18173c2cb 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_if_elif_else.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_if_elif_else.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 3, - column: 8, - }, - ), + range: 0..28, custom: (), node: If { test: Located { - location: Location { - row: 1, - column: 3, - }, - end_location: Some( - Location { - row: 1, - column: 4, - }, - ), + range: 3..4, custom: (), node: Constant { value: Int( @@ -37,29 +19,11 @@ expression: parse_ast }, body: [ Located { - location: Location { - row: 1, - column: 6, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 6..8, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 6, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 6..8, custom: (), node: Constant { value: Int( @@ -73,29 +37,11 @@ expression: parse_ast ], orelse: [ Located { - location: Location { - row: 2, - column: 0, - }, - end_location: Some( - Location { - row: 3, - column: 8, - }, - ), + range: 9..28, custom: (), node: If { test: Located { - location: Location { - row: 2, - column: 5, - }, - end_location: Some( - Location { - row: 2, - column: 6, - }, - ), + range: 14..15, custom: (), node: Constant { value: Int( @@ -106,29 +52,11 @@ expression: parse_ast }, body: [ Located { - location: Location { - row: 2, - column: 8, - }, - end_location: Some( - Location { - row: 2, - column: 10, - }, - ), + range: 17..19, custom: (), node: Expr { value: Located { - location: Location { - row: 2, - column: 8, - }, - end_location: Some( - Location { - row: 2, - column: 10, - }, - ), + range: 17..19, custom: (), node: Constant { value: Int( @@ -142,29 +70,11 @@ expression: parse_ast ], orelse: [ Located { - location: Location { - row: 3, - column: 6, - }, - end_location: Some( - Location { - row: 3, - column: 8, - }, - ), + range: 26..28, custom: (), node: Expr { value: Located { - location: Location { - row: 3, - column: 6, - }, - end_location: Some( - Location { - row: 3, - column: 8, - }, - ), + range: 26..28, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_if_else_generator_comprehension.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_if_else_generator_comprehension.snap index 92b85877de..4e40173a8e 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_if_else_generator_comprehension.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_if_else_generator_comprehension.snap @@ -3,42 +3,15 @@ source: compiler/parser/src/parser.rs expression: parse_ast --- Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 26, - }, - ), + range: 0..26, custom: (), node: GeneratorExp { elt: Located { - location: Location { - row: 1, - column: 1, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 1..14, custom: (), node: IfExp { test: Located { - location: Location { - row: 1, - column: 6, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 6..7, custom: (), node: Name { id: "y", @@ -46,16 +19,7 @@ Located { }, }, body: Located { - location: Location { - row: 1, - column: 1, - }, - end_location: Some( - Location { - row: 1, - column: 2, - }, - ), + range: 1..2, custom: (), node: Name { id: "x", @@ -63,16 +27,7 @@ Located { }, }, orelse: Located { - location: Location { - row: 1, - column: 13, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 13..14, custom: (), node: Name { id: "y", @@ -84,16 +39,7 @@ Located { generators: [ Comprehension { target: Located { - location: Location { - row: 1, - column: 19, - }, - end_location: Some( - Location { - row: 1, - column: 20, - }, - ), + range: 19..20, custom: (), node: Name { id: "y", @@ -101,16 +47,7 @@ Located { }, }, iter: Located { - location: Location { - row: 1, - column: 24, - }, - end_location: Some( - Location { - row: 1, - column: 25, - }, - ), + range: 24..25, custom: (), node: Name { id: "z", diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_kwargs.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_kwargs.snap index dfe9859731..c53cd20163 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_kwargs.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_kwargs.snap @@ -4,42 +4,15 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 32, - }, - ), + range: 0..32, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 32, - }, - ), + range: 0..32, custom: (), node: Call { func: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 0..7, custom: (), node: Name { id: "my_func", @@ -48,16 +21,7 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 1, - column: 8, - }, - end_location: Some( - Location { - row: 1, - column: 20, - }, - ), + range: 8..20, custom: (), node: Constant { value: Str( @@ -69,32 +33,14 @@ expression: parse_ast ], keywords: [ Located { - location: Location { - row: 1, - column: 22, - }, - end_location: Some( - Location { - row: 1, - column: 31, - }, - ), + range: 22..31, custom: (), node: KeywordData { arg: Some( "keyword", ), value: Located { - location: Location { - row: 1, - column: 30, - }, - end_location: Some( - Location { - row: 1, - column: 31, - }, - ), + range: 30..31, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_lambda.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_lambda.snap index df154a3731..4f1d4a2eb0 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_lambda.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_lambda.snap @@ -4,45 +4,18 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 18, - }, - ), + range: 0..18, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 18, - }, - ), + range: 0..18, custom: (), node: Lambda { args: Arguments { posonlyargs: [], args: [ Located { - location: Location { - row: 1, - column: 7, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 7..8, custom: (), node: ArgData { arg: "x", @@ -51,16 +24,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 10, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 10..11, custom: (), node: ArgData { arg: "y", @@ -76,29 +40,11 @@ expression: parse_ast defaults: [], }, body: Located { - location: Location { - row: 1, - column: 13, - }, - end_location: Some( - Location { - row: 1, - column: 18, - }, - ), + range: 13..18, custom: (), node: BinOp { left: Located { - location: Location { - row: 1, - column: 13, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 13..14, custom: (), node: Name { id: "x", @@ -107,16 +53,7 @@ expression: parse_ast }, op: Mult, right: Located { - location: Location { - row: 1, - column: 17, - }, - end_location: Some( - Location { - row: 1, - column: 18, - }, - ), + range: 17..18, custom: (), node: Name { id: "y", diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_list_comprehension.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_list_comprehension.snap index 9af8e55ea3..01b76be8a4 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_list_comprehension.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_list_comprehension.snap @@ -3,29 +3,11 @@ source: compiler/parser/src/parser.rs expression: parse_ast --- Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 0..14, custom: (), node: ListComp { elt: Located { - location: Location { - row: 1, - column: 1, - }, - end_location: Some( - Location { - row: 1, - column: 2, - }, - ), + range: 1..2, custom: (), node: Name { id: "x", @@ -35,16 +17,7 @@ Located { generators: [ Comprehension { target: Located { - location: Location { - row: 1, - column: 7, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 7..8, custom: (), node: Name { id: "y", @@ -52,16 +25,7 @@ Located { }, }, iter: Located { - location: Location { - row: 1, - column: 12, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 12..13, custom: (), node: Name { id: "z", diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_named_expression_generator_comprehension.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_named_expression_generator_comprehension.snap index 639bf21f98..9719788943 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_named_expression_generator_comprehension.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_named_expression_generator_comprehension.snap @@ -3,42 +3,15 @@ source: compiler/parser/src/parser.rs expression: parse_ast --- Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 23, - }, - ), + range: 0..23, custom: (), node: GeneratorExp { elt: Located { - location: Location { - row: 1, - column: 1, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 1..11, custom: (), node: NamedExpr { target: Located { - location: Location { - row: 1, - column: 1, - }, - end_location: Some( - Location { - row: 1, - column: 2, - }, - ), + range: 1..2, custom: (), node: Name { id: "x", @@ -46,29 +19,11 @@ Located { }, }, value: Located { - location: Location { - row: 1, - column: 6, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 6..11, custom: (), node: BinOp { left: Located { - location: Location { - row: 1, - column: 6, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 6..7, custom: (), node: Name { id: "y", @@ -77,16 +32,7 @@ Located { }, op: Add, right: Located { - location: Location { - row: 1, - column: 10, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 10..11, custom: (), node: Constant { value: Int( @@ -102,16 +48,7 @@ Located { generators: [ Comprehension { target: Located { - location: Location { - row: 1, - column: 16, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 16..17, custom: (), node: Name { id: "y", @@ -119,16 +56,7 @@ Located { }, }, iter: Located { - location: Location { - row: 1, - column: 21, - }, - end_location: Some( - Location { - row: 1, - column: 22, - }, - ), + range: 21..22, custom: (), node: Name { id: "z", diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_print_2.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_print_2.snap index c782b8a887..42098d17a1 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_print_2.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_print_2.snap @@ -4,42 +4,15 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 23, - }, - ), + range: 0..23, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 23, - }, - ), + range: 0..23, custom: (), node: Call { func: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 5, - }, - ), + range: 0..5, custom: (), node: Name { id: "print", @@ -48,16 +21,7 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 1, - column: 6, - }, - end_location: Some( - Location { - row: 1, - column: 19, - }, - ), + range: 6..19, custom: (), node: Constant { value: Str( @@ -67,16 +31,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 21, - }, - end_location: Some( - Location { - row: 1, - column: 22, - }, - ), + range: 21..22, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_print_hello.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_print_hello.snap index 34f6ed85be..ea57857466 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_print_hello.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_print_hello.snap @@ -4,42 +4,15 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 20, - }, - ), + range: 0..20, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 20, - }, - ), + range: 0..20, custom: (), node: Call { func: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 5, - }, - ), + range: 0..5, custom: (), node: Name { id: "print", @@ -48,16 +21,7 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 1, - column: 6, - }, - end_location: Some( - Location { - row: 1, - column: 19, - }, - ), + range: 6..19, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_string.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_string.snap index d58f9e3a40..d5cbbbd1ed 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_string.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_string.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 0..13, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 0..13, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_tuples.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_tuples.snap index 7be8628176..e6963e9057 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_tuples.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__parse_tuples.snap @@ -4,44 +4,17 @@ expression: "parse_program(source, \"\").unwrap()" --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 0..11, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 4, - }, - ), + range: 0..4, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 1, - }, - ), + range: 0..1, custom: (), node: Name { id: "a", @@ -49,16 +22,7 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 1, - column: 3, - }, - end_location: Some( - Location { - row: 1, - column: 4, - }, - ), + range: 3..4, custom: (), node: Name { id: "b", @@ -71,30 +35,12 @@ expression: "parse_program(source, \"\").unwrap()" }, ], value: Located { - location: Location { - row: 1, - column: 7, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 7..11, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 1, - column: 7, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 7..8, custom: (), node: Constant { value: Int( @@ -104,16 +50,7 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 1, - column: 10, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 10..11, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__patma.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__patma.snap index 147ba2424e..8f51fe3d7a 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__patma.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__patma.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 4, - column: 0, - }, - end_location: Some( - Location { - row: 6, - column: 13, - }, - ), + range: 67..103, custom: (), node: Match { subject: Located { - location: Location { - row: 4, - column: 6, - }, - end_location: Some( - Location { - row: 4, - column: 7, - }, - ), + range: 73..74, custom: (), node: Name { id: "x", @@ -36,43 +18,16 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 5, - column: 9, - }, - end_location: Some( - Location { - row: 5, - column: 12, - }, - ), + range: 85..88, custom: (), node: MatchValue { value: Located { - location: Location { - row: 5, - column: 9, - }, - end_location: Some( - Location { - row: 5, - column: 12, - }, - ), + range: 85..88, custom: (), node: UnaryOp { op: USub, operand: Located { - location: Location { - row: 5, - column: 10, - }, - end_location: Some( - Location { - row: 5, - column: 12, - }, - ), + range: 86..88, custom: (), node: Constant { value: Complex { @@ -89,30 +44,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 6, - column: 8, - }, - end_location: Some( - Location { - row: 6, - column: 13, - }, - ), + range: 98..103, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 6, - column: 8, - }, - end_location: Some( - Location { - row: 6, - column: 9, - }, - ), + range: 98..99, custom: (), node: Name { id: "y", @@ -121,16 +58,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 6, - column: 12, - }, - end_location: Some( - Location { - row: 6, - column: 13, - }, - ), + range: 102..103, custom: (), node: Constant { value: Int( @@ -148,29 +76,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 8, - column: 0, - }, - end_location: Some( - Location { - row: 10, - column: 13, - }, - ), + range: 126..167, custom: (), node: Match { subject: Located { - location: Location { - row: 8, - column: 6, - }, - end_location: Some( - Location { - row: 8, - column: 7, - }, - ), + range: 132..133, custom: (), node: Name { id: "x", @@ -180,29 +90,11 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 9, - column: 9, - }, - end_location: Some( - Location { - row: 9, - column: 17, - }, - ), + range: 144..152, custom: (), node: MatchClass { cls: Located { - location: Location { - row: 9, - column: 9, - }, - end_location: Some( - Location { - row: 9, - column: 14, - }, - ), + range: 144..149, custom: (), node: Name { id: "bytes", @@ -211,16 +103,7 @@ expression: parse_ast }, patterns: [ Located { - location: Location { - row: 9, - column: 15, - }, - end_location: Some( - Location { - row: 9, - column: 16, - }, - ), + range: 150..151, custom: (), node: MatchAs { pattern: None, @@ -237,30 +120,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 10, - column: 8, - }, - end_location: Some( - Location { - row: 10, - column: 13, - }, - ), + range: 162..167, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 10, - column: 8, - }, - end_location: Some( - Location { - row: 10, - column: 9, - }, - ), + range: 162..163, custom: (), node: Name { id: "y", @@ -269,16 +134,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 10, - column: 12, - }, - end_location: Some( - Location { - row: 10, - column: 13, - }, - ), + range: 166..167, custom: (), node: Constant { value: Int( @@ -296,29 +152,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 12, - column: 0, - }, - end_location: Some( - Location { - row: 16, - column: 13, - }, - ), + range: 190..260, custom: (), node: Match { subject: Located { - location: Location { - row: 12, - column: 6, - }, - end_location: Some( - Location { - row: 12, - column: 7, - }, - ), + range: 196..197, custom: (), node: Name { id: "x", @@ -328,29 +166,11 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 13, - column: 9, - }, - end_location: Some( - Location { - row: 13, - column: 10, - }, - ), + range: 208..209, custom: (), node: MatchValue { value: Located { - location: Location { - row: 13, - column: 9, - }, - end_location: Some( - Location { - row: 13, - column: 10, - }, - ), + range: 208..209, custom: (), node: Constant { value: Int( @@ -363,16 +183,7 @@ expression: parse_ast }, guard: Some( Located { - location: Location { - row: 13, - column: 14, - }, - end_location: Some( - Location { - row: 13, - column: 15, - }, - ), + range: 213..214, custom: (), node: Constant { value: Int( @@ -384,30 +195,12 @@ expression: parse_ast ), body: [ Located { - location: Location { - row: 14, - column: 8, - }, - end_location: Some( - Location { - row: 14, - column: 13, - }, - ), + range: 224..229, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 14, - column: 8, - }, - end_location: Some( - Location { - row: 14, - column: 9, - }, - ), + range: 224..225, custom: (), node: Name { id: "y", @@ -416,16 +209,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 14, - column: 12, - }, - end_location: Some( - Location { - row: 14, - column: 13, - }, - ), + range: 228..229, custom: (), node: Constant { value: Int( @@ -441,29 +225,11 @@ expression: parse_ast }, MatchCase { pattern: Located { - location: Location { - row: 15, - column: 9, - }, - end_location: Some( - Location { - row: 15, - column: 10, - }, - ), + range: 239..240, custom: (), node: MatchValue { value: Located { - location: Location { - row: 15, - column: 9, - }, - end_location: Some( - Location { - row: 15, - column: 10, - }, - ), + range: 239..240, custom: (), node: Constant { value: Int( @@ -476,16 +242,7 @@ expression: parse_ast }, guard: Some( Located { - location: Location { - row: 15, - column: 14, - }, - end_location: Some( - Location { - row: 15, - column: 15, - }, - ), + range: 244..245, custom: (), node: Constant { value: Int( @@ -497,30 +254,12 @@ expression: parse_ast ), body: [ Located { - location: Location { - row: 16, - column: 8, - }, - end_location: Some( - Location { - row: 16, - column: 13, - }, - ), + range: 255..260, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 16, - column: 8, - }, - end_location: Some( - Location { - row: 16, - column: 9, - }, - ), + range: 255..256, custom: (), node: Name { id: "y", @@ -529,16 +268,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 16, - column: 12, - }, - end_location: Some( - Location { - row: 16, - column: 13, - }, - ), + range: 259..260, custom: (), node: Constant { value: Int( @@ -556,29 +286,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 18, - column: 0, - }, - end_location: Some( - Location { - row: 20, - column: 16, - }, - ), + range: 283..332, custom: (), node: Match { subject: Located { - location: Location { - row: 18, - column: 6, - }, - end_location: Some( - Location { - row: 18, - column: 7, - }, - ), + range: 289..290, custom: (), node: Constant { value: Int( @@ -590,43 +302,16 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 19, - column: 9, - }, - end_location: Some( - Location { - row: 19, - column: 22, - }, - ), + range: 301..314, custom: (), node: MatchOr { patterns: [ Located { - location: Location { - row: 19, - column: 9, - }, - end_location: Some( - Location { - row: 19, - column: 10, - }, - ), + range: 301..302, custom: (), node: MatchValue { value: Located { - location: Location { - row: 19, - column: 9, - }, - end_location: Some( - Location { - row: 19, - column: 10, - }, - ), + range: 301..302, custom: (), node: Constant { value: Int( @@ -638,29 +323,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 19, - column: 13, - }, - end_location: Some( - Location { - row: 19, - column: 14, - }, - ), + range: 305..306, custom: (), node: MatchValue { value: Located { - location: Location { - row: 19, - column: 13, - }, - end_location: Some( - Location { - row: 19, - column: 14, - }, - ), + range: 305..306, custom: (), node: Constant { value: Int( @@ -672,29 +339,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 19, - column: 17, - }, - end_location: Some( - Location { - row: 19, - column: 18, - }, - ), + range: 309..310, custom: (), node: MatchValue { value: Located { - location: Location { - row: 19, - column: 17, - }, - end_location: Some( - Location { - row: 19, - column: 18, - }, - ), + range: 309..310, custom: (), node: Constant { value: Int( @@ -706,29 +355,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 19, - column: 21, - }, - end_location: Some( - Location { - row: 19, - column: 22, - }, - ), + range: 313..314, custom: (), node: MatchValue { value: Located { - location: Location { - row: 19, - column: 21, - }, - end_location: Some( - Location { - row: 19, - column: 22, - }, - ), + range: 313..314, custom: (), node: Constant { value: Int( @@ -745,30 +376,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 20, - column: 8, - }, - end_location: Some( - Location { - row: 20, - column: 16, - }, - ), + range: 324..332, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 20, - column: 8, - }, - end_location: Some( - Location { - row: 20, - column: 9, - }, - ), + range: 324..325, custom: (), node: Name { id: "x", @@ -777,16 +390,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 20, - column: 12, - }, - end_location: Some( - Location { - row: 20, - column: 16, - }, - ), + range: 328..332, custom: (), node: Constant { value: Bool( @@ -804,29 +408,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 22, - column: 0, - }, - end_location: Some( - Location { - row: 24, - column: 13, - }, - ), + range: 355..403, custom: (), node: Match { subject: Located { - location: Location { - row: 22, - column: 6, - }, - end_location: Some( - Location { - row: 22, - column: 7, - }, - ), + range: 361..362, custom: (), node: Name { id: "x", @@ -836,57 +422,21 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 23, - column: 9, - }, - end_location: Some( - Location { - row: 23, - column: 24, - }, - ), + range: 373..388, custom: (), node: MatchOr { patterns: [ Located { - location: Location { - row: 23, - column: 9, - }, - end_location: Some( - Location { - row: 23, - column: 15, - }, - ), + range: 373..379, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 23, - column: 10, - }, - end_location: Some( - Location { - row: 23, - column: 11, - }, - ), + range: 374..375, custom: (), node: MatchValue { value: Located { - location: Location { - row: 23, - column: 10, - }, - end_location: Some( - Location { - row: 23, - column: 11, - }, - ), + range: 374..375, custom: (), node: Constant { value: Int( @@ -898,29 +448,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 23, - column: 13, - }, - end_location: Some( - Location { - row: 23, - column: 14, - }, - ), + range: 377..378, custom: (), node: MatchValue { value: Located { - location: Location { - row: 23, - column: 13, - }, - end_location: Some( - Location { - row: 23, - column: 14, - }, - ), + range: 377..378, custom: (), node: Constant { value: Int( @@ -935,43 +467,16 @@ expression: parse_ast }, }, Located { - location: Location { - row: 23, - column: 18, - }, - end_location: Some( - Location { - row: 23, - column: 24, - }, - ), + range: 382..388, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 23, - column: 19, - }, - end_location: Some( - Location { - row: 23, - column: 20, - }, - ), + range: 383..384, custom: (), node: MatchValue { value: Located { - location: Location { - row: 23, - column: 19, - }, - end_location: Some( - Location { - row: 23, - column: 20, - }, - ), + range: 383..384, custom: (), node: Constant { value: Int( @@ -983,29 +488,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 23, - column: 22, - }, - end_location: Some( - Location { - row: 23, - column: 23, - }, - ), + range: 386..387, custom: (), node: MatchValue { value: Located { - location: Location { - row: 23, - column: 22, - }, - end_location: Some( - Location { - row: 23, - column: 23, - }, - ), + range: 386..387, custom: (), node: Constant { value: Int( @@ -1025,30 +512,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 24, - column: 8, - }, - end_location: Some( - Location { - row: 24, - column: 13, - }, - ), + range: 398..403, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 24, - column: 8, - }, - end_location: Some( - Location { - row: 24, - column: 9, - }, - ), + range: 398..399, custom: (), node: Name { id: "y", @@ -1057,16 +526,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 24, - column: 12, - }, - end_location: Some( - Location { - row: 24, - column: 13, - }, - ), + range: 402..403, custom: (), node: Constant { value: Int( @@ -1084,29 +544,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 26, - column: 0, - }, - end_location: Some( - Location { - row: 30, - column: 20, - }, - ), + range: 445..523, custom: (), node: Match { subject: Located { - location: Location { - row: 26, - column: 6, - }, - end_location: Some( - Location { - row: 26, - column: 7, - }, - ), + range: 451..452, custom: (), node: Name { id: "x", @@ -1116,30 +558,12 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 27, - column: 9, - }, - end_location: Some( - Location { - row: 27, - column: 13, - }, - ), + range: 463..467, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 27, - column: 10, - }, - end_location: Some( - Location { - row: 27, - column: 12, - }, - ), + range: 464..466, custom: (), node: MatchStar { name: None, @@ -1151,30 +575,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 28, - column: 8, - }, - end_location: Some( - Location { - row: 28, - column: 20, - }, - ), + range: 477..489, custom: (), node: Return { value: Some( Located { - location: Location { - row: 28, - column: 15, - }, - end_location: Some( - Location { - row: 28, - column: 20, - }, - ), + range: 484..489, custom: (), node: Constant { value: Str( @@ -1190,16 +596,7 @@ expression: parse_ast }, MatchCase { pattern: Located { - location: Location { - row: 29, - column: 9, - }, - end_location: Some( - Location { - row: 29, - column: 11, - }, - ), + range: 499..501, custom: (), node: MatchMapping { keys: [], @@ -1210,30 +607,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 30, - column: 8, - }, - end_location: Some( - Location { - row: 30, - column: 20, - }, - ), + range: 511..523, custom: (), node: Return { value: Some( Located { - location: Location { - row: 30, - column: 15, - }, - end_location: Some( - Location { - row: 30, - column: 20, - }, - ), + range: 518..523, custom: (), node: Constant { value: Str( @@ -1251,29 +630,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 32, - column: 0, - }, - end_location: Some( - Location { - row: 38, - column: 13, - }, - ), + range: 546..714, custom: (), node: Match { subject: Located { - location: Location { - row: 32, - column: 6, - }, - end_location: Some( - Location { - row: 32, - column: 7, - }, - ), + range: 552..553, custom: (), node: Name { id: "x", @@ -1283,30 +644,12 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 33, - column: 9, - }, - end_location: Some( - Location { - row: 33, - column: 24, - }, - ), + range: 564..579, custom: (), node: MatchMapping { keys: [ Located { - location: Location { - row: 33, - column: 10, - }, - end_location: Some( - Location { - row: 33, - column: 11, - }, - ), + range: 565..566, custom: (), node: Constant { value: Int( @@ -1318,43 +661,16 @@ expression: parse_ast ], patterns: [ Located { - location: Location { - row: 33, - column: 13, - }, - end_location: Some( - Location { - row: 33, - column: 23, - }, - ), + range: 568..578, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 33, - column: 14, - }, - end_location: Some( - Location { - row: 33, - column: 15, - }, - ), + range: 569..570, custom: (), node: MatchValue { value: Located { - location: Location { - row: 33, - column: 14, - }, - end_location: Some( - Location { - row: 33, - column: 15, - }, - ), + range: 569..570, custom: (), node: Constant { value: Int( @@ -1366,29 +682,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 33, - column: 17, - }, - end_location: Some( - Location { - row: 33, - column: 18, - }, - ), + range: 572..573, custom: (), node: MatchValue { value: Located { - location: Location { - row: 33, - column: 17, - }, - end_location: Some( - Location { - row: 33, - column: 18, - }, - ), + range: 572..573, custom: (), node: Constant { value: Int( @@ -1400,16 +698,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 33, - column: 20, - }, - end_location: Some( - Location { - row: 33, - column: 22, - }, - ), + range: 575..577, custom: (), node: MatchMapping { keys: [], @@ -1427,30 +716,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 34, - column: 8, - }, - end_location: Some( - Location { - row: 34, - column: 13, - }, - ), + range: 589..594, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 34, - column: 8, - }, - end_location: Some( - Location { - row: 34, - column: 9, - }, - ), + range: 589..590, custom: (), node: Name { id: "y", @@ -1459,16 +730,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 34, - column: 12, - }, - end_location: Some( - Location { - row: 34, - column: 13, - }, - ), + range: 593..594, custom: (), node: Constant { value: Int( @@ -1484,44 +746,17 @@ expression: parse_ast }, MatchCase { pattern: Located { - location: Location { - row: 35, - column: 9, - }, - end_location: Some( - Location { - row: 35, - column: 77, - }, - ), + range: 604..672, custom: (), node: MatchOr { patterns: [ Located { - location: Location { - row: 35, - column: 9, - }, - end_location: Some( - Location { - row: 35, - column: 31, - }, - ), + range: 604..626, custom: (), node: MatchMapping { keys: [ Located { - location: Location { - row: 35, - column: 10, - }, - end_location: Some( - Location { - row: 35, - column: 11, - }, - ), + range: 605..606, custom: (), node: Constant { value: Int( @@ -1533,57 +768,21 @@ expression: parse_ast ], patterns: [ Located { - location: Location { - row: 35, - column: 13, - }, - end_location: Some( - Location { - row: 35, - column: 30, - }, - ), + range: 608..625, custom: (), node: MatchOr { patterns: [ Located { - location: Location { - row: 35, - column: 13, - }, - end_location: Some( - Location { - row: 35, - column: 23, - }, - ), + range: 608..618, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 35, - column: 14, - }, - end_location: Some( - Location { - row: 35, - column: 15, - }, - ), + range: 609..610, custom: (), node: MatchValue { value: Located { - location: Location { - row: 35, - column: 14, - }, - end_location: Some( - Location { - row: 35, - column: 15, - }, - ), + range: 609..610, custom: (), node: Constant { value: Int( @@ -1595,29 +794,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 35, - column: 17, - }, - end_location: Some( - Location { - row: 35, - column: 18, - }, - ), + range: 612..613, custom: (), node: MatchValue { value: Located { - location: Location { - row: 35, - column: 17, - }, - end_location: Some( - Location { - row: 35, - column: 18, - }, - ), + range: 612..613, custom: (), node: Constant { value: Int( @@ -1629,16 +810,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 35, - column: 20, - }, - end_location: Some( - Location { - row: 35, - column: 22, - }, - ), + range: 615..617, custom: (), node: MatchMapping { keys: [], @@ -1650,16 +822,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 35, - column: 26, - }, - end_location: Some( - Location { - row: 35, - column: 30, - }, - ), + range: 621..625, custom: (), node: MatchSingleton { value: Bool( @@ -1675,30 +838,12 @@ expression: parse_ast }, }, Located { - location: Location { - row: 35, - column: 34, - }, - end_location: Some( - Location { - row: 35, - column: 43, - }, - ), + range: 629..638, custom: (), node: MatchMapping { keys: [ Located { - location: Location { - row: 35, - column: 35, - }, - end_location: Some( - Location { - row: 35, - column: 36, - }, - ), + range: 630..631, custom: (), node: Constant { value: Int( @@ -1710,30 +855,12 @@ expression: parse_ast ], patterns: [ Located { - location: Location { - row: 35, - column: 38, - }, - end_location: Some( - Location { - row: 35, - column: 42, - }, - ), + range: 633..637, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 35, - column: 39, - }, - end_location: Some( - Location { - row: 35, - column: 41, - }, - ), + range: 634..636, custom: (), node: MatchSequence { patterns: [], @@ -1747,30 +874,12 @@ expression: parse_ast }, }, Located { - location: Location { - row: 35, - column: 46, - }, - end_location: Some( - Location { - row: 35, - column: 61, - }, - ), + range: 641..656, custom: (), node: MatchMapping { keys: [ Located { - location: Location { - row: 35, - column: 47, - }, - end_location: Some( - Location { - row: 35, - column: 48, - }, - ), + range: 642..643, custom: (), node: Constant { value: Int( @@ -1782,43 +891,16 @@ expression: parse_ast ], patterns: [ Located { - location: Location { - row: 35, - column: 50, - }, - end_location: Some( - Location { - row: 35, - column: 60, - }, - ), + range: 645..655, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 35, - column: 51, - }, - end_location: Some( - Location { - row: 35, - column: 52, - }, - ), + range: 646..647, custom: (), node: MatchValue { value: Located { - location: Location { - row: 35, - column: 51, - }, - end_location: Some( - Location { - row: 35, - column: 52, - }, - ), + range: 646..647, custom: (), node: Constant { value: Int( @@ -1830,29 +912,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 35, - column: 54, - }, - end_location: Some( - Location { - row: 35, - column: 55, - }, - ), + range: 649..650, custom: (), node: MatchValue { value: Located { - location: Location { - row: 35, - column: 54, - }, - end_location: Some( - Location { - row: 35, - column: 55, - }, - ), + range: 649..650, custom: (), node: Constant { value: Int( @@ -1864,16 +928,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 35, - column: 57, - }, - end_location: Some( - Location { - row: 35, - column: 59, - }, - ), + range: 652..654, custom: (), node: MatchMapping { keys: [], @@ -1889,45 +944,18 @@ expression: parse_ast }, }, Located { - location: Location { - row: 35, - column: 64, - }, - end_location: Some( - Location { - row: 35, - column: 66, - }, - ), + range: 659..661, custom: (), node: MatchSequence { patterns: [], }, }, Located { - location: Location { - row: 35, - column: 69, - }, - end_location: Some( - Location { - row: 35, - column: 72, - }, - ), + range: 664..667, custom: (), node: MatchValue { value: Located { - location: Location { - row: 35, - column: 69, - }, - end_location: Some( - Location { - row: 35, - column: 72, - }, - ), + range: 664..667, custom: (), node: Constant { value: Str( @@ -1939,16 +967,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 35, - column: 75, - }, - end_location: Some( - Location { - row: 35, - column: 77, - }, - ), + range: 670..672, custom: (), node: MatchMapping { keys: [], @@ -1962,30 +981,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 36, - column: 8, - }, - end_location: Some( - Location { - row: 36, - column: 13, - }, - ), + range: 682..687, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 36, - column: 8, - }, - end_location: Some( - Location { - row: 36, - column: 9, - }, - ), + range: 682..683, custom: (), node: Name { id: "y", @@ -1994,16 +995,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 36, - column: 12, - }, - end_location: Some( - Location { - row: 36, - column: 13, - }, - ), + range: 686..687, custom: (), node: Constant { value: Int( @@ -2019,16 +1011,7 @@ expression: parse_ast }, MatchCase { pattern: Located { - location: Location { - row: 37, - column: 9, - }, - end_location: Some( - Location { - row: 37, - column: 11, - }, - ), + range: 697..699, custom: (), node: MatchSequence { patterns: [], @@ -2037,30 +1020,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 38, - column: 8, - }, - end_location: Some( - Location { - row: 38, - column: 13, - }, - ), + range: 709..714, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 38, - column: 8, - }, - end_location: Some( - Location { - row: 38, - column: 9, - }, - ), + range: 709..710, custom: (), node: Name { id: "y", @@ -2069,16 +1034,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 38, - column: 12, - }, - end_location: Some( - Location { - row: 38, - column: 13, - }, - ), + range: 713..714, custom: (), node: Constant { value: Int( @@ -2096,29 +1052,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 40, - column: 0, - }, - end_location: Some( - Location { - row: 42, - column: 13, - }, - ), + range: 737..782, custom: (), node: Match { subject: Located { - location: Location { - row: 40, - column: 6, - }, - end_location: Some( - Location { - row: 40, - column: 7, - }, - ), + range: 743..744, custom: (), node: Name { id: "x", @@ -2128,42 +1066,15 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 41, - column: 9, - }, - end_location: Some( - Location { - row: 41, - column: 21, - }, - ), + range: 755..767, custom: (), node: MatchValue { value: Located { - location: Location { - row: 41, - column: 9, - }, - end_location: Some( - Location { - row: 41, - column: 21, - }, - ), + range: 755..767, custom: (), node: BinOp { left: Located { - location: Location { - row: 41, - column: 9, - }, - end_location: Some( - Location { - row: 41, - column: 13, - }, - ), + range: 755..759, custom: (), node: Constant { value: Float( @@ -2174,16 +1085,7 @@ expression: parse_ast }, op: Add, right: Located { - location: Location { - row: 41, - column: 16, - }, - end_location: Some( - Location { - row: 41, - column: 21, - }, - ), + range: 762..767, custom: (), node: Constant { value: Complex { @@ -2200,30 +1102,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 42, - column: 8, - }, - end_location: Some( - Location { - row: 42, - column: 13, - }, - ), + range: 777..782, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 42, - column: 8, - }, - end_location: Some( - Location { - row: 42, - column: 9, - }, - ), + range: 777..778, custom: (), node: Name { id: "y", @@ -2232,16 +1116,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 42, - column: 12, - }, - end_location: Some( - Location { - row: 42, - column: 13, - }, - ), + range: 781..782, custom: (), node: Constant { value: Int( @@ -2259,29 +1134,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 44, - column: 0, - }, - end_location: Some( - Location { - row: 46, - column: 13, - }, - ), + range: 805..841, custom: (), node: Match { subject: Located { - location: Location { - row: 44, - column: 6, - }, - end_location: Some( - Location { - row: 44, - column: 7, - }, - ), + range: 811..812, custom: (), node: Name { id: "x", @@ -2291,43 +1148,16 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 45, - column: 9, - }, - end_location: Some( - Location { - row: 45, - column: 12, - }, - ), + range: 823..826, custom: (), node: MatchValue { value: Located { - location: Location { - row: 45, - column: 9, - }, - end_location: Some( - Location { - row: 45, - column: 12, - }, - ), + range: 823..826, custom: (), node: UnaryOp { op: USub, operand: Located { - location: Location { - row: 45, - column: 10, - }, - end_location: Some( - Location { - row: 45, - column: 12, - }, - ), + range: 824..826, custom: (), node: Constant { value: Complex { @@ -2344,30 +1174,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 46, - column: 8, - }, - end_location: Some( - Location { - row: 46, - column: 13, - }, - ), + range: 836..841, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 46, - column: 8, - }, - end_location: Some( - Location { - row: 46, - column: 9, - }, - ), + range: 836..837, custom: (), node: Name { id: "y", @@ -2376,16 +1188,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 46, - column: 12, - }, - end_location: Some( - Location { - row: 46, - column: 13, - }, - ), + range: 840..841, custom: (), node: Constant { value: Int( @@ -2403,29 +1206,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 48, - column: 0, - }, - end_location: Some( - Location { - row: 50, - column: 16, - }, - ), + range: 864..913, custom: (), node: Match { subject: Located { - location: Location { - row: 48, - column: 6, - }, - end_location: Some( - Location { - row: 48, - column: 7, - }, - ), + range: 870..871, custom: (), node: Constant { value: Int( @@ -2437,43 +1222,16 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 49, - column: 9, - }, - end_location: Some( - Location { - row: 49, - column: 22, - }, - ), + range: 882..895, custom: (), node: MatchOr { patterns: [ Located { - location: Location { - row: 49, - column: 9, - }, - end_location: Some( - Location { - row: 49, - column: 10, - }, - ), + range: 882..883, custom: (), node: MatchValue { value: Located { - location: Location { - row: 49, - column: 9, - }, - end_location: Some( - Location { - row: 49, - column: 10, - }, - ), + range: 882..883, custom: (), node: Constant { value: Int( @@ -2485,29 +1243,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 49, - column: 13, - }, - end_location: Some( - Location { - row: 49, - column: 14, - }, - ), + range: 886..887, custom: (), node: MatchValue { value: Located { - location: Location { - row: 49, - column: 13, - }, - end_location: Some( - Location { - row: 49, - column: 14, - }, - ), + range: 886..887, custom: (), node: Constant { value: Int( @@ -2519,29 +1259,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 49, - column: 17, - }, - end_location: Some( - Location { - row: 49, - column: 18, - }, - ), + range: 890..891, custom: (), node: MatchValue { value: Located { - location: Location { - row: 49, - column: 17, - }, - end_location: Some( - Location { - row: 49, - column: 18, - }, - ), + range: 890..891, custom: (), node: Constant { value: Int( @@ -2553,29 +1275,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 49, - column: 21, - }, - end_location: Some( - Location { - row: 49, - column: 22, - }, - ), + range: 894..895, custom: (), node: MatchValue { value: Located { - location: Location { - row: 49, - column: 21, - }, - end_location: Some( - Location { - row: 49, - column: 22, - }, - ), + range: 894..895, custom: (), node: Constant { value: Int( @@ -2592,30 +1296,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 50, - column: 8, - }, - end_location: Some( - Location { - row: 50, - column: 16, - }, - ), + range: 905..913, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 50, - column: 8, - }, - end_location: Some( - Location { - row: 50, - column: 9, - }, - ), + range: 905..906, custom: (), node: Name { id: "x", @@ -2624,16 +1310,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 50, - column: 12, - }, - end_location: Some( - Location { - row: 50, - column: 16, - }, - ), + range: 909..913, custom: (), node: Constant { value: Bool( @@ -2651,29 +1328,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 52, - column: 0, - }, - end_location: Some( - Location { - row: 54, - column: 13, - }, - ), + range: 936..975, custom: (), node: Match { subject: Located { - location: Location { - row: 52, - column: 6, - }, - end_location: Some( - Location { - row: 52, - column: 7, - }, - ), + range: 942..943, custom: (), node: Name { id: "x", @@ -2683,29 +1342,11 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 53, - column: 9, - }, - end_location: Some( - Location { - row: 53, - column: 10, - }, - ), + range: 954..955, custom: (), node: MatchValue { value: Located { - location: Location { - row: 53, - column: 9, - }, - end_location: Some( - Location { - row: 53, - column: 10, - }, - ), + range: 954..955, custom: (), node: Constant { value: Int( @@ -2718,16 +1359,7 @@ expression: parse_ast }, guard: Some( Located { - location: Location { - row: 53, - column: 14, - }, - end_location: Some( - Location { - row: 53, - column: 15, - }, - ), + range: 959..960, custom: (), node: Name { id: "x", @@ -2737,30 +1369,12 @@ expression: parse_ast ), body: [ Located { - location: Location { - row: 54, - column: 8, - }, - end_location: Some( - Location { - row: 54, - column: 13, - }, - ), + range: 970..975, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 54, - column: 8, - }, - end_location: Some( - Location { - row: 54, - column: 9, - }, - ), + range: 970..971, custom: (), node: Name { id: "y", @@ -2769,16 +1383,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 54, - column: 12, - }, - end_location: Some( - Location { - row: 54, - column: 13, - }, - ), + range: 974..975, custom: (), node: Constant { value: Int( @@ -2796,29 +1401,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 56, - column: 0, - }, - end_location: Some( - Location { - row: 62, - column: 13, - }, - ), + range: 998..1098, custom: (), node: Match { subject: Located { - location: Location { - row: 56, - column: 6, - }, - end_location: Some( - Location { - row: 56, - column: 7, - }, - ), + range: 1004..1005, custom: (), node: Name { id: "x", @@ -2828,30 +1415,12 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 57, - column: 9, - }, - end_location: Some( - Location { - row: 57, - column: 15, - }, - ), + range: 1016..1022, custom: (), node: MatchMapping { keys: [ Located { - location: Location { - row: 57, - column: 10, - }, - end_location: Some( - Location { - row: 57, - column: 11, - }, - ), + range: 1017..1018, custom: (), node: Constant { value: Int( @@ -2863,29 +1432,11 @@ expression: parse_ast ], patterns: [ Located { - location: Location { - row: 57, - column: 13, - }, - end_location: Some( - Location { - row: 57, - column: 14, - }, - ), + range: 1020..1021, custom: (), node: MatchValue { value: Located { - location: Location { - row: 57, - column: 13, - }, - end_location: Some( - Location { - row: 57, - column: 14, - }, - ), + range: 1020..1021, custom: (), node: Constant { value: Int( @@ -2903,30 +1454,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 58, - column: 8, - }, - end_location: Some( - Location { - row: 58, - column: 13, - }, - ), + range: 1032..1037, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 58, - column: 8, - }, - end_location: Some( - Location { - row: 58, - column: 9, - }, - ), + range: 1032..1033, custom: (), node: Name { id: "y", @@ -2935,16 +1468,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 58, - column: 12, - }, - end_location: Some( - Location { - row: 58, - column: 13, - }, - ), + range: 1036..1037, custom: (), node: Constant { value: Int( @@ -2960,30 +1484,12 @@ expression: parse_ast }, MatchCase { pattern: Located { - location: Location { - row: 59, - column: 9, - }, - end_location: Some( - Location { - row: 59, - column: 15, - }, - ), + range: 1047..1053, custom: (), node: MatchMapping { keys: [ Located { - location: Location { - row: 59, - column: 10, - }, - end_location: Some( - Location { - row: 59, - column: 11, - }, - ), + range: 1048..1049, custom: (), node: Constant { value: Int( @@ -2995,29 +1501,11 @@ expression: parse_ast ], patterns: [ Located { - location: Location { - row: 59, - column: 13, - }, - end_location: Some( - Location { - row: 59, - column: 14, - }, - ), + range: 1051..1052, custom: (), node: MatchValue { value: Located { - location: Location { - row: 59, - column: 13, - }, - end_location: Some( - Location { - row: 59, - column: 14, - }, - ), + range: 1051..1052, custom: (), node: Constant { value: Int( @@ -3035,30 +1523,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 60, - column: 8, - }, - end_location: Some( - Location { - row: 60, - column: 13, - }, - ), + range: 1063..1068, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 60, - column: 8, - }, - end_location: Some( - Location { - row: 60, - column: 9, - }, - ), + range: 1063..1064, custom: (), node: Name { id: "y", @@ -3067,16 +1537,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 60, - column: 12, - }, - end_location: Some( - Location { - row: 60, - column: 13, - }, - ), + range: 1067..1068, custom: (), node: Constant { value: Int( @@ -3092,16 +1553,7 @@ expression: parse_ast }, MatchCase { pattern: Located { - location: Location { - row: 61, - column: 9, - }, - end_location: Some( - Location { - row: 61, - column: 14, - }, - ), + range: 1078..1083, custom: (), node: MatchMapping { keys: [], @@ -3114,30 +1566,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 62, - column: 8, - }, - end_location: Some( - Location { - row: 62, - column: 13, - }, - ), + range: 1093..1098, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 62, - column: 8, - }, - end_location: Some( - Location { - row: 62, - column: 9, - }, - ), + range: 1093..1094, custom: (), node: Name { id: "y", @@ -3146,16 +1580,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 62, - column: 12, - }, - end_location: Some( - Location { - row: 62, - column: 13, - }, - ), + range: 1097..1098, custom: (), node: Constant { value: Int( @@ -3173,42 +1598,15 @@ expression: parse_ast }, }, Located { - location: Location { - row: 64, - column: 0, - }, - end_location: Some( - Location { - row: 66, - column: 13, - }, - ), + range: 1121..1162, custom: (), node: Match { subject: Located { - location: Location { - row: 64, - column: 6, - }, - end_location: Some( - Location { - row: 64, - column: 11, - }, - ), + range: 1127..1132, custom: (), node: Call { func: Located { - location: Location { - row: 64, - column: 6, - }, - end_location: Some( - Location { - row: 64, - column: 9, - }, - ), + range: 1127..1130, custom: (), node: Name { id: "Seq", @@ -3222,30 +1620,12 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 65, - column: 9, - }, - end_location: Some( - Location { - row: 65, - column: 13, - }, - ), + range: 1143..1147, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 65, - column: 10, - }, - end_location: Some( - Location { - row: 65, - column: 12, - }, - ), + range: 1144..1146, custom: (), node: MatchStar { name: None, @@ -3257,30 +1637,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 66, - column: 8, - }, - end_location: Some( - Location { - row: 66, - column: 13, - }, - ), + range: 1157..1162, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 66, - column: 8, - }, - end_location: Some( - Location { - row: 66, - column: 9, - }, - ), + range: 1157..1158, custom: (), node: Name { id: "y", @@ -3289,16 +1651,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 66, - column: 12, - }, - end_location: Some( - Location { - row: 66, - column: 13, - }, - ), + range: 1161..1162, custom: (), node: Constant { value: Int( @@ -3316,29 +1669,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 68, - column: 0, - }, - end_location: Some( - Location { - row: 72, - column: 13, - }, - ), + range: 1185..1245, custom: (), node: Match { subject: Located { - location: Location { - row: 68, - column: 6, - }, - end_location: Some( - Location { - row: 68, - column: 7, - }, - ), + range: 1191..1192, custom: (), node: Name { id: "x", @@ -3348,29 +1683,11 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 69, - column: 9, - }, - end_location: Some( - Location { - row: 69, - column: 10, - }, - ), + range: 1203..1204, custom: (), node: MatchValue { value: Located { - location: Location { - row: 69, - column: 9, - }, - end_location: Some( - Location { - row: 69, - column: 10, - }, - ), + range: 1203..1204, custom: (), node: Constant { value: Int( @@ -3384,30 +1701,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 70, - column: 8, - }, - end_location: Some( - Location { - row: 70, - column: 13, - }, - ), + range: 1214..1219, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 70, - column: 8, - }, - end_location: Some( - Location { - row: 70, - column: 9, - }, - ), + range: 1214..1215, custom: (), node: Name { id: "y", @@ -3416,16 +1715,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 70, - column: 12, - }, - end_location: Some( - Location { - row: 70, - column: 13, - }, - ), + range: 1218..1219, custom: (), node: Constant { value: Int( @@ -3441,29 +1731,11 @@ expression: parse_ast }, MatchCase { pattern: Located { - location: Location { - row: 71, - column: 9, - }, - end_location: Some( - Location { - row: 71, - column: 10, - }, - ), + range: 1229..1230, custom: (), node: MatchValue { value: Located { - location: Location { - row: 71, - column: 9, - }, - end_location: Some( - Location { - row: 71, - column: 10, - }, - ), + range: 1229..1230, custom: (), node: Constant { value: Int( @@ -3477,30 +1749,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 72, - column: 8, - }, - end_location: Some( - Location { - row: 72, - column: 13, - }, - ), + range: 1240..1245, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 72, - column: 8, - }, - end_location: Some( - Location { - row: 72, - column: 9, - }, - ), + range: 1240..1241, custom: (), node: Name { id: "y", @@ -3509,16 +1763,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 72, - column: 12, - }, - end_location: Some( - Location { - row: 72, - column: 13, - }, - ), + range: 1244..1245, custom: (), node: Constant { value: Int( @@ -3536,29 +1781,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 74, - column: 0, - }, - end_location: Some( - Location { - row: 76, - column: 15, - }, - ), + range: 1268..1315, custom: (), node: Match { subject: Located { - location: Location { - row: 74, - column: 6, - }, - end_location: Some( - Location { - row: 74, - column: 7, - }, - ), + range: 1274..1275, custom: (), node: Name { id: "x", @@ -3568,30 +1795,12 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 75, - column: 9, - }, - end_location: Some( - Location { - row: 75, - column: 21, - }, - ), + range: 1286..1298, custom: (), node: MatchMapping { keys: [ Located { - location: Location { - row: 75, - column: 10, - }, - end_location: Some( - Location { - row: 75, - column: 15, - }, - ), + range: 1287..1292, custom: (), node: Constant { value: Str( @@ -3603,16 +1812,7 @@ expression: parse_ast ], patterns: [ Located { - location: Location { - row: 75, - column: 17, - }, - end_location: Some( - Location { - row: 75, - column: 20, - }, - ), + range: 1294..1297, custom: (), node: MatchAs { pattern: None, @@ -3628,30 +1828,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 76, - column: 8, - }, - end_location: Some( - Location { - row: 76, - column: 15, - }, - ), + range: 1308..1315, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 76, - column: 8, - }, - end_location: Some( - Location { - row: 76, - column: 9, - }, - ), + range: 1308..1309, custom: (), node: Name { id: "y", @@ -3660,16 +1842,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 76, - column: 12, - }, - end_location: Some( - Location { - row: 76, - column: 15, - }, - ), + range: 1312..1315, custom: (), node: Name { id: "bar", @@ -3685,43 +1858,16 @@ expression: parse_ast }, }, Located { - location: Location { - row: 78, - column: 0, - }, - end_location: Some( - Location { - row: 80, - column: 13, - }, - ), + range: 1338..1392, custom: (), node: Match { subject: Located { - location: Location { - row: 78, - column: 6, - }, - end_location: Some( - Location { - row: 78, - column: 15, - }, - ), + range: 1344..1353, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 78, - column: 7, - }, - end_location: Some( - Location { - row: 78, - column: 8, - }, - ), + range: 1345..1346, custom: (), node: Constant { value: Int( @@ -3731,16 +1877,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 78, - column: 10, - }, - end_location: Some( - Location { - row: 78, - column: 11, - }, - ), + range: 1348..1349, custom: (), node: Constant { value: Int( @@ -3750,16 +1887,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 78, - column: 13, - }, - end_location: Some( - Location { - row: 78, - column: 14, - }, - ), + range: 1351..1352, custom: (), node: Constant { value: Int( @@ -3775,43 +1903,16 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 79, - column: 9, - }, - end_location: Some( - Location { - row: 79, - column: 22, - }, - ), + range: 1364..1377, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 79, - column: 10, - }, - end_location: Some( - Location { - row: 79, - column: 11, - }, - ), + range: 1365..1366, custom: (), node: MatchValue { value: Located { - location: Location { - row: 79, - column: 10, - }, - end_location: Some( - Location { - row: 79, - column: 11, - }, - ), + range: 1365..1366, custom: (), node: Constant { value: Int( @@ -3823,29 +1924,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 79, - column: 13, - }, - end_location: Some( - Location { - row: 79, - column: 14, - }, - ), + range: 1368..1369, custom: (), node: MatchValue { value: Located { - location: Location { - row: 79, - column: 13, - }, - end_location: Some( - Location { - row: 79, - column: 14, - }, - ), + range: 1368..1369, custom: (), node: Constant { value: Int( @@ -3857,16 +1940,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 79, - column: 16, - }, - end_location: Some( - Location { - row: 79, - column: 18, - }, - ), + range: 1371..1373, custom: (), node: MatchStar { name: Some( @@ -3875,29 +1949,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 79, - column: 20, - }, - end_location: Some( - Location { - row: 79, - column: 21, - }, - ), + range: 1375..1376, custom: (), node: MatchValue { value: Located { - location: Location { - row: 79, - column: 20, - }, - end_location: Some( - Location { - row: 79, - column: 21, - }, - ), + range: 1375..1376, custom: (), node: Constant { value: Int( @@ -3914,30 +1970,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 80, - column: 8, - }, - end_location: Some( - Location { - row: 80, - column: 13, - }, - ), + range: 1387..1392, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 80, - column: 8, - }, - end_location: Some( - Location { - row: 80, - column: 9, - }, - ), + range: 1387..1388, custom: (), node: Name { id: "y", @@ -3946,16 +1984,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 80, - column: 12, - }, - end_location: Some( - Location { - row: 80, - column: 13, - }, - ), + range: 1391..1392, custom: (), node: Constant { value: Int( @@ -3973,29 +2002,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 82, - column: 0, - }, - end_location: Some( - Location { - row: 88, - column: 13, - }, - ), + range: 1415..1529, custom: (), node: Match { subject: Located { - location: Location { - row: 82, - column: 6, - }, - end_location: Some( - Location { - row: 82, - column: 7, - }, - ), + range: 1421..1422, custom: (), node: Name { id: "x", @@ -4005,43 +2016,16 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 83, - column: 9, - }, - end_location: Some( - Location { - row: 83, - column: 12, - }, - ), + range: 1433..1436, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 83, - column: 10, - }, - end_location: Some( - Location { - row: 83, - column: 11, - }, - ), + range: 1434..1435, custom: (), node: MatchValue { value: Located { - location: Location { - row: 83, - column: 10, - }, - end_location: Some( - Location { - row: 83, - column: 11, - }, - ), + range: 1434..1435, custom: (), node: Constant { value: Int( @@ -4058,30 +2042,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 84, - column: 8, - }, - end_location: Some( - Location { - row: 84, - column: 13, - }, - ), + range: 1446..1451, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 84, - column: 8, - }, - end_location: Some( - Location { - row: 84, - column: 9, - }, - ), + range: 1446..1447, custom: (), node: Name { id: "y", @@ -4090,16 +2056,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 84, - column: 12, - }, - end_location: Some( - Location { - row: 84, - column: 13, - }, - ), + range: 1450..1451, custom: (), node: Constant { value: Int( @@ -4115,43 +2072,16 @@ expression: parse_ast }, MatchCase { pattern: Located { - location: Location { - row: 85, - column: 9, - }, - end_location: Some( - Location { - row: 85, - column: 15, - }, - ), + range: 1461..1467, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 85, - column: 10, - }, - end_location: Some( - Location { - row: 85, - column: 11, - }, - ), + range: 1462..1463, custom: (), node: MatchValue { value: Located { - location: Location { - row: 85, - column: 10, - }, - end_location: Some( - Location { - row: 85, - column: 11, - }, - ), + range: 1462..1463, custom: (), node: Constant { value: Int( @@ -4163,29 +2093,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 85, - column: 13, - }, - end_location: Some( - Location { - row: 85, - column: 14, - }, - ), + range: 1465..1466, custom: (), node: MatchValue { value: Located { - location: Location { - row: 85, - column: 13, - }, - end_location: Some( - Location { - row: 85, - column: 14, - }, - ), + range: 1465..1466, custom: (), node: Constant { value: Int( @@ -4201,29 +2113,11 @@ expression: parse_ast }, guard: Some( Located { - location: Location { - row: 85, - column: 20, - }, - end_location: Some( - Location { - row: 85, - column: 30, - }, - ), + range: 1472..1482, custom: (), node: NamedExpr { target: Located { - location: Location { - row: 85, - column: 20, - }, - end_location: Some( - Location { - row: 85, - column: 21, - }, - ), + range: 1472..1473, custom: (), node: Name { id: "x", @@ -4231,29 +2125,11 @@ expression: parse_ast }, }, value: Located { - location: Location { - row: 85, - column: 25, - }, - end_location: Some( - Location { - row: 85, - column: 30, - }, - ), + range: 1477..1482, custom: (), node: Subscript { value: Located { - location: Location { - row: 85, - column: 25, - }, - end_location: Some( - Location { - row: 85, - column: 26, - }, - ), + range: 1477..1478, custom: (), node: Name { id: "x", @@ -4261,31 +2137,13 @@ expression: parse_ast }, }, slice: Located { - location: Location { - row: 85, - column: 27, - }, - end_location: Some( - Location { - row: 85, - column: 29, - }, - ), + range: 1479..1481, custom: (), node: Slice { lower: None, upper: Some( Located { - location: Location { - row: 85, - column: 28, - }, - end_location: Some( - Location { - row: 85, - column: 29, - }, - ), + range: 1480..1481, custom: (), node: Constant { value: Int( @@ -4306,30 +2164,12 @@ expression: parse_ast ), body: [ Located { - location: Location { - row: 86, - column: 8, - }, - end_location: Some( - Location { - row: 86, - column: 13, - }, - ), + range: 1493..1498, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 86, - column: 8, - }, - end_location: Some( - Location { - row: 86, - column: 9, - }, - ), + range: 1493..1494, custom: (), node: Name { id: "y", @@ -4338,16 +2178,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 86, - column: 12, - }, - end_location: Some( - Location { - row: 86, - column: 13, - }, - ), + range: 1497..1498, custom: (), node: Constant { value: Int( @@ -4363,43 +2194,16 @@ expression: parse_ast }, MatchCase { pattern: Located { - location: Location { - row: 87, - column: 9, - }, - end_location: Some( - Location { - row: 87, - column: 15, - }, - ), + range: 1508..1514, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 87, - column: 10, - }, - end_location: Some( - Location { - row: 87, - column: 11, - }, - ), + range: 1509..1510, custom: (), node: MatchValue { value: Located { - location: Location { - row: 87, - column: 10, - }, - end_location: Some( - Location { - row: 87, - column: 11, - }, - ), + range: 1509..1510, custom: (), node: Constant { value: Int( @@ -4411,29 +2215,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 87, - column: 13, - }, - end_location: Some( - Location { - row: 87, - column: 14, - }, - ), + range: 1512..1513, custom: (), node: MatchValue { value: Located { - location: Location { - row: 87, - column: 13, - }, - end_location: Some( - Location { - row: 87, - column: 14, - }, - ), + range: 1512..1513, custom: (), node: Constant { value: Int( @@ -4450,30 +2236,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 88, - column: 8, - }, - end_location: Some( - Location { - row: 88, - column: 13, - }, - ), + range: 1524..1529, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 88, - column: 8, - }, - end_location: Some( - Location { - row: 88, - column: 9, - }, - ), + range: 1524..1525, custom: (), node: Name { id: "y", @@ -4482,16 +2250,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 88, - column: 12, - }, - end_location: Some( - Location { - row: 88, - column: 13, - }, - ), + range: 1528..1529, custom: (), node: Constant { value: Int( @@ -4509,29 +2268,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 90, - column: 0, - }, - end_location: Some( - Location { - row: 92, - column: 13, - }, - ), + range: 1552..1595, custom: (), node: Match { subject: Located { - location: Location { - row: 90, - column: 6, - }, - end_location: Some( - Location { - row: 90, - column: 7, - }, - ), + range: 1558..1559, custom: (), node: Name { id: "w", @@ -4541,30 +2282,12 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 91, - column: 9, - }, - end_location: Some( - Location { - row: 91, - column: 19, - }, - ), + range: 1570..1580, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 91, - column: 10, - }, - end_location: Some( - Location { - row: 91, - column: 11, - }, - ), + range: 1571..1572, custom: (), node: MatchAs { pattern: None, @@ -4574,16 +2297,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 91, - column: 13, - }, - end_location: Some( - Location { - row: 91, - column: 14, - }, - ), + range: 1574..1575, custom: (), node: MatchAs { pattern: None, @@ -4593,16 +2307,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 91, - column: 16, - }, - end_location: Some( - Location { - row: 91, - column: 18, - }, - ), + range: 1577..1579, custom: (), node: MatchStar { name: None, @@ -4614,30 +2319,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 92, - column: 8, - }, - end_location: Some( - Location { - row: 92, - column: 13, - }, - ), + range: 1590..1595, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 92, - column: 8, - }, - end_location: Some( - Location { - row: 92, - column: 9, - }, - ), + range: 1590..1591, custom: (), node: Name { id: "z", @@ -4646,16 +2333,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 92, - column: 12, - }, - end_location: Some( - Location { - row: 92, - column: 13, - }, - ), + range: 1594..1595, custom: (), node: Constant { value: Int( @@ -4673,29 +2351,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 94, - column: 0, - }, - end_location: Some( - Location { - row: 96, - column: 13, - }, - ), + range: 1618..1664, custom: (), node: Match { subject: Located { - location: Location { - row: 94, - column: 6, - }, - end_location: Some( - Location { - row: 94, - column: 7, - }, - ), + range: 1624..1625, custom: (), node: Name { id: "x", @@ -4705,56 +2365,20 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 95, - column: 9, - }, - end_location: Some( - Location { - row: 95, - column: 22, - }, - ), + range: 1636..1649, custom: (), node: MatchValue { value: Located { - location: Location { - row: 95, - column: 9, - }, - end_location: Some( - Location { - row: 95, - column: 22, - }, - ), + range: 1636..1649, custom: (), node: BinOp { left: Located { - location: Location { - row: 95, - column: 9, - }, - end_location: Some( - Location { - row: 95, - column: 14, - }, - ), + range: 1636..1641, custom: (), node: UnaryOp { op: USub, operand: Located { - location: Location { - row: 95, - column: 10, - }, - end_location: Some( - Location { - row: 95, - column: 14, - }, - ), + range: 1637..1641, custom: (), node: Constant { value: Float( @@ -4767,16 +2391,7 @@ expression: parse_ast }, op: Sub, right: Located { - location: Location { - row: 95, - column: 17, - }, - end_location: Some( - Location { - row: 95, - column: 22, - }, - ), + range: 1644..1649, custom: (), node: Constant { value: Complex { @@ -4793,30 +2408,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 96, - column: 8, - }, - end_location: Some( - Location { - row: 96, - column: 13, - }, - ), + range: 1659..1664, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 96, - column: 8, - }, - end_location: Some( - Location { - row: 96, - column: 9, - }, - ), + range: 1659..1660, custom: (), node: Name { id: "y", @@ -4825,16 +2422,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 96, - column: 12, - }, - end_location: Some( - Location { - row: 96, - column: 13, - }, - ), + range: 1663..1664, custom: (), node: Constant { value: Int( @@ -4852,43 +2440,16 @@ expression: parse_ast }, }, Located { - location: Location { - row: 98, - column: 0, - }, - end_location: Some( - Location { - row: 100, - column: 13, - }, - ), + range: 1687..1726, custom: (), node: Match { subject: Located { - location: Location { - row: 98, - column: 6, - }, - end_location: Some( - Location { - row: 98, - column: 10, - }, - ), + range: 1693..1697, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 98, - column: 7, - }, - end_location: Some( - Location { - row: 98, - column: 8, - }, - ), + range: 1694..1695, custom: (), node: Name { id: "x", @@ -4902,30 +2463,12 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 99, - column: 9, - }, - end_location: Some( - Location { - row: 99, - column: 12, - }, - ), + range: 1708..1711, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 99, - column: 10, - }, - end_location: Some( - Location { - row: 99, - column: 11, - }, - ), + range: 1709..1710, custom: (), node: MatchAs { pattern: None, @@ -4940,30 +2483,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 100, - column: 8, - }, - end_location: Some( - Location { - row: 100, - column: 13, - }, - ), + range: 1721..1726, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 100, - column: 8, - }, - end_location: Some( - Location { - row: 100, - column: 9, - }, - ), + range: 1721..1722, custom: (), node: Name { id: "z", @@ -4972,16 +2497,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 100, - column: 12, - }, - end_location: Some( - Location { - row: 100, - column: 13, - }, - ), + range: 1725..1726, custom: (), node: Constant { value: Int( @@ -4999,29 +2515,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 102, - column: 0, - }, - end_location: Some( - Location { - row: 104, - column: 13, - }, - ), + range: 1749..1789, custom: (), node: Match { subject: Located { - location: Location { - row: 102, - column: 6, - }, - end_location: Some( - Location { - row: 102, - column: 7, - }, - ), + range: 1755..1756, custom: (), node: Name { id: "x", @@ -5031,68 +2529,23 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 103, - column: 9, - }, - end_location: Some( - Location { - row: 103, - column: 16, - }, - ), + range: 1767..1774, custom: (), node: MatchValue { value: Located { - location: Location { - row: 103, - column: 9, - }, - end_location: Some( - Location { - row: 103, - column: 16, - }, - ), + range: 1767..1774, custom: (), node: Attribute { value: Located { - location: Location { - row: 103, - column: 9, - }, - end_location: Some( - Location { - row: 103, - column: 14, - }, - ), + range: 1767..1772, custom: (), node: Attribute { value: Located { - location: Location { - row: 103, - column: 9, - }, - end_location: Some( - Location { - row: 103, - column: 12, - }, - ), + range: 1767..1770, custom: (), node: Attribute { value: Located { - location: Location { - row: 103, - column: 9, - }, - end_location: Some( - Location { - row: 103, - column: 10, - }, - ), + range: 1767..1768, custom: (), node: Name { id: "A", @@ -5116,30 +2569,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 104, - column: 8, - }, - end_location: Some( - Location { - row: 104, - column: 13, - }, - ), + range: 1784..1789, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 104, - column: 8, - }, - end_location: Some( - Location { - row: 104, - column: 9, - }, - ), + range: 1784..1785, custom: (), node: Name { id: "y", @@ -5148,16 +2583,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 104, - column: 12, - }, - end_location: Some( - Location { - row: 104, - column: 13, - }, - ), + range: 1788..1789, custom: (), node: Constant { value: Int( @@ -5175,29 +2601,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 106, - column: 0, - }, - end_location: Some( - Location { - row: 108, - column: 13, - }, - ), + range: 1812..1849, custom: (), node: Match { subject: Located { - location: Location { - row: 106, - column: 6, - }, - end_location: Some( - Location { - row: 106, - column: 7, - }, - ), + range: 1818..1819, custom: (), node: Name { id: "x", @@ -5207,16 +2615,7 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 107, - column: 9, - }, - end_location: Some( - Location { - row: 107, - column: 13, - }, - ), + range: 1830..1834, custom: (), node: MatchSingleton { value: None, @@ -5225,30 +2624,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 108, - column: 8, - }, - end_location: Some( - Location { - row: 108, - column: 13, - }, - ), + range: 1844..1849, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 108, - column: 8, - }, - end_location: Some( - Location { - row: 108, - column: 9, - }, - ), + range: 1844..1845, custom: (), node: Name { id: "y", @@ -5257,16 +2638,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 108, - column: 12, - }, - end_location: Some( - Location { - row: 108, - column: 13, - }, - ), + range: 1848..1849, custom: (), node: Constant { value: Int( @@ -5284,29 +2656,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 110, - column: 0, - }, - end_location: Some( - Location { - row: 112, - column: 13, - }, - ), + range: 1872..1906, custom: (), node: Match { subject: Located { - location: Location { - row: 110, - column: 6, - }, - end_location: Some( - Location { - row: 110, - column: 7, - }, - ), + range: 1878..1879, custom: (), node: Name { id: "x", @@ -5316,29 +2670,11 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 111, - column: 9, - }, - end_location: Some( - Location { - row: 111, - column: 10, - }, - ), + range: 1890..1891, custom: (), node: MatchValue { value: Located { - location: Location { - row: 111, - column: 9, - }, - end_location: Some( - Location { - row: 111, - column: 10, - }, - ), + range: 1890..1891, custom: (), node: Constant { value: Int( @@ -5352,30 +2688,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 112, - column: 8, - }, - end_location: Some( - Location { - row: 112, - column: 13, - }, - ), + range: 1901..1906, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 112, - column: 8, - }, - end_location: Some( - Location { - row: 112, - column: 9, - }, - ), + range: 1901..1902, custom: (), node: Name { id: "y", @@ -5384,16 +2702,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 112, - column: 12, - }, - end_location: Some( - Location { - row: 112, - column: 13, - }, - ), + range: 1905..1906, custom: (), node: Constant { value: Int( @@ -5411,29 +2720,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 114, - column: 0, - }, - end_location: Some( - Location { - row: 116, - column: 13, - }, - ), + range: 1929..1967, custom: (), node: Match { subject: Located { - location: Location { - row: 114, - column: 6, - }, - end_location: Some( - Location { - row: 114, - column: 7, - }, - ), + range: 1935..1936, custom: (), node: Name { id: "x", @@ -5443,16 +2734,7 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 115, - column: 9, - }, - end_location: Some( - Location { - row: 115, - column: 14, - }, - ), + range: 1947..1952, custom: (), node: MatchSingleton { value: Bool( @@ -5463,30 +2745,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 116, - column: 8, - }, - end_location: Some( - Location { - row: 116, - column: 13, - }, - ), + range: 1962..1967, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 116, - column: 8, - }, - end_location: Some( - Location { - row: 116, - column: 9, - }, - ), + range: 1962..1963, custom: (), node: Name { id: "y", @@ -5495,16 +2759,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 116, - column: 12, - }, - end_location: Some( - Location { - row: 116, - column: 13, - }, - ), + range: 1966..1967, custom: (), node: Constant { value: Int( @@ -5522,29 +2777,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 118, - column: 0, - }, - end_location: Some( - Location { - row: 124, - column: 13, - }, - ), + range: 1990..2081, custom: (), node: Match { subject: Located { - location: Location { - row: 118, - column: 6, - }, - end_location: Some( - Location { - row: 118, - column: 7, - }, - ), + range: 1996..1997, custom: (), node: Name { id: "x", @@ -5554,16 +2791,7 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 119, - column: 9, - }, - end_location: Some( - Location { - row: 119, - column: 11, - }, - ), + range: 2008..2010, custom: (), node: MatchSequence { patterns: [], @@ -5572,30 +2800,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 120, - column: 8, - }, - end_location: Some( - Location { - row: 120, - column: 13, - }, - ), + range: 2020..2025, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 120, - column: 8, - }, - end_location: Some( - Location { - row: 120, - column: 9, - }, - ), + range: 2020..2021, custom: (), node: Name { id: "y", @@ -5604,16 +2814,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 120, - column: 12, - }, - end_location: Some( - Location { - row: 120, - column: 13, - }, - ), + range: 2024..2025, custom: (), node: Constant { value: Int( @@ -5629,43 +2830,16 @@ expression: parse_ast }, MatchCase { pattern: Located { - location: Location { - row: 121, - column: 9, - }, - end_location: Some( - Location { - row: 121, - column: 13, - }, - ), + range: 2035..2039, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 121, - column: 10, - }, - end_location: Some( - Location { - row: 121, - column: 12, - }, - ), + range: 2036..2038, custom: (), node: MatchValue { value: Located { - location: Location { - row: 121, - column: 10, - }, - end_location: Some( - Location { - row: 121, - column: 12, - }, - ), + range: 2036..2038, custom: (), node: Constant { value: Str( @@ -5682,30 +2856,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 122, - column: 8, - }, - end_location: Some( - Location { - row: 122, - column: 13, - }, - ), + range: 2049..2054, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 122, - column: 8, - }, - end_location: Some( - Location { - row: 122, - column: 9, - }, - ), + range: 2049..2050, custom: (), node: Name { id: "y", @@ -5714,16 +2870,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 122, - column: 12, - }, - end_location: Some( - Location { - row: 122, - column: 13, - }, - ), + range: 2053..2054, custom: (), node: Constant { value: Int( @@ -5739,29 +2886,11 @@ expression: parse_ast }, MatchCase { pattern: Located { - location: Location { - row: 123, - column: 9, - }, - end_location: Some( - Location { - row: 123, - column: 11, - }, - ), + range: 2064..2066, custom: (), node: MatchValue { value: Located { - location: Location { - row: 123, - column: 9, - }, - end_location: Some( - Location { - row: 123, - column: 11, - }, - ), + range: 2064..2066, custom: (), node: Constant { value: Str( @@ -5775,30 +2904,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 124, - column: 8, - }, - end_location: Some( - Location { - row: 124, - column: 13, - }, - ), + range: 2076..2081, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 124, - column: 8, - }, - end_location: Some( - Location { - row: 124, - column: 9, - }, - ), + range: 2076..2077, custom: (), node: Name { id: "y", @@ -5807,16 +2918,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 124, - column: 12, - }, - end_location: Some( - Location { - row: 124, - column: 13, - }, - ), + range: 2080..2081, custom: (), node: Constant { value: Int( @@ -5834,29 +2936,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 126, - column: 0, - }, - end_location: Some( - Location { - row: 128, - column: 13, - }, - ), + range: 2104..2138, custom: (), node: Match { subject: Located { - location: Location { - row: 126, - column: 6, - }, - end_location: Some( - Location { - row: 126, - column: 7, - }, - ), + range: 2110..2111, custom: (), node: Name { id: "x", @@ -5866,16 +2950,7 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 127, - column: 9, - }, - end_location: Some( - Location { - row: 127, - column: 10, - }, - ), + range: 2122..2123, custom: (), node: MatchAs { pattern: None, @@ -5887,30 +2962,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 128, - column: 8, - }, - end_location: Some( - Location { - row: 128, - column: 13, - }, - ), + range: 2133..2138, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 128, - column: 8, - }, - end_location: Some( - Location { - row: 128, - column: 9, - }, - ), + range: 2133..2134, custom: (), node: Name { id: "y", @@ -5919,16 +2976,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 128, - column: 12, - }, - end_location: Some( - Location { - row: 128, - column: 13, - }, - ), + range: 2137..2138, custom: (), node: Constant { value: Int( @@ -5946,29 +2994,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 130, - column: 0, - }, - end_location: Some( - Location { - row: 132, - column: 13, - }, - ), + range: 2161..2207, custom: (), node: Match { subject: Located { - location: Location { - row: 130, - column: 6, - }, - end_location: Some( - Location { - row: 130, - column: 7, - }, - ), + range: 2167..2168, custom: (), node: Name { id: "w", @@ -5978,30 +3008,12 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 131, - column: 9, - }, - end_location: Some( - Location { - row: 131, - column: 22, - }, - ), + range: 2179..2192, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 131, - column: 10, - }, - end_location: Some( - Location { - row: 131, - column: 11, - }, - ), + range: 2180..2181, custom: (), node: MatchAs { pattern: None, @@ -6011,16 +3023,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 131, - column: 13, - }, - end_location: Some( - Location { - row: 131, - column: 14, - }, - ), + range: 2183..2184, custom: (), node: MatchAs { pattern: None, @@ -6030,16 +3033,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 131, - column: 16, - }, - end_location: Some( - Location { - row: 131, - column: 21, - }, - ), + range: 2186..2191, custom: (), node: MatchStar { name: Some( @@ -6053,30 +3047,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 132, - column: 8, - }, - end_location: Some( - Location { - row: 132, - column: 13, - }, - ), + range: 2202..2207, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 132, - column: 8, - }, - end_location: Some( - Location { - row: 132, - column: 9, - }, - ), + range: 2202..2203, custom: (), node: Name { id: "z", @@ -6085,16 +3061,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 132, - column: 12, - }, - end_location: Some( - Location { - row: 132, - column: 13, - }, - ), + range: 2206..2207, custom: (), node: Constant { value: Int( @@ -6112,29 +3079,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 134, - column: 0, - }, - end_location: Some( - Location { - row: 136, - column: 13, - }, - ), + range: 2230..2307, custom: (), node: Match { subject: Located { - location: Location { - row: 134, - column: 6, - }, - end_location: Some( - Location { - row: 134, - column: 7, - }, - ), + range: 2236..2237, custom: (), node: Name { id: "x", @@ -6144,57 +3093,21 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 135, - column: 9, - }, - end_location: Some( - Location { - row: 135, - column: 39, - }, - ), + range: 2248..2278, custom: (), node: MatchOr { patterns: [ Located { - location: Location { - row: 135, - column: 9, - }, - end_location: Some( - Location { - row: 135, - column: 17, - }, - ), + range: 2248..2256, custom: (), node: MatchAs { pattern: Some( Located { - location: Location { - row: 135, - column: 10, - }, - end_location: Some( - Location { - row: 135, - column: 11, - }, - ), + range: 2249..2250, custom: (), node: MatchValue { value: Located { - location: Location { - row: 135, - column: 10, - }, - end_location: Some( - Location { - row: 135, - column: 11, - }, - ), + range: 2249..2250, custom: (), node: Constant { value: Int( @@ -6212,43 +3125,16 @@ expression: parse_ast }, }, Located { - location: Location { - row: 135, - column: 20, - }, - end_location: Some( - Location { - row: 135, - column: 28, - }, - ), + range: 2259..2267, custom: (), node: MatchAs { pattern: Some( Located { - location: Location { - row: 135, - column: 21, - }, - end_location: Some( - Location { - row: 135, - column: 22, - }, - ), + range: 2260..2261, custom: (), node: MatchValue { value: Located { - location: Location { - row: 135, - column: 21, - }, - end_location: Some( - Location { - row: 135, - column: 22, - }, - ), + range: 2260..2261, custom: (), node: Constant { value: Int( @@ -6266,43 +3152,16 @@ expression: parse_ast }, }, Located { - location: Location { - row: 135, - column: 31, - }, - end_location: Some( - Location { - row: 135, - column: 39, - }, - ), + range: 2270..2278, custom: (), node: MatchAs { pattern: Some( Located { - location: Location { - row: 135, - column: 32, - }, - end_location: Some( - Location { - row: 135, - column: 33, - }, - ), + range: 2271..2272, custom: (), node: MatchValue { value: Located { - location: Location { - row: 135, - column: 32, - }, - end_location: Some( - Location { - row: 135, - column: 33, - }, - ), + range: 2271..2272, custom: (), node: Constant { value: Int( @@ -6324,29 +3183,11 @@ expression: parse_ast }, guard: Some( Located { - location: Location { - row: 135, - column: 43, - }, - end_location: Some( - Location { - row: 135, - column: 53, - }, - ), + range: 2282..2292, custom: (), node: Compare { left: Located { - location: Location { - row: 135, - column: 43, - }, - end_location: Some( - Location { - row: 135, - column: 44, - }, - ), + range: 2282..2283, custom: (), node: Name { id: "z", @@ -6356,31 +3197,13 @@ expression: parse_ast ops: [ Eq, ], - comparators: [ - Located { - location: Location { - row: 135, - column: 48, - }, - end_location: Some( - Location { - row: 135, - column: 53, - }, - ), + comparators: [ + Located { + range: 2287..2292, custom: (), node: BinOp { left: Located { - location: Location { - row: 135, - column: 48, - }, - end_location: Some( - Location { - row: 135, - column: 49, - }, - ), + range: 2287..2288, custom: (), node: Name { id: "x", @@ -6389,16 +3212,7 @@ expression: parse_ast }, op: Mod, right: Located { - location: Location { - row: 135, - column: 52, - }, - end_location: Some( - Location { - row: 135, - column: 53, - }, - ), + range: 2291..2292, custom: (), node: Constant { value: Int( @@ -6415,30 +3229,12 @@ expression: parse_ast ), body: [ Located { - location: Location { - row: 136, - column: 8, - }, - end_location: Some( - Location { - row: 136, - column: 13, - }, - ), + range: 2302..2307, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 136, - column: 8, - }, - end_location: Some( - Location { - row: 136, - column: 9, - }, - ), + range: 2302..2303, custom: (), node: Name { id: "y", @@ -6447,16 +3243,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 136, - column: 12, - }, - end_location: Some( - Location { - row: 136, - column: 13, - }, - ), + range: 2306..2307, custom: (), node: Constant { value: Int( @@ -6474,29 +3261,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 138, - column: 0, - }, - end_location: Some( - Location { - row: 144, - column: 13, - }, - ), + range: 2330..2499, custom: (), node: Match { subject: Located { - location: Location { - row: 138, - column: 6, - }, - end_location: Some( - Location { - row: 138, - column: 7, - }, - ), + range: 2336..2337, custom: (), node: Name { id: "x", @@ -6506,30 +3275,12 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 139, - column: 9, - }, - end_location: Some( - Location { - row: 139, - column: 24, - }, - ), + range: 2348..2363, custom: (), node: MatchMapping { keys: [ Located { - location: Location { - row: 139, - column: 10, - }, - end_location: Some( - Location { - row: 139, - column: 11, - }, - ), + range: 2349..2350, custom: (), node: Constant { value: Int( @@ -6541,43 +3292,16 @@ expression: parse_ast ], patterns: [ Located { - location: Location { - row: 139, - column: 13, - }, - end_location: Some( - Location { - row: 139, - column: 23, - }, - ), + range: 2352..2362, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 139, - column: 14, - }, - end_location: Some( - Location { - row: 139, - column: 15, - }, - ), + range: 2353..2354, custom: (), node: MatchValue { value: Located { - location: Location { - row: 139, - column: 14, - }, - end_location: Some( - Location { - row: 139, - column: 15, - }, - ), + range: 2353..2354, custom: (), node: Constant { value: Int( @@ -6589,29 +3313,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 139, - column: 17, - }, - end_location: Some( - Location { - row: 139, - column: 18, - }, - ), + range: 2356..2357, custom: (), node: MatchValue { value: Located { - location: Location { - row: 139, - column: 17, - }, - end_location: Some( - Location { - row: 139, - column: 18, - }, - ), + range: 2356..2357, custom: (), node: Constant { value: Int( @@ -6623,16 +3329,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 139, - column: 20, - }, - end_location: Some( - Location { - row: 139, - column: 22, - }, - ), + range: 2359..2361, custom: (), node: MatchMapping { keys: [], @@ -6650,30 +3347,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 140, - column: 8, - }, - end_location: Some( - Location { - row: 140, - column: 13, - }, - ), + range: 2373..2378, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 140, - column: 8, - }, - end_location: Some( - Location { - row: 140, - column: 9, - }, - ), + range: 2373..2374, custom: (), node: Name { id: "y", @@ -6682,16 +3361,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 140, - column: 12, - }, - end_location: Some( - Location { - row: 140, - column: 13, - }, - ), + range: 2377..2378, custom: (), node: Constant { value: Int( @@ -6707,44 +3377,17 @@ expression: parse_ast }, MatchCase { pattern: Located { - location: Location { - row: 141, - column: 9, - }, - end_location: Some( - Location { - row: 141, - column: 78, - }, - ), + range: 2388..2457, custom: (), node: MatchOr { patterns: [ Located { - location: Location { - row: 141, - column: 9, - }, - end_location: Some( - Location { - row: 141, - column: 32, - }, - ), + range: 2388..2411, custom: (), node: MatchMapping { keys: [ Located { - location: Location { - row: 141, - column: 10, - }, - end_location: Some( - Location { - row: 141, - column: 11, - }, - ), + range: 2389..2390, custom: (), node: Constant { value: Int( @@ -6756,57 +3399,21 @@ expression: parse_ast ], patterns: [ Located { - location: Location { - row: 141, - column: 13, - }, - end_location: Some( - Location { - row: 141, - column: 31, - }, - ), + range: 2392..2410, custom: (), node: MatchOr { patterns: [ Located { - location: Location { - row: 141, - column: 13, - }, - end_location: Some( - Location { - row: 141, - column: 23, - }, - ), + range: 2392..2402, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 141, - column: 14, - }, - end_location: Some( - Location { - row: 141, - column: 15, - }, - ), + range: 2393..2394, custom: (), node: MatchValue { value: Located { - location: Location { - row: 141, - column: 14, - }, - end_location: Some( - Location { - row: 141, - column: 15, - }, - ), + range: 2393..2394, custom: (), node: Constant { value: Int( @@ -6818,29 +3425,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 141, - column: 17, - }, - end_location: Some( - Location { - row: 141, - column: 18, - }, - ), + range: 2396..2397, custom: (), node: MatchValue { value: Located { - location: Location { - row: 141, - column: 17, - }, - end_location: Some( - Location { - row: 141, - column: 18, - }, - ), + range: 2396..2397, custom: (), node: Constant { value: Int( @@ -6852,16 +3441,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 141, - column: 20, - }, - end_location: Some( - Location { - row: 141, - column: 22, - }, - ), + range: 2399..2401, custom: (), node: MatchMapping { keys: [], @@ -6873,16 +3453,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 141, - column: 26, - }, - end_location: Some( - Location { - row: 141, - column: 31, - }, - ), + range: 2405..2410, custom: (), node: MatchSingleton { value: Bool( @@ -6898,30 +3469,12 @@ expression: parse_ast }, }, Located { - location: Location { - row: 141, - column: 35, - }, - end_location: Some( - Location { - row: 141, - column: 44, - }, - ), + range: 2414..2423, custom: (), node: MatchMapping { keys: [ Located { - location: Location { - row: 141, - column: 36, - }, - end_location: Some( - Location { - row: 141, - column: 37, - }, - ), + range: 2415..2416, custom: (), node: Constant { value: Int( @@ -6933,30 +3486,12 @@ expression: parse_ast ], patterns: [ Located { - location: Location { - row: 141, - column: 39, - }, - end_location: Some( - Location { - row: 141, - column: 43, - }, - ), + range: 2418..2422, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 141, - column: 40, - }, - end_location: Some( - Location { - row: 141, - column: 42, - }, - ), + range: 2419..2421, custom: (), node: MatchSequence { patterns: [], @@ -6970,30 +3505,12 @@ expression: parse_ast }, }, Located { - location: Location { - row: 141, - column: 47, - }, - end_location: Some( - Location { - row: 141, - column: 62, - }, - ), + range: 2426..2441, custom: (), node: MatchMapping { keys: [ Located { - location: Location { - row: 141, - column: 48, - }, - end_location: Some( - Location { - row: 141, - column: 49, - }, - ), + range: 2427..2428, custom: (), node: Constant { value: Int( @@ -7005,43 +3522,16 @@ expression: parse_ast ], patterns: [ Located { - location: Location { - row: 141, - column: 51, - }, - end_location: Some( - Location { - row: 141, - column: 61, - }, - ), + range: 2430..2440, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 141, - column: 52, - }, - end_location: Some( - Location { - row: 141, - column: 53, - }, - ), + range: 2431..2432, custom: (), node: MatchValue { value: Located { - location: Location { - row: 141, - column: 52, - }, - end_location: Some( - Location { - row: 141, - column: 53, - }, - ), + range: 2431..2432, custom: (), node: Constant { value: Int( @@ -7053,29 +3543,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 141, - column: 55, - }, - end_location: Some( - Location { - row: 141, - column: 56, - }, - ), + range: 2434..2435, custom: (), node: MatchValue { value: Located { - location: Location { - row: 141, - column: 55, - }, - end_location: Some( - Location { - row: 141, - column: 56, - }, - ), + range: 2434..2435, custom: (), node: Constant { value: Int( @@ -7087,16 +3559,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 141, - column: 58, - }, - end_location: Some( - Location { - row: 141, - column: 60, - }, - ), + range: 2437..2439, custom: (), node: MatchMapping { keys: [], @@ -7112,45 +3575,18 @@ expression: parse_ast }, }, Located { - location: Location { - row: 141, - column: 65, - }, - end_location: Some( - Location { - row: 141, - column: 67, - }, - ), + range: 2444..2446, custom: (), node: MatchSequence { patterns: [], }, }, Located { - location: Location { - row: 141, - column: 70, - }, - end_location: Some( - Location { - row: 141, - column: 73, - }, - ), + range: 2449..2452, custom: (), node: MatchValue { value: Located { - location: Location { - row: 141, - column: 70, - }, - end_location: Some( - Location { - row: 141, - column: 73, - }, - ), + range: 2449..2452, custom: (), node: Constant { value: Str( @@ -7162,16 +3598,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 141, - column: 76, - }, - end_location: Some( - Location { - row: 141, - column: 78, - }, - ), + range: 2455..2457, custom: (), node: MatchMapping { keys: [], @@ -7185,30 +3612,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 142, - column: 8, - }, - end_location: Some( - Location { - row: 142, - column: 13, - }, - ), + range: 2467..2472, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 142, - column: 8, - }, - end_location: Some( - Location { - row: 142, - column: 9, - }, - ), + range: 2467..2468, custom: (), node: Name { id: "y", @@ -7217,16 +3626,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 142, - column: 12, - }, - end_location: Some( - Location { - row: 142, - column: 13, - }, - ), + range: 2471..2472, custom: (), node: Constant { value: Int( @@ -7242,16 +3642,7 @@ expression: parse_ast }, MatchCase { pattern: Located { - location: Location { - row: 143, - column: 9, - }, - end_location: Some( - Location { - row: 143, - column: 11, - }, - ), + range: 2482..2484, custom: (), node: MatchSequence { patterns: [], @@ -7260,30 +3651,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 144, - column: 8, - }, - end_location: Some( - Location { - row: 144, - column: 13, - }, - ), + range: 2494..2499, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 144, - column: 8, - }, - end_location: Some( - Location { - row: 144, - column: 9, - }, - ), + range: 2494..2495, custom: (), node: Name { id: "y", @@ -7292,16 +3665,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 144, - column: 12, - }, - end_location: Some( - Location { - row: 144, - column: 13, - }, - ), + range: 2498..2499, custom: (), node: Constant { value: Int( @@ -7319,43 +3683,16 @@ expression: parse_ast }, }, Located { - location: Location { - row: 146, - column: 0, - }, - end_location: Some( - Location { - row: 148, - column: 13, - }, - ), + range: 2522..2568, custom: (), node: Match { subject: Located { - location: Location { - row: 146, - column: 6, - }, - end_location: Some( - Location { - row: 146, - column: 15, - }, - ), + range: 2528..2537, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 146, - column: 7, - }, - end_location: Some( - Location { - row: 146, - column: 8, - }, - ), + range: 2529..2530, custom: (), node: Constant { value: Int( @@ -7365,16 +3702,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 146, - column: 10, - }, - end_location: Some( - Location { - row: 146, - column: 11, - }, - ), + range: 2532..2533, custom: (), node: Constant { value: Int( @@ -7384,16 +3712,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 146, - column: 13, - }, - end_location: Some( - Location { - row: 146, - column: 14, - }, - ), + range: 2535..2536, custom: (), node: Constant { value: Int( @@ -7409,43 +3728,16 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 147, - column: 9, - }, - end_location: Some( - Location { - row: 147, - column: 14, - }, - ), + range: 2548..2553, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 147, - column: 9, - }, - end_location: Some( - Location { - row: 147, - column: 10, - }, - ), + range: 2548..2549, custom: (), node: MatchValue { value: Located { - location: Location { - row: 147, - column: 9, - }, - end_location: Some( - Location { - row: 147, - column: 10, - }, - ), + range: 2548..2549, custom: (), node: Constant { value: Int( @@ -7457,16 +3749,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 147, - column: 12, - }, - end_location: Some( - Location { - row: 147, - column: 14, - }, - ), + range: 2551..2553, custom: (), node: MatchStar { name: Some( @@ -7480,30 +3763,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 148, - column: 8, - }, - end_location: Some( - Location { - row: 148, - column: 13, - }, - ), + range: 2563..2568, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 148, - column: 8, - }, - end_location: Some( - Location { - row: 148, - column: 9, - }, - ), + range: 2563..2564, custom: (), node: Name { id: "y", @@ -7512,16 +3777,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 148, - column: 12, - }, - end_location: Some( - Location { - row: 148, - column: 13, - }, - ), + range: 2567..2568, custom: (), node: Constant { value: Int( @@ -7539,43 +3795,16 @@ expression: parse_ast }, }, Located { - location: Location { - row: 150, - column: 0, - }, - end_location: Some( - Location { - row: 152, - column: 13, - }, - ), + range: 2591..2638, custom: (), node: Match { subject: Located { - location: Location { - row: 150, - column: 6, - }, - end_location: Some( - Location { - row: 150, - column: 15, - }, - ), + range: 2597..2606, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 150, - column: 7, - }, - end_location: Some( - Location { - row: 150, - column: 8, - }, - ), + range: 2598..2599, custom: (), node: Constant { value: Int( @@ -7585,16 +3814,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 150, - column: 10, - }, - end_location: Some( - Location { - row: 150, - column: 11, - }, - ), + range: 2601..2602, custom: (), node: Constant { value: Int( @@ -7604,16 +3824,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 150, - column: 13, - }, - end_location: Some( - Location { - row: 150, - column: 14, - }, - ), + range: 2604..2605, custom: (), node: Constant { value: Int( @@ -7629,30 +3840,12 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 151, - column: 9, - }, - end_location: Some( - Location { - row: 151, - column: 15, - }, - ), + range: 2617..2623, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 151, - column: 9, - }, - end_location: Some( - Location { - row: 151, - column: 11, - }, - ), + range: 2617..2619, custom: (), node: MatchStar { name: Some( @@ -7661,29 +3854,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 151, - column: 13, - }, - end_location: Some( - Location { - row: 151, - column: 14, - }, - ), + range: 2621..2622, custom: (), node: MatchValue { value: Located { - location: Location { - row: 151, - column: 13, - }, - end_location: Some( - Location { - row: 151, - column: 14, - }, - ), + range: 2621..2622, custom: (), node: Constant { value: Int( @@ -7700,30 +3875,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 152, - column: 8, - }, - end_location: Some( - Location { - row: 152, - column: 13, - }, - ), + range: 2633..2638, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 152, - column: 8, - }, - end_location: Some( - Location { - row: 152, - column: 9, - }, - ), + range: 2633..2634, custom: (), node: Name { id: "y", @@ -7732,16 +3889,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 152, - column: 12, - }, - end_location: Some( - Location { - row: 152, - column: 13, - }, - ), + range: 2637..2638, custom: (), node: Constant { value: Int( @@ -7759,29 +3907,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 154, - column: 0, - }, - end_location: Some( - Location { - row: 156, - column: 13, - }, - ), + range: 2661..2697, custom: (), node: Match { subject: Located { - location: Location { - row: 154, - column: 6, - }, - end_location: Some( - Location { - row: 154, - column: 7, - }, - ), + range: 2667..2668, custom: (), node: Name { id: "x", @@ -7791,30 +3921,12 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 155, - column: 9, - }, - end_location: Some( - Location { - row: 155, - column: 11, - }, - ), + range: 2680..2682, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 155, - column: 9, - }, - end_location: Some( - Location { - row: 155, - column: 10, - }, - ), + range: 2680..2681, custom: (), node: MatchAs { pattern: None, @@ -7829,30 +3941,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 156, - column: 8, - }, - end_location: Some( - Location { - row: 156, - column: 13, - }, - ), + range: 2692..2697, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 156, - column: 8, - }, - end_location: Some( - Location { - row: 156, - column: 9, - }, - ), + range: 2692..2693, custom: (), node: Name { id: "z", @@ -7861,16 +3955,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 156, - column: 12, - }, - end_location: Some( - Location { - row: 156, - column: 13, - }, - ), + range: 2696..2697, custom: (), node: Constant { value: Int( @@ -7888,43 +3973,16 @@ expression: parse_ast }, }, Located { - location: Location { - row: 158, - column: 0, - }, - end_location: Some( - Location { - row: 160, - column: 13, - }, - ), + range: 2720..2760, custom: (), node: Match { subject: Located { - location: Location { - row: 158, - column: 0, - }, - end_location: Some( - Location { - row: 160, - column: 13, - }, - ), + range: 2720..2760, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 158, - column: 6, - }, - end_location: Some( - Location { - row: 158, - column: 7, - }, - ), + range: 2726..2727, custom: (), node: Name { id: "w", @@ -7932,16 +3990,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 158, - column: 9, - }, - end_location: Some( - Location { - row: 158, - column: 10, - }, - ), + range: 2729..2730, custom: (), node: Name { id: "x", @@ -7955,30 +4004,12 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 159, - column: 9, - }, - end_location: Some( - Location { - row: 159, - column: 13, - }, - ), + range: 2741..2745, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 159, - column: 9, - }, - end_location: Some( - Location { - row: 159, - column: 10, - }, - ), + range: 2741..2742, custom: (), node: MatchAs { pattern: None, @@ -7988,16 +4019,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 159, - column: 12, - }, - end_location: Some( - Location { - row: 159, - column: 13, - }, - ), + range: 2744..2745, custom: (), node: MatchAs { pattern: None, @@ -8012,30 +4034,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 160, - column: 8, - }, - end_location: Some( - Location { - row: 160, - column: 13, - }, - ), + range: 2755..2760, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 160, - column: 8, - }, - end_location: Some( - Location { - row: 160, - column: 9, - }, - ), + range: 2755..2756, custom: (), node: Name { id: "v", @@ -8044,16 +4048,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 160, - column: 12, - }, - end_location: Some( - Location { - row: 160, - column: 13, - }, - ), + range: 2759..2760, custom: (), node: Constant { value: Int( @@ -8071,42 +4066,15 @@ expression: parse_ast }, }, Located { - location: Location { - row: 162, - column: 0, - }, - end_location: Some( - Location { - row: 164, - column: 13, - }, - ), + range: 2783..2829, custom: (), node: Match { subject: Located { - location: Location { - row: 162, - column: 6, - }, - end_location: Some( - Location { - row: 162, - column: 12, - }, - ), + range: 2789..2795, custom: (), node: NamedExpr { target: Located { - location: Location { - row: 162, - column: 6, - }, - end_location: Some( - Location { - row: 162, - column: 7, - }, - ), + range: 2789..2790, custom: (), node: Name { id: "w", @@ -8114,16 +4082,7 @@ expression: parse_ast }, }, value: Located { - location: Location { - row: 162, - column: 11, - }, - end_location: Some( - Location { - row: 162, - column: 12, - }, - ), + range: 2794..2795, custom: (), node: Name { id: "x", @@ -8135,44 +4094,17 @@ expression: parse_ast cases: [ MatchCase { pattern: Located { - location: Location { - row: 163, - column: 9, - }, - end_location: Some( - Location { - row: 163, - column: 16, - }, - ), + range: 2807..2814, custom: (), node: MatchSequence { patterns: [ Located { - location: Location { - row: 163, - column: 9, - }, - end_location: Some( - Location { - row: 163, - column: 15, - }, - ), + range: 2807..2813, custom: (), node: MatchAs { pattern: Some( Located { - location: Location { - row: 163, - column: 9, - }, - end_location: Some( - Location { - row: 163, - column: 10, - }, - ), + range: 2807..2808, custom: (), node: MatchAs { pattern: None, @@ -8193,30 +4125,12 @@ expression: parse_ast guard: None, body: [ Located { - location: Location { - row: 164, - column: 8, - }, - end_location: Some( - Location { - row: 164, - column: 13, - }, - ), + range: 2824..2829, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 164, - column: 8, - }, - end_location: Some( - Location { - row: 164, - column: 9, - }, - ), + range: 2824..2825, custom: (), node: Name { id: "z", @@ -8225,16 +4139,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 164, - column: 12, - }, - end_location: Some( - Location { - row: 164, - column: 13, - }, - ), + range: 2828..2829, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__slice.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__slice.snap index 2d404f064c..930a316ffe 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__slice.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__slice.snap @@ -3,29 +3,11 @@ source: compiler/parser/src/parser.rs expression: parse_ast --- Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 0..8, custom: (), node: Subscript { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 1, - }, - ), + range: 0..1, custom: (), node: Name { id: "x", @@ -33,30 +15,12 @@ Located { }, }, slice: Located { - location: Location { - row: 1, - column: 2, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 2..7, custom: (), node: Slice { lower: Some( Located { - location: Location { - row: 1, - column: 2, - }, - end_location: Some( - Location { - row: 1, - column: 3, - }, - ), + range: 2..3, custom: (), node: Constant { value: Int( @@ -68,16 +32,7 @@ Located { ), upper: Some( Located { - location: Location { - row: 1, - column: 4, - }, - end_location: Some( - Location { - row: 1, - column: 5, - }, - ), + range: 4..5, custom: (), node: Constant { value: Int( @@ -89,16 +44,7 @@ Located { ), step: Some( Located { - location: Location { - row: 1, - column: 6, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 6..7, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__star_index.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__star_index.snap index 897edb232a..44da1d2dc1 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__star_index.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__star_index.snap @@ -4,30 +4,12 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 36, - }, - ), + range: 0..36, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 0..11, custom: (), node: Name { id: "array_slice", @@ -36,29 +18,11 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 1, - column: 14, - }, - end_location: Some( - Location { - row: 1, - column: 36, - }, - ), + range: 14..36, custom: (), node: Subscript { value: Located { - location: Location { - row: 1, - column: 14, - }, - end_location: Some( - Location { - row: 1, - column: 19, - }, - ), + range: 14..19, custom: (), node: Name { id: "array", @@ -66,30 +30,12 @@ expression: parse_ast }, }, slice: Located { - location: Location { - row: 1, - column: 20, - }, - end_location: Some( - Location { - row: 1, - column: 35, - }, - ), + range: 20..35, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 1, - column: 20, - }, - end_location: Some( - Location { - row: 1, - column: 21, - }, - ), + range: 20..21, custom: (), node: Constant { value: Int( @@ -99,29 +45,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 23, - }, - end_location: Some( - Location { - row: 1, - column: 31, - }, - ), + range: 23..31, custom: (), node: Starred { value: Located { - location: Location { - row: 1, - column: 24, - }, - end_location: Some( - Location { - row: 1, - column: 31, - }, - ), + range: 24..31, custom: (), node: Name { id: "indexes", @@ -132,30 +60,12 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 33, - }, - end_location: Some( - Location { - row: 1, - column: 35, - }, - ), + range: 33..35, custom: (), node: UnaryOp { op: USub, operand: Located { - location: Location { - row: 1, - column: 34, - }, - end_location: Some( - Location { - row: 1, - column: 35, - }, - ), + range: 34..35, custom: (), node: Constant { value: Int( @@ -177,43 +87,16 @@ expression: parse_ast }, }, Located { - location: Location { - row: 2, - column: 0, - }, - end_location: Some( - Location { - row: 2, - column: 36, - }, - ), + range: 37..73, custom: (), node: Assign { targets: [ Located { - location: Location { - row: 2, - column: 0, - }, - end_location: Some( - Location { - row: 2, - column: 22, - }, - ), + range: 37..59, custom: (), node: Subscript { value: Located { - location: Location { - row: 2, - column: 0, - }, - end_location: Some( - Location { - row: 2, - column: 5, - }, - ), + range: 37..42, custom: (), node: Name { id: "array", @@ -221,30 +104,12 @@ expression: parse_ast }, }, slice: Located { - location: Location { - row: 2, - column: 6, - }, - end_location: Some( - Location { - row: 2, - column: 21, - }, - ), + range: 43..58, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 2, - column: 6, - }, - end_location: Some( - Location { - row: 2, - column: 7, - }, - ), + range: 43..44, custom: (), node: Constant { value: Int( @@ -254,29 +119,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 2, - column: 9, - }, - end_location: Some( - Location { - row: 2, - column: 17, - }, - ), + range: 46..54, custom: (), node: Starred { value: Located { - location: Location { - row: 2, - column: 10, - }, - end_location: Some( - Location { - row: 2, - column: 17, - }, - ), + range: 47..54, custom: (), node: Name { id: "indexes", @@ -287,30 +134,12 @@ expression: parse_ast }, }, Located { - location: Location { - row: 2, - column: 19, - }, - end_location: Some( - Location { - row: 2, - column: 21, - }, - ), + range: 56..58, custom: (), node: UnaryOp { op: USub, operand: Located { - location: Location { - row: 2, - column: 20, - }, - end_location: Some( - Location { - row: 2, - column: 21, - }, - ), + range: 57..58, custom: (), node: Constant { value: Int( @@ -330,16 +159,7 @@ expression: parse_ast }, ], value: Located { - location: Location { - row: 2, - column: 25, - }, - end_location: Some( - Location { - row: 2, - column: 36, - }, - ), + range: 62..73, custom: (), node: Name { id: "array_slice", @@ -350,42 +170,15 @@ expression: parse_ast }, }, Located { - location: Location { - row: 3, - column: 0, - }, - end_location: Some( - Location { - row: 3, - column: 45, - }, - ), + range: 74..119, custom: (), node: Expr { value: Located { - location: Location { - row: 3, - column: 0, - }, - end_location: Some( - Location { - row: 3, - column: 45, - }, - ), + range: 74..119, custom: (), node: Subscript { value: Located { - location: Location { - row: 3, - column: 0, - }, - end_location: Some( - Location { - row: 3, - column: 5, - }, - ), + range: 74..79, custom: (), node: Name { id: "array", @@ -393,43 +186,16 @@ expression: parse_ast }, }, slice: Located { - location: Location { - row: 3, - column: 6, - }, - end_location: Some( - Location { - row: 3, - column: 44, - }, - ), + range: 80..118, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 3, - column: 6, - }, - end_location: Some( - Location { - row: 3, - column: 24, - }, - ), + range: 80..98, custom: (), node: Starred { value: Located { - location: Location { - row: 3, - column: 7, - }, - end_location: Some( - Location { - row: 3, - column: 24, - }, - ), + range: 81..98, custom: (), node: Name { id: "indexes_to_select", @@ -440,29 +206,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 3, - column: 26, - }, - end_location: Some( - Location { - row: 3, - column: 44, - }, - ), + range: 100..118, custom: (), node: Starred { value: Located { - location: Location { - row: 3, - column: 27, - }, - end_location: Some( - Location { - row: 3, - column: 44, - }, - ), + range: 101..118, custom: (), node: Name { id: "indexes_to_select", @@ -482,42 +230,15 @@ expression: parse_ast }, }, Located { - location: Location { - row: 4, - column: 0, - }, - end_location: Some( - Location { - row: 4, - column: 30, - }, - ), + range: 120..150, custom: (), node: Expr { value: Located { - location: Location { - row: 4, - column: 0, - }, - end_location: Some( - Location { - row: 4, - column: 30, - }, - ), + range: 120..150, custom: (), node: Subscript { value: Located { - location: Location { - row: 4, - column: 0, - }, - end_location: Some( - Location { - row: 4, - column: 5, - }, - ), + range: 120..125, custom: (), node: Name { id: "array", @@ -525,44 +246,17 @@ expression: parse_ast }, }, slice: Located { - location: Location { - row: 4, - column: 6, - }, - end_location: Some( - Location { - row: 4, - column: 29, - }, - ), + range: 126..149, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 4, - column: 6, - }, - end_location: Some( - Location { - row: 4, - column: 9, - }, - ), + range: 126..129, custom: (), node: Slice { lower: Some( Located { - location: Location { - row: 4, - column: 6, - }, - end_location: Some( - Location { - row: 4, - column: 7, - }, - ), + range: 126..127, custom: (), node: Constant { value: Int( @@ -574,16 +268,7 @@ expression: parse_ast ), upper: Some( Located { - location: Location { - row: 4, - column: 8, - }, - end_location: Some( - Location { - row: 4, - column: 9, - }, - ), + range: 128..129, custom: (), node: Constant { value: Int( @@ -597,29 +282,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 4, - column: 11, - }, - end_location: Some( - Location { - row: 4, - column: 29, - }, - ), + range: 131..149, custom: (), node: Starred { value: Located { - location: Location { - row: 4, - column: 12, - }, - end_location: Some( - Location { - row: 4, - column: 29, - }, - ), + range: 132..149, custom: (), node: Name { id: "indexes_to_select", diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__try.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__try.snap index 5b6037ae20..961d4220c3 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__try.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__try.snap @@ -4,57 +4,21 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 6, - column: 30, - }, - ), + range: 0..134, custom: (), node: Try { body: [ Located { - location: Location { - row: 2, - column: 4, - }, - end_location: Some( - Location { - row: 2, - column: 23, - }, - ), + range: 9..28, custom: (), node: Raise { exc: Some( Located { - location: Location { - row: 2, - column: 10, - }, - end_location: Some( - Location { - row: 2, - column: 23, - }, - ), + range: 15..28, custom: (), node: Call { func: Located { - location: Location { - row: 2, - column: 10, - }, - end_location: Some( - Location { - row: 2, - column: 20, - }, - ), + range: 15..25, custom: (), node: Name { id: "ValueError", @@ -63,16 +27,7 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 2, - column: 21, - }, - end_location: Some( - Location { - row: 2, - column: 22, - }, - ), + range: 26..27, custom: (), node: Constant { value: Int( @@ -92,30 +47,12 @@ expression: parse_ast ], handlers: [ Located { - location: Location { - row: 3, - column: 0, - }, - end_location: Some( - Location { - row: 4, - column: 30, - }, - ), + range: 29..82, custom: (), node: ExceptHandler { type_: Some( Located { - location: Location { - row: 3, - column: 7, - }, - end_location: Some( - Location { - row: 3, - column: 16, - }, - ), + range: 36..45, custom: (), node: Name { id: "TypeError", @@ -128,42 +65,15 @@ expression: parse_ast ), body: [ Located { - location: Location { - row: 4, - column: 4, - }, - end_location: Some( - Location { - row: 4, - column: 30, - }, - ), + range: 56..82, custom: (), node: Expr { value: Located { - location: Location { - row: 4, - column: 4, - }, - end_location: Some( - Location { - row: 4, - column: 30, - }, - ), + range: 56..82, custom: (), node: Call { func: Located { - location: Location { - row: 4, - column: 4, - }, - end_location: Some( - Location { - row: 4, - column: 9, - }, - ), + range: 56..61, custom: (), node: Name { id: "print", @@ -172,30 +82,12 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 4, - column: 10, - }, - end_location: Some( - Location { - row: 4, - column: 29, - }, - ), + range: 62..81, custom: (), node: JoinedStr { values: [ Located { - location: Location { - row: 4, - column: 10, - }, - end_location: Some( - Location { - row: 4, - column: 29, - }, - ), + range: 62..81, custom: (), node: Constant { value: Str( @@ -205,42 +97,15 @@ expression: parse_ast }, }, Located { - location: Location { - row: 4, - column: 10, - }, - end_location: Some( - Location { - row: 4, - column: 29, - }, - ), + range: 62..81, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 4, - column: 20, - }, - end_location: Some( - Location { - row: 4, - column: 27, - }, - ), + range: 72..79, custom: (), node: Call { func: Located { - location: Location { - row: 4, - column: 20, - }, - end_location: Some( - Location { - row: 4, - column: 24, - }, - ), + range: 72..76, custom: (), node: Name { id: "type", @@ -249,16 +114,7 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 4, - column: 25, - }, - end_location: Some( - Location { - row: 4, - column: 26, - }, - ), + range: 77..78, custom: (), node: Name { id: "e", @@ -286,30 +142,12 @@ expression: parse_ast }, }, Located { - location: Location { - row: 5, - column: 0, - }, - end_location: Some( - Location { - row: 6, - column: 30, - }, - ), + range: 83..134, custom: (), node: ExceptHandler { type_: Some( Located { - location: Location { - row: 5, - column: 7, - }, - end_location: Some( - Location { - row: 5, - column: 14, - }, - ), + range: 90..97, custom: (), node: Name { id: "OSError", @@ -322,42 +160,15 @@ expression: parse_ast ), body: [ Located { - location: Location { - row: 6, - column: 4, - }, - end_location: Some( - Location { - row: 6, - column: 30, - }, - ), + range: 108..134, custom: (), node: Expr { value: Located { - location: Location { - row: 6, - column: 4, - }, - end_location: Some( - Location { - row: 6, - column: 30, - }, - ), + range: 108..134, custom: (), node: Call { func: Located { - location: Location { - row: 6, - column: 4, - }, - end_location: Some( - Location { - row: 6, - column: 9, - }, - ), + range: 108..113, custom: (), node: Name { id: "print", @@ -366,30 +177,12 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 6, - column: 10, - }, - end_location: Some( - Location { - row: 6, - column: 29, - }, - ), + range: 114..133, custom: (), node: JoinedStr { values: [ Located { - location: Location { - row: 6, - column: 10, - }, - end_location: Some( - Location { - row: 6, - column: 29, - }, - ), + range: 114..133, custom: (), node: Constant { value: Str( @@ -399,42 +192,15 @@ expression: parse_ast }, }, Located { - location: Location { - row: 6, - column: 10, - }, - end_location: Some( - Location { - row: 6, - column: 29, - }, - ), + range: 114..133, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 6, - column: 20, - }, - end_location: Some( - Location { - row: 6, - column: 27, - }, - ), + range: 124..131, custom: (), node: Call { func: Located { - location: Location { - row: 6, - column: 20, - }, - end_location: Some( - Location { - row: 6, - column: 24, - }, - ), + range: 124..128, custom: (), node: Name { id: "type", @@ -443,16 +209,7 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 6, - column: 25, - }, - end_location: Some( - Location { - row: 6, - column: 26, - }, - ), + range: 129..130, custom: (), node: Name { id: "e", diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__try_star.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__try_star.snap index 472f316b58..c36ed2c746 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__try_star.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__try_star.snap @@ -4,57 +4,21 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 7, - column: 57, - }, - ), + range: 0..260, custom: (), node: TryStar { body: [ Located { - location: Location { - row: 2, - column: 4, - }, - end_location: Some( - Location { - row: 3, - column: 62, - }, - ), + range: 9..98, custom: (), node: Raise { exc: Some( Located { - location: Location { - row: 2, - column: 10, - }, - end_location: Some( - Location { - row: 3, - column: 62, - }, - ), + range: 15..98, custom: (), node: Call { func: Located { - location: Location { - row: 2, - column: 10, - }, - end_location: Some( - Location { - row: 2, - column: 24, - }, - ), + range: 15..29, custom: (), node: Name { id: "ExceptionGroup", @@ -63,16 +27,7 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 2, - column: 25, - }, - end_location: Some( - Location { - row: 2, - column: 29, - }, - ), + range: 30..34, custom: (), node: Constant { value: Str( @@ -82,43 +37,16 @@ expression: parse_ast }, }, Located { - location: Location { - row: 3, - column: 8, - }, - end_location: Some( - Location { - row: 3, - column: 61, - }, - ), + range: 44..97, custom: (), node: List { elts: [ Located { - location: Location { - row: 3, - column: 9, - }, - end_location: Some( - Location { - row: 3, - column: 22, - }, - ), + range: 45..58, custom: (), node: Call { func: Located { - location: Location { - row: 3, - column: 9, - }, - end_location: Some( - Location { - row: 3, - column: 19, - }, - ), + range: 45..55, custom: (), node: Name { id: "ValueError", @@ -127,16 +55,7 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 3, - column: 20, - }, - end_location: Some( - Location { - row: 3, - column: 21, - }, - ), + range: 56..57, custom: (), node: Constant { value: Int( @@ -150,29 +69,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 3, - column: 24, - }, - end_location: Some( - Location { - row: 3, - column: 36, - }, - ), + range: 60..72, custom: (), node: Call { func: Located { - location: Location { - row: 3, - column: 24, - }, - end_location: Some( - Location { - row: 3, - column: 33, - }, - ), + range: 60..69, custom: (), node: Name { id: "TypeError", @@ -181,16 +82,7 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 3, - column: 34, - }, - end_location: Some( - Location { - row: 3, - column: 35, - }, - ), + range: 70..71, custom: (), node: Constant { value: Int( @@ -204,29 +96,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 3, - column: 38, - }, - end_location: Some( - Location { - row: 3, - column: 48, - }, - ), + range: 74..84, custom: (), node: Call { func: Located { - location: Location { - row: 3, - column: 38, - }, - end_location: Some( - Location { - row: 3, - column: 45, - }, - ), + range: 74..81, custom: (), node: Name { id: "OSError", @@ -235,16 +109,7 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 3, - column: 46, - }, - end_location: Some( - Location { - row: 3, - column: 47, - }, - ), + range: 82..83, custom: (), node: Constant { value: Int( @@ -258,29 +123,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 3, - column: 50, - }, - end_location: Some( - Location { - row: 3, - column: 60, - }, - ), + range: 86..96, custom: (), node: Call { func: Located { - location: Location { - row: 3, - column: 50, - }, - end_location: Some( - Location { - row: 3, - column: 57, - }, - ), + range: 86..93, custom: (), node: Name { id: "OSError", @@ -289,16 +136,7 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 3, - column: 58, - }, - end_location: Some( - Location { - row: 3, - column: 59, - }, - ), + range: 94..95, custom: (), node: Constant { value: Int( @@ -326,30 +164,12 @@ expression: parse_ast ], handlers: [ Located { - location: Location { - row: 4, - column: 0, - }, - end_location: Some( - Location { - row: 5, - column: 57, - }, - ), + range: 99..180, custom: (), node: ExceptHandler { type_: Some( Located { - location: Location { - row: 4, - column: 8, - }, - end_location: Some( - Location { - row: 4, - column: 17, - }, - ), + range: 107..116, custom: (), node: Name { id: "TypeError", @@ -362,42 +182,15 @@ expression: parse_ast ), body: [ Located { - location: Location { - row: 5, - column: 4, - }, - end_location: Some( - Location { - row: 5, - column: 57, - }, - ), + range: 127..180, custom: (), node: Expr { value: Located { - location: Location { - row: 5, - column: 4, - }, - end_location: Some( - Location { - row: 5, - column: 57, - }, - ), + range: 127..180, custom: (), node: Call { func: Located { - location: Location { - row: 5, - column: 4, - }, - end_location: Some( - Location { - row: 5, - column: 9, - }, - ), + range: 127..132, custom: (), node: Name { id: "print", @@ -406,30 +199,12 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 5, - column: 10, - }, - end_location: Some( - Location { - row: 5, - column: 56, - }, - ), + range: 133..179, custom: (), node: JoinedStr { values: [ Located { - location: Location { - row: 5, - column: 10, - }, - end_location: Some( - Location { - row: 5, - column: 56, - }, - ), + range: 133..179, custom: (), node: Constant { value: Str( @@ -439,42 +214,15 @@ expression: parse_ast }, }, Located { - location: Location { - row: 5, - column: 10, - }, - end_location: Some( - Location { - row: 5, - column: 56, - }, - ), + range: 133..179, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 5, - column: 20, - }, - end_location: Some( - Location { - row: 5, - column: 27, - }, - ), + range: 143..150, custom: (), node: Call { func: Located { - location: Location { - row: 5, - column: 20, - }, - end_location: Some( - Location { - row: 5, - column: 24, - }, - ), + range: 143..147, custom: (), node: Name { id: "type", @@ -483,16 +231,7 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 5, - column: 25, - }, - end_location: Some( - Location { - row: 5, - column: 26, - }, - ), + range: 148..149, custom: (), node: Name { id: "e", @@ -508,16 +247,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 5, - column: 10, - }, - end_location: Some( - Location { - row: 5, - column: 56, - }, - ), + range: 133..179, custom: (), node: Constant { value: Str( @@ -527,42 +257,15 @@ expression: parse_ast }, }, Located { - location: Location { - row: 5, - column: 10, - }, - end_location: Some( - Location { - row: 5, - column: 56, - }, - ), + range: 133..179, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 5, - column: 42, - }, - end_location: Some( - Location { - row: 5, - column: 54, - }, - ), + range: 165..177, custom: (), node: Attribute { value: Located { - location: Location { - row: 5, - column: 42, - }, - end_location: Some( - Location { - row: 5, - column: 43, - }, - ), + range: 165..166, custom: (), node: Name { id: "e", @@ -590,30 +293,12 @@ expression: parse_ast }, }, Located { - location: Location { - row: 6, - column: 0, - }, - end_location: Some( - Location { - row: 7, - column: 57, - }, - ), + range: 181..260, custom: (), node: ExceptHandler { type_: Some( Located { - location: Location { - row: 6, - column: 8, - }, - end_location: Some( - Location { - row: 6, - column: 15, - }, - ), + range: 189..196, custom: (), node: Name { id: "OSError", @@ -626,42 +311,15 @@ expression: parse_ast ), body: [ Located { - location: Location { - row: 7, - column: 4, - }, - end_location: Some( - Location { - row: 7, - column: 57, - }, - ), + range: 207..260, custom: (), node: Expr { value: Located { - location: Location { - row: 7, - column: 4, - }, - end_location: Some( - Location { - row: 7, - column: 57, - }, - ), + range: 207..260, custom: (), node: Call { func: Located { - location: Location { - row: 7, - column: 4, - }, - end_location: Some( - Location { - row: 7, - column: 9, - }, - ), + range: 207..212, custom: (), node: Name { id: "print", @@ -670,30 +328,12 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 7, - column: 10, - }, - end_location: Some( - Location { - row: 7, - column: 56, - }, - ), + range: 213..259, custom: (), node: JoinedStr { values: [ Located { - location: Location { - row: 7, - column: 10, - }, - end_location: Some( - Location { - row: 7, - column: 56, - }, - ), + range: 213..259, custom: (), node: Constant { value: Str( @@ -703,42 +343,15 @@ expression: parse_ast }, }, Located { - location: Location { - row: 7, - column: 10, - }, - end_location: Some( - Location { - row: 7, - column: 56, - }, - ), + range: 213..259, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 7, - column: 20, - }, - end_location: Some( - Location { - row: 7, - column: 27, - }, - ), + range: 223..230, custom: (), node: Call { func: Located { - location: Location { - row: 7, - column: 20, - }, - end_location: Some( - Location { - row: 7, - column: 24, - }, - ), + range: 223..227, custom: (), node: Name { id: "type", @@ -747,16 +360,7 @@ expression: parse_ast }, args: [ Located { - location: Location { - row: 7, - column: 25, - }, - end_location: Some( - Location { - row: 7, - column: 26, - }, - ), + range: 228..229, custom: (), node: Name { id: "e", @@ -772,16 +376,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 7, - column: 10, - }, - end_location: Some( - Location { - row: 7, - column: 56, - }, - ), + range: 213..259, custom: (), node: Constant { value: Str( @@ -791,42 +386,15 @@ expression: parse_ast }, }, Located { - location: Location { - row: 7, - column: 10, - }, - end_location: Some( - Location { - row: 7, - column: 56, - }, - ), + range: 213..259, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 7, - column: 42, - }, - end_location: Some( - Location { - row: 7, - column: 54, - }, - ), + range: 245..257, custom: (), node: Attribute { value: Located { - location: Location { - row: 7, - column: 42, - }, - end_location: Some( - Location { - row: 7, - column: 43, - }, - ), + range: 245..246, custom: (), node: Name { id: "e", diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__variadic_generics.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__variadic_generics.snap index a6875c3ba6..1740366e27 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__variadic_generics.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__variadic_generics.snap @@ -4,16 +4,7 @@ expression: parse_ast --- [ Located { - location: Location { - row: 2, - column: 0, - }, - end_location: Some( - Location { - row: 2, - column: 48, - }, - ), + range: 1..49, custom: (), node: FunctionDef { name: "args_to_tuple", @@ -22,44 +13,17 @@ expression: parse_ast args: [], vararg: Some( Located { - location: Location { - row: 2, - column: 19, - }, - end_location: Some( - Location { - row: 2, - column: 28, - }, - ), + range: 20..29, custom: (), node: ArgData { arg: "args", annotation: Some( Located { - location: Location { - row: 2, - column: 25, - }, - end_location: Some( - Location { - row: 2, - column: 28, - }, - ), + range: 26..29, custom: (), node: Starred { value: Located { - location: Location { - row: 2, - column: 26, - }, - end_location: Some( - Location { - row: 2, - column: 28, - }, - ), + range: 27..29, custom: (), node: Name { id: "Ts", @@ -81,29 +45,11 @@ expression: parse_ast }, body: [ Located { - location: Location { - row: 2, - column: 45, - }, - end_location: Some( - Location { - row: 2, - column: 48, - }, - ), + range: 46..49, custom: (), node: Expr { value: Located { - location: Location { - row: 2, - column: 45, - }, - end_location: Some( - Location { - row: 2, - column: 48, - }, - ), + range: 46..49, custom: (), node: Constant { value: Ellipsis, @@ -116,29 +62,11 @@ expression: parse_ast decorator_list: [], returns: Some( Located { - location: Location { - row: 2, - column: 33, - }, - end_location: Some( - Location { - row: 2, - column: 43, - }, - ), + range: 34..44, custom: (), node: Subscript { value: Located { - location: Location { - row: 2, - column: 33, - }, - end_location: Some( - Location { - row: 2, - column: 38, - }, - ), + range: 34..39, custom: (), node: Name { id: "Tuple", @@ -146,29 +74,11 @@ expression: parse_ast }, }, slice: Located { - location: Location { - row: 2, - column: 39, - }, - end_location: Some( - Location { - row: 2, - column: 42, - }, - ), + range: 40..43, custom: (), node: Starred { value: Located { - location: Location { - row: 2, - column: 40, - }, - end_location: Some( - Location { - row: 2, - column: 42, - }, - ), + range: 41..43, custom: (), node: Name { id: "Ts", diff --git a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__with_statement.snap b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__with_statement.snap index 8ac056bbec..027646cb94 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__parser__tests__with_statement.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__parser__tests__with_statement.snap @@ -4,31 +4,13 @@ expression: "parse_program(source, \"\").unwrap()" --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 12, - }, - ), + range: 0..12, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 1, - column: 5, - }, - end_location: Some( - Location { - row: 1, - column: 6, - }, - ), + range: 5..6, custom: (), node: Constant { value: Int( @@ -42,16 +24,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 1, - column: 8, - }, - end_location: Some( - Location { - row: 1, - column: 12, - }, - ), + range: 8..12, custom: (), node: Pass, }, @@ -60,31 +33,13 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 2, - column: 0, - }, - end_location: Some( - Location { - row: 2, - column: 17, - }, - ), + range: 13..30, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 2, - column: 5, - }, - end_location: Some( - Location { - row: 2, - column: 6, - }, - ), + range: 18..19, custom: (), node: Constant { value: Int( @@ -95,16 +50,7 @@ expression: "parse_program(source, \"\").unwrap()" }, optional_vars: Some( Located { - location: Location { - row: 2, - column: 10, - }, - end_location: Some( - Location { - row: 2, - column: 11, - }, - ), + range: 23..24, custom: (), node: Name { id: "x", @@ -116,16 +62,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 2, - column: 13, - }, - end_location: Some( - Location { - row: 2, - column: 17, - }, - ), + range: 26..30, custom: (), node: Pass, }, @@ -134,31 +71,13 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 3, - column: 0, - }, - end_location: Some( - Location { - row: 3, - column: 15, - }, - ), + range: 31..46, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 3, - column: 5, - }, - end_location: Some( - Location { - row: 3, - column: 6, - }, - ), + range: 36..37, custom: (), node: Constant { value: Int( @@ -171,16 +90,7 @@ expression: "parse_program(source, \"\").unwrap()" }, Withitem { context_expr: Located { - location: Location { - row: 3, - column: 8, - }, - end_location: Some( - Location { - row: 3, - column: 9, - }, - ), + range: 39..40, custom: (), node: Constant { value: Int( @@ -194,16 +104,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 3, - column: 11, - }, - end_location: Some( - Location { - row: 3, - column: 15, - }, - ), + range: 42..46, custom: (), node: Pass, }, @@ -212,31 +113,13 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 4, - column: 0, - }, - end_location: Some( - Location { - row: 4, - column: 25, - }, - ), + range: 47..72, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 4, - column: 5, - }, - end_location: Some( - Location { - row: 4, - column: 6, - }, - ), + range: 52..53, custom: (), node: Constant { value: Int( @@ -247,16 +130,7 @@ expression: "parse_program(source, \"\").unwrap()" }, optional_vars: Some( Located { - location: Location { - row: 4, - column: 10, - }, - end_location: Some( - Location { - row: 4, - column: 11, - }, - ), + range: 57..58, custom: (), node: Name { id: "x", @@ -267,16 +141,7 @@ expression: "parse_program(source, \"\").unwrap()" }, Withitem { context_expr: Located { - location: Location { - row: 4, - column: 13, - }, - end_location: Some( - Location { - row: 4, - column: 14, - }, - ), + range: 60..61, custom: (), node: Constant { value: Int( @@ -287,16 +152,7 @@ expression: "parse_program(source, \"\").unwrap()" }, optional_vars: Some( Located { - location: Location { - row: 4, - column: 18, - }, - end_location: Some( - Location { - row: 4, - column: 19, - }, - ), + range: 65..66, custom: (), node: Name { id: "y", @@ -308,16 +164,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 4, - column: 21, - }, - end_location: Some( - Location { - row: 4, - column: 25, - }, - ), + range: 68..72, custom: (), node: Pass, }, @@ -326,44 +173,17 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 5, - column: 0, - }, - end_location: Some( - Location { - row: 5, - column: 24, - }, - ), + range: 73..97, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 5, - column: 5, - }, - end_location: Some( - Location { - row: 5, - column: 18, - }, - ), + range: 78..91, custom: (), node: IfExp { test: Located { - location: Location { - row: 5, - column: 10, - }, - end_location: Some( - Location { - row: 5, - column: 11, - }, - ), + range: 83..84, custom: (), node: Constant { value: Int( @@ -373,16 +193,7 @@ expression: "parse_program(source, \"\").unwrap()" }, }, body: Located { - location: Location { - row: 5, - column: 5, - }, - end_location: Some( - Location { - row: 5, - column: 6, - }, - ), + range: 78..79, custom: (), node: Constant { value: Int( @@ -392,16 +203,7 @@ expression: "parse_program(source, \"\").unwrap()" }, }, orelse: Located { - location: Location { - row: 5, - column: 17, - }, - end_location: Some( - Location { - row: 5, - column: 18, - }, - ), + range: 90..91, custom: (), node: Constant { value: Int( @@ -417,16 +219,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 5, - column: 20, - }, - end_location: Some( - Location { - row: 5, - column: 24, - }, - ), + range: 93..97, custom: (), node: Pass, }, @@ -435,44 +228,17 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 6, - column: 0, - }, - end_location: Some( - Location { - row: 6, - column: 29, - }, - ), + range: 98..127, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 6, - column: 5, - }, - end_location: Some( - Location { - row: 6, - column: 18, - }, - ), + range: 103..116, custom: (), node: IfExp { test: Located { - location: Location { - row: 6, - column: 10, - }, - end_location: Some( - Location { - row: 6, - column: 11, - }, - ), + range: 108..109, custom: (), node: Constant { value: Int( @@ -482,16 +248,7 @@ expression: "parse_program(source, \"\").unwrap()" }, }, body: Located { - location: Location { - row: 6, - column: 5, - }, - end_location: Some( - Location { - row: 6, - column: 6, - }, - ), + range: 103..104, custom: (), node: Constant { value: Int( @@ -501,16 +258,7 @@ expression: "parse_program(source, \"\").unwrap()" }, }, orelse: Located { - location: Location { - row: 6, - column: 17, - }, - end_location: Some( - Location { - row: 6, - column: 18, - }, - ), + range: 115..116, custom: (), node: Constant { value: Int( @@ -523,16 +271,7 @@ expression: "parse_program(source, \"\").unwrap()" }, optional_vars: Some( Located { - location: Location { - row: 6, - column: 22, - }, - end_location: Some( - Location { - row: 6, - column: 23, - }, - ), + range: 120..121, custom: (), node: Name { id: "x", @@ -544,16 +283,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 6, - column: 25, - }, - end_location: Some( - Location { - row: 6, - column: 29, - }, - ), + range: 123..127, custom: (), node: Pass, }, @@ -562,31 +292,13 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 7, - column: 0, - }, - end_location: Some( - Location { - row: 7, - column: 13, - }, - ), + range: 128..141, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 7, - column: 5, - }, - end_location: Some( - Location { - row: 7, - column: 7, - }, - ), + range: 133..135, custom: (), node: Tuple { elts: [], @@ -598,16 +310,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 7, - column: 9, - }, - end_location: Some( - Location { - row: 7, - column: 13, - }, - ), + range: 137..141, custom: (), node: Pass, }, @@ -616,31 +319,13 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 8, - column: 0, - }, - end_location: Some( - Location { - row: 8, - column: 18, - }, - ), + range: 142..160, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 8, - column: 5, - }, - end_location: Some( - Location { - row: 8, - column: 7, - }, - ), + range: 147..149, custom: (), node: Tuple { elts: [], @@ -649,16 +334,7 @@ expression: "parse_program(source, \"\").unwrap()" }, optional_vars: Some( Located { - location: Location { - row: 8, - column: 11, - }, - end_location: Some( - Location { - row: 8, - column: 12, - }, - ), + range: 153..154, custom: (), node: Name { id: "x", @@ -670,16 +346,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 8, - column: 14, - }, - end_location: Some( - Location { - row: 8, - column: 18, - }, - ), + range: 156..160, custom: (), node: Pass, }, @@ -688,31 +355,13 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 9, - column: 0, - }, - end_location: Some( - Location { - row: 9, - column: 14, - }, - ), + range: 161..175, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 9, - column: 6, - }, - end_location: Some( - Location { - row: 9, - column: 7, - }, - ), + range: 167..168, custom: (), node: Constant { value: Int( @@ -726,16 +375,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 9, - column: 10, - }, - end_location: Some( - Location { - row: 9, - column: 14, - }, - ), + range: 171..175, custom: (), node: Pass, }, @@ -744,31 +384,13 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 10, - column: 0, - }, - end_location: Some( - Location { - row: 10, - column: 19, - }, - ), + range: 176..195, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 10, - column: 6, - }, - end_location: Some( - Location { - row: 10, - column: 7, - }, - ), + range: 182..183, custom: (), node: Constant { value: Int( @@ -779,16 +401,7 @@ expression: "parse_program(source, \"\").unwrap()" }, optional_vars: Some( Located { - location: Location { - row: 10, - column: 12, - }, - end_location: Some( - Location { - row: 10, - column: 13, - }, - ), + range: 188..189, custom: (), node: Name { id: "x", @@ -800,16 +413,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 10, - column: 15, - }, - end_location: Some( - Location { - row: 10, - column: 19, - }, - ), + range: 191..195, custom: (), node: Pass, }, @@ -818,31 +422,13 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 11, - column: 0, - }, - end_location: Some( - Location { - row: 11, - column: 15, - }, - ), + range: 196..211, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 11, - column: 6, - }, - end_location: Some( - Location { - row: 11, - column: 7, - }, - ), + range: 202..203, custom: (), node: Constant { value: Int( @@ -856,16 +442,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 11, - column: 11, - }, - end_location: Some( - Location { - row: 11, - column: 15, - }, - ), + range: 207..211, custom: (), node: Pass, }, @@ -874,45 +451,18 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 12, - column: 0, - }, - end_location: Some( - Location { - row: 12, - column: 20, - }, - ), + range: 212..232, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 12, - column: 5, - }, - end_location: Some( - Location { - row: 12, - column: 9, - }, - ), + range: 217..221, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 12, - column: 6, - }, - end_location: Some( - Location { - row: 12, - column: 7, - }, - ), + range: 218..219, custom: (), node: Constant { value: Int( @@ -927,16 +477,7 @@ expression: "parse_program(source, \"\").unwrap()" }, optional_vars: Some( Located { - location: Location { - row: 12, - column: 13, - }, - end_location: Some( - Location { - row: 12, - column: 14, - }, - ), + range: 225..226, custom: (), node: Name { id: "x", @@ -948,16 +489,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 12, - column: 16, - }, - end_location: Some( - Location { - row: 12, - column: 20, - }, - ), + range: 228..232, custom: (), node: Pass, }, @@ -966,31 +498,13 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 13, - column: 0, - }, - end_location: Some( - Location { - row: 13, - column: 17, - }, - ), + range: 233..250, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 13, - column: 6, - }, - end_location: Some( - Location { - row: 13, - column: 7, - }, - ), + range: 239..240, custom: (), node: Constant { value: Int( @@ -1003,16 +517,7 @@ expression: "parse_program(source, \"\").unwrap()" }, Withitem { context_expr: Located { - location: Location { - row: 13, - column: 9, - }, - end_location: Some( - Location { - row: 13, - column: 10, - }, - ), + range: 242..243, custom: (), node: Constant { value: Int( @@ -1026,16 +531,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 13, - column: 13, - }, - end_location: Some( - Location { - row: 13, - column: 17, - }, - ), + range: 246..250, custom: (), node: Pass, }, @@ -1044,45 +540,18 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 14, - column: 0, - }, - end_location: Some( - Location { - row: 14, - column: 22, - }, - ), + range: 251..273, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 14, - column: 5, - }, - end_location: Some( - Location { - row: 14, - column: 11, - }, - ), + range: 256..262, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 14, - column: 6, - }, - end_location: Some( - Location { - row: 14, - column: 7, - }, - ), + range: 257..258, custom: (), node: Constant { value: Int( @@ -1092,16 +561,7 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 14, - column: 9, - }, - end_location: Some( - Location { - row: 14, - column: 10, - }, - ), + range: 260..261, custom: (), node: Constant { value: Int( @@ -1116,16 +576,7 @@ expression: "parse_program(source, \"\").unwrap()" }, optional_vars: Some( Located { - location: Location { - row: 14, - column: 15, - }, - end_location: Some( - Location { - row: 14, - column: 16, - }, - ), + range: 266..267, custom: (), node: Name { id: "x", @@ -1137,16 +588,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 14, - column: 18, - }, - end_location: Some( - Location { - row: 14, - column: 22, - }, - ), + range: 269..273, custom: (), node: Pass, }, @@ -1155,58 +597,22 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 15, - column: 0, - }, - end_location: Some( - Location { - row: 15, - column: 16, - }, - ), + range: 274..290, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 15, - column: 5, - }, - end_location: Some( - Location { - row: 15, - column: 10, - }, - ), + range: 279..284, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 15, - column: 6, - }, - end_location: Some( - Location { - row: 15, - column: 8, - }, - ), + range: 280..282, custom: (), node: Starred { value: Located { - location: Location { - row: 15, - column: 7, - }, - end_location: Some( - Location { - row: 15, - column: 8, - }, - ), + range: 281..282, custom: (), node: Name { id: "a", @@ -1225,16 +631,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 15, - column: 12, - }, - end_location: Some( - Location { - row: 15, - column: 16, - }, - ), + range: 286..290, custom: (), node: Pass, }, @@ -1243,58 +640,22 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 16, - column: 0, - }, - end_location: Some( - Location { - row: 16, - column: 21, - }, - ), + range: 291..312, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 16, - column: 5, - }, - end_location: Some( - Location { - row: 16, - column: 10, - }, - ), + range: 296..301, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 16, - column: 6, - }, - end_location: Some( - Location { - row: 16, - column: 8, - }, - ), + range: 297..299, custom: (), node: Starred { value: Located { - location: Location { - row: 16, - column: 7, - }, - end_location: Some( - Location { - row: 16, - column: 8, - }, - ), + range: 298..299, custom: (), node: Name { id: "a", @@ -1310,16 +671,7 @@ expression: "parse_program(source, \"\").unwrap()" }, optional_vars: Some( Located { - location: Location { - row: 16, - column: 14, - }, - end_location: Some( - Location { - row: 16, - column: 15, - }, - ), + range: 305..306, custom: (), node: Name { id: "x", @@ -1331,16 +683,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 16, - column: 17, - }, - end_location: Some( - Location { - row: 16, - column: 21, - }, - ), + range: 308..312, custom: (), node: Pass, }, @@ -1349,45 +692,18 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 17, - column: 0, - }, - end_location: Some( - Location { - row: 17, - column: 18, - }, - ), + range: 313..331, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 17, - column: 5, - }, - end_location: Some( - Location { - row: 17, - column: 12, - }, - ), + range: 318..325, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 17, - column: 6, - }, - end_location: Some( - Location { - row: 17, - column: 7, - }, - ), + range: 319..320, custom: (), node: Constant { value: Int( @@ -1397,29 +713,11 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 17, - column: 9, - }, - end_location: Some( - Location { - row: 17, - column: 11, - }, - ), + range: 322..324, custom: (), node: Starred { value: Located { - location: Location { - row: 17, - column: 10, - }, - end_location: Some( - Location { - row: 17, - column: 11, - }, - ), + range: 323..324, custom: (), node: Name { id: "a", @@ -1438,16 +736,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 17, - column: 14, - }, - end_location: Some( - Location { - row: 17, - column: 18, - }, - ), + range: 327..331, custom: (), node: Pass, }, @@ -1456,45 +745,18 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 18, - column: 0, - }, - end_location: Some( - Location { - row: 18, - column: 23, - }, - ), + range: 332..355, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 18, - column: 5, - }, - end_location: Some( - Location { - row: 18, - column: 12, - }, - ), + range: 337..344, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 18, - column: 6, - }, - end_location: Some( - Location { - row: 18, - column: 7, - }, - ), + range: 338..339, custom: (), node: Constant { value: Int( @@ -1504,29 +766,11 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 18, - column: 9, - }, - end_location: Some( - Location { - row: 18, - column: 11, - }, - ), + range: 341..343, custom: (), node: Starred { value: Located { - location: Location { - row: 18, - column: 10, - }, - end_location: Some( - Location { - row: 18, - column: 11, - }, - ), + range: 342..343, custom: (), node: Name { id: "a", @@ -1542,16 +786,7 @@ expression: "parse_program(source, \"\").unwrap()" }, optional_vars: Some( Located { - location: Location { - row: 18, - column: 16, - }, - end_location: Some( - Location { - row: 18, - column: 17, - }, - ), + range: 348..349, custom: (), node: Name { id: "x", @@ -1563,16 +798,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 18, - column: 19, - }, - end_location: Some( - Location { - row: 18, - column: 23, - }, - ), + range: 351..355, custom: (), node: Pass, }, @@ -1581,44 +807,17 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 19, - column: 0, - }, - end_location: Some( - Location { - row: 19, - column: 19, - }, - ), + range: 356..375, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 19, - column: 6, - }, - end_location: Some( - Location { - row: 19, - column: 12, - }, - ), + range: 362..368, custom: (), node: NamedExpr { target: Located { - location: Location { - row: 19, - column: 6, - }, - end_location: Some( - Location { - row: 19, - column: 7, - }, - ), + range: 362..363, custom: (), node: Name { id: "a", @@ -1626,16 +825,7 @@ expression: "parse_program(source, \"\").unwrap()" }, }, value: Located { - location: Location { - row: 19, - column: 11, - }, - end_location: Some( - Location { - row: 19, - column: 12, - }, - ), + range: 367..368, custom: (), node: Constant { value: Int( @@ -1651,16 +841,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 19, - column: 15, - }, - end_location: Some( - Location { - row: 19, - column: 19, - }, - ), + range: 371..375, custom: (), node: Pass, }, @@ -1669,44 +850,17 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 20, - column: 0, - }, - end_location: Some( - Location { - row: 20, - column: 24, - }, - ), + range: 376..400, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 20, - column: 6, - }, - end_location: Some( - Location { - row: 20, - column: 12, - }, - ), + range: 382..388, custom: (), node: NamedExpr { target: Located { - location: Location { - row: 20, - column: 6, - }, - end_location: Some( - Location { - row: 20, - column: 7, - }, - ), + range: 382..383, custom: (), node: Name { id: "a", @@ -1714,16 +868,7 @@ expression: "parse_program(source, \"\").unwrap()" }, }, value: Located { - location: Location { - row: 20, - column: 11, - }, - end_location: Some( - Location { - row: 20, - column: 12, - }, - ), + range: 387..388, custom: (), node: Constant { value: Int( @@ -1736,16 +881,7 @@ expression: "parse_program(source, \"\").unwrap()" }, optional_vars: Some( Located { - location: Location { - row: 20, - column: 17, - }, - end_location: Some( - Location { - row: 20, - column: 18, - }, - ), + range: 393..394, custom: (), node: Name { id: "x", @@ -1757,16 +893,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 20, - column: 20, - }, - end_location: Some( - Location { - row: 20, - column: 24, - }, - ), + range: 396..400, custom: (), node: Pass, }, @@ -1775,58 +902,22 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 21, - column: 0, - }, - end_location: Some( - Location { - row: 21, - column: 27, - }, - ), + range: 401..428, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 21, - column: 5, - }, - end_location: Some( - Location { - row: 21, - column: 21, - }, - ), + range: 406..422, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 21, - column: 6, - }, - end_location: Some( - Location { - row: 21, - column: 12, - }, - ), + range: 407..413, custom: (), node: NamedExpr { target: Located { - location: Location { - row: 21, - column: 6, - }, - end_location: Some( - Location { - row: 21, - column: 7, - }, - ), + range: 407..408, custom: (), node: Name { id: "a", @@ -1834,16 +925,7 @@ expression: "parse_program(source, \"\").unwrap()" }, }, value: Located { - location: Location { - row: 21, - column: 11, - }, - end_location: Some( - Location { - row: 21, - column: 12, - }, - ), + range: 412..413, custom: (), node: Constant { value: Int( @@ -1855,29 +937,11 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 21, - column: 14, - }, - end_location: Some( - Location { - row: 21, - column: 20, - }, - ), + range: 415..421, custom: (), node: NamedExpr { target: Located { - location: Location { - row: 21, - column: 14, - }, - end_location: Some( - Location { - row: 21, - column: 15, - }, - ), + range: 415..416, custom: (), node: Name { id: "b", @@ -1885,16 +949,7 @@ expression: "parse_program(source, \"\").unwrap()" }, }, value: Located { - location: Location { - row: 21, - column: 19, - }, - end_location: Some( - Location { - row: 21, - column: 20, - }, - ), + range: 420..421, custom: (), node: Constant { value: Int( @@ -1914,16 +969,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 21, - column: 23, - }, - end_location: Some( - Location { - row: 21, - column: 27, - }, - ), + range: 424..428, custom: (), node: Pass, }, @@ -1932,58 +978,22 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 22, - column: 0, - }, - end_location: Some( - Location { - row: 22, - column: 32, - }, - ), + range: 429..461, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 22, - column: 5, - }, - end_location: Some( - Location { - row: 22, - column: 21, - }, - ), + range: 434..450, custom: (), node: Tuple { elts: [ Located { - location: Location { - row: 22, - column: 6, - }, - end_location: Some( - Location { - row: 22, - column: 12, - }, - ), + range: 435..441, custom: (), node: NamedExpr { target: Located { - location: Location { - row: 22, - column: 6, - }, - end_location: Some( - Location { - row: 22, - column: 7, - }, - ), + range: 435..436, custom: (), node: Name { id: "a", @@ -1991,16 +1001,7 @@ expression: "parse_program(source, \"\").unwrap()" }, }, value: Located { - location: Location { - row: 22, - column: 11, - }, - end_location: Some( - Location { - row: 22, - column: 12, - }, - ), + range: 440..441, custom: (), node: Constant { value: Int( @@ -2012,29 +1013,11 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 22, - column: 14, - }, - end_location: Some( - Location { - row: 22, - column: 20, - }, - ), + range: 443..449, custom: (), node: NamedExpr { target: Located { - location: Location { - row: 22, - column: 14, - }, - end_location: Some( - Location { - row: 22, - column: 15, - }, - ), + range: 443..444, custom: (), node: Name { id: "b", @@ -2042,16 +1025,7 @@ expression: "parse_program(source, \"\").unwrap()" }, }, value: Located { - location: Location { - row: 22, - column: 19, - }, - end_location: Some( - Location { - row: 22, - column: 20, - }, - ), + range: 448..449, custom: (), node: Constant { value: Int( @@ -2068,16 +1042,7 @@ expression: "parse_program(source, \"\").unwrap()" }, optional_vars: Some( Located { - location: Location { - row: 22, - column: 25, - }, - end_location: Some( - Location { - row: 22, - column: 26, - }, - ), + range: 454..455, custom: (), node: Name { id: "x", @@ -2089,16 +1054,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 22, - column: 28, - }, - end_location: Some( - Location { - row: 22, - column: 32, - }, - ), + range: 457..461, custom: (), node: Pass, }, @@ -2107,31 +1063,13 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 23, - column: 0, - }, - end_location: Some( - Location { - row: 23, - column: 19, - }, - ), + range: 462..481, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 23, - column: 6, - }, - end_location: Some( - Location { - row: 23, - column: 7, - }, - ), + range: 468..469, custom: (), node: Constant { value: Int( @@ -2142,16 +1080,7 @@ expression: "parse_program(source, \"\").unwrap()" }, optional_vars: Some( Located { - location: Location { - row: 23, - column: 11, - }, - end_location: Some( - Location { - row: 23, - column: 12, - }, - ), + range: 473..474, custom: (), node: Name { id: "a", @@ -2163,16 +1092,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 23, - column: 15, - }, - end_location: Some( - Location { - row: 23, - column: 19, - }, - ), + range: 477..481, custom: (), node: Pass, }, @@ -2181,31 +1101,13 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 24, - column: 0, - }, - end_location: Some( - Location { - row: 24, - column: 20, - }, - ), + range: 482..502, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 24, - column: 6, - }, - end_location: Some( - Location { - row: 24, - column: 7, - }, - ), + range: 488..489, custom: (), node: Constant { value: Int( @@ -2216,16 +1118,7 @@ expression: "parse_program(source, \"\").unwrap()" }, optional_vars: Some( Located { - location: Location { - row: 24, - column: 11, - }, - end_location: Some( - Location { - row: 24, - column: 12, - }, - ), + range: 493..494, custom: (), node: Name { id: "a", @@ -2237,16 +1130,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 24, - column: 16, - }, - end_location: Some( - Location { - row: 24, - column: 20, - }, - ), + range: 498..502, custom: (), node: Pass, }, @@ -2255,31 +1139,13 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 25, - column: 0, - }, - end_location: Some( - Location { - row: 25, - column: 27, - }, - ), + range: 503..530, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 25, - column: 6, - }, - end_location: Some( - Location { - row: 25, - column: 7, - }, - ), + range: 509..510, custom: (), node: Constant { value: Int( @@ -2290,16 +1156,7 @@ expression: "parse_program(source, \"\").unwrap()" }, optional_vars: Some( Located { - location: Location { - row: 25, - column: 11, - }, - end_location: Some( - Location { - row: 25, - column: 12, - }, - ), + range: 514..515, custom: (), node: Name { id: "a", @@ -2310,16 +1167,7 @@ expression: "parse_program(source, \"\").unwrap()" }, Withitem { context_expr: Located { - location: Location { - row: 25, - column: 14, - }, - end_location: Some( - Location { - row: 25, - column: 15, - }, - ), + range: 517..518, custom: (), node: Constant { value: Int( @@ -2330,16 +1178,7 @@ expression: "parse_program(source, \"\").unwrap()" }, optional_vars: Some( Located { - location: Location { - row: 25, - column: 19, - }, - end_location: Some( - Location { - row: 25, - column: 20, - }, - ), + range: 522..523, custom: (), node: Name { id: "b", @@ -2351,16 +1190,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 25, - column: 23, - }, - end_location: Some( - Location { - row: 25, - column: 27, - }, - ), + range: 526..530, custom: (), node: Pass, }, @@ -2369,31 +1199,13 @@ expression: "parse_program(source, \"\").unwrap()" }, }, Located { - location: Location { - row: 26, - column: 0, - }, - end_location: Some( - Location { - row: 26, - column: 28, - }, - ), + range: 531..559, custom: (), node: With { items: [ Withitem { context_expr: Located { - location: Location { - row: 26, - column: 6, - }, - end_location: Some( - Location { - row: 26, - column: 7, - }, - ), + range: 537..538, custom: (), node: Constant { value: Int( @@ -2404,16 +1216,7 @@ expression: "parse_program(source, \"\").unwrap()" }, optional_vars: Some( Located { - location: Location { - row: 26, - column: 11, - }, - end_location: Some( - Location { - row: 26, - column: 12, - }, - ), + range: 542..543, custom: (), node: Name { id: "a", @@ -2424,16 +1227,7 @@ expression: "parse_program(source, \"\").unwrap()" }, Withitem { context_expr: Located { - location: Location { - row: 26, - column: 14, - }, - end_location: Some( - Location { - row: 26, - column: 15, - }, - ), + range: 545..546, custom: (), node: Constant { value: Int( @@ -2444,16 +1238,7 @@ expression: "parse_program(source, \"\").unwrap()" }, optional_vars: Some( Located { - location: Location { - row: 26, - column: 19, - }, - end_location: Some( - Location { - row: 26, - column: 20, - }, - ), + range: 550..551, custom: (), node: Name { id: "b", @@ -2465,16 +1250,7 @@ expression: "parse_program(source, \"\").unwrap()" ], body: [ Located { - location: Location { - row: 26, - column: 24, - }, - end_location: Some( - Location { - row: 26, - column: 28, - }, - ), + range: 555..559, custom: (), node: Pass, }, diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__backspace_alias.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__backspace_alias.snap index eea9786970..e869f8e54d 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__backspace_alias.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__backspace_alias.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 15, - }, - ), + range: 0..15, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 15, - }, - ), + range: 0..15, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__bell_alias.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__bell_alias.snap index cf04fd68fd..bc06ee8e46 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__bell_alias.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__bell_alias.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 9, - }, - ), + range: 0..9, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 9, - }, - ), + range: 0..9, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__carriage_return_alias.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__carriage_return_alias.snap index 33a84d2291..9e9a9401eb 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__carriage_return_alias.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__carriage_return_alias.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 21, - }, - ), + range: 0..21, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 21, - }, - ), + range: 0..21, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__character_tabulation_with_justification_alias.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__character_tabulation_with_justification_alias.snap index 282706f8b9..7d91697a80 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__character_tabulation_with_justification_alias.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__character_tabulation_with_justification_alias.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 45, - }, - ), + range: 0..45, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 45, - }, - ), + range: 0..45, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__delete_alias.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__delete_alias.snap index 06e74d248a..19c867101e 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__delete_alias.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__delete_alias.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 12, - }, - ), + range: 0..12, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 12, - }, - ), + range: 0..12, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__double_quoted_byte.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__double_quoted_byte.snap index 0d8c8c9ab1..488c745dea 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__double_quoted_byte.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__double_quoted_byte.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 738, - }, - ), + range: 0..738, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 738, - }, - ), + range: 0..738, custom: (), node: Constant { value: Bytes( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__escape_alias.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__escape_alias.snap index 751456db8c..eff50d53e2 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__escape_alias.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__escape_alias.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 12, - }, - ), + range: 0..12, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 12, - }, - ), + range: 0..12, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__escape_char_in_byte_literal.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__escape_char_in_byte_literal.snap index 98fc3c7949..29d76e27c1 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__escape_char_in_byte_literal.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__escape_char_in_byte_literal.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 0..13, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 0..13, custom: (), node: Constant { value: Bytes( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__escape_octet.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__escape_octet.snap index 677e3f9f86..0e8823046e 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__escape_octet.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__escape_octet.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 0..14, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 0..14, custom: (), node: Constant { value: Bytes( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__form_feed_alias.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__form_feed_alias.snap index b91c10ebe2..0413645e50 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__form_feed_alias.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__form_feed_alias.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 15, - }, - ), + range: 0..15, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 15, - }, - ), + range: 0..15, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_escaped_character.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_escaped_character.snap index 7ab1247bf1..0cfcb3978f 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_escaped_character.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_escaped_character.snap @@ -4,43 +4,16 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 0..8, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 0..8, custom: (), node: JoinedStr { values: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 0..8, custom: (), node: Constant { value: Str( @@ -50,29 +23,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 0..8, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 1, - column: 5, - }, - end_location: Some( - Location { - row: 1, - column: 6, - }, - ), + range: 5..6, custom: (), node: Name { id: "x", diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_escaped_newline.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_escaped_newline.snap index 8359845998..9d14654cdf 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_escaped_newline.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_escaped_newline.snap @@ -4,43 +4,16 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 0..8, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 0..8, custom: (), node: JoinedStr { values: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 0..8, custom: (), node: Constant { value: Str( @@ -50,29 +23,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 0..8, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 1, - column: 5, - }, - end_location: Some( - Location { - row: 1, - column: 6, - }, - ), + range: 5..6, custom: (), node: Name { id: "x", diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_line_continuation.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_line_continuation.snap index 2f6167d4ba..c02fa300d8 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_line_continuation.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_line_continuation.snap @@ -4,43 +4,16 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 2, - column: 4, - }, - ), + range: 0..9, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 2, - column: 4, - }, - ), + range: 0..9, custom: (), node: JoinedStr { values: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 2, - column: 4, - }, - ), + range: 0..9, custom: (), node: Constant { value: Str( @@ -50,29 +23,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 2, - column: 4, - }, - ), + range: 0..9, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 2, - column: 1, - }, - end_location: Some( - Location { - row: 2, - column: 2, - }, - ), + range: 6..7, custom: (), node: Name { id: "x", diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_parse_self_documenting_base.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_parse_self_documenting_base.snap index 125c6af7a7..a5c84b8d9d 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_parse_self_documenting_base.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_parse_self_documenting_base.snap @@ -4,16 +4,7 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 10, - }, - ), + range: 0..10, custom: (), node: Constant { value: Str( @@ -23,16 +14,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 10, - }, - ), + range: 0..10, custom: (), node: Constant { value: Str( @@ -42,29 +24,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 10, - }, - ), + range: 0..10, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 1, - column: 3, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 3..7, custom: (), node: Name { id: "user", diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_parse_self_documenting_base_more.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_parse_self_documenting_base_more.snap index 14a20345ee..d7a1001552 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_parse_self_documenting_base_more.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_parse_self_documenting_base_more.snap @@ -4,16 +4,7 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 38, - }, - ), + range: 0..38, custom: (), node: Constant { value: Str( @@ -23,16 +14,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 38, - }, - ), + range: 0..38, custom: (), node: Constant { value: Str( @@ -42,16 +24,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 38, - }, - ), + range: 0..38, custom: (), node: Constant { value: Str( @@ -61,29 +34,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 38, - }, - ), + range: 0..38, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 1, - column: 7, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 7..11, custom: (), node: Name { id: "user", @@ -95,16 +50,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 38, - }, - ), + range: 0..38, custom: (), node: Constant { value: Str( @@ -114,16 +60,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 38, - }, - ), + range: 0..38, custom: (), node: Constant { value: Str( @@ -133,16 +70,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 38, - }, - ), + range: 0..38, custom: (), node: Constant { value: Str( @@ -152,29 +80,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 38, - }, - ), + range: 0..38, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 1, - column: 29, - }, - end_location: Some( - Location { - row: 1, - column: 35, - }, - ), + range: 29..35, custom: (), node: Name { id: "second", diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_parse_self_documenting_format.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_parse_self_documenting_format.snap index c7f6288327..322ed96dd2 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_parse_self_documenting_format.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_parse_self_documenting_format.snap @@ -4,16 +4,7 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 0..14, custom: (), node: Constant { value: Str( @@ -23,16 +14,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 0..14, custom: (), node: Constant { value: Str( @@ -42,29 +24,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 0..14, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 1, - column: 3, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 3..7, custom: (), node: Name { id: "user", @@ -74,30 +38,12 @@ expression: parse_ast conversion: 0, format_spec: Some( Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 0..14, custom: (), node: JoinedStr { values: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 14, - }, - ), + range: 0..14, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_unescaped_newline.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_unescaped_newline.snap index b44c329960..34ea9b248d 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_unescaped_newline.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__fstring_unescaped_newline.snap @@ -4,43 +4,16 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 2, - column: 6, - }, - ), + range: 0..11, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 2, - column: 6, - }, - ), + range: 0..11, custom: (), node: JoinedStr { values: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 2, - column: 6, - }, - ), + range: 0..11, custom: (), node: Constant { value: Str( @@ -50,29 +23,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 2, - column: 6, - }, - ), + range: 0..11, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 2, - column: 1, - }, - end_location: Some( - Location { - row: 2, - column: 2, - }, - ), + range: 6..7, custom: (), node: Name { id: "x", diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__hts_alias.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__hts_alias.snap index 73f12074eb..f65b9b57aa 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__hts_alias.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__hts_alias.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 9, - }, - ), + range: 0..9, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 9, - }, - ), + range: 0..9, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_f_string_concat_1.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_f_string_concat_1.snap index bfe109e114..daf8ad84dd 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_f_string_concat_1.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_f_string_concat_1.snap @@ -4,43 +4,16 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 0..17, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 0..17, custom: (), node: JoinedStr { values: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 0..17, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_f_string_concat_2.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_f_string_concat_2.snap index bfe109e114..daf8ad84dd 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_f_string_concat_2.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_f_string_concat_2.snap @@ -4,43 +4,16 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 0..17, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 0..17, custom: (), node: JoinedStr { values: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 0..17, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_f_string_concat_3.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_f_string_concat_3.snap index 0fdc8e82ef..ef323cf48f 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_f_string_concat_3.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_f_string_concat_3.snap @@ -4,43 +4,16 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 22, - }, - ), + range: 0..22, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 22, - }, - ), + range: 0..22, custom: (), node: JoinedStr { values: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 22, - }, - ), + range: 0..22, custom: (), node: Constant { value: Str( @@ -50,29 +23,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 9, - }, - end_location: Some( - Location { - row: 1, - column: 22, - }, - ), + range: 9..22, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 1, - column: 17, - }, - end_location: Some( - Location { - row: 1, - column: 20, - }, - ), + range: 17..20, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring.snap index 4355fd70fb..b568e9066b 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 18, - }, - ), + range: 0..18, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 1, - column: 3, - }, - end_location: Some( - Location { - row: 1, - column: 4, - }, - ), + range: 3..4, custom: (), node: Name { id: "a", @@ -38,29 +20,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 18, - }, - ), + range: 0..18, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 1, - column: 7, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 7..8, custom: (), node: Name { id: "b", @@ -72,16 +36,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 18, - }, - ), + range: 0..18, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_equals.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_equals.snap index c8c2052205..b911810b95 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_equals.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_equals.snap @@ -4,42 +4,15 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 0..13, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 1, - column: 3, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 3..11, custom: (), node: Compare { left: Located { - location: Location { - row: 1, - column: 3, - }, - end_location: Some( - Location { - row: 1, - column: 5, - }, - ), + range: 3..5, custom: (), node: Constant { value: Int( @@ -53,16 +26,7 @@ expression: parse_ast ], comparators: [ Located { - location: Location { - row: 1, - column: 9, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 9..11, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_nested_spec.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_nested_spec.snap index 6154948933..517580ff94 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_nested_spec.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_nested_spec.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 15, - }, - ), + range: 0..15, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 1, - column: 3, - }, - end_location: Some( - Location { - row: 1, - column: 6, - }, - ), + range: 3..6, custom: (), node: Name { id: "foo", @@ -36,43 +18,16 @@ expression: parse_ast conversion: 0, format_spec: Some( Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 15, - }, - ), + range: 0..15, custom: (), node: JoinedStr { values: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 15, - }, - ), + range: 0..15, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 1, - column: 8, - }, - end_location: Some( - Location { - row: 1, - column: 12, - }, - ), + range: 8..12, custom: (), node: Name { id: "spec", diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_not_equals.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_not_equals.snap index 029b5ee10a..d215c81b06 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_not_equals.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_not_equals.snap @@ -4,42 +4,15 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 0..11, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 1, - column: 3, - }, - end_location: Some( - Location { - row: 1, - column: 9, - }, - ), + range: 3..9, custom: (), node: Compare { left: Located { - location: Location { - row: 1, - column: 3, - }, - end_location: Some( - Location { - row: 1, - column: 4, - }, - ), + range: 3..4, custom: (), node: Constant { value: Int( @@ -53,16 +26,7 @@ expression: parse_ast ], comparators: [ Located { - location: Location { - row: 1, - column: 8, - }, - end_location: Some( - Location { - row: 1, - column: 9, - }, - ), + range: 8..9, custom: (), node: Constant { value: Int( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_not_nested_spec.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_not_nested_spec.snap index 8b26d29593..77141df4d6 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_not_nested_spec.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_not_nested_spec.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 0..13, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 1, - column: 3, - }, - end_location: Some( - Location { - row: 1, - column: 6, - }, - ), + range: 3..6, custom: (), node: Name { id: "foo", @@ -36,30 +18,12 @@ expression: parse_ast conversion: 0, format_spec: Some( Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 0..13, custom: (), node: JoinedStr { values: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 13, - }, - ), + range: 0..13, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_self_doc_prec_space.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_self_doc_prec_space.snap index f48f688ec7..3f88828042 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_self_doc_prec_space.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_self_doc_prec_space.snap @@ -4,16 +4,7 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 10, - }, - ), + range: 0..10, custom: (), node: Constant { value: Str( @@ -23,16 +14,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 10, - }, - ), + range: 0..10, custom: (), node: Constant { value: Str( @@ -42,29 +24,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 10, - }, - ), + range: 0..10, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 1, - column: 3, - }, - end_location: Some( - Location { - row: 1, - column: 4, - }, - ), + range: 3..4, custom: (), node: Name { id: "x", diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_self_doc_trailing_space.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_self_doc_trailing_space.snap index e1ced2147d..a12267e256 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_self_doc_trailing_space.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_self_doc_trailing_space.snap @@ -4,16 +4,7 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 10, - }, - ), + range: 0..10, custom: (), node: Constant { value: Str( @@ -23,16 +14,7 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 10, - }, - ), + range: 0..10, custom: (), node: Constant { value: Str( @@ -42,29 +24,11 @@ expression: parse_ast }, }, Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 10, - }, - ), + range: 0..10, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 1, - column: 3, - }, - end_location: Some( - Location { - row: 1, - column: 4, - }, - ), + range: 3..4, custom: (), node: Name { id: "x", diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_yield_expr.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_yield_expr.snap index 90223888be..61047df1a5 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_yield_expr.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_fstring_yield_expr.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 10, - }, - ), + range: 0..10, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 1, - column: 3, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 3..8, custom: (), node: Yield { value: None, diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_string_concat.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_string_concat.snap index a8744263f5..d47ecc65df 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_string_concat.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_string_concat.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 16, - }, - ), + range: 0..16, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 16, - }, - ), + range: 0..16, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_string_triple_quotes_with_kind.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_string_triple_quotes_with_kind.snap index 0616991c8f..9bfdd3c31b 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_string_triple_quotes_with_kind.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_string_triple_quotes_with_kind.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 20, - }, - ), + range: 0..20, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 20, - }, - ), + range: 0..20, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_u_f_string_concat_1.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_u_f_string_concat_1.snap index 76e6b1d220..787294072e 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_u_f_string_concat_1.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_u_f_string_concat_1.snap @@ -4,43 +4,16 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 18, - }, - ), + range: 0..18, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 18, - }, - ), + range: 0..18, custom: (), node: JoinedStr { values: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 18, - }, - ), + range: 0..18, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_u_f_string_concat_2.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_u_f_string_concat_2.snap index 8c073fd901..e7b546c9a2 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_u_f_string_concat_2.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_u_f_string_concat_2.snap @@ -4,43 +4,16 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 22, - }, - ), + range: 0..22, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 22, - }, - ), + range: 0..22, custom: (), node: JoinedStr { values: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 22, - }, - ), + range: 0..22, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_u_string_concat_1.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_u_string_concat_1.snap index 868ba813e8..cc6f0f5677 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_u_string_concat_1.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_u_string_concat_1.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 0..17, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 0..17, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_u_string_concat_2.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_u_string_concat_2.snap index a24fc2b347..1812a9311a 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_u_string_concat_2.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__parse_u_string_concat_2.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 0..17, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 17, - }, - ), + range: 0..17, custom: (), node: Constant { value: Str( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__raw_byte_literal_1.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__raw_byte_literal_1.snap index 14daedd976..17b4a2586c 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__raw_byte_literal_1.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__raw_byte_literal_1.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 0..8, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 8, - }, - ), + range: 0..8, custom: (), node: Constant { value: Bytes( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__raw_byte_literal_2.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__raw_byte_literal_2.snap index d34d8c8807..fd11e8ae8d 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__raw_byte_literal_2.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__raw_byte_literal_2.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 6, - }, - ), + range: 0..6, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 6, - }, - ), + range: 0..6, custom: (), node: Constant { value: Bytes( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__raw_fstring.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__raw_fstring.snap index e53b86104f..c63f4afeaa 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__raw_fstring.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__raw_fstring.snap @@ -4,56 +4,20 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 0..7, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 0..7, custom: (), node: JoinedStr { values: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 0..7, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 1, - column: 4, - }, - end_location: Some( - Location { - row: 1, - column: 5, - }, - ), + range: 4..5, custom: (), node: Name { id: "x", diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__single_quoted_byte.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__single_quoted_byte.snap index 0d8c8c9ab1..488c745dea 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__single_quoted_byte.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__single_quoted_byte.snap @@ -4,29 +4,11 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 738, - }, - ), + range: 0..738, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 738, - }, - ), + range: 0..738, custom: (), node: Constant { value: Bytes( diff --git a/compiler/parser/src/snapshots/rustpython_parser__string__tests__triple_quoted_raw_fstring.snap b/compiler/parser/src/snapshots/rustpython_parser__string__tests__triple_quoted_raw_fstring.snap index 19975d53b5..716d52da42 100644 --- a/compiler/parser/src/snapshots/rustpython_parser__string__tests__triple_quoted_raw_fstring.snap +++ b/compiler/parser/src/snapshots/rustpython_parser__string__tests__triple_quoted_raw_fstring.snap @@ -4,56 +4,20 @@ expression: parse_ast --- [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 0..11, custom: (), node: Expr { value: Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 0..11, custom: (), node: JoinedStr { values: [ Located { - location: Location { - row: 1, - column: 0, - }, - end_location: Some( - Location { - row: 1, - column: 11, - }, - ), + range: 0..11, custom: (), node: FormattedValue { value: Located { - location: Location { - row: 1, - column: 6, - }, - end_location: Some( - Location { - row: 1, - column: 7, - }, - ), + range: 6..7, custom: (), node: Name { id: "x", diff --git a/compiler/parser/src/string.rs b/compiler/parser/src/string.rs index d5eda859b5..3856b2783c 100644 --- a/compiler/parser/src/string.rs +++ b/compiler/parser/src/string.rs @@ -833,8 +833,7 @@ mod tests { LexicalErrorType::FStringError(e) => e, e => unreachable!("Expected FStringError: {:?}", e), }) - .err() - .expect("Expected error") + .expect_err("Expected error") } #[test] From eaddf24c0c9b6ac6f1c2bb741c073874eeeb09a6 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Mon, 17 Apr 2023 11:15:17 +0200 Subject: [PATCH 08/16] Correctly set range on `Indent` --- compiler/parser/src/lexer.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/compiler/parser/src/lexer.rs b/compiler/parser/src/lexer.rs index 4c0b55c405..9f4bb54528 100644 --- a/compiler/parser/src/lexer.rs +++ b/compiler/parser/src/lexer.rs @@ -19,9 +19,9 @@ //! .map(|tok| tok.expect("Failed to lex")) //! .collect::>(); //! -//! for (start, token, end) in tokens { +//! for (token, range) in tokens { //! println!( -//! "{start:?}-{end:?} {token:?}", +//! "{token:?}@{range:?}", //! ); //! } //! ``` @@ -663,7 +663,15 @@ where // New indentation level: self.indentations.push(indentation_level); let tok_pos = self.get_pos(); - self.emit((Tok::Indent, TextRange::empty(tok_pos))); + self.emit(( + Tok::Indent, + TextRange::new( + tok_pos + - TextSize::new(indentation_level.spaces) + - TextSize::new(indentation_level.tabs), + tok_pos, + ), + )); } Ordering::Less => { // One or more dedentations @@ -1336,7 +1344,7 @@ mod tests { pub fn lex_source(source: &str) -> Vec { let lexer = lex(source, Mode::Module); - lexer.map(|x| x.unwrap().1).collect() + lexer.map(|x| x.unwrap().0).collect() } fn str_tok(s: &str) -> Tok { From 9bbdcda091f444fd4aa856e102b9b81551ba2c03 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Mon, 17 Apr 2023 10:17:56 +0200 Subject: [PATCH 09/16] Fix CI --- .github/workflows/ci.yaml | 337 +++++++++++++++++------------------ Cargo.toml | 2 +- compiler/ast/asdl_rs.py | 58 +++++- compiler/ast/src/ast_gen.rs | 33 +--- compiler/ast/src/constant.rs | 1 - 5 files changed, 220 insertions(+), 211 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c901ada030..bc5e562367 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,18 +15,10 @@ concurrency: cancel-in-progress: true env: - CARGO_ARGS: --no-default-features --features stdlib,zlib,importlib,encodings,ssl,jit NON_WASM_PACKAGES: >- -p rustpython-common -p rustpython-compiler-core - -p rustpython-compiler - -p rustpython-codegen -p rustpython-parser - -p rustpython-vm - -p rustpython-stdlib - -p rustpython-jit - -p rustpython-derive - -p rustpython PLATFORM_INDEPENDENT_TESTS: >- test_argparse test_array @@ -137,12 +129,7 @@ jobs: run: cargo clippy ${{ env.CARGO_ARGS }} ${{ env.NON_WASM_PACKAGES }} -- -Dwarnings - name: run rust tests - run: cargo test --workspace --exclude rustpython_wasm --verbose --features threading ${{ env.CARGO_ARGS }} ${{ env.NON_WASM_PACKAGES }} - if: runner.os != 'macOS' - # temp skip ssl linking for Mac to avoid CI failure - - name: run rust tests (MacOS no ssl) - run: cargo test --workspace --exclude rustpython_wasm --verbose --no-default-features --features threading,stdlib,zlib,importlib,encodings,jit ${{ env.NON_WASM_PACKAGES }} - if: runner.os == 'macOS' + run: cargo test --workspace --verbose --features threading ${{ env.CARGO_ARGS }} ${{ env.NON_WASM_PACKAGES }} - name: check compilation without threading run: cargo check ${{ env.CARGO_ARGS }} @@ -221,7 +208,7 @@ jobs: target: wasm32-unknown-unknown - name: Check compilation for wasm32 - run: cargo check --target wasm32-unknown-unknown --no-default-features + run: cargo check --target wasm32-unknown-unknown - uses: dtolnay/rust-toolchain@stable with: @@ -237,84 +224,80 @@ jobs: with: command: check - snippets_cpython: - if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} - needs: lalrpop - env: - RUST_BACKTRACE: full - name: Run snippets and cpython tests - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] - fail-fast: false - steps: - - uses: actions/checkout@v3 - - name: Cache generated parser - uses: actions/cache@v3 - with: - path: compiler/parser/python.rs - key: lalrpop-${{ hashFiles('compiler/parser/python.lalrpop') }} - - - uses: dtolnay/rust-toolchain@stable - - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - name: Set up the Windows environment - shell: bash - run: | - choco install llvm openssl --no-progress - echo "OPENSSL_DIR=C:\Program Files\OpenSSL" >>$GITHUB_ENV - if: runner.os == 'Windows' - - name: Set up the Mac environment - run: brew install autoconf automake libtool openssl@3 - if: runner.os == 'macOS' - - - uses: Swatinem/rust-cache@v2 - - name: build rustpython - run: cargo build --release --verbose --features=threading ${{ env.CARGO_ARGS }} - - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - name: run snippets - run: python -m pip install -r requirements.txt && pytest -v - working-directory: ./extra_tests - - if: runner.os == 'Linux' - name: run cpython platform-independent tests - run: - target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v ${{ env.PLATFORM_INDEPENDENT_TESTS }} - - if: runner.os != 'Windows' - name: run cpython platform-dependent tests - run: target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }} - - if: runner.os == 'Windows' - name: run cpython platform-dependent tests (windows partial - fixme) - run: - target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }} - test_glob - test_importlib - test_io - test_os - test_pathlib - test_posixpath - test_shutil - test_venv - - if: runner.os != 'Windows' - name: check that --install-pip succeeds - run: | - mkdir site-packages - target/release/rustpython --install-pip ensurepip --user - - if: runner.os != 'Windows' - name: Check that ensurepip succeeds. - run: | - target/release/rustpython -m ensurepip - target/release/rustpython -c "import pip" - - if: runner.os != 'Windows' - name: Check if pip inside venv is functional - run: | - target/release/rustpython -m venv testvenv - testvenv/bin/rustpython -m pip install wheel - - name: Check whats_left is not broken - run: python -I whats_left.py +# snippets_cpython: +# if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} +# needs: lalrpop +# env: +# RUST_BACKTRACE: full +# name: Run snippets and cpython tests +# runs-on: ${{ matrix.os }} +# strategy: +# matrix: +# os: [macos-latest, ubuntu-latest, windows-latest] +# fail-fast: false +# steps: +# - uses: actions/checkout@v3 +# - name: Cache generated parser +# uses: actions/cache@v3 +# with: +# path: compiler/parser/python.rs +# key: lalrpop-${{ hashFiles('compiler/parser/python.lalrpop') }} +# +# - uses: dtolnay/rust-toolchain@stable +# - uses: actions/setup-python@v4 +# with: +# python-version: "3.11" +# - name: Set up the Windows environment +# shell: bash +# run: | +# choco install llvm openssl +# echo "OPENSSL_DIR=C:\Program Files\OpenSSL-Win64" >>$GITHUB_ENV +# if: runner.os == 'Windows' +# - name: Set up the Mac environment +# run: brew install autoconf automake libtool openssl@3 +# if: runner.os == 'macOS' +# +# - uses: Swatinem/rust-cache@v2 +# - name: build rustpython +# run: cargo build --release --verbose --features=threading ${{ env.CARGO_ARGS }} +# - uses: actions/setup-python@v4 +# with: +# python-version: "3.11" +# - name: run snippets +# run: python -m pip install -r requirements.txt && pytest -v +# working-directory: ./extra_tests +# - if: runner.os == 'Linux' +# name: run cpython platform-independent tests +# run: +# target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v ${{ env.PLATFORM_INDEPENDENT_TESTS }} +# - if: runner.os != 'Windows' +# name: run cpython platform-dependent tests +# run: target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }} +# - if: runner.os == 'Windows' +# name: run cpython platform-dependent tests (windows partial - fixme) +# run: +# target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }} +# test_glob +# test_importlib +# test_io +# test_iter +# test_os +# test_pathlib +# test_posixpath +# test_shutil +# test_venv +# - if: runner.os != 'Windows' +# name: check that --install-pip succeeds +# run: | +# mkdir site-packages +# target/release/rustpython --install-pip ensurepip --user +# - if: runner.os != 'Windows' +# name: Check that ensurepip succeeds. +# run: | +# target/release/rustpython -m ensurepip +# target/release/rustpython -c "import pip" +# - name: Check whats_left is not broken +# run: python -I whats_left.py lalrpop: if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} @@ -365,8 +348,8 @@ jobs: components: rustfmt, clippy - name: run rustfmt run: cargo fmt --all -- --check - - name: run clippy on wasm - run: cargo clippy --manifest-path=wasm/lib/Cargo.toml -- -Dwarnings +# - name: run clippy on wasm +# run: cargo clippy --manifest-path=wasm/lib/Cargo.toml -- -Dwarnings - uses: actions/setup-python@v4 with: python-version: "3.11" @@ -401,86 +384,84 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run tests under miri - # miri-ignore-leaks because the type-object circular reference means that there will always be - # a memory leak, at least until we have proper cyclic gc - run: MIRIFLAGS='-Zmiri-ignore-leaks' cargo +nightly miri test -p rustpython-vm -- miri_test - - wasm: - if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} - name: Check the WASM package and demo - needs: lalrpop - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Cache generated parser - uses: actions/cache@v3 - with: - path: compiler/parser/python.rs - key: lalrpop-${{ hashFiles('compiler/parser/python.lalrpop') }} - - uses: dtolnay/rust-toolchain@stable - - - uses: Swatinem/rust-cache@v2 - - name: install wasm-pack - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - name: install geckodriver - run: | - wget https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz - mkdir geckodriver - tar -xzf geckodriver-v0.30.0-linux64.tar.gz -C geckodriver - - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - run: python -m pip install -r requirements.txt - working-directory: ./wasm/tests - - uses: actions/setup-node@v3 - - name: run test - run: | - export PATH=$PATH:`pwd`/../../geckodriver - npm install - npm run test - env: - NODE_OPTIONS: "--openssl-legacy-provider" - working-directory: ./wasm/demo - - name: build notebook demo - if: github.ref == 'refs/heads/release' - run: | - npm install - npm run dist - mv dist ../demo/dist/notebook - env: - NODE_OPTIONS: "--openssl-legacy-provider" - working-directory: ./wasm/notebook - - name: Deploy demo to Github Pages - if: success() && github.ref == 'refs/heads/release' - uses: peaceiris/actions-gh-pages@v2 - env: - ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEMO_DEPLOY_KEY }} - PUBLISH_DIR: ./wasm/demo/dist - EXTERNAL_REPOSITORY: RustPython/demo - PUBLISH_BRANCH: master - - wasm-wasi: - if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} - name: Run snippets and cpython tests on wasm-wasi - needs: lalrpop - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Cache generated parser - uses: actions/cache@v3 - with: - path: compiler/parser/python.rs - key: lalrpop-${{ hashFiles('compiler/parser/python.lalrpop') }} - - uses: dtolnay/rust-toolchain@stable - with: - target: wasm32-wasi - - - uses: Swatinem/rust-cache@v2 - - name: Setup Wasmer - uses: wasmerio/setup-wasmer@v2 - - name: Install clang - run: sudo apt-get update && sudo apt-get install clang -y - - name: build rustpython - run: cargo build --release --target wasm32-wasi --features freeze-stdlib,stdlib --verbose - - name: run snippets - run: wasmer run --dir . target/wasm32-wasi/release/rustpython.wasm -- extra_tests/snippets/stdlib_random.py + run: cargo +nightly miri test -p rustpython-parser -- miri_test + +# wasm: +# if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} +# name: Check the WASM package and demo +# needs: lalrpop +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# - name: Cache generated parser +# uses: actions/cache@v3 +# with: +# path: compiler/parser/python.rs +# key: lalrpop-${{ hashFiles('compiler/parser/python.lalrpop') }} +# - uses: dtolnay/rust-toolchain@stable +# +# - uses: Swatinem/rust-cache@v2 +# - name: install wasm-pack +# run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh +# - name: install geckodriver +# run: | +# wget https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz +# mkdir geckodriver +# tar -xzf geckodriver-v0.30.0-linux64.tar.gz -C geckodriver +# - uses: actions/setup-python@v4 +# with: +# python-version: "3.11" +# - run: python -m pip install -r requirements.txt +# working-directory: ./wasm/tests +# - uses: actions/setup-node@v3 +# - name: run test +# run: | +# export PATH=$PATH:`pwd`/../../geckodriver +# npm install +# npm run test +# env: +# NODE_OPTIONS: "--openssl-legacy-provider" +# working-directory: ./wasm/demo +# - name: build notebook demo +# if: github.ref == 'refs/heads/release' +# run: | +# npm install +# npm run dist +# mv dist ../demo/dist/notebook +# env: +# NODE_OPTIONS: "--openssl-legacy-provider" +# working-directory: ./wasm/notebook +# - name: Deploy demo to Github Pages +# if: success() && github.ref == 'refs/heads/release' +# uses: peaceiris/actions-gh-pages@v2 +# env: +# ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEMO_DEPLOY_KEY }} +# PUBLISH_DIR: ./wasm/demo/dist +# EXTERNAL_REPOSITORY: RustPython/demo +# PUBLISH_BRANCH: master +# +# wasm-wasi: +# if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} +# name: Run snippets and cpython tests on wasm-wasi +# needs: lalrpop +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# - name: Cache generated parser +# uses: actions/cache@v3 +# with: +# path: compiler/parser/python.rs +# key: lalrpop-${{ hashFiles('compiler/parser/python.lalrpop') }} +# - uses: dtolnay/rust-toolchain@stable +# with: +# target: wasm32-wasi +# +# - uses: Swatinem/rust-cache@v2 +# - name: Setup Wasmer +# uses: wasmerio/setup-wasmer@v2 +# - name: Install clang +# run: sudo apt-get update && sudo apt-get install clang -y +# - name: build rustpython +# run: cargo build --release --target wasm32-wasi --features freeze-stdlib,stdlib --verbose +# - name: run snippets +# run: wasmer run --dir . target/wasm32-wasi/release/rustpython.wasm -- extra_tests/snippets/stdlib_random.py diff --git a/Cargo.toml b/Cargo.toml index 5caf902530..39ec98e2e7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ [workspace] resolver = "2" members = [ - "ruff_text_size", "compiler/ast", "compiler/parser" + "ruff_text_size", "compiler/ast", "compiler/core", "compiler/parser", "common" ] [workspace.dependencies] diff --git a/compiler/ast/asdl_rs.py b/compiler/ast/asdl_rs.py index c9b819dae2..046146a940 100755 --- a/compiler/ast/asdl_rs.py +++ b/compiler/ast/asdl_rs.py @@ -311,7 +311,7 @@ def visitModule(self, mod, depth): depth, ) self.emit( - "Ok(Located { custom: folder.map_user(node.custom)?, location: node.location, end_location: node.end_location, node: f(folder, node.node)? })", + "Ok(Located { custom: folder.map_user(node.custom)?, range: node.range, node: f(folder, node.node)? })", depth + 1, ) self.emit("}", depth) @@ -649,7 +649,7 @@ def write_ast_def(mod, typeinfo, f): #![allow(clippy::derive_partial_eq_without_eq)] pub use crate::constant::*; - pub use crate::Location; + pub use ruff_text_size::{TextSize, TextRange}; type Ident = String; \n @@ -661,15 +661,61 @@ def write_ast_def(mod, typeinfo, f): textwrap.dedent( """ pub struct Located { - pub location: Location, - pub end_location: Option, + pub range: TextRange, pub custom: U, pub node: T, } impl Located { - pub fn new(location: Location, end_location: Location, node: T) -> Self { - Self { location, end_location: Some(end_location), custom: (), node } + pub fn new(start: TextSize, end: TextSize, node: T) -> Self { + Self { range: TextRange::new(start, end), custom: (), node } + } + + /// Creates a new node that spans the position specified by `range`. + pub fn with_range(node: T, range: TextRange) -> Self { + Self { + range, + custom: (), + node, + } + } + + /// Returns the absolute start position of the node from the beginning of the document. + #[inline] + pub const fn start(&self) -> TextSize { + self.range.start() + } + + /// Returns the node + #[inline] + pub fn node(&self) -> &T { + &self.node + } + + /// Consumes self and returns the node. + #[inline] + pub fn into_node(self) -> T { + self.node + } + + /// Returns the `range` of the node. The range offsets are absolute to the start of the document. + #[inline] + pub const fn range(&self) -> TextRange { + self.range + } + + /// Returns the absolute position at which the node ends in the source document. + #[inline] + pub const fn end(&self) -> TextSize { + self.range.end() + } + } + + impl std::ops::Deref for Located { + type Target = T; + + fn deref(&self) -> &Self::Target { + &self.node } pub const fn start(&self) -> Location { diff --git a/compiler/ast/src/ast_gen.rs b/compiler/ast/src/ast_gen.rs index bbf8431815..d5fd6ece7d 100644 --- a/compiler/ast/src/ast_gen.rs +++ b/compiler/ast/src/ast_gen.rs @@ -3,8 +3,7 @@ #![allow(clippy::derive_partial_eq_without_eq)] pub use crate::constant::*; -use ruff_text_size::{TextRange, TextSize}; -use std::ops::Deref; +pub use ruff_text_size::{TextRange, TextSize}; type Ident = String; @@ -15,26 +14,20 @@ pub struct Located { pub node: T, } -impl Located { - pub fn new(location: TextSize, end_location: TextSize, node: T) -> Self - where - U: Default, - { +impl Located { + pub fn new(start: TextSize, end: TextSize, node: T) -> Self { Self { - custom: U::default(), - range: TextRange::new(location, end_location), + range: TextRange::new(start, end), + custom: (), node, } } /// Creates a new node that spans the position specified by `range`. - pub fn with_range(node: T, range: TextRange) -> Self - where - U: Default, - { + pub fn with_range(node: T, range: TextRange) -> Self { Self { range, - custom: U::default(), + custom: (), node, } } @@ -45,11 +38,6 @@ impl Located { self.range.start() } - #[inline] - pub fn custom(&self) -> &U { - &self.custom - } - /// Returns the node #[inline] pub fn node(&self) -> &T { @@ -62,11 +50,6 @@ impl Located { self.node } - #[inline] - pub fn into_custom(self) -> U { - self.custom - } - /// Returns the `range` of the node. The range offsets are absolute to the start of the document. #[inline] pub const fn range(&self) -> TextRange { @@ -80,7 +63,7 @@ impl Located { } } -impl Deref for Located { +impl std::ops::Deref for Located { type Target = T; fn deref(&self) -> &Self::Target { diff --git a/compiler/ast/src/constant.rs b/compiler/ast/src/constant.rs index fee791ae41..a811ccf30e 100644 --- a/compiler/ast/src/constant.rs +++ b/compiler/ast/src/constant.rs @@ -132,7 +132,6 @@ impl crate::fold::Fold for ConstantOptimizer { #[cfg(test)] mod tests { use super::*; - use ruff_text_size::TextRange; #[cfg(feature = "constant-optimization")] #[test] From 805d7738571b453d13a205a6033fa9059ff8cbfd Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Mon, 17 Apr 2023 17:47:38 +0200 Subject: [PATCH 10/16] Fix WASM build, remove unused dependencies --- Cargo.lock | 213 +++++++++++++++++++++++++++++++++---- common/Cargo.toml | 4 +- compiler/core/Cargo.toml | 1 - compiler/parser/Cargo.toml | 1 - 4 files changed, 198 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a76f86d7f4..f2165220c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,17 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom", - "once_cell", - "version_check", -] - [[package]] name = "aho-corasick" version = "0.7.20" @@ -28,6 +17,12 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" +[[package]] +name = "ascii" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" + [[package]] name = "ascii-canvas" version = "3.0.0" @@ -75,6 +70,12 @@ dependencies = [ "regex-automata", ] +[[package]] +name = "bumpalo" +version = "3.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b1ce199063694f33ffb7dd4e0ee620741495c32833cde5aa08f02a0bf96f0c8" + [[package]] name = "cc" version = "1.0.79" @@ -188,13 +189,15 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -209,6 +212,12 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +[[package]] +name = "hexf-parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" + [[package]] name = "indexmap" version = "1.9.2" @@ -270,6 +279,15 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" +[[package]] +name = "js-sys" +version = "0.3.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +dependencies = [ + "wasm-bindgen", +] + [[package]] name = "lalrpop" version = "0.19.9" @@ -308,6 +326,36 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "lexical-parse-float" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683b3a5ebd0130b8fb52ba0bdc718cc56815b6a097e28ae5a6997d0ad17dc05f" +dependencies = [ + "lexical-parse-integer", + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-parse-integer" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d0994485ed0c312f6d965766754ea177d07f9c00c9b82a5ee62ed5b47945ee9" +dependencies = [ + "lexical-util", + "static_assertions", +] + +[[package]] +name = "lexical-util" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5255b9ff16ff898710eb9eb63cb39248ea8a5bb036bea8085b1a767ff6c4e3fc" +dependencies = [ + "static_assertions", +] + [[package]] name = "libc" version = "0.2.141" @@ -354,6 +402,12 @@ dependencies = [ "twox-hash", ] +[[package]] +name = "matches" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" + [[package]] name = "memchr" version = "2.5.0" @@ -497,6 +551,12 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db8bcd96cb740d03149cbad5518db9fd87126a10ab519c011893b1754134c468" +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + [[package]] name = "precomputed-hash" version = "0.1.1" @@ -521,12 +581,30 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "rand" version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", "rand_core", ] @@ -535,6 +613,9 @@ name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] [[package]] name = "redox_syscall" @@ -618,11 +699,36 @@ dependencies = [ ] [[package]] -name = "rustpython-compiler-core" +name = "rustpython-common" version = "0.2.0" dependencies = [ + "ascii", "bitflags", "bstr", + "cfg-if", + "getrandom", + "hexf-parse", + "itertools", + "lexical-parse-float", + "libc", + "lock_api", + "num-bigint", + "num-traits", + "once_cell", + "parking_lot", + "radium", + "rand", + "siphasher", + "unic-ucd-category", + "volatile", + "widestring", +] + +[[package]] +name = "rustpython-compiler-core" +version = "0.2.0" +dependencies = [ + "bitflags", "itertools", "lz4_flex", "num-bigint", @@ -635,7 +741,6 @@ dependencies = [ name = "rustpython-parser" version = "0.2.0" dependencies = [ - "ahash", "anyhow", "insta", "itertools", @@ -880,6 +985,18 @@ dependencies = [ "unic-ucd-version", ] +[[package]] +name = "unic-ucd-category" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b8d4591f5fcfe1bd4453baaf803c40e1b1e69ff8455c47620440b46efef91c0" +dependencies = [ + "matches", + "unic-char-property", + "unic-char-range", + "unic-ucd-version", +] + [[package]] name = "unic-ucd-ident" version = "0.9.0" @@ -921,10 +1038,10 @@ dependencies = [ ] [[package]] -name = "version_check" -version = "0.9.4" +name = "volatile" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "f8e76fae08f03f96e166d2dfda232190638c10e0383841252416f9cfe2ae60e6" [[package]] name = "wasi" @@ -932,6 +1049,66 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasm-bindgen" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" + +[[package]] +name = "widestring" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983" + [[package]] name = "winapi" version = "0.3.9" diff --git a/common/Cargo.toml b/common/Cargo.toml index 7707a63fa7..9f83720fd7 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -18,7 +18,6 @@ cfg-if = { workspace = true } itertools = { workspace = true } libc = { workspace = true } num-bigint = { workspace = true } -num-complex = { workspace = true } num-traits = { workspace = true } once_cell = { workspace = true } parking_lot = { workspace = true, optional = true } @@ -32,5 +31,8 @@ siphasher = "0.3" unic-ucd-category = "0.9" volatile = "0.3" +#[target.'cfg(target_arch = "wasm32")'.dependencies] +getrandom = { version = "0.2.9", features = ["js"] } + [target.'cfg(windows)'.dependencies] widestring = { workspace = true } diff --git a/compiler/core/Cargo.toml b/compiler/core/Cargo.toml index 119bfe6ce5..e4016f922d 100644 --- a/compiler/core/Cargo.toml +++ b/compiler/core/Cargo.toml @@ -9,7 +9,6 @@ license = "MIT" [dependencies] bitflags = { workspace = true } -bstr = { workspace = true } itertools = { workspace = true } num-bigint = { workspace = true } num-complex = { workspace = true } diff --git a/compiler/parser/Cargo.toml b/compiler/parser/Cargo.toml index 9c89733004..3129d5f45f 100644 --- a/compiler/parser/Cargo.toml +++ b/compiler/parser/Cargo.toml @@ -23,7 +23,6 @@ rustpython-ast = { path = "../ast", version = "0.2.0" } rustpython-compiler-core = { path = "../core", version = "0.2.0" } ruff_text_size = { path = "../../ruff_text_size" } -ahash = { workspace = true } itertools = { workspace = true } log = { workspace = true } num-bigint = { workspace = true } From 6e66daae1bb9338ac333c37c925868b0de1c234d Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Tue, 18 Apr 2023 14:46:43 +0200 Subject: [PATCH 11/16] Fix offset for unrecognized tokens --- compiler/parser/src/parser.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/parser/src/parser.rs b/compiler/parser/src/parser.rs index 7704c2ada3..d922eb9cbb 100644 --- a/compiler/parser/src/parser.rs +++ b/compiler/parser/src/parser.rs @@ -24,7 +24,6 @@ use itertools::Itertools; use std::iter; pub(super) use lalrpop_util::ParseError as LalrpopError; -use ruff_text_size::TextSize; /// Parse a full Python program usually consisting of multiple lines. /// @@ -255,7 +254,7 @@ fn parse_error_from_lalrpop( let expected = (expected.len() == 1).then(|| expected[0].clone()); ParseError { error: ParseErrorType::UnrecognizedToken(token.1, expected), - location: token.0 + TextSize::from(1), + location: token.0, source_path, } } From e39034e5bf1f4f9397ab1769093bb49c30f5d00a Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Tue, 25 Apr 2023 14:44:10 -0600 Subject: [PATCH 12/16] Upgrade lalrpop --- Cargo.lock | 23 ++++++----------------- compiler/parser/Cargo.toml | 4 ++-- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f2165220c4..dd7472615d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,15 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "aho-corasick" -version = "0.7.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" -dependencies = [ - "memchr", -] - [[package]] name = "anyhow" version = "1.0.69" @@ -290,9 +281,9 @@ dependencies = [ [[package]] name = "lalrpop" -version = "0.19.9" +version = "0.19.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f34313ec00c2eb5c3c87ca6732ea02dcf3af99c3ff7a8fb622ffb99c9d860a87" +checksum = "06ada7ece1f5bc6d36eec2a4dc204135f14888209b3773df8fefcfe990fd4cbc" dependencies = [ "ascii-canvas", "bit-set", @@ -313,9 +304,9 @@ dependencies = [ [[package]] name = "lalrpop-util" -version = "0.19.9" +version = "0.19.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c1f7869c94d214466c5fd432dfed12c379fd87786768d36455892d46b18edd" +checksum = "3d3b45d694c8074f77bc24fc26e47633c862a9cd3b48dd51209c02ba4c434d68" dependencies = [ "regex", ] @@ -547,9 +538,9 @@ dependencies = [ [[package]] name = "pico-args" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8bcd96cb740d03149cbad5518db9fd87126a10ab519c011893b1754134c468" +checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" [[package]] name = "ppv-lite86" @@ -643,8 +634,6 @@ version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ - "aho-corasick", - "memchr", "regex-syntax", ] diff --git a/compiler/parser/Cargo.toml b/compiler/parser/Cargo.toml index 3129d5f45f..6792e24451 100644 --- a/compiler/parser/Cargo.toml +++ b/compiler/parser/Cargo.toml @@ -14,7 +14,7 @@ serde = ["dep:serde", "rustpython-compiler-core/serde"] [build-dependencies] anyhow = { workspace = true } -lalrpop = { version = "0.19.9", optional = true } +lalrpop = { version = "0.19.10", optional = true } phf_codegen = "0.11.1" tiny-keccak = { version = "2", features = ["sha3"] } @@ -31,7 +31,7 @@ unicode_names2 = { workspace = true } unic-emoji-char = "0.9.0" unic-ucd-ident = "0.9.0" -lalrpop-util = "0.19.9" +lalrpop-util = "0.19.10" phf = "0.11.1" rustc-hash = "1.1.0" serde = { version = "1.0.133", optional = true, default-features = false, features = ["derive"] } From f0281bcc031bbebdf72b65ef04e6f1562a14985d Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Tue, 25 Apr 2023 14:46:21 -0600 Subject: [PATCH 13/16] Delete commented out code --- .github/workflows/ci.yaml | 155 -------------------------------------- Cargo.toml | 70 ----------------- 2 files changed, 225 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bc5e562367..da04f4be1f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -224,81 +224,6 @@ jobs: with: command: check -# snippets_cpython: -# if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} -# needs: lalrpop -# env: -# RUST_BACKTRACE: full -# name: Run snippets and cpython tests -# runs-on: ${{ matrix.os }} -# strategy: -# matrix: -# os: [macos-latest, ubuntu-latest, windows-latest] -# fail-fast: false -# steps: -# - uses: actions/checkout@v3 -# - name: Cache generated parser -# uses: actions/cache@v3 -# with: -# path: compiler/parser/python.rs -# key: lalrpop-${{ hashFiles('compiler/parser/python.lalrpop') }} -# -# - uses: dtolnay/rust-toolchain@stable -# - uses: actions/setup-python@v4 -# with: -# python-version: "3.11" -# - name: Set up the Windows environment -# shell: bash -# run: | -# choco install llvm openssl -# echo "OPENSSL_DIR=C:\Program Files\OpenSSL-Win64" >>$GITHUB_ENV -# if: runner.os == 'Windows' -# - name: Set up the Mac environment -# run: brew install autoconf automake libtool openssl@3 -# if: runner.os == 'macOS' -# -# - uses: Swatinem/rust-cache@v2 -# - name: build rustpython -# run: cargo build --release --verbose --features=threading ${{ env.CARGO_ARGS }} -# - uses: actions/setup-python@v4 -# with: -# python-version: "3.11" -# - name: run snippets -# run: python -m pip install -r requirements.txt && pytest -v -# working-directory: ./extra_tests -# - if: runner.os == 'Linux' -# name: run cpython platform-independent tests -# run: -# target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v ${{ env.PLATFORM_INDEPENDENT_TESTS }} -# - if: runner.os != 'Windows' -# name: run cpython platform-dependent tests -# run: target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }} -# - if: runner.os == 'Windows' -# name: run cpython platform-dependent tests (windows partial - fixme) -# run: -# target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed -v -x ${{ env.PLATFORM_INDEPENDENT_TESTS }} -# test_glob -# test_importlib -# test_io -# test_iter -# test_os -# test_pathlib -# test_posixpath -# test_shutil -# test_venv -# - if: runner.os != 'Windows' -# name: check that --install-pip succeeds -# run: | -# mkdir site-packages -# target/release/rustpython --install-pip ensurepip --user -# - if: runner.os != 'Windows' -# name: Check that ensurepip succeeds. -# run: | -# target/release/rustpython -m ensurepip -# target/release/rustpython -c "import pip" -# - name: Check whats_left is not broken -# run: python -I whats_left.py - lalrpop: if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} name: Generate parser with lalrpop @@ -385,83 +310,3 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run tests under miri run: cargo +nightly miri test -p rustpython-parser -- miri_test - -# wasm: -# if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} -# name: Check the WASM package and demo -# needs: lalrpop -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v3 -# - name: Cache generated parser -# uses: actions/cache@v3 -# with: -# path: compiler/parser/python.rs -# key: lalrpop-${{ hashFiles('compiler/parser/python.lalrpop') }} -# - uses: dtolnay/rust-toolchain@stable -# -# - uses: Swatinem/rust-cache@v2 -# - name: install wasm-pack -# run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -# - name: install geckodriver -# run: | -# wget https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz -# mkdir geckodriver -# tar -xzf geckodriver-v0.30.0-linux64.tar.gz -C geckodriver -# - uses: actions/setup-python@v4 -# with: -# python-version: "3.11" -# - run: python -m pip install -r requirements.txt -# working-directory: ./wasm/tests -# - uses: actions/setup-node@v3 -# - name: run test -# run: | -# export PATH=$PATH:`pwd`/../../geckodriver -# npm install -# npm run test -# env: -# NODE_OPTIONS: "--openssl-legacy-provider" -# working-directory: ./wasm/demo -# - name: build notebook demo -# if: github.ref == 'refs/heads/release' -# run: | -# npm install -# npm run dist -# mv dist ../demo/dist/notebook -# env: -# NODE_OPTIONS: "--openssl-legacy-provider" -# working-directory: ./wasm/notebook -# - name: Deploy demo to Github Pages -# if: success() && github.ref == 'refs/heads/release' -# uses: peaceiris/actions-gh-pages@v2 -# env: -# ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEMO_DEPLOY_KEY }} -# PUBLISH_DIR: ./wasm/demo/dist -# EXTERNAL_REPOSITORY: RustPython/demo -# PUBLISH_BRANCH: master -# -# wasm-wasi: -# if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} -# name: Run snippets and cpython tests on wasm-wasi -# needs: lalrpop -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v3 -# - name: Cache generated parser -# uses: actions/cache@v3 -# with: -# path: compiler/parser/python.rs -# key: lalrpop-${{ hashFiles('compiler/parser/python.lalrpop') }} -# - uses: dtolnay/rust-toolchain@stable -# with: -# target: wasm32-wasi -# -# - uses: Swatinem/rust-cache@v2 -# - name: Setup Wasmer -# uses: wasmerio/setup-wasmer@v2 -# - name: Install clang -# run: sudo apt-get update && sudo apt-get install clang -y -# - name: build rustpython -# run: cargo build --release --target wasm32-wasi --features freeze-stdlib,stdlib --verbose -# - name: run snippets -# run: wasmer run --dir . target/wasm32-wasi/release/rustpython.wasm -- extra_tests/snippets/stdlib_random.py diff --git a/Cargo.toml b/Cargo.toml index 39ec98e2e7..0dd2bd6c5c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,14 +1,3 @@ -#[package] -#name = "rustpython" -#version = "0.2.0" -#authors = ["RustPython Team"] -#edition = "2021" -#rust-version = "1.67.1" -#description = "A python interpreter written in rust." -#repository = "https://github.com/RustPython/RustPython" -#license = "MIT" -#include = ["LICENSE", "Cargo.toml", "src/**/*.rs"] - [workspace] resolver = "2" members = [ @@ -55,60 +44,6 @@ thread_local = "1.1.4" unicode_names2 = { version = "0.6.0", git = "https://github.com/youknowone/unicode_names2.git", rev = "4ce16aa85cbcdd9cc830410f1a72ef9a235f2fde" } widestring = "0.5.1" -#[features] -#default = ["threading", "stdlib", "zlib", "importlib", "encodings", "rustpython-parser/lalrpop"] -#importlib = ["rustpython-vm/importlib"] -#encodings = ["rustpython-vm/encodings"] -#stdlib = ["rustpython-stdlib", "rustpython-pylib"] -#flame-it = ["rustpython-vm/flame-it", "flame", "flamescope"] -#freeze-stdlib = ["rustpython-vm/freeze-stdlib", "rustpython-pylib?/freeze-stdlib"] -#jit = ["rustpython-vm/jit"] -#threading = ["rustpython-vm/threading", "rustpython-stdlib/threading"] -#zlib = ["stdlib", "rustpython-stdlib/zlib"] -#bz2 = ["stdlib", "rustpython-stdlib/bz2"] -#ssl = ["rustpython-stdlib/ssl"] -#ssl-vendor = ["rustpython-stdlib/ssl-vendor"] - -#[dependencies] -#rustpython-compiler = { path = "compiler", version = "0.2.0" } -#rustpython-parser = { path = "compiler/parser", version = "0.2.0" } -#rustpython-pylib = { path = "pylib", optional = true, default-features = false } -#rustpython-stdlib = { path = "stdlib", optional = true, default-features = false } -#rustpython-vm = { path = "vm", version = "0.2.0", default-features = false, features = ["compiler"] } - -#atty = { workspace = true } -#cfg-if = { workspace = true } -#log = { workspace = true } -#flame = { workspace = true, optional = true } -# -#clap = "2.34" -#dirs = { package = "dirs-next", version = "2.0.0" } -#env_logger = { version = "0.9.0", default-features = false, features = ["atty", "termcolor"] } -#flamescope = { version = "0.1.2", optional = true } -# -#[target.'cfg(windows)'.dependencies] -#libc = { workspace = true } -# -#[target.'cfg(not(target_arch = "wasm32"))'.dependencies] -#rustyline = { workspace = true } -# -#[dev-dependencies] -#cpython = "0.7.0" -#criterion = "0.3.5" -#python3-sys = "0.7.0" - -#[[bench]] -#name = "execution" -#harness = false -# -#[[bench]] -#name = "microbenchmarks" -#harness = false -# -#[[bin]] -#name = "rustpython" -#path = "src/main.rs" - [profile.dev.package."*"] opt-level = 3 @@ -124,8 +59,3 @@ opt-level = 3 [profile.release] lto = "thin" - -[patch.crates-io] -# REDOX START, Uncomment when you want to compile/check with redoxer -# nix = { git = "https://github.com/coolreader18/nix", branch = "0.26.2-redox" } -# REDOX END From a4011c839cd0b17c8b07d9721b772372261942a6 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Tue, 25 Apr 2023 23:25:19 -0600 Subject: [PATCH 14/16] Revert unparse --- compiler/ast/src/lib.rs | 2 + compiler/ast/src/unparse.rs | 534 ++++++++++++++++++++++++++++++++++++ 2 files changed, 536 insertions(+) create mode 100644 compiler/ast/src/unparse.rs diff --git a/compiler/ast/src/lib.rs b/compiler/ast/src/lib.rs index d60f8d0747..cf7d6ad8df 100644 --- a/compiler/ast/src/lib.rs +++ b/compiler/ast/src/lib.rs @@ -3,6 +3,8 @@ mod constant; #[cfg(feature = "fold")] mod fold_helpers; mod impls; +#[cfg(feature = "unparse")] +mod unparse; pub use ast_gen::*; diff --git a/compiler/ast/src/unparse.rs b/compiler/ast/src/unparse.rs new file mode 100644 index 0000000000..081c2a9241 --- /dev/null +++ b/compiler/ast/src/unparse.rs @@ -0,0 +1,534 @@ +use crate::{ + Arg, Arguments, Boolop, Cmpop, Comprehension, Constant, ConversionFlag, Expr, ExprKind, + Operator, +}; +use std::fmt; + +mod precedence { + macro_rules! precedence { + ($($op:ident,)*) => { + precedence!(@0, $($op,)*); + }; + (@$i:expr, $op1:ident, $($op:ident,)*) => { + pub const $op1: u8 = $i; + precedence!(@$i + 1, $($op,)*); + }; + (@$i:expr,) => {}; + } + precedence!( + TUPLE, TEST, OR, AND, NOT, CMP, // "EXPR" = + BOR, BXOR, BAND, SHIFT, ARITH, TERM, FACTOR, POWER, AWAIT, ATOM, + ); + pub const EXPR: u8 = BOR; +} + +#[repr(transparent)] +struct Unparser<'a> { + f: fmt::Formatter<'a>, +} +impl<'a> Unparser<'a> { + fn new<'b>(f: &'b mut fmt::Formatter<'a>) -> &'b mut Unparser<'a> { + unsafe { &mut *(f as *mut fmt::Formatter<'a> as *mut Unparser<'a>) } + } + + fn p(&mut self, s: &str) -> fmt::Result { + self.f.write_str(s) + } + fn p_if(&mut self, cond: bool, s: &str) -> fmt::Result { + if cond { + self.f.write_str(s)?; + } + Ok(()) + } + fn p_delim(&mut self, first: &mut bool, s: &str) -> fmt::Result { + self.p_if(!std::mem::take(first), s) + } + fn write_fmt(&mut self, f: fmt::Arguments<'_>) -> fmt::Result { + self.f.write_fmt(f) + } + + fn unparse_expr(&mut self, ast: &Expr, level: u8) -> fmt::Result { + macro_rules! op_prec { + ($op_ty:ident, $x:expr, $enu:path, $($var:ident($op:literal, $prec:ident)),*$(,)?) => { + match $x { + $(<$enu>::$var => (op_prec!(@space $op_ty, $op), precedence::$prec),)* + } + }; + (@space bin, $op:literal) => { + concat!(" ", $op, " ") + }; + (@space un, $op:literal) => { + $op + }; + } + macro_rules! group_if { + ($lvl:expr, $body:block) => {{ + let group = level > $lvl; + self.p_if(group, "(")?; + let ret = $body; + self.p_if(group, ")")?; + ret + }}; + } + match &ast.node { + ExprKind::BoolOp { op, values } => { + let (op, prec) = op_prec!(bin, op, Boolop, And("and", AND), Or("or", OR)); + group_if!(prec, { + let mut first = true; + for val in values { + self.p_delim(&mut first, op)?; + self.unparse_expr(val, prec + 1)?; + } + }) + } + ExprKind::NamedExpr { target, value } => { + group_if!(precedence::TUPLE, { + self.unparse_expr(target, precedence::ATOM)?; + self.p(" := ")?; + self.unparse_expr(value, precedence::ATOM)?; + }) + } + ExprKind::BinOp { left, op, right } => { + let right_associative = matches!(op, Operator::Pow); + let (op, prec) = op_prec!( + bin, + op, + Operator, + Add("+", ARITH), + Sub("-", ARITH), + Mult("*", TERM), + MatMult("@", TERM), + Div("/", TERM), + Mod("%", TERM), + Pow("**", POWER), + LShift("<<", SHIFT), + RShift(">>", SHIFT), + BitOr("|", BOR), + BitXor("^", BXOR), + BitAnd("&", BAND), + FloorDiv("//", TERM), + ); + group_if!(prec, { + self.unparse_expr(left, prec + right_associative as u8)?; + self.p(op)?; + self.unparse_expr(right, prec + !right_associative as u8)?; + }) + } + ExprKind::UnaryOp { op, operand } => { + let (op, prec) = op_prec!( + un, + op, + crate::Unaryop, + Invert("~", FACTOR), + Not("not ", NOT), + UAdd("+", FACTOR), + USub("-", FACTOR) + ); + group_if!(prec, { + self.p(op)?; + self.unparse_expr(operand, prec)?; + }) + } + ExprKind::Lambda { args, body } => { + group_if!(precedence::TEST, { + let pos = args.args.len() + args.posonlyargs.len(); + self.p(if pos > 0 { "lambda " } else { "lambda" })?; + self.unparse_args(args)?; + write!(self, ": {}", **body)?; + }) + } + ExprKind::IfExp { test, body, orelse } => { + group_if!(precedence::TEST, { + self.unparse_expr(body, precedence::TEST + 1)?; + self.p(" if ")?; + self.unparse_expr(test, precedence::TEST + 1)?; + self.p(" else ")?; + self.unparse_expr(orelse, precedence::TEST)?; + }) + } + ExprKind::Dict { keys, values } => { + self.p("{")?; + let mut first = true; + let (packed, unpacked) = values.split_at(keys.len()); + for (k, v) in keys.iter().zip(packed) { + self.p_delim(&mut first, ", ")?; + if let Some(k) = k { + write!(self, "{}: {}", *k, *v)?; + } else { + write!(self, "**{}", *v)?; + } + } + for d in unpacked { + self.p_delim(&mut first, ", ")?; + write!(self, "**{}", *d)?; + } + self.p("}")?; + } + ExprKind::Set { elts } => { + self.p("{")?; + let mut first = true; + for v in elts { + self.p_delim(&mut first, ", ")?; + self.unparse_expr(v, precedence::TEST)?; + } + self.p("}")?; + } + ExprKind::ListComp { elt, generators } => { + self.p("[")?; + self.unparse_expr(elt, precedence::TEST)?; + self.unparse_comp(generators)?; + self.p("]")?; + } + ExprKind::SetComp { elt, generators } => { + self.p("{")?; + self.unparse_expr(elt, precedence::TEST)?; + self.unparse_comp(generators)?; + self.p("}")?; + } + ExprKind::DictComp { + key, + value, + generators, + } => { + self.p("{")?; + self.unparse_expr(key, precedence::TEST)?; + self.p(": ")?; + self.unparse_expr(value, precedence::TEST)?; + self.unparse_comp(generators)?; + self.p("}")?; + } + ExprKind::GeneratorExp { elt, generators } => { + self.p("(")?; + self.unparse_expr(elt, precedence::TEST)?; + self.unparse_comp(generators)?; + self.p(")")?; + } + ExprKind::Await { value } => { + group_if!(precedence::AWAIT, { + self.p("await ")?; + self.unparse_expr(value, precedence::ATOM)?; + }) + } + ExprKind::Yield { value } => { + if let Some(value) = value { + write!(self, "(yield {})", **value)?; + } else { + self.p("(yield)")?; + } + } + ExprKind::YieldFrom { value } => { + write!(self, "(yield from {})", **value)?; + } + ExprKind::Compare { + left, + ops, + comparators, + } => { + group_if!(precedence::CMP, { + let new_lvl = precedence::CMP + 1; + self.unparse_expr(left, new_lvl)?; + for (op, cmp) in ops.iter().zip(comparators) { + let op = match op { + Cmpop::Eq => " == ", + Cmpop::NotEq => " != ", + Cmpop::Lt => " < ", + Cmpop::LtE => " <= ", + Cmpop::Gt => " > ", + Cmpop::GtE => " >= ", + Cmpop::Is => " is ", + Cmpop::IsNot => " is not ", + Cmpop::In => " in ", + Cmpop::NotIn => " not in ", + }; + self.p(op)?; + self.unparse_expr(cmp, new_lvl)?; + } + }) + } + ExprKind::Call { + func, + args, + keywords, + } => { + self.unparse_expr(func, precedence::ATOM)?; + self.p("(")?; + if let ( + [Expr { + node: ExprKind::GeneratorExp { elt, generators }, + .. + }], + [], + ) = (&**args, &**keywords) + { + // make sure a single genexpr doesn't get double parens + self.unparse_expr(elt, precedence::TEST)?; + self.unparse_comp(generators)?; + } else { + let mut first = true; + for arg in args { + self.p_delim(&mut first, ", ")?; + self.unparse_expr(arg, precedence::TEST)?; + } + for kw in keywords { + self.p_delim(&mut first, ", ")?; + if let Some(arg) = &kw.node.arg { + self.p(arg)?; + self.p("=")?; + } else { + self.p("**")?; + } + self.unparse_expr(&kw.node.value, precedence::TEST)?; + } + } + self.p(")")?; + } + ExprKind::FormattedValue { + value, + conversion, + format_spec, + } => self.unparse_formatted(value, *conversion, format_spec.as_deref())?, + ExprKind::JoinedStr { values } => self.unparse_joined_str(values, false)?, + ExprKind::Constant { value, kind } => { + if let Some(kind) = kind { + self.p(kind)?; + } + assert_eq!(f64::MAX_10_EXP, 308); + let inf_str = "1e309"; + match value { + Constant::Float(f) if f.is_infinite() => self.p(inf_str)?, + Constant::Complex { real, imag } + if real.is_infinite() || imag.is_infinite() => + { + self.p(&value.to_string().replace("inf", inf_str))? + } + _ => fmt::Display::fmt(value, &mut self.f)?, + } + } + ExprKind::Attribute { value, attr, .. } => { + self.unparse_expr(value, precedence::ATOM)?; + let period = if let ExprKind::Constant { + value: Constant::Int(_), + .. + } = &value.node + { + " ." + } else { + "." + }; + self.p(period)?; + self.p(attr)?; + } + ExprKind::Subscript { value, slice, .. } => { + self.unparse_expr(value, precedence::ATOM)?; + let mut lvl = precedence::TUPLE; + if let ExprKind::Tuple { elts, .. } = &slice.node { + if elts + .iter() + .any(|expr| matches!(expr.node, ExprKind::Starred { .. })) + { + lvl += 1 + } + } + self.p("[")?; + self.unparse_expr(slice, lvl)?; + self.p("]")?; + } + ExprKind::Starred { value, .. } => { + self.p("*")?; + self.unparse_expr(value, precedence::EXPR)?; + } + ExprKind::Name { id, .. } => self.p(id)?, + ExprKind::List { elts, .. } => { + self.p("[")?; + let mut first = true; + for elt in elts { + self.p_delim(&mut first, ", ")?; + self.unparse_expr(elt, precedence::TEST)?; + } + self.p("]")?; + } + ExprKind::Tuple { elts, .. } => { + if elts.is_empty() { + self.p("()")?; + } else { + group_if!(precedence::TUPLE, { + let mut first = true; + for elt in elts { + self.p_delim(&mut first, ", ")?; + self.unparse_expr(elt, precedence::TEST)?; + } + self.p_if(elts.len() == 1, ",")?; + }) + } + } + ExprKind::Slice { lower, upper, step } => { + if let Some(lower) = lower { + self.unparse_expr(lower, precedence::TEST)?; + } + self.p(":")?; + if let Some(upper) = upper { + self.unparse_expr(upper, precedence::TEST)?; + } + if let Some(step) = step { + self.p(":")?; + self.unparse_expr(step, precedence::TEST)?; + } + } + } + Ok(()) + } + + fn unparse_args(&mut self, args: &Arguments) -> fmt::Result { + let mut first = true; + let defaults_start = args.posonlyargs.len() + args.args.len() - args.defaults.len(); + for (i, arg) in args.posonlyargs.iter().chain(&args.args).enumerate() { + self.p_delim(&mut first, ", ")?; + self.unparse_arg(arg)?; + if let Some(i) = i.checked_sub(defaults_start) { + write!(self, "={}", &args.defaults[i])?; + } + self.p_if(i + 1 == args.posonlyargs.len(), ", /")?; + } + if args.vararg.is_some() || !args.kwonlyargs.is_empty() { + self.p_delim(&mut first, ", ")?; + self.p("*")?; + } + if let Some(vararg) = &args.vararg { + self.unparse_arg(vararg)?; + } + let defaults_start = args.kwonlyargs.len() - args.kw_defaults.len(); + for (i, kwarg) in args.kwonlyargs.iter().enumerate() { + self.p_delim(&mut first, ", ")?; + self.unparse_arg(kwarg)?; + if let Some(default) = i + .checked_sub(defaults_start) + .and_then(|i| args.kw_defaults.get(i)) + { + write!(self, "={default}")?; + } + } + if let Some(kwarg) = &args.kwarg { + self.p_delim(&mut first, ", ")?; + self.p("**")?; + self.unparse_arg(kwarg)?; + } + Ok(()) + } + fn unparse_arg(&mut self, arg: &Arg) -> fmt::Result { + self.p(&arg.node.arg)?; + if let Some(ann) = &arg.node.annotation { + write!(self, ": {}", **ann)?; + } + Ok(()) + } + + fn unparse_comp(&mut self, generators: &[Comprehension]) -> fmt::Result { + for comp in generators { + self.p(if comp.is_async > 0 { + " async for " + } else { + " for " + })?; + self.unparse_expr(&comp.target, precedence::TUPLE)?; + self.p(" in ")?; + self.unparse_expr(&comp.iter, precedence::TEST + 1)?; + for cond in &comp.ifs { + self.p(" if ")?; + self.unparse_expr(cond, precedence::TEST + 1)?; + } + } + Ok(()) + } + + fn unparse_fstring_body(&mut self, values: &[Expr], is_spec: bool) -> fmt::Result { + for value in values { + self.unparse_fstring_elem(value, is_spec)?; + } + Ok(()) + } + + fn unparse_formatted( + &mut self, + val: &Expr, + conversion: usize, + spec: Option<&Expr>, + ) -> fmt::Result { + let buffered = to_string_fmt(|f| Unparser::new(f).unparse_expr(val, precedence::TEST + 1)); + let brace = if buffered.starts_with('{') { + // put a space to avoid escaping the bracket + "{ " + } else { + "{" + }; + self.p(brace)?; + self.p(&buffered)?; + drop(buffered); + + if conversion != ConversionFlag::None as usize { + self.p("!")?; + let buf = &[conversion as u8]; + let c = std::str::from_utf8(buf).unwrap(); + self.p(c)?; + } + + if let Some(spec) = spec { + self.p(":")?; + self.unparse_fstring_elem(spec, true)?; + } + + self.p("}")?; + + Ok(()) + } + + fn unparse_fstring_elem(&mut self, expr: &Expr, is_spec: bool) -> fmt::Result { + match &expr.node { + ExprKind::Constant { value, .. } => { + if let Constant::Str(s) = value { + self.unparse_fstring_str(s) + } else { + unreachable!() + } + } + ExprKind::JoinedStr { values } => self.unparse_joined_str(values, is_spec), + ExprKind::FormattedValue { + value, + conversion, + format_spec, + } => self.unparse_formatted(value, *conversion, format_spec.as_deref()), + _ => unreachable!(), + } + } + + fn unparse_fstring_str(&mut self, s: &str) -> fmt::Result { + let s = s.replace('{', "{{").replace('}', "}}"); + self.p(&s) + } + + fn unparse_joined_str(&mut self, values: &[Expr], is_spec: bool) -> fmt::Result { + if is_spec { + self.unparse_fstring_body(values, is_spec) + } else { + self.p("f")?; + let body = to_string_fmt(|f| Unparser::new(f).unparse_fstring_body(values, is_spec)); + fmt::Display::fmt(&rustpython_common::str::repr(&body), &mut self.f) + } + } +} + +impl fmt::Display for Expr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + Unparser::new(f).unparse_expr(self, precedence::TEST) + } +} + +fn to_string_fmt(f: impl FnOnce(&mut fmt::Formatter) -> fmt::Result) -> String { + use std::cell::Cell; + struct Fmt(Cell>); + impl fmt::Result> fmt::Display for Fmt { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + self.0.take().unwrap()(f) + } + } + Fmt(Cell::new(Some(f))).to_string() +} From 5ffa8a1985d436607bbcfaac01a3a4e7d1809645 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Wed, 26 Apr 2023 11:33:34 -0600 Subject: [PATCH 15/16] Revert lalrpop upgrade --- compiler/parser/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/parser/Cargo.toml b/compiler/parser/Cargo.toml index 6792e24451..3129d5f45f 100644 --- a/compiler/parser/Cargo.toml +++ b/compiler/parser/Cargo.toml @@ -14,7 +14,7 @@ serde = ["dep:serde", "rustpython-compiler-core/serde"] [build-dependencies] anyhow = { workspace = true } -lalrpop = { version = "0.19.10", optional = true } +lalrpop = { version = "0.19.9", optional = true } phf_codegen = "0.11.1" tiny-keccak = { version = "2", features = ["sha3"] } @@ -31,7 +31,7 @@ unicode_names2 = { workspace = true } unic-emoji-char = "0.9.0" unic-ucd-ident = "0.9.0" -lalrpop-util = "0.19.10" +lalrpop-util = "0.19.9" phf = "0.11.1" rustc-hash = "1.1.0" serde = { version = "1.0.133", optional = true, default-features = false, features = ["derive"] } From a42e77a405c98a5460b76d29ca7a54ff76989c80 Mon Sep 17 00:00:00 2001 From: Micha Reiser Date: Wed, 26 Apr 2023 11:36:18 -0600 Subject: [PATCH 16/16] Revert into_node and node() changes --- compiler/ast/asdl_rs.py | 18 ------------------ compiler/parser/python.lalrpop | 4 ++-- compiler/parser/src/function.rs | 2 +- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/compiler/ast/asdl_rs.py b/compiler/ast/asdl_rs.py index 046146a940..7013f3580c 100755 --- a/compiler/ast/asdl_rs.py +++ b/compiler/ast/asdl_rs.py @@ -711,24 +711,6 @@ def write_ast_def(mod, typeinfo, f): } } - impl std::ops::Deref for Located { - type Target = T; - - fn deref(&self) -> &Self::Target { - &self.node - } - - pub const fn start(&self) -> Location { - self.location - } - - /// Returns the node's [`end_location`](Located::end_location) or [`location`](Located::start) if - /// [`end_location`](Located::end_location) is `None`. - pub fn end(&self) -> Location { - self.end_location.unwrap_or(self.location) - } - } - impl std::ops::Deref for Located { type Target = T; diff --git a/compiler/parser/python.lalrpop b/compiler/parser/python.lalrpop index 0b18f5c2e3..9f03853661 100644 --- a/compiler/parser/python.lalrpop +++ b/compiler/parser/python.lalrpop @@ -519,7 +519,7 @@ ClosedPattern: ast::Pattern = { SequencePattern: ast::PatternKind = { // A single-item tuple is a special case: it's a group pattern, _not_ a sequence pattern. - "(" ")" => pattern.into_node(), + "(" ")" => pattern.node, "(" ")" => ast::PatternKind::MatchSequence { patterns: vec![], }, @@ -1554,7 +1554,7 @@ Atom: ast::Expr = { }, "(" >> ",")?> )*> ")" =>? { if left.is_none() && right.is_empty() && trailing_comma.is_none() { - if matches!(mid.node(), ast::ExprKind::Starred { .. }) { + if matches!(mid.node, ast::ExprKind::Starred { .. }) { Err(LexicalError{ error: LexicalErrorType::OtherError("cannot use starred expression here".to_string()), location: mid.start(), diff --git a/compiler/parser/src/function.rs b/compiler/parser/src/function.rs index 1bb0016d50..ea66938a7d 100644 --- a/compiler/parser/src/function.rs +++ b/compiler/parser/src/function.rs @@ -144,7 +144,7 @@ pub(crate) fn parse_args(func_args: Vec) -> Result bool { - matches!(exp.node(), ast::ExprKind::Starred { .. }) + matches!(exp.node, ast::ExprKind::Starred { .. }) } #[cfg(test)]