From 8a98f29c9d4f6402d35cb0002cc4d46bf5bda319 Mon Sep 17 00:00:00 2001 From: Pakin Date: Mon, 25 May 2026 08:17:43 +0700 Subject: [PATCH] add: ffi node api for other languages - WIP xml script parser Signed-off-by: Pakin --- .dockerignore | 2 + .gitignore | 3 +- Cargo.lock | 1518 ++++++++++++++++++++++++++------ Cargo.toml | 23 +- Dockerfile | 52 ++ codegen_python.sh | 25 + src/lib.rs | 2 + src/xml/ast/mod.rs | 1 + src/xml/ast/nodes.rs | 88 ++ src/xml/codegen/java.rs | 0 src/xml/codegen/javascript.rs | 0 src/xml/codegen/mod.rs | 23 + src/xml/codegen/python.rs | 0 src/xml/codegen/rust.rs | 0 src/xml/error/formatter.rs | 0 src/xml/error/mod.rs | 84 ++ src/xml/ffi_node.rs | 167 ++++ src/xml/mod.rs | 5 + src/xml/node.rs | 50 +- src/xml/parser/grammar.lalrpop | 9 + src/xml/parser/grammar.rs | 722 +++++++++++++++ src/xml/parser/mod.rs | 37 + src/xml/parser/mod.rs.bak | 59 ++ 23 files changed, 2591 insertions(+), 279 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100755 codegen_python.sh create mode 100644 src/xml/ast/mod.rs create mode 100644 src/xml/ast/nodes.rs create mode 100644 src/xml/codegen/java.rs create mode 100644 src/xml/codegen/javascript.rs create mode 100644 src/xml/codegen/mod.rs create mode 100644 src/xml/codegen/python.rs create mode 100644 src/xml/codegen/rust.rs create mode 100644 src/xml/error/formatter.rs create mode 100644 src/xml/error/mod.rs create mode 100644 src/xml/ffi_node.rs create mode 100644 src/xml/parser/grammar.lalrpop create mode 100644 src/xml/parser/grammar.rs create mode 100644 src/xml/parser/mod.rs create mode 100644 src/xml/parser/mod.rs.bak diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..510df0b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +target +.tbcfg \ No newline at end of file diff --git a/.gitignore b/.gitignore index 828887d..92da366 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /target .DS_Store *.jar -**/*/android \ No newline at end of file +**/*/android +out \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 949bedd..6e6cefa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,6 +19,15 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + [[package]] name = "android_system_properties" version = "0.1.5" @@ -28,6 +37,18 @@ dependencies = [ "libc", ] +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + [[package]] name = "arbitrary" version = "1.4.2" @@ -37,6 +58,70 @@ dependencies = [ "derive_arbitrary", ] +[[package]] +name = "ascii-canvas" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" +dependencies = [ + "term", +] + +[[package]] +name = "askama" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75363874b771be265f4ffe307ca705ef6f3baa19011c149da8674a87f1b75c4" +dependencies = [ + "askama_derive", + "itoa", + "percent-encoding", + "serde", + "serde_json", +] + +[[package]] +name = "askama_derive" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "129397200fe83088e8a68407a8e2b1f826cf0086b21ccdb866a722c8bcd3a94f" +dependencies = [ + "askama_parser", + "basic-toml", + "memchr", + "proc-macro2", + "quote", + "rustc-hash", + "serde", + "serde_derive", + "syn", +] + +[[package]] +name = "askama_parser" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6ab5630b3d5eaf232620167977f95eb51f3432fc76852328774afbd242d4358" +dependencies = [ + "memchr", + "serde", + "serde_derive", + "winnow 0.7.15", +] + +[[package]] +name = "async-compat" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ba85bc55464dcbf728b56d97e119d673f4cf9062be330a9a26f3acf504a590" +dependencies = [ + "futures-core", + "futures-io", + "once_cell", + "pin-project-lite", + "tokio", +] + [[package]] name = "autocfg" version = "1.5.0" @@ -44,10 +129,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] -name = "bitflags" -version = "2.10.0" +name = "basic-toml" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" +checksum = "ba62675e8242a4c4e806d12f11d136e626e6c8361d6b829310732241652a178a" +dependencies = [ + "serde", +] + +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + +[[package]] +name = "bitflags" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" [[package]] name = "block-buffer" @@ -60,9 +169,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.19.1" +version = "3.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" [[package]] name = "bzip2" @@ -74,10 +189,42 @@ dependencies = [ ] [[package]] -name = "cc" -version = "1.2.51" +name = "camino" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a0aeaff4ff1a90589618835a598e545176939b97874f7abc7851caa0618f203" +checksum = "e629a66d692cb9ff1a1c664e41771b3dcaf961985a9774c0eb0bd1b51cf60a48" +dependencies = [ + "serde_core", +] + +[[package]] +name = "cargo-platform" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror 2.0.18", +] + +[[package]] +name = "cc" +version = "1.2.62" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1dce859f0832a7d088c4f1119888ab94ef4b5d6795d1ce05afb7fe159d79f98" dependencies = [ "find-msvc-tools", "jobserver", @@ -93,9 +240,9 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "chrono" -version = "0.4.42" +version = "0.4.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" dependencies = [ "iana-time-zone", "js-sys", @@ -114,6 +261,45 @@ dependencies = [ "inout", ] +[[package]] +name = "clap" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" +dependencies = [ + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" + [[package]] name = "constant_time_eq" version = "0.3.1" @@ -146,9 +332,9 @@ dependencies = [ [[package]] name = "crc-catalog" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" +checksum = "217698eaf96b4a3f0bc4f3662aaa55bdf913cd54d7204591faa790070c6d0853" [[package]] name = "crc32fast" @@ -184,6 +370,12 @@ version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + [[package]] name = "crypto-common" version = "0.1.7" @@ -196,15 +388,15 @@ dependencies = [ [[package]] name = "deflate64" -version = "0.1.10" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26bf8fc351c5ed29b5c2f0cbbac1b209b74f60ecd62e675a998df72c49af5204" +checksum = "ac6b926516df9c60bfa16e107b21086399f8285a44ca9711344b9e553c5146e2" [[package]] name = "deranged" -version = "0.5.5" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" dependencies = [ "powerfmt", ] @@ -231,6 +423,27 @@ dependencies = [ "subtle", ] +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + [[package]] name = "displaydoc" version = "0.2.5" @@ -244,9 +457,18 @@ dependencies = [ [[package]] name = "either" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e" + +[[package]] +name = "ena" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eabffdaee24bd1bf95c5ef7cec31260444317e72ea56c4c91750e8b7ee58d5f1" +dependencies = [ + "log", +] [[package]] name = "equivalent" @@ -261,38 +483,54 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys", ] [[package]] -name = "filetime" -version = "0.2.26" +name = "fastrand" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc0505cd1b6fa6580283f6bdf70a73fcf4aba1184038c90902b92b3dd0df63ed" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" + +[[package]] +name = "filetime" +version = "0.2.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759" dependencies = [ "cfg-if", "libc", - "libredox", - "windows-sys 0.60.2", ] [[package]] name = "find-msvc-tools" -version = "0.1.6" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645cbb3a84e60b7531617d5ae4e57f7e27308f6445f5abf653209ea76dec8dff" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.1.5" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" dependencies = [ "crc32fast", - "libz-rs-sys", "miniz_oxide", + "zlib-rs", ] +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + [[package]] name = "form_urlencoded" version = "1.2.2" @@ -302,6 +540,45 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fs-err" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88a41f105fe1d5b6b34b2055e3dc59bb79b46b48b2040b9e6c7b4b5de097aa41" +dependencies = [ + "autocfg", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-io" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "slab", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -312,6 +589,17 @@ dependencies = [ "version_check", ] +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + [[package]] name = "getrandom" version = "0.3.4" @@ -320,15 +608,28 @@ checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", "libc", - "r-efi", + "r-efi 5.3.0", "wasip2", ] [[package]] -name = "git2" -version = "0.20.3" +name = "getrandom" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e2b37e2f62729cdada11f0e6b3b6fe383c69c29fc619e391223e12856af308c" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "wasip2", + "wasip3", +] + +[[package]] +name = "git2" +version = "0.20.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b88256088d75a56f8ecfa070513a775dd9107f6530ef14919dac831af9cfe2b" dependencies = [ "bitflags", "libc", @@ -340,10 +641,42 @@ dependencies = [ ] [[package]] -name = "hashbrown" -version = "0.17.0" +name = "glob" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" + +[[package]] +name = "goblin" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b363a30c165f666402fe6a3024d3bec7ebc898f96a4a23bd1c99f8dbf3f4f47" +dependencies = [ + "log", + "plain", + "scroll", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hmac" @@ -356,9 +689,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.64" +version = "0.1.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -380,12 +713,13 @@ dependencies = [ [[package]] name = "icu_collections" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" dependencies = [ "displaydoc", "potential_utf", + "utf8_iter", "yoke", "zerofrom", "zerovec", @@ -393,9 +727,9 @@ dependencies = [ [[package]] name = "icu_locale_core" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" dependencies = [ "displaydoc", "litemap", @@ -406,9 +740,9 @@ dependencies = [ [[package]] name = "icu_normalizer" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" dependencies = [ "icu_collections", "icu_normalizer_data", @@ -420,15 +754,15 @@ dependencies = [ [[package]] name = "icu_normalizer_data" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" [[package]] name = "icu_properties" -version = "2.1.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" dependencies = [ "icu_collections", "icu_locale_core", @@ -440,15 +774,15 @@ dependencies = [ [[package]] name = "icu_properties_data" -version = "2.1.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" [[package]] name = "icu_provider" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" dependencies = [ "displaydoc", "icu_locale_core", @@ -459,6 +793,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + [[package]] name = "idna" version = "1.1.0" @@ -472,9 +812,9 @@ dependencies = [ [[package]] name = "idna_adapter" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" dependencies = [ "icu_normalizer", "icu_properties", @@ -487,7 +827,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.17.1", + "serde", + "serde_core", ] [[package]] @@ -500,10 +842,19 @@ dependencies = [ ] [[package]] -name = "itoa" -version = "1.0.17" +name = "itertools" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" [[package]] name = "jobserver" @@ -511,37 +862,76 @@ version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" dependencies = [ - "getrandom", + "getrandom 0.3.4", "libc", ] [[package]] name = "js-sys" -version = "0.3.83" +version = "0.3.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8" +checksum = "67df7112613f8bfd9150013a0314e196f4800d3201ae742489d999db2f979f08" dependencies = [ + "cfg-if", + "futures-util", "once_cell", "wasm-bindgen", ] [[package]] -name = "libbz2-rs-sys" -version = "0.2.2" +name = "lalrpop" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c4a545a15244c7d945065b5d392b2d2d7f21526fba56ce51467b06ed445e8f7" +checksum = "55cb077ad656299f160924eb2912aa147d7339ea7d69e1b5517326fdcec3c1ca" +dependencies = [ + "ascii-canvas", + "bit-set", + "ena", + "itertools", + "lalrpop-util", + "petgraph", + "pico-args", + "regex", + "regex-syntax", + "string_cache", + "term", + "tiny-keccak", + "unicode-xid", + "walkdir", +] + +[[package]] +name = "lalrpop-util" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "507460a910eb7b32ee961886ff48539633b788a36b65692b95f225b844c82553" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "libbz2-rs-sys" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34b357333733e8260735ba5894eb928c02ecc69c78715f01a8019e7fa7f2db4c" [[package]] name = "libc" -version = "0.2.179" +version = "0.2.186" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5a2d376baa530d1238d133232d15e239abad80d05838b4b59354e5268af431f" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" [[package]] name = "libgit2-sys" -version = "0.18.3+1.9.2" +version = "0.18.4+1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9b3acc4b91781bb0b3386669d325163746af5f6e4f73e6d2d630e09a35f3487" +checksum = "9b26f66f35e1871b22efcf7191564123d2a446ca0538cde63c23adfefa9b15b7" dependencies = [ "cc", "libc", @@ -553,13 +943,11 @@ dependencies = [ [[package]] name = "libredox" -version = "0.1.12" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" +checksum = "e02f3bb43d335493c96bf3fd3a321600bf6bd07ed34bc64118e9293bdffea46c" dependencies = [ - "bitflags", "libc", - "redox_syscall", ] [[package]] @@ -584,31 +972,26 @@ dependencies = [ "flate2", "git2", "indexmap", + "lalrpop", + "lalrpop-util", "log", + "openssl-sys", "quick-xml", "rand", "rayon", "serde", "serde_json", "tar", + "uniffi", "walkdir", "zip", ] -[[package]] -name = "libz-rs-sys" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c10501e7805cee23da17c7790e59df2870c0d4043ec6d03f67d31e2b53e77415" -dependencies = [ - "zlib-rs", -] - [[package]] name = "libz-sys" -version = "1.1.23" +version = "1.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15d118bbf3771060e7311cc7bb0545b01d08a8b4a7de949198dec1fa0ca1c0f7" +checksum = "fc3a226e576f50782b3305c5ccf458698f92798987f551c6a02efe8276721e22" dependencies = [ "cc", "libc", @@ -618,15 +1001,24 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "litemap" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] [[package]] name = "log" @@ -650,6 +1042,12 @@ version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.8.9" @@ -661,10 +1059,26 @@ dependencies = [ ] [[package]] -name = "num-conv" -version = "0.1.0" +name = "new_debug_unreachable" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-conv" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" [[package]] name = "num-traits" @@ -677,9 +1091,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.21.3" +version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] name = "openssl-probe" @@ -688,17 +1102,50 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" [[package]] -name = "openssl-sys" -version = "0.9.111" +name = "openssl-src" +version = "300.6.0+3.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321" +checksum = "a8e8cbfd3a4a8c8f089147fd7aaa33cf8c7450c4d09f8f80698a0cf093abeff4" +dependencies = [ + "cc", +] + +[[package]] +name = "openssl-sys" +version = "0.9.116" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28a22dc7140cda5f096e5e7724a6962ca81a7f8bfd2979f9b18c11af56318c4" dependencies = [ "cc", "libc", + "openssl-src", "pkg-config", "vcpkg", ] +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + [[package]] name = "pbkdf2" version = "0.12.2" @@ -716,16 +1163,53 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] -name = "pkg-config" -version = "0.3.32" +name = "petgraph" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pico-args" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pkg-config" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" + +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" [[package]] name = "potential_utf" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" dependencies = [ "zerovec", ] @@ -738,9 +1222,9 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppmd-rust" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d558c559f0450f16f2a27a1f017ef38468c1090c9ce63c8e51366232d53717b4" +checksum = "efca4c95a19a79d1c98f791f10aebd5c1363b473244630bb7dbde1dc98455a24" [[package]] name = "ppv-lite86" @@ -752,28 +1236,44 @@ dependencies = [ ] [[package]] -name = "proc-macro2" -version = "1.0.105" +name = "precomputed-hash" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] [[package]] name = "quick-xml" -version = "0.39.2" +version = "0.39.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "958f21e8e7ceb5a1aa7fa87fab28e7c75976e0bfe7e23ff069e0a260f894067d" +checksum = "cdcc8dd4e2f670d309a5f0e83fe36dfdc05af317008fea29144da1a2ac858e5e" dependencies = [ "memchr", ] [[package]] name = "quote" -version = "1.0.43" +version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" dependencies = [ "proc-macro2", ] @@ -785,10 +1285,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" [[package]] -name = "rand" -version = "0.9.2" +name = "r-efi" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea" dependencies = [ "rand_chacha", "rand_core", @@ -806,18 +1312,18 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.9.3" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" dependencies = [ - "getrandom", + "getrandom 0.3.4", ] [[package]] name = "rayon" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" dependencies = [ "either", "rayon-core", @@ -835,24 +1341,70 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.7.0" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f3fe0889e69e2ae9e41f4d6c4c0181701d00e4697b356fb1f74173a5e0ee27" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ "bitflags", ] [[package]] -name = "rustix" -version = "1.1.3" +name = "redox_users" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom 0.2.17", + "libredox", + "thiserror 1.0.69", +] + +[[package]] +name = "regex" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" + +[[package]] +name = "rustc-hash" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" + +[[package]] +name = "rustix" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys 0.61.2", + "windows-sys", ] [[package]] @@ -870,6 +1422,42 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "scroll" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ab8598aa408498679922eff7fa985c25d58a90771bd6be794434c5277eab1a6" +dependencies = [ + "scroll_derive", +] + +[[package]] +name = "scroll_derive" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1783eabc414609e28a5ba76aee5ddd52199f7107a0b24c2e9746a1ecc34a683d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" +dependencies = [ + "serde", + "serde_core", +] + [[package]] name = "serde" version = "1.0.228" @@ -902,9 +1490,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.149" +version = "1.0.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9" dependencies = [ "itoa", "memchr", @@ -913,6 +1501,15 @@ dependencies = [ "zmij", ] +[[package]] +name = "serde_spanned" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" +dependencies = [ + "serde_core", +] + [[package]] name = "sha1" version = "0.10.6" @@ -943,9 +1540,21 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "simd-adler32" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" +checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" + +[[package]] +name = "siphasher" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "smallvec" @@ -953,12 +1562,42 @@ version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +[[package]] +name = "smawk" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" + [[package]] name = "stable_deref_trait" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "string_cache" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f" +dependencies = [ + "new_debug_unreachable", + "parking_lot", + "phf_shared", + "precomputed-hash", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + [[package]] name = "subtle" version = "2.6.1" @@ -967,9 +1606,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.114" +version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" dependencies = [ "proc-macro2", "quote", @@ -989,9 +1628,9 @@ dependencies = [ [[package]] name = "tar" -version = "0.4.44" +version = "0.4.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d863878d212c87a19c1a610eb53bb01fe12951c0501cf5a0d65f724914a667a" +checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840" dependencies = [ "filetime", "libc", @@ -999,45 +1638,315 @@ dependencies = [ ] [[package]] -name = "time" -version = "0.3.44" +name = "tempfile" +version = "3.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.2", + "once_cell", + "rustix", + "windows-sys", +] + +[[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 = "textwrap" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057" +dependencies = [ + "smawk", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl 2.0.18", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "time" +version = "0.3.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" dependencies = [ "deranged", "num-conv", "powerfmt", - "serde", + "serde_core", "time-core", ] [[package]] name = "time-core" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] [[package]] name = "tinystr" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" dependencies = [ "displaydoc", "zerovec", ] [[package]] -name = "typenum" -version = "1.19.0" +name = "tokio" +version = "1.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" +checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe" +dependencies = [ + "pin-project-lite", +] + +[[package]] +name = "toml" +version = "0.9.12+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned", + "toml_datetime", + "toml_parser", + "toml_writer", + "winnow 0.7.15", +] + +[[package]] +name = "toml_datetime" +version = "0.7.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_parser" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" +dependencies = [ + "winnow 1.0.3", +] + +[[package]] +name = "toml_writer" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db" + +[[package]] +name = "typenum" +version = "1.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de" [[package]] name = "unicode-ident" -version = "1.0.22" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "uniffi" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc5f2297ee5b893405bed1a6929faec4713a061df158ecf5198089f23910d470" +dependencies = [ + "anyhow", + "camino", + "cargo_metadata", + "clap", + "uniffi_bindgen", + "uniffi_build", + "uniffi_core", + "uniffi_macros", + "uniffi_pipeline", +] + +[[package]] +name = "uniffi_bindgen" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bc0c60a9607e7ab77a2ad47ec5530178015014839db25af7512447d2238016c" +dependencies = [ + "anyhow", + "askama", + "camino", + "cargo_metadata", + "fs-err", + "glob", + "goblin", + "heck", + "indexmap", + "once_cell", + "serde", + "tempfile", + "textwrap", + "toml", + "uniffi_internal_macros", + "uniffi_meta", + "uniffi_pipeline", + "uniffi_udl", +] + +[[package]] +name = "uniffi_build" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c39413c43b955e4aa8a4e2b34bbd1b6b5ff6bd85532b52f9eb92fbe88c14458" +dependencies = [ + "anyhow", + "camino", + "uniffi_bindgen", +] + +[[package]] +name = "uniffi_core" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77baf5d539fe2e1ad6805e942dbc5dbdeb2b83eb5f2b3a6535d422ca4b02a12f" +dependencies = [ + "anyhow", + "async-compat", + "bytes", + "once_cell", + "static_assertions", +] + +[[package]] +name = "uniffi_internal_macros" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4b42137524f4be6400fcaca9d02c1d4ecb6ad917e4013c0b93235526d8396e5" +dependencies = [ + "anyhow", + "indexmap", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "uniffi_macros" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9273ec45330d8fe9a3701b7b983cea7a4e218503359831967cb95d26b873561" +dependencies = [ + "camino", + "fs-err", + "once_cell", + "proc-macro2", + "quote", + "serde", + "syn", + "toml", + "uniffi_meta", +] + +[[package]] +name = "uniffi_meta" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "431d2f443e7828a6c29d188de98b6771a6491ee98bba2d4372643bf93f988a18" +dependencies = [ + "anyhow", + "siphasher", + "uniffi_internal_macros", + "uniffi_pipeline", +] + +[[package]] +name = "uniffi_pipeline" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "761ef74f6175e15603d0424cc5f98854c5baccfe7bf4ccb08e5816f9ab8af689" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "tempfile", + "uniffi_internal_macros", +] + +[[package]] +name = "uniffi_udl" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68773ec0e1c067b6505a73bbf6a5782f31a7f9209333a0df97b87565c46bf370" +dependencies = [ + "anyhow", + "textwrap", + "uniffi_meta", + "weedle2", +] [[package]] name = "url" @@ -1080,19 +1989,34 @@ dependencies = [ ] [[package]] -name = "wasip2" -version = "1.0.1+wasi-0.2.4" +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.3+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" dependencies = [ - "wit-bindgen", + "wit-bindgen 0.57.1", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen 0.51.0", ] [[package]] name = "wasm-bindgen" -version = "0.2.106" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd" +checksum = "49ace1d07c165b0864824eee619580c4689389afa9dc9ed3a4c75040d82e6790" dependencies = [ "cfg-if", "once_cell", @@ -1103,9 +2027,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.106" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3" +checksum = "8e68e6f4afd367a562002c05637acb8578ff2dea1943df76afb9e83d177c8578" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1113,9 +2037,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.106" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40" +checksum = "d95a9ec35c64b2a7cb35d3fead40c4238d0940c86d107136999567a4703259f2" dependencies = [ "bumpalo", "proc-macro2", @@ -1126,22 +2050,87 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.106" +version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4" +checksum = "c4e0100b01e9f0d03189a92b96772a1fb998639d981193d7dbab487302513441" dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags", + "hashbrown 0.15.5", + "indexmap", + "semver", +] + +[[package]] +name = "weedle2" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "998d2c24ec099a87daf9467808859f9d82b61f1d9c9701251aea037f514eae0e" +dependencies = [ + "nom", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + [[package]] name = "winapi-util" version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys", ] +[[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-core" version = "0.62.2" @@ -1201,15 +2190,6 @@ dependencies = [ "windows-link", ] -[[package]] -name = "windows-sys" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" -dependencies = [ - "windows-targets", -] - [[package]] name = "windows-sys" version = "0.61.2" @@ -1220,81 +2200,119 @@ dependencies = [ ] [[package]] -name = "windows-targets" -version = "0.53.5" +name = "winnow" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" dependencies = [ - "windows-link", - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "memchr", ] [[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.1" +name = "winnow" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" - -[[package]] -name = "windows_i686_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" - -[[package]] -name = "windows_i686_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" +checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1" [[package]] name = "wit-bindgen" -version = "0.46.0" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] [[package]] name = "writeable" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" [[package]] name = "xattr" @@ -1308,9 +2326,9 @@ dependencies = [ [[package]] name = "yoke" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" +checksum = "abe8c5fda708d9ca3df187cae8bfb9ceda00dd96231bed36e445a1a48e66f9ca" dependencies = [ "stable_deref_trait", "yoke-derive", @@ -1319,9 +2337,9 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" dependencies = [ "proc-macro2", "quote", @@ -1331,18 +2349,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.33" +version = "0.8.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd" +checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.33" +version = "0.8.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" +checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" dependencies = [ "proc-macro2", "quote", @@ -1351,18 +2369,18 @@ dependencies = [ [[package]] name = "zerofrom" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" dependencies = [ "proc-macro2", "quote", @@ -1392,9 +2410,9 @@ dependencies = [ [[package]] name = "zerotrie" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" dependencies = [ "displaydoc", "yoke", @@ -1403,9 +2421,9 @@ dependencies = [ [[package]] name = "zerovec" -version = "0.11.5" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" dependencies = [ "yoke", "zerofrom", @@ -1414,9 +2432,9 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" dependencies = [ "proc-macro2", "quote", @@ -1436,7 +2454,7 @@ dependencies = [ "crc32fast", "deflate64", "flate2", - "getrandom", + "getrandom 0.3.4", "hmac", "indexmap", "lzma-rust2", @@ -1452,15 +2470,15 @@ dependencies = [ [[package]] name = "zlib-rs" -version = "0.5.5" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40990edd51aae2c2b6907af74ffb635029d5788228222c4bb811e9351c0caad3" +checksum = "3be3d40e40a133f9c916ee3f9f4fa2d9d63435b5fbe1bfc6d9dae0aa0ada1513" [[package]] name = "zmij" -version = "1.0.12" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fc5a66a20078bf1251bde995aa2fdcc4b800c70b5d92dd2c62abc5c60f679f8" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" [[package]] name = "zopfli" diff --git a/Cargo.toml b/Cargo.toml index 6fea581..3a9f1fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,17 +3,34 @@ name = "libtbr" version = "0.1.1" edition = "2024" +[lib] +name = "tbr" +crate-type = ["rlib", "cdylib"] + +[[bin]] +name = "uniffi-bindgen" +path = "uniffi-bindgen.rs" + [dependencies] -chrono = "0.4.41" +chrono = "0.4.44" flate2 = "1.1.2" git2 = "0.20.2" indexmap = "2.14.0" log = "0.4.27" +lalrpop-util = { version = "0.20.0", features = ["lexer"] } +openssl-sys = { version = "0.9.116", features = ["vendored"] } quick-xml = "0.39.2" rand = "0.9.2" rayon = "1.10.0" -serde = { version = "1.0.219", features = ["derive", "serde_derive"] } -serde_json = "1.0.140" +serde = { version = "1.0.228", features = ["derive"] } +serde_json = "1.0.150" tar = "0.4.44" +uniffi = { version = "0.31.1", features = ["cli", "tokio"] } walkdir = "2.5.0" zip = "5.0.0" + +[build-dependencies] +lalrpop = "0.20.0" + +[dev-dependencies] +uniffi = { version = "0.31.1", features = ["build"] } diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f87c29d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,52 @@ +# ========================================================================= +# Stage 1: Native Host Builder +# We use --platform=$BUILDPLATFORM so the container runs natively on your +# Mac's ultra-fast CPU instead of running slow ARM-to-Intel emulation. +# ========================================================================= +FROM --platform=$BUILDPLATFORM rust:slim AS builder + +# Install linkers and cross-compilers for Linux ARM64, Linux x86, and Windows +RUN apt-get update && apt-get install -y \ + build-essential \ + gcc-aarch64-linux-gnu \ + gcc-x86-64-linux-gnu \ + mingw-w64 \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /workspace +COPY . . + +# Capture target arguments from the docker buildx flag +ARG TARGETOS +ARG TARGETARCH + +# Dynamically cross-compile based on the platform requested by Buildx +RUN set -ex; \ + if [ "$TARGETOS" = "linux" ] && [ "$TARGETARCH" = "amd64" ]; then \ + rustup target add x86_64-unknown-linux-gnu; \ + export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-linux-gnu-gcc; \ + cargo build --release --target x86_64-unknown-linux-gnu; \ + mkdir -p /out; cp target/x86_64-unknown-linux-gnu/release/libtbr.so /out/; \ + \ + elif [ "$TARGETOS" = "linux" ] && [ "$TARGETARCH" = "arm64" ]; then \ + rustup target add aarch64-unknown-linux-gnu; \ + export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc; \ + cargo build --release --target aarch64-unknown-linux-gnu; \ + mkdir -p /out; cp target/aarch64-unknown-linux-gnu/release/libtbr.so /out/; \ + \ + elif [ "$TARGETOS" = "windows" ] && [ "$TARGETARCH" = "amd64" ]; then \ + rustup target add x86_64-pc-windows-gnu; \ + cargo build --release --target x86_64-pc-windows-gnu; \ + mkdir -p /out; \ + # Copy the compiled Windows DLL (supports both prefixed and non-prefixed outputs) \ + cp target/x86_64-pc-windows-gnu/release/*.dll /out/tbr.dll; \ + fi + +# ========================================================================= +# Stage 2: Exporter Stage +# ========================================================================= +FROM scratch AS exporter +ARG TARGETOS +ARG TARGETARCH +# Copies the binaries into cleanly structured, platform-named folders +COPY --from=builder /out/ / \ No newline at end of file diff --git a/codegen_python.sh b/codegen_python.sh new file mode 100755 index 0000000..d6f5989 --- /dev/null +++ b/codegen_python.sh @@ -0,0 +1,25 @@ +mkdir -p out/binaries + +# mac +cargo build --release --target aarch64-apple-darwin +cargo build --release --target x86_64-apple-darwin + + + +# other platforms +docker buildx build \ + --platform linux/amd64,linux/arm64,windows/amd64 \ + --target exporter \ + --output type=local,dest=./out/binaries \ + . + +cp ./out/binaries/linux_amd64/libtbr.so ./out/libtbr_x86.so +cp ./out/binaries/linux_arm64/libtbr.so ./out/libtbr_arm64.so +cp ./out/binaries/windows_amd64/tbr.dll ./out/tbr.dll + +# full conbined archs for mac +lipo -create target/aarch64-apple-darwin/release/libtbr.dylib target/x86_64-apple-darwin/release/libtbr.dylib -output target/release/libtbr.dylib + +cp target/release/libtbr.dylib ./out/ + +cargo run --bin uniffi-bindgen generate --library target/release/libtbr.dylib --language python --out-dir out \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index a9581bc..ace6a46 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,3 +3,5 @@ pub mod models; pub mod previews; pub mod recipe_functions; pub mod xml; + +uniffi::setup_scaffolding!(); diff --git a/src/xml/ast/mod.rs b/src/xml/ast/mod.rs new file mode 100644 index 0000000..69e3fea --- /dev/null +++ b/src/xml/ast/mod.rs @@ -0,0 +1 @@ +pub mod nodes; diff --git a/src/xml/ast/nodes.rs b/src/xml/ast/nodes.rs new file mode 100644 index 0000000..b68c11f --- /dev/null +++ b/src/xml/ast/nodes.rs @@ -0,0 +1,88 @@ +pub struct Program { + pub statements: Vec, +} + +pub enum Statement { + VarDecl { + name: String, + value: Option, + assignment_type: AssignmentType, + }, + IfStmt { + condition: Expression, + then_branch: Vec, + else_branch: Vec, + }, + ForStmt { + condition: Expression, + body: Vec, + }, + ExprStmt { + expression: Expression, + }, +} + +pub enum Expression { + BinaryOp { + left: Box, + op: BinaryOpKind, // Add, Sub, Mul, Div, Eq, Neq, Lt, Gt, Lte, Gte + right: Box, + }, + UnaryOp { + op: UnaryOpKind, // Neg, Not + operand: Box, + }, + Literal(LiteralValue), + Identifier(String), + ArrayAccess { + name: String, + indices: Vec, + }, + FunctionCall { + name: String, + args: Vec, + }, + SpecialVar { + name: String, + is_negative: bool, // For $- prefixed vars + }, + AutoVarExpr { + variable: Box, // Changed from SpecialVar to Expression + }, + FlagExpr { + args: Vec, + }, + StringConcat { + // Special node for disambiguating + + parts: Vec, + }, +} + +pub enum LiteralValue { + String(String), + Number(f64), // or i64/f64 distinction if needed + Bool(bool), +} + +pub enum BinaryOpKind { + Add, + Sub, + Mul, + Div, + Eq, // = + Neq, // != + Lt, // < + Gt, // > + Lte, // <= + Gte, // >= +} + +pub enum UnaryOpKind { + Neg, // - + Not, // ! +} + +pub enum AssignmentType { + Equals, // = + NotAssigned, // !assigned +} diff --git a/src/xml/codegen/java.rs b/src/xml/codegen/java.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/xml/codegen/javascript.rs b/src/xml/codegen/javascript.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/xml/codegen/mod.rs b/src/xml/codegen/mod.rs new file mode 100644 index 0000000..1edc54b --- /dev/null +++ b/src/xml/codegen/mod.rs @@ -0,0 +1,23 @@ +use crate::xml::ast::nodes::{AssignmentType, BinaryOpKind, LiteralValue, Program, UnaryOpKind}; + +pub trait CodeGen { + fn generate_program(&self, program: &Program) -> T; + + // Expression visitors + fn visit_binary_op(&self, left: &T, op: BinaryOpKind, right: &T) -> T; + fn visit_unary_op(&self, op: UnaryOpKind, operand: &T) -> T; + fn visit_literal(&self, lit: &LiteralValue) -> T; + fn visit_identifier(&self, name: &str) -> T; + fn visit_array_access(&self, name: &T, indices: &[T]) -> T; + fn visit_function_call(&self, name: &T, args: &[T]) -> T; + fn visit_special_var(&self, name: &str, is_negative: bool) -> T; + fn visit_auto_var_expr(&self, variable: &T) -> T; + fn visit_flag_expr(&self, args: &[T]) -> T; + fn visit_string_concat(&self, parts: &[T]) -> T; + + // Statement visitors + fn visit_var_decl(&self, name: &T, value: Option<&T>, assignment_type: AssignmentType) -> T; + fn visit_if_stmt(&self, condition: &T, then_body: &[T], else_body: &[T]) -> T; + fn visit_for_stmt(&self, condition: &T, body: &[T]) -> T; + fn visit_expr_stmt(&self, expr: &T) -> T; +} diff --git a/src/xml/codegen/python.rs b/src/xml/codegen/python.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/xml/codegen/rust.rs b/src/xml/codegen/rust.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/xml/error/formatter.rs b/src/xml/error/formatter.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/xml/error/mod.rs b/src/xml/error/mod.rs new file mode 100644 index 0000000..427e797 --- /dev/null +++ b/src/xml/error/mod.rs @@ -0,0 +1,84 @@ +use lalrpop_util::ParseError as LalrpopParseError; +use crate::xml::parser::grammar::Token; + +pub type ParserResult = Result; + +pub enum ParseError { + LexerError { + position: Position, + message: String, + }, + ParserError { + position: Position, + message: String, + expected: Vec, + }, + SemanticError { + position: Position, + message: String, + }, +} + +pub struct Position { + pub line: usize, + pub column: usize, + pub file: Option, // For tracking which XML file/script block +} + +impl ParseError { + pub fn from_lalrpop_error(source: &str, e: LalrpopParseError, &'static str>) -> Self { + match e { + LalrpopParseError::User { error } => ParseError::SemanticError { + position: Position { + line: 0, // TODO: improve position tracking + column: 0, + file: None, + }, + message: format!("User error: {}", error), + }, + LalrpopParseError::InvalidToken { location } => ParseError::LexerError { + position: Position { + line: 0, // TODO: improve position tracking + column: 0, + file: None, + }, + message: format!("Invalid token at location {}", location), + }, + LalrpopParseError::UnrecognizedEof { location, expected } => ParseError::ParserError { + position: Position { + line: 0, // TODO: improve position tracking + column: 0, + file: None, + }, + message: format!("Unexpected end of input, expected one of: {:?}", expected), + expected: expected.into_iter().map(|s| s.to_string()).collect(), + }, + LalrpopParseError::UnrecognizedToken { token, expected } => ParseError::ParserError { + position: Position { + line: 0, // TODO: improve position tracking + column: token.0, + file: None, + }, + message: format!("Unrecognized token: {:?}", token.1), + expected: expected.into_iter().map(|s| s.to_string()).collect(), + }, + LalrpopParseError::ExtraToken { token } => ParseError::ParserError { + position: Position { + line: 0, // TODO: improve position tracking + column: token.0, + file: None, + }, + message: format!("Extra token: {:?}", token.1), + expected: Vec::new(), + }, + LalrpopParseError::User { error: e } => ParseError::SemanticError { + position: Position { + line: 0, // TODO: improve position tracking + column: 0, + file: None, + }, + message: format!("User error: {}", e), + }, + } + } +} diff --git a/src/xml/ffi_node.rs b/src/xml/ffi_node.rs new file mode 100644 index 0000000..9314003 --- /dev/null +++ b/src/xml/ffi_node.rs @@ -0,0 +1,167 @@ +use std::{ + collections::HashMap, + sync::{Arc, RwLock}, +}; + +use super::node::*; + +/// Node FFI DTO object +/// +/// Parsing xml as node structure +/// +#[derive(uniffi::Object)] +pub struct FfiNode { + pub name: RwLock, + pub value: RwLock>, + pub children: RwLock>>, +} + +#[uniffi::export] +impl FfiNode { + #[uniffi::constructor] + pub fn new(name: String, value: Option) -> Arc { + Arc::new(FfiNode { + name: RwLock::new(name), + value: RwLock::new(value), + children: RwLock::new(Vec::new()), + }) + } + + /// Get name of this node + pub fn get_name(&self) -> String { + self.name.read().unwrap().clone() + } + + /// Get value of this node + pub fn get_value(&self) -> Option { + self.value.read().unwrap().clone() + } + + /// Get child of this node by expected name + pub fn get_child(&self, name: String) -> Option> { + self.children + .read() + .unwrap() + .iter() + .find(|x| x.get_name() == name) + .cloned() + } + + /// Add new spawn branch to this node + pub fn add_child(&self, child: Arc) { + self.children.write().unwrap().push(child); + } + + /// Get children of this node + pub fn get_children(&self) -> Vec> { + self.children.read().unwrap().clone() + } + + /// Set name + pub fn set_name(&self, new_value: String) { + let mut name_lock = self.name.write().unwrap(); + *name_lock = new_value; + } + /// Set value + pub fn set_value(&self, new_value: Option) { + let mut value_lock = self.value.write().unwrap(); + *value_lock = new_value; + } + + /// Set children + pub fn set_children(&self, new_children: Vec>) { + let mut children_lock = self.children.write().unwrap(); + *children_lock = new_children; + } + + /// Find child node by expected value + pub fn find_by_child_value( + &self, + parent_name: String, + child_name: String, + target_value: String, + ) -> Vec> { + let mut matches = Vec::new(); + + if self.get_name() == parent_name { + if self.get_children().iter().any(|c| { + c.get_name() == child_name + && c.get_value() + .as_ref() + .is_some_and(|x| x.contains(&target_value)) + }) { + matches.push(Arc::new(FfiNode { + name: RwLock::new(self.get_name()), + value: RwLock::new(self.get_value()), + children: RwLock::new(self.get_children()), + })); + } + } + + for child in &self.get_children() { + matches.extend(child.find_by_child_value( + parent_name.clone(), + child_name.clone(), + target_value.clone(), + )); + } + + matches + } +} + +/// Recursive converter +pub fn to_ffi_node(internal: Node) -> Arc { + Arc::new(FfiNode { + name: RwLock::new(internal.name), + value: RwLock::new(internal.value), + children: RwLock::new(internal.children.into_iter().map(to_ffi_node).collect()), + }) +} + +// +#[uniffi::export] +pub fn parse_xml_to_node(xml: String) -> Vec> { + let internal_roots = parse_xml_to_tree(&xml); + internal_roots.into_iter().map(to_ffi_node).collect() +} + +// Entry point for python +// moved from parse xml to node because we have to clean file first +#[uniffi::export] +pub fn generate_node_from_xml( + mapping: HashMap, +) -> HashMap>> { + let mut result = HashMap::new(); + + for m in mapping { + let map_name = m.0; + // change from read path to entire file string instead, let user handle the file reading + let map_val = m.1; + + let mut cleaned = String::new(); + for line in map_val.lines() { + if line.contains(";") { + // special block + // either comment or include + if line.starts_with(";include") { + let converted = + format!("{}\n", line.replace(";include=", "")); + cleaned.push_str(&converted); + } else if line.starts_with(";") { + // into comment + let comment = format!("{}\n", line.replace(";", "")); + cleaned.push_str(&comment); + } else { + cleaned.push_str(format!("{line}\n").replace("&", "[amp]").as_str()); + } + } else { + cleaned.push_str(format!("{line}\n").replace("&", "[amp]").as_str()); + } + } + + let node = parse_xml_to_node(cleaned); + result.insert(map_name.to_string(), node); + } + result +} diff --git a/src/xml/mod.rs b/src/xml/mod.rs index 492bc84..81cbe50 100644 --- a/src/xml/mod.rs +++ b/src/xml/mod.rs @@ -1 +1,6 @@ +pub mod ast; +pub mod codegen; +pub mod error; +pub mod ffi_node; pub mod node; +pub mod parser; diff --git a/src/xml/node.rs b/src/xml/node.rs index be06699..1da3d26 100644 --- a/src/xml/node.rs +++ b/src/xml/node.rs @@ -101,6 +101,31 @@ impl Node { } } +/// get node from path of node vector +/// +/// Example: +/// ``` +/// let current_menus_result: Option<&Node> = get_path!(root_node, ScrollableCatalog.Menus); +/// +/// // Possible results +/// +/// //Some(Node { name: "Menus", children: [Node { name: "Menu", children: [Node { name: "State",.... +/// +/// //None +/// ``` +#[macro_export] +macro_rules! get_path { + ($node:expr, $last:ident) => { + $node.get_child(stringify!($last)) + }; + // recursive case + ($node:expr, $next:ident . $($rest:ident).+) => { + $node + .get_child(stringify!($next)) + .and_then(|child| get_path!(child, $($rest).+)) + }; +} + pub fn generate_nodes_from_xml( catalog_map: Vec<(&str, String)>, ) -> Result>, Box> { @@ -131,28 +156,3 @@ pub fn generate_nodes_from_xml( Ok(result) } - -/// get node from path of node vector -/// -/// Example: -/// ``` -/// let current_menus_result: Option<&Node> = get_path!(root_node, ScrollableCatalog.Menus); -/// -/// // Possible results -/// -/// //Some(Node { name: "Menus", children: [Node { name: "Menu", children: [Node { name: "State",.... -/// -/// //None -/// ``` -#[macro_export] -macro_rules! get_path { - ($node:expr, $last:ident) => { - $node.get_child(stringify!($last)) - }; - // recursive case - ($node:expr, $next:ident . $($rest:ident).+) => { - $node - .get_child(stringify!($next)) - .and_then(|child| get_path!(child, $($rest).+)) - }; -} diff --git a/src/xml/parser/grammar.lalrpop b/src/xml/parser/grammar.lalrpop new file mode 100644 index 0000000..297d4fe --- /dev/null +++ b/src/xml/parser/grammar.lalrpop @@ -0,0 +1,9 @@ +grammar; + +pub Program: () = { + => () +}; + +Statement: () = { + "hello" => () +}; diff --git a/src/xml/parser/grammar.rs b/src/xml/parser/grammar.rs new file mode 100644 index 0000000..c41af73 --- /dev/null +++ b/src/xml/parser/grammar.rs @@ -0,0 +1,722 @@ +// auto-generated: "lalrpop 0.20.0" +// sha3: ec3e9ad964a91b00df78376d9bb2e2c3df24aea537d87c1ca9bb028bad1ed06c +#[allow(unused_extern_crates)] +extern crate lalrpop_util as __lalrpop_util; +#[allow(unused_imports)] +use self::__lalrpop_util::state_machine as __state_machine; +extern crate core; +extern crate alloc; + +#[rustfmt::skip] +#[allow(non_snake_case, non_camel_case_types, unused_mut, unused_variables, unused_imports, unused_parens, clippy::all)] +mod __parse__Program { + + #[allow(unused_extern_crates)] + extern crate lalrpop_util as __lalrpop_util; + #[allow(unused_imports)] + use self::__lalrpop_util::state_machine as __state_machine; + extern crate core; + extern crate alloc; + use self::__lalrpop_util::lexer::Token; + #[allow(dead_code)] + pub(crate) enum __Symbol<'input> + { + Variant0(&'input str), + Variant1(()), + Variant2(alloc::vec::Vec<()>), + } + const __ACTION: &[i8] = &[ + // State 0 + 5, + // State 1 + 5, + // State 2 + 0, + // State 3 + -6, + // State 4 + -3, + // State 5 + -7, + ]; + fn __action(state: i8, integer: usize) -> i8 { + __ACTION[(state as usize) * 1 + integer] + } + const __EOF_ACTION: &[i8] = &[ + // State 0 + -1, + // State 1 + -2, + // State 2 + -8, + // State 3 + -6, + // State 4 + -3, + // State 5 + -7, + ]; + fn __goto(state: i8, nt: usize) -> i8 { + match nt { + 0 => 2, + 1 => match state { + 1 => 5, + _ => 3, + }, + 3 => 1, + _ => 0, + } + } + const __TERMINAL: &[&str] = &[ + r###""hello""###, + ]; + fn __expected_tokens(__state: i8) -> alloc::vec::Vec { + __TERMINAL.iter().enumerate().filter_map(|(index, terminal)| { + let next_state = __action(__state, index); + if next_state == 0 { + None + } else { + Some(alloc::string::ToString::to_string(terminal)) + } + }).collect() + } + fn __expected_tokens_from_states< + 'input, + >( + __states: &[i8], + _: core::marker::PhantomData<(&'input ())>, + ) -> alloc::vec::Vec + { + __TERMINAL.iter().enumerate().filter_map(|(index, terminal)| { + if __accepts(None, __states, Some(index), core::marker::PhantomData::<(&())>) { + Some(alloc::string::ToString::to_string(terminal)) + } else { + None + } + }).collect() + } + pub(crate) struct __StateMachine<'input> + where + { + input: &'input str, + __phantom: core::marker::PhantomData<(&'input ())>, + } + impl<'input> __state_machine::ParserDefinition for __StateMachine<'input> + where + { + type Location = usize; + type Error = &'static str; + type Token = Token<'input>; + type TokenIndex = usize; + type Symbol = __Symbol<'input>; + type Success = (); + type StateIndex = i8; + type Action = i8; + type ReduceIndex = i8; + type NonterminalIndex = usize; + + #[inline] + fn start_location(&self) -> Self::Location { + Default::default() + } + + #[inline] + fn start_state(&self) -> Self::StateIndex { + 0 + } + + #[inline] + fn token_to_index(&self, token: &Self::Token) -> Option { + __token_to_integer(token, core::marker::PhantomData::<(&())>) + } + + #[inline] + fn action(&self, state: i8, integer: usize) -> i8 { + __action(state, integer) + } + + #[inline] + fn error_action(&self, state: i8) -> i8 { + __action(state, 1 - 1) + } + + #[inline] + fn eof_action(&self, state: i8) -> i8 { + __EOF_ACTION[state as usize] + } + + #[inline] + fn goto(&self, state: i8, nt: usize) -> i8 { + __goto(state, nt) + } + + fn token_to_symbol(&self, token_index: usize, token: Self::Token) -> Self::Symbol { + __token_to_symbol(token_index, token, core::marker::PhantomData::<(&())>) + } + + fn expected_tokens(&self, state: i8) -> alloc::vec::Vec { + __expected_tokens(state) + } + + fn expected_tokens_from_states(&self, states: &[i8]) -> alloc::vec::Vec { + __expected_tokens_from_states(states, core::marker::PhantomData::<(&())>) + } + + #[inline] + fn uses_error_recovery(&self) -> bool { + false + } + + #[inline] + fn error_recovery_symbol( + &self, + recovery: __state_machine::ErrorRecovery, + ) -> Self::Symbol { + panic!("error recovery not enabled for this grammar") + } + + fn reduce( + &mut self, + action: i8, + start_location: Option<&Self::Location>, + states: &mut alloc::vec::Vec, + symbols: &mut alloc::vec::Vec<__state_machine::SymbolTriple>, + ) -> Option<__state_machine::ParseResult> { + __reduce( + self.input, + action, + start_location, + states, + symbols, + core::marker::PhantomData::<(&())>, + ) + } + + fn simulate_reduce(&self, action: i8) -> __state_machine::SimulatedReduce { + __simulate_reduce(action, core::marker::PhantomData::<(&())>) + } + } + fn __token_to_integer< + 'input, + >( + __token: &Token<'input>, + _: core::marker::PhantomData<(&'input ())>, + ) -> Option + { + match *__token { + Token(0, _) if true => Some(0), + _ => None, + } + } + fn __token_to_symbol< + 'input, + >( + __token_index: usize, + __token: Token<'input>, + _: core::marker::PhantomData<(&'input ())>, + ) -> __Symbol<'input> + { + match __token_index { + 0 => match __token { + Token(0, __tok0) if true => __Symbol::Variant0(__tok0), + _ => unreachable!(), + }, + _ => unreachable!(), + } + } + fn __simulate_reduce< + 'input, + >( + __reduce_index: i8, + _: core::marker::PhantomData<(&'input ())>, + ) -> __state_machine::SimulatedReduce<__StateMachine<'input>> + { + match __reduce_index { + 0 => { + __state_machine::SimulatedReduce::Reduce { + states_to_pop: 0, + nonterminal_produced: 0, + } + } + 1 => { + __state_machine::SimulatedReduce::Reduce { + states_to_pop: 1, + nonterminal_produced: 0, + } + } + 2 => { + __state_machine::SimulatedReduce::Reduce { + states_to_pop: 1, + nonterminal_produced: 1, + } + } + 3 => { + __state_machine::SimulatedReduce::Reduce { + states_to_pop: 0, + nonterminal_produced: 2, + } + } + 4 => { + __state_machine::SimulatedReduce::Reduce { + states_to_pop: 1, + nonterminal_produced: 2, + } + } + 5 => { + __state_machine::SimulatedReduce::Reduce { + states_to_pop: 1, + nonterminal_produced: 3, + } + } + 6 => { + __state_machine::SimulatedReduce::Reduce { + states_to_pop: 2, + nonterminal_produced: 3, + } + } + 7 => __state_machine::SimulatedReduce::Accept, + _ => panic!("invalid reduction index {}", __reduce_index) + } + } + pub struct ProgramParser { + builder: __lalrpop_util::lexer::MatcherBuilder, + _priv: (), + } + + impl ProgramParser { + pub fn new() -> ProgramParser { + let __builder = super::__intern_token::new_builder(); + ProgramParser { + builder: __builder, + _priv: (), + } + } + + #[allow(dead_code)] + pub fn parse< + 'input, + >( + &self, + input: &'input str, + ) -> Result<(), __lalrpop_util::ParseError, &'static str>> + { + let mut __tokens = self.builder.matcher(input); + __state_machine::Parser::drive( + __StateMachine { + input, + __phantom: core::marker::PhantomData::<(&())>, + }, + __tokens, + ) + } + } + fn __accepts< + 'input, + >( + __error_state: Option, + __states: &[i8], + __opt_integer: Option, + _: core::marker::PhantomData<(&'input ())>, + ) -> bool + { + let mut __states = __states.to_vec(); + __states.extend(__error_state); + loop { + let mut __states_len = __states.len(); + let __top = __states[__states_len - 1]; + let __action = match __opt_integer { + None => __EOF_ACTION[__top as usize], + Some(__integer) => __action(__top, __integer), + }; + if __action == 0 { return false; } + if __action > 0 { return true; } + let (__to_pop, __nt) = match __simulate_reduce(-(__action + 1), core::marker::PhantomData::<(&())>) { + __state_machine::SimulatedReduce::Reduce { + states_to_pop, nonterminal_produced + } => (states_to_pop, nonterminal_produced), + __state_machine::SimulatedReduce::Accept => return true, + }; + __states_len -= __to_pop; + __states.truncate(__states_len); + let __top = __states[__states_len - 1]; + let __next_state = __goto(__top, __nt); + __states.push(__next_state); + } + } + pub(crate) fn __reduce< + 'input, + >( + input: &'input str, + __action: i8, + __lookahead_start: Option<&usize>, + __states: &mut alloc::vec::Vec, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input ())>, + ) -> Option, &'static str>>> + { + let (__pop_states, __nonterminal) = match __action { + 0 => { + __reduce0(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&())>) + } + 1 => { + __reduce1(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&())>) + } + 2 => { + __reduce2(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&())>) + } + 3 => { + __reduce3(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&())>) + } + 4 => { + __reduce4(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&())>) + } + 5 => { + __reduce5(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&())>) + } + 6 => { + __reduce6(input, __lookahead_start, __symbols, core::marker::PhantomData::<(&())>) + } + 7 => { + // __Program = Program => ActionFn(0); + let __sym0 = __pop_Variant1(__symbols); + let __start = __sym0.0; + let __end = __sym0.2; + let __nt = super::__action0::<>(input, __sym0); + return Some(Ok(__nt)); + } + _ => panic!("invalid action code {}", __action) + }; + let __states_len = __states.len(); + __states.truncate(__states_len - __pop_states); + let __state = *__states.last().unwrap(); + let __next_state = __goto(__state, __nonterminal); + __states.push(__next_state); + None + } + #[inline(never)] + fn __symbol_type_mismatch() -> ! { + panic!("symbol type mismatch") + } + fn __pop_Variant1< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, (), usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant1(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } + fn __pop_Variant2< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, alloc::vec::Vec<()>, usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant2(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } + fn __pop_Variant0< + 'input, + >( + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)> + ) -> (usize, &'input str, usize) + { + match __symbols.pop() { + Some((__l, __Symbol::Variant0(__v), __r)) => (__l, __v, __r), + _ => __symbol_type_mismatch() + } + } + pub(crate) fn __reduce0< + 'input, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input ())>, + ) -> (usize, usize) + { + // Program = => ActionFn(7); + let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); + let __end = __start.clone(); + let __nt = super::__action7::<>(input, &__start, &__end); + __symbols.push((__start, __Symbol::Variant1(__nt), __end)); + (0, 0) + } + pub(crate) fn __reduce1< + 'input, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input ())>, + ) -> (usize, usize) + { + // Program = Statement+ => ActionFn(8); + let __sym0 = __pop_Variant2(__symbols); + let __start = __sym0.0; + let __end = __sym0.2; + let __nt = super::__action8::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant1(__nt), __end)); + (1, 0) + } + pub(crate) fn __reduce2< + 'input, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input ())>, + ) -> (usize, usize) + { + // Statement = "hello" => ActionFn(2); + let __sym0 = __pop_Variant0(__symbols); + let __start = __sym0.0; + let __end = __sym0.2; + let __nt = super::__action2::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant1(__nt), __end)); + (1, 1) + } + pub(crate) fn __reduce3< + 'input, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input ())>, + ) -> (usize, usize) + { + // Statement* = => ActionFn(3); + let __start = __lookahead_start.cloned().or_else(|| __symbols.last().map(|s| s.2.clone())).unwrap_or_default(); + let __end = __start.clone(); + let __nt = super::__action3::<>(input, &__start, &__end); + __symbols.push((__start, __Symbol::Variant2(__nt), __end)); + (0, 2) + } + pub(crate) fn __reduce4< + 'input, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input ())>, + ) -> (usize, usize) + { + // Statement* = Statement+ => ActionFn(4); + let __sym0 = __pop_Variant2(__symbols); + let __start = __sym0.0; + let __end = __sym0.2; + let __nt = super::__action4::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant2(__nt), __end)); + (1, 2) + } + pub(crate) fn __reduce5< + 'input, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input ())>, + ) -> (usize, usize) + { + // Statement+ = Statement => ActionFn(5); + let __sym0 = __pop_Variant1(__symbols); + let __start = __sym0.0; + let __end = __sym0.2; + let __nt = super::__action5::<>(input, __sym0); + __symbols.push((__start, __Symbol::Variant2(__nt), __end)); + (1, 3) + } + pub(crate) fn __reduce6< + 'input, + >( + input: &'input str, + __lookahead_start: Option<&usize>, + __symbols: &mut alloc::vec::Vec<(usize,__Symbol<'input>,usize)>, + _: core::marker::PhantomData<(&'input ())>, + ) -> (usize, usize) + { + // Statement+ = Statement+, Statement => ActionFn(6); + assert!(__symbols.len() >= 2); + let __sym1 = __pop_Variant1(__symbols); + let __sym0 = __pop_Variant2(__symbols); + let __start = __sym0.0; + let __end = __sym1.2; + let __nt = super::__action6::<>(input, __sym0, __sym1); + __symbols.push((__start, __Symbol::Variant2(__nt), __end)); + (2, 3) + } +} +pub use self::__parse__Program::ProgramParser; +#[cfg_attr(rustfmt, rustfmt_skip)] +mod __intern_token { + #![allow(unused_imports)] + #[allow(unused_extern_crates)] + extern crate lalrpop_util as __lalrpop_util; + #[allow(unused_imports)] + use self::__lalrpop_util::state_machine as __state_machine; + extern crate core; + extern crate alloc; + pub fn new_builder() -> __lalrpop_util::lexer::MatcherBuilder { + let __strs: &[(&str, bool)] = &[ + ("^((?:hello))", false), + (r"^(\s*)", true), + ]; + __lalrpop_util::lexer::MatcherBuilder::new(__strs.iter().copied()).unwrap() + } +} +pub(crate) use self::__lalrpop_util::lexer::Token; + +#[allow(unused_variables)] +#[allow(clippy::too_many_arguments)] +fn __action0< + 'input, +>( + input: &'input str, + (_, __0, _): (usize, (), usize), +) +{ +} + +#[allow(unused_variables)] +#[allow(clippy::too_many_arguments)] +fn __action1< + 'input, +>( + input: &'input str, + (_, __0, _): (usize, alloc::vec::Vec<()>, usize), +) +{ +} + +#[allow(unused_variables)] +#[allow(clippy::too_many_arguments)] +fn __action2< + 'input, +>( + input: &'input str, + (_, __0, _): (usize, &'input str, usize), +) +{ +} + +#[allow(unused_variables)] +#[allow(clippy::too_many_arguments)] +fn __action3< + 'input, +>( + input: &'input str, + __lookbehind: &usize, + __lookahead: &usize, +) -> alloc::vec::Vec<()> +{ + alloc::vec![] +} + +#[allow(unused_variables)] +#[allow(clippy::too_many_arguments)] +fn __action4< + 'input, +>( + input: &'input str, + (_, v, _): (usize, alloc::vec::Vec<()>, usize), +) -> alloc::vec::Vec<()> +{ + v +} + +#[allow(unused_variables)] +#[allow(clippy::too_many_arguments)] +fn __action5< + 'input, +>( + input: &'input str, + (_, __0, _): (usize, (), usize), +) -> alloc::vec::Vec<()> +{ + alloc::vec![__0] +} + +#[allow(unused_variables)] +#[allow(clippy::too_many_arguments)] +fn __action6< + 'input, +>( + input: &'input str, + (_, v, _): (usize, alloc::vec::Vec<()>, usize), + (_, e, _): (usize, (), usize), +) -> alloc::vec::Vec<()> +{ + { let mut v = v; v.push(e); v } +} + +#[allow(unused_variables)] +#[allow(clippy::too_many_arguments)] +fn __action7< + 'input, +>( + input: &'input str, + __lookbehind: &usize, + __lookahead: &usize, +) +{ + let __start0 = *__lookbehind; + let __end0 = *__lookahead; + let __temp0 = __action3( + input, + &__start0, + &__end0, + ); + let __temp0 = (__start0, __temp0, __end0); + __action1( + input, + __temp0, + ) +} + +#[allow(unused_variables)] +#[allow(clippy::too_many_arguments)] +fn __action8< + 'input, +>( + input: &'input str, + __0: (usize, alloc::vec::Vec<()>, usize), +) +{ + let __start0 = __0.0; + let __end0 = __0.2; + let __temp0 = __action4( + input, + __0, + ); + let __temp0 = (__start0, __temp0, __end0); + __action1( + input, + __temp0, + ) +} +#[allow(clippy::type_complexity)] + +pub trait __ToTriple<'input, > +{ + fn to_triple(value: Self) -> Result<(usize,Token<'input>,usize), __lalrpop_util::ParseError, &'static str>>; +} + +impl<'input, > __ToTriple<'input, > for (usize, Token<'input>, usize) +{ + fn to_triple(value: Self) -> Result<(usize,Token<'input>,usize), __lalrpop_util::ParseError, &'static str>> { + Ok(value) + } +} +impl<'input, > __ToTriple<'input, > for Result<(usize, Token<'input>, usize), &'static str> +{ + fn to_triple(value: Self) -> Result<(usize,Token<'input>,usize), __lalrpop_util::ParseError, &'static str>> { + match value { + Ok(v) => Ok(v), + Err(error) => Err(__lalrpop_util::ParseError::User { error }), + } + } +} diff --git a/src/xml/parser/mod.rs b/src/xml/parser/mod.rs new file mode 100644 index 0000000..17c855f --- /dev/null +++ b/src/xml/parser/mod.rs @@ -0,0 +1,37 @@ +use crate::xml::ast::nodes::{AssignmentType, BinaryOpKind, Expression, LiteralValue, Program, Statement, UnaryOpKind}; +use crate::xml::error::{ParseError, ParserResult}; + +// The LALRPOP-generated parser will be in this module +pub mod grammar; + +pub use grammar::ProgramParser; + +// Wrapper around the LALRPOP parser to provide a cleaner interface +pub struct ScriptParser; + +impl ScriptParser { + /// Parse a script string into an AST + pub fn parse(source: &str) -> ParserResult { + let parser = grammar::ProgramParser::new(); + match parser.parse(source) { + Ok(_) => { + // For now, just return an empty program since our grammar returns unit + Ok(Program { statements: vec![] }) + }, + Err(e) => Err(ParseError::from_lalrpop_error(source, e)), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_empty() { + let result = ScriptParser::parse(""); + assert!(result.is_ok()); + let program = result.unwrap(); + assert_eq!(program.statements.len(), 0); + } +} diff --git a/src/xml/parser/mod.rs.bak b/src/xml/parser/mod.rs.bak new file mode 100644 index 0000000..ed8404f --- /dev/null +++ b/src/xml/parser/mod.rs.bak @@ -0,0 +1,59 @@ +use crate::xml::ast::nodes::{AssignmentType, BinaryOpKind, Expression, LiteralValue, Program, Statement, UnaryOpKind}; +use crate::xml::error::{ParseError, ParserResult}; + +// The LALRPOP-generated parser will be in this module +mod grammar; + +pub use grammar::ProgramParser; + +// Wrapper around the LALRPOP parser to provide a cleaner interface +pub struct ScriptParser; + +impl ScriptParser { + /// Parse a script string into an AST + pub fn parse(source: &str) -> ParserResult { + let parser = grammar::ProgramParser::new(); + match parser.parse(source) { + Ok(program) => Ok(program), + Err(e) => Err(ParseError::from_lalrpop_error(source, e)), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_empty() { + let result = ScriptParser::parse(""); + assert!(result.is_ok()); + let program = result.unwrap(); + assert_eq!(program.statements.len(), 0); + } + + #[test] + fn test_simple_var_decl() { + let result = ScriptParser::parse("Var x = 5"); + assert!(result.is_ok()); + let program = result.unwrap(); + assert_eq!(program.statements.len(), 1); + if let Statement::VarDecl { name, value, assignment_type } = &program.statements[0] { + assert_eq!(name, "x"); + assert_eq!(assignment_type, &AssignmentType::Equals); + if let Some(Expression::Literal(LiteralValue::Number(val))) = value { + assert_eq!(*val, 5.0); + } else { + panic!("Expected number literal"); + } + } else { + panic!("Expected VarDecl statement"); + } + } + + #[test] + fn test_if_stmt() { + let result = ScriptParser::parse("If x = 5 Then Var y = 10 EndIf"); + assert!(result.is_ok()); + } +}