From 577f5f1abb838541467c3cb639ac93dc6ce9cee5 Mon Sep 17 00:00:00 2001 From: Jake Stanger Date: Sun, 16 Jun 2024 14:26:22 +0100 Subject: [PATCH] build: update deps --- Cargo.lock | 546 ++++++++++++++----------- assets/inputs/compact.corn | 2 +- assets/inputs/null_in_array.corn | 3 + assets/inputs/very_compact.corn | 2 +- assets/outputs/json/compact.json | 4 +- assets/outputs/json/null_in_array.json | 5 + assets/outputs/json/quoted_keys.json | 3 +- assets/outputs/json/very_compact.json | 4 +- assets/outputs/toml/compact.toml | 4 + assets/outputs/toml/complex_keys.toml | 2 +- assets/outputs/toml/null_in_array.toml | 0 assets/outputs/toml/quoted_keys.toml | 1 + assets/outputs/toml/very_compact.toml | 4 + assets/outputs/yaml/compact.yml | 4 +- assets/outputs/yaml/complex_keys.yml | 2 +- assets/outputs/yaml/null_in_array.yml | 3 + assets/outputs/yaml/quoted_keys.yml | 1 + assets/outputs/yaml/very_compact.yml | 4 +- corn-cli/Cargo.toml | 12 +- corn-cli/src/bin/corn.rs | 2 +- corn-cli/src/error.rs | 4 +- libcorn/Cargo.toml | 30 +- libcorn/src/lib.rs | 4 + libcorn/src/lua.rs | 4 +- libcorn/src/parser.rs | 2 +- libcorn/tests/de_tests.rs | 34 +- libcorn/tests/parser_tests.rs | 5 +- 27 files changed, 418 insertions(+), 273 deletions(-) create mode 100644 assets/inputs/null_in_array.corn create mode 100644 assets/outputs/json/null_in_array.json create mode 100644 assets/outputs/toml/null_in_array.toml create mode 100644 assets/outputs/yaml/null_in_array.yml diff --git a/Cargo.lock b/Cargo.lock index bb1209d..c4d0cdb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,14 +18,52 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] -name = "atty" -version = "0.2.14" +name = "anstream" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" + +[[package]] +name = "anstyle-parse" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", ] [[package]] @@ -51,11 +89,12 @@ dependencies = [ [[package]] name = "bstr" -version = "0.2.17" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" +checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" dependencies = [ "memchr", + "serde", ] [[package]] @@ -117,50 +156,58 @@ dependencies = [ [[package]] name = "clap" -version = "4.0.15" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bf8832993da70a4c6d13c581f4463c2bdda27b9bf1c5498dc4365543abe6d6f" +checksum = "5db83dced34638ad474f39f250d7fea9598bdd239eaced1bdf45d597da0f433f" dependencies = [ - "atty", - "bitflags", + "clap_builder", "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7e204572485eb3fbf28f871612191521df159bc3e15a9f5064c66dba3a8c05f" +dependencies = [ + "anstream", + "anstyle", "clap_lex", - "once_cell", "strsim", - "termcolor", ] [[package]] name = "clap_derive" -version = "4.0.13" +version = "4.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c42f169caba89a7d512b5418b09864543eeb4d497416c917d7137863bd2076ad" +checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6" dependencies = [ "heck", - "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.102", + "syn 2.0.66", ] [[package]] name = "clap_lex" -version = "0.3.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8" -dependencies = [ - "os_str_bytes", -] +checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" + +[[package]] +name = "colorchoice" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" [[package]] name = "colored" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" dependencies = [ - "atty", "lazy_static", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -184,7 +231,7 @@ dependencies = [ "serde", "serde_json", "serde_yaml", - "toml", + "toml_edit", ] [[package]] @@ -208,7 +255,7 @@ dependencies = [ "clap", "criterion-plot", "is-terminal", - "itertools", + "itertools 0.10.5", "num-traits", "once_cell", "oorandom", @@ -229,7 +276,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" dependencies = [ "cast", - "itertools", + "itertools 0.10.5", ] [[package]] @@ -297,9 +344,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.1" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" [[package]] name = "equivalent" @@ -309,32 +356,22 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "erased-serde" -version = "0.3.26" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6984864d65d092d9e9ada107007a846a09f75d2e24046bcce9a38d14aa52052" +checksum = "24e2389d65ab4fab27dc2a5de7b191e1f6617d1f1c8855c0dc569c94a4cbb18d" dependencies = [ "serde", + "typeid", ] [[package]] name = "errno" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ - "cc", "libc", + "windows-sys 0.52.0", ] [[package]] @@ -355,30 +392,15 @@ checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hashbrown" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "heck" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" @@ -397,22 +419,12 @@ checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" [[package]] name = "indexmap" -version = "1.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - -[[package]] -name = "indexmap" -version = "2.0.0" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown", "serde", ] @@ -424,7 +436,7 @@ checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ "hermit-abi 0.3.1", "libc", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -436,9 +448,15 @@ dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", "rustix", - "windows-sys", + "windows-sys 0.48.0", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + [[package]] name = "itertools" version = "0.10.5" @@ -448,6 +466,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.4" @@ -456,9 +483,9 @@ checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -471,9 +498,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.146" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libcorn" @@ -482,7 +509,7 @@ dependencies = [ "cfg-if 1.0.0", "console_error_panic_hook", "criterion", - "indexmap 2.0.0", + "indexmap", "mlua", "paste", "pest", @@ -493,7 +520,7 @@ dependencies = [ "serde_json", "serde_yaml", "thiserror", - "toml", + "toml_edit", "wasm-bindgen", "wasm-bindgen-test", "wee_alloc", @@ -514,30 +541,11 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "lua-src" -version = "546.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cb00c1380f1b4b4928dd211c07301ffa34872a239e590bd3219d9e5b213face" -dependencies = [ - "cc", -] - -[[package]] -name = "luajit-src" -version = "210.4.7+resty107baaf" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca76a3752fc130e5dabef71792f4f7095babb72f7c85860c7830eb746ad8bf31" -dependencies = [ - "cc", - "which", -] - [[package]] name = "memchr" -version = "2.5.0" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memoffset" @@ -556,36 +564,45 @@ checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" [[package]] name = "mlua" -version = "0.8.9" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07366ed2cd22a3b000aed076e2b68896fb46f06f1f5786c5962da73c0af01577" +checksum = "e340c022072f3208a4105458286f4985ba5355bfe243c3073afe45cbe9ecf491" dependencies = [ "bstr", - "cc", "erased-serde", - "lua-src", - "luajit-src", + "mlua-sys", "mlua_derive", "num-traits", "once_cell", - "pkg-config", "rustc-hash", "serde", + "serde-value", +] + +[[package]] +name = "mlua-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5552e7e4e22ada0463dfdeee6caf6dc057a189fdc83136408a8f950a5e5c5540" +dependencies = [ + "cc", + "cfg-if 1.0.0", + "pkg-config", ] [[package]] name = "mlua_derive" -version = "0.8.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9214e60d3cf1643013b107330fcd374ccec1e4ba1eef76e7e5da5e8202e71c0" +checksum = "09697a6cec88e7f58a02c7ab5c18c611c6907c8654613df9cc0192658a4fb859" dependencies = [ - "itertools", + "itertools 0.12.1", "once_cell", "proc-macro-error", "proc-macro2", "quote", "regex", - "syn 1.0.102", + "syn 2.0.66", ] [[package]] @@ -620,32 +637,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" [[package]] -name = "os_str_bytes" -version = "6.3.0" +name = "ordered-float" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" +dependencies = [ + "num-traits", +] [[package]] name = "paste" -version = "1.0.9" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pest" -version = "2.6.0" +version = "2.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e68e84bfb01f0507134eac1e9b410a12ba379d064eab48c50ba4ce329a527b70" +checksum = "560131c633294438da9f7c4b08189194b20946c8274c6b9e38881a7874dc8ee8" dependencies = [ + "memchr", "thiserror", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.6.0" +version = "2.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b79d4c71c865a25a4322296122e3924d30bc8ee0834c8bfc8b95f7f054afbfb" +checksum = "26293c9193fbca7b1a3bf9b79dc1e388e927e6cacaa78b4a3ab705a1d3d41459" dependencies = [ "pest", "pest_generator", @@ -653,22 +674,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.6.0" +version = "2.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c435bf1076437b851ebc8edc3a18442796b30f1728ffea6262d59bbe28b077e" +checksum = "3ec22af7d3fb470a85dd2ca96b7c577a1eb4ef6f1683a9fe9a8c16e136c04687" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.66", ] [[package]] name = "pest_meta" -version = "2.6.0" +version = "2.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "745a452f8eb71e39ffd8ee32b3c5f51d03845f99786fa9b68db6ff509c505411" +checksum = "d7a240022f37c361ec1878d646fc5b7d7c4d28d5946e1a80ad5a7a4f4ca0bdcd" dependencies = [ "once_cell", "pest", @@ -735,18 +756,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.58" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa1fb82fc0c281dd9671101b66b771ebbe1eaf967b96ac8740dcba4b70005ca8" +checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.27" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -807,7 +828,7 @@ dependencies = [ "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -839,18 +860,28 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" -version = "1.0.145" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] +[[package]] +name = "serde-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde", +] + [[package]] name = "serde-wasm-bindgen" -version = "0.5.0" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3b143e2833c57ab9ad3ea280d21fd34e285a42837aeb0ee301f4f41890fa00e" +checksum = "8302e169f0eddcc139c70f139d19d6467353af16f9fce27e8c30158036a1e16b" dependencies = [ "js-sys", "serde", @@ -859,29 +890,29 @@ dependencies = [ [[package]] name = "serde_bytes" -version = "0.11.9" +version = "0.11.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "416bda436f9aab92e02c8e10d49a15ddd339cea90b6e340fe51ed97abb548294" +checksum = "8b8497c313fd43ab992087548117643f6fcd935cbf36f176ffda0aacf9591734" dependencies = [ "serde", ] [[package]] name = "serde_derive" -version = "1.0.145" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", - "syn 1.0.102", + "syn 2.0.66", ] [[package]] name = "serde_json" -version = "1.0.86" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41feea4228a6f1cd09ec7a3593a682276702cd67b5273544757dae23c096f074" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa", "ryu", @@ -890,20 +921,20 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.2" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93107647184f6027e3b7dcb2e11034cf95ffa1e3a682c67951963ac69c1c007d" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" dependencies = [ "serde", ] [[package]] name = "serde_yaml" -version = "0.9.13" +version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8613d593412a0deb7bbd8de9d908efff5a0cb9ccd8f62c641e7b2ed2f57291d1" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 1.9.1", + "indexmap", "itoa", "ryu", "serde", @@ -923,9 +954,9 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" @@ -934,48 +965,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1" dependencies = [ "proc-macro2", - "quote", "unicode-ident", ] [[package]] name = "syn" -version = "2.0.16" +version = "2.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6f671d4b5ffdb8eadec19c0ae67fe2639df8684bd7bc4b83d986b8db549cf01" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "termcolor" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" -dependencies = [ - "winapi-util", -] - [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.16", + "syn 2.0.66", ] [[package]] @@ -988,40 +1009,34 @@ dependencies = [ "serde_json", ] -[[package]] -name = "toml" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6135d499e69981f9ff0ef2167955a5333c35e36f6937d382974566b3d5b94ec" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - [[package]] name = "toml_datetime" -version = "0.6.2" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.19.10" +version = "0.22.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739" +checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38" dependencies = [ - "indexmap 1.9.1", + "indexmap", "serde", "serde_spanned", "toml_datetime", "winnow", ] +[[package]] +name = "typeid" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "059d83cc991e7a42fc37bd50941885db0888e34209f8cfd9aab07ddec03bc9cf" + [[package]] name = "typenum" version = "1.15.0" @@ -1042,9 +1057,15 @@ checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" [[package]] name = "unsafe-libyaml" -version = "0.2.4" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + +[[package]] +name = "utf8parse" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1e5fa573d8ac5f1a856f8d7be41d390ee973daf97c806b2c1a465e4e1406e68" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "version_check" @@ -1064,9 +1085,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -1074,24 +1095,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 1.0.102", + "syn 2.0.66", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.33" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -1101,9 +1122,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1111,28 +1132,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 1.0.102", + "syn 2.0.66", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "wasm-bindgen-test" -version = "0.3.33" +version = "0.3.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d2fff962180c3fadf677438054b1db62bee4aa32af26a45388af07d1287e1d" +checksum = "d9bf62a58e0780af3e852044583deee40983e5886da43a271dd772379987667b" dependencies = [ "console_error_panic_hook", "js-sys", @@ -1144,12 +1165,13 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.33" +version = "0.3.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4683da3dfc016f704c9f82cf401520c4f1cb3ee440f7f52b3d6ac29506a49ca7" +checksum = "b7f89739351a2e03cb94beb799d47fb2cac01759b40ec441f7de39b00cbf7ef0" dependencies = [ "proc-macro2", "quote", + "syn 2.0.66", ] [[package]] @@ -1174,17 +1196,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "which" -version = "4.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" -dependencies = [ - "either", - "libc", - "once_cell", -] - [[package]] name = "winapi" version = "0.3.9" @@ -1222,7 +1233,16 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.0", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.5", ] [[package]] @@ -1231,13 +1251,29 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", ] [[package]] @@ -1246,47 +1282,95 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + [[package]] name = "windows_aarch64_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + [[package]] name = "windows_i686_gnu" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + [[package]] name = "windows_i686_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + [[package]] name = "windows_x86_64_gnu" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + [[package]] name = "windows_x86_64_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" + [[package]] name = "winnow" -version = "0.4.6" +version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699" +checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1" dependencies = [ "memchr", ] diff --git a/assets/inputs/compact.corn b/assets/inputs/compact.corn index 32665c3..49185de 100644 --- a/assets/inputs/compact.corn +++ b/assets/inputs/compact.corn @@ -9,7 +9,7 @@ eight=["foo""bar"] nine=[truefalse] - ten=[nullnull] + ten=[1 2] eleven=[[][]] twelve=[{}{}] } diff --git a/assets/inputs/null_in_array.corn b/assets/inputs/null_in_array.corn new file mode 100644 index 0000000..a2518b7 --- /dev/null +++ b/assets/inputs/null_in_array.corn @@ -0,0 +1,3 @@ +{ + foo = [ null ] +} \ No newline at end of file diff --git a/assets/inputs/very_compact.corn b/assets/inputs/very_compact.corn index 2ec7d65..3932084 100644 --- a/assets/inputs/very_compact.corn +++ b/assets/inputs/very_compact.corn @@ -1 +1 @@ -{one={foo="bar" bar="foo"} two={foo=1 bar=2} three={foo=1.0 bar=2.0} four={foo=true bar=false} five={foo=null bar=null} six={foo={} bar={}} seven={foo=[] bar=[]} eight=["foo""bar"] nine=[truefalse] ten=[nullnull] eleven=[[][]] twelve=[{}{}]} +{one={foo="bar" bar="foo"} two={foo=1 bar=2} three={foo=1.0 bar=2.0} four={foo=true bar=false} five={foo=null bar=null} six={foo={} bar={}} seven={foo=[] bar=[]} eight=["foo""bar"] nine=[truefalse] ten=[1 2] eleven=[[][]] twelve=[{}{}]} diff --git a/assets/outputs/json/compact.json b/assets/outputs/json/compact.json index be2fd93..65ecfe0 100644 --- a/assets/outputs/json/compact.json +++ b/assets/outputs/json/compact.json @@ -36,8 +36,8 @@ false ], "ten": [ - null, - null + 1, + 2 ], "eleven": [ [], diff --git a/assets/outputs/json/null_in_array.json b/assets/outputs/json/null_in_array.json new file mode 100644 index 0000000..bfe673a --- /dev/null +++ b/assets/outputs/json/null_in_array.json @@ -0,0 +1,5 @@ +{ + "foo": [ + null + ] +} diff --git a/assets/outputs/json/quoted_keys.json b/assets/outputs/json/quoted_keys.json index b26f31a..c1bc3f5 100644 --- a/assets/outputs/json/quoted_keys.json +++ b/assets/outputs/json/quoted_keys.json @@ -6,5 +6,6 @@ } }, "with spaces": true, - "escaped'quote": false + "escaped'quote": false, + "escaped=equals": -3 } diff --git a/assets/outputs/json/very_compact.json b/assets/outputs/json/very_compact.json index be2fd93..65ecfe0 100644 --- a/assets/outputs/json/very_compact.json +++ b/assets/outputs/json/very_compact.json @@ -36,8 +36,8 @@ false ], "ten": [ - null, - null + 1, + 2 ], "eleven": [ [], diff --git a/assets/outputs/toml/compact.toml b/assets/outputs/toml/compact.toml index 06893db..0d9cd8d 100644 --- a/assets/outputs/toml/compact.toml +++ b/assets/outputs/toml/compact.toml @@ -6,6 +6,10 @@ nine = [ true, false, ] +ten = [ + 1, + 2, +] eleven = [ [], [], diff --git a/assets/outputs/toml/complex_keys.toml b/assets/outputs/toml/complex_keys.toml index 7f619d9..072b05e 100644 --- a/assets/outputs/toml/complex_keys.toml +++ b/assets/outputs/toml/complex_keys.toml @@ -1,7 +1,7 @@ with_underscore = 0 with-dash = 1 "with_🌽" = 2 -"!\"£$%^&*()_" = 3 +'!"£$%^&*()_' = 3 j12345 = 4 [foo] diff --git a/assets/outputs/toml/null_in_array.toml b/assets/outputs/toml/null_in_array.toml new file mode 100644 index 0000000..e69de29 diff --git a/assets/outputs/toml/quoted_keys.toml b/assets/outputs/toml/quoted_keys.toml index e7bf402..06bc629 100644 --- a/assets/outputs/toml/quoted_keys.toml +++ b/assets/outputs/toml/quoted_keys.toml @@ -1,6 +1,7 @@ "foo.bar" = 42 "with spaces" = true "escaped'quote" = false +"escaped=equals" = -3 ["green.eggs".and] ham = "hello world" diff --git a/assets/outputs/toml/very_compact.toml b/assets/outputs/toml/very_compact.toml index 06893db..0d9cd8d 100644 --- a/assets/outputs/toml/very_compact.toml +++ b/assets/outputs/toml/very_compact.toml @@ -6,6 +6,10 @@ nine = [ true, false, ] +ten = [ + 1, + 2, +] eleven = [ [], [], diff --git a/assets/outputs/yaml/compact.yml b/assets/outputs/yaml/compact.yml index 2550a8f..ada8415 100644 --- a/assets/outputs/yaml/compact.yml +++ b/assets/outputs/yaml/compact.yml @@ -26,8 +26,8 @@ nine: - true - false ten: -- null -- null +- 1 +- 2 eleven: - [] - [] diff --git a/assets/outputs/yaml/complex_keys.yml b/assets/outputs/yaml/complex_keys.yml index 64e5dc2..cb4e419 100644 --- a/assets/outputs/yaml/complex_keys.yml +++ b/assets/outputs/yaml/complex_keys.yml @@ -1,6 +1,6 @@ with_underscore: 0 with-dash: 1 -"with_\U0001F33D": 2 +with_🌽: 2 '!"£$%^&*()_': 3 j12345: 4 foo: diff --git a/assets/outputs/yaml/null_in_array.yml b/assets/outputs/yaml/null_in_array.yml new file mode 100644 index 0000000..74c12c9 --- /dev/null +++ b/assets/outputs/yaml/null_in_array.yml @@ -0,0 +1,3 @@ +foo: +- null + diff --git a/assets/outputs/yaml/quoted_keys.yml b/assets/outputs/yaml/quoted_keys.yml index e311f05..da5aced 100644 --- a/assets/outputs/yaml/quoted_keys.yml +++ b/assets/outputs/yaml/quoted_keys.yml @@ -4,4 +4,5 @@ green.eggs: ham: hello world with spaces: true escaped'quote: false +escaped=equals: -3 diff --git a/assets/outputs/yaml/very_compact.yml b/assets/outputs/yaml/very_compact.yml index 2550a8f..ada8415 100644 --- a/assets/outputs/yaml/very_compact.yml +++ b/assets/outputs/yaml/very_compact.yml @@ -26,8 +26,8 @@ nine: - true - false ten: -- null -- null +- 1 +- 2 eleven: - [] - [] diff --git a/corn-cli/Cargo.toml b/corn-cli/Cargo.toml index f193d55..3e6093f 100644 --- a/corn-cli/Cargo.toml +++ b/corn-cli/Cargo.toml @@ -10,10 +10,10 @@ keywords = ["configuration", "language", "pest", "peg", "cli"] [dependencies] libcorn = { version = "0.9.2", path = "../libcorn" } -clap = { version = "4.0.15", features = ["derive"] } -colored = "2.0.0" +clap = { version = "4.5.7", features = ["derive"] } +colored = "2.1.0" serde = { version = "1.0.133", features = ["derive"] } -serde_json = "1.0.75" -serde_yaml = "0.9.11" -toml = "0.7.4" -pest = "2.3.0" +serde_json = "1.0.117" +serde_yaml = "0.9.34" +toml_edit = { version = "0.22.14", features = ["serde"] } +pest = "2.7.10" diff --git a/corn-cli/src/bin/corn.rs b/corn-cli/src/bin/corn.rs index b9a70f1..ee3ac0a 100644 --- a/corn-cli/src/bin/corn.rs +++ b/corn-cli/src/bin/corn.rs @@ -84,7 +84,7 @@ fn serialize(config: &Value, output_type: OutputType) -> Result { match output_type { OutputType::Json => serde_json::to_string_pretty(&config).map_err(Error::from), OutputType::Yaml => serde_yaml::to_string(&config).map_err(Error::from), - OutputType::Toml => toml::to_string_pretty(&config).map_err(Error::from), + OutputType::Toml => toml_edit::ser::to_string_pretty(&config).map_err(Error::from), } } diff --git a/corn-cli/src/error.rs b/corn-cli/src/error.rs index 947f877..34ea582 100644 --- a/corn-cli/src/error.rs +++ b/corn-cli/src/error.rs @@ -61,8 +61,8 @@ impl From for Error { } } -impl From for Error { - fn from(err: toml::ser::Error) -> Self { +impl From for Error { + fn from(err: toml_edit::ser::Error) -> Self { Self::Serializing(err.to_string()) } } diff --git a/libcorn/Cargo.toml b/libcorn/Cargo.toml index fef706d..3d194be 100644 --- a/libcorn/Cargo.toml +++ b/libcorn/Cargo.toml @@ -9,8 +9,8 @@ categories = ["config"] keywords = ["configuration", "language", "wasm", "pest", "peg"] [features] -wasm = ["wasm-bindgen", "serde-wasm-bindgen", "console_error_panic_hook", "wee_alloc"] bench = ["criterion"] +wasm = ["wasm-bindgen", "serde-wasm-bindgen", "console_error_panic_hook", "wee_alloc"] lua51 = ["mlua/lua51"] lua52 = ["mlua/lua52"] lua53 = ["mlua/lua53"] @@ -23,29 +23,29 @@ name = "corn" crate-type = ["cdylib", "rlib"] [dependencies] -pest = "2.6.0" -pest_derive = "2.6.0" +pest = "2.7.10" +pest_derive = "2.7.10" cfg-if = "1.0.0" -serde = { version = "1.0.133", features = ["derive"] } -indexmap = { version = "2.0.0", features = ["serde"] } -thiserror = "1.0.40" -wasm-bindgen = { version = "0.2.83", optional = true } -serde-wasm-bindgen = { version = "0.5.0", optional = true } +serde = { version = "1.0.203", features = ["derive"] } +indexmap = { version = "2.2.6", features = ["serde"] } +thiserror = "1.0.61" +wasm-bindgen = { version = "0.2.92", optional = true } +serde-wasm-bindgen = { version = "0.6.5", optional = true } console_error_panic_hook = { version = "0.1.7", optional = true } wee_alloc = { version = "0.4.5", optional = true } -mlua = { version = "0.8.9", features = ["vendored", "module", "macros", "serialize"], optional = true } +mlua = { version = "0.9.8", features = ["module", "macros", "serialize"], optional = true } # bench criterion = { version = "0.5.1", features = ["html_reports"], optional = true } [dev-dependencies] -paste = "1.0.6" -wasm-bindgen-test = { version = "0.3.29" } +paste = "1.0.15" +wasm-bindgen-test = { version = "0.3.42" } # required for testing -serde_json = "1.0.75" -serde_yaml = "0.9.11" -serde_bytes = "0.11.9" -toml = "0.7.4" +serde_json = "1.0.117" +serde_yaml = "0.9.34" +serde_bytes = "0.11.14" +toml_edit = { version = "0.22.14", features = ["serde"] } [[bench]] name = "serde" diff --git a/libcorn/src/lib.rs b/libcorn/src/lib.rs index 7ba402f..fc6d3b2 100644 --- a/libcorn/src/lib.rs +++ b/libcorn/src/lib.rs @@ -47,6 +47,10 @@ pub enum Value<'a> { /// true or false Boolean(bool), /// `null` literal. + /// + /// Takes an optional unit type as the `toml` crate + /// errors when encountering unit types, + /// but can handle `None` types. Null(Option<()>), } diff --git a/libcorn/src/lua.rs b/libcorn/src/lua.rs index 685911f..373efbd 100644 --- a/libcorn/src/lua.rs +++ b/libcorn/src/lua.rs @@ -1,8 +1,8 @@ use crate::Value; use mlua::prelude::*; -impl<'lua> ToLua<'lua> for Value<'lua> { - fn to_lua(self, lua: &'lua Lua) -> LuaResult> { +impl<'lua> IntoLua<'lua> for Value<'lua> { + fn into_lua(self, lua: &'lua Lua) -> LuaResult> { lua.to_value(&self) } } diff --git a/libcorn/src/parser.rs b/libcorn/src/parser.rs index d76bbdf..4e02edb 100644 --- a/libcorn/src/parser.rs +++ b/libcorn/src/parser.rs @@ -277,7 +277,7 @@ impl<'a> CornParser<'a> { } let child_obj = obj - .remove(part) + .shift_remove(part) .unwrap_or_else(|| Value::Object(IndexMap::new())); match child_obj { diff --git a/libcorn/tests/de_tests.rs b/libcorn/tests/de_tests.rs index 774b696..8dc5dc4 100644 --- a/libcorn/tests/de_tests.rs +++ b/libcorn/tests/de_tests.rs @@ -123,7 +123,7 @@ struct Compact { seven: CompactSeven, eight: Vec, nine: Vec, - ten: Vec<()>, + ten: (u8, u8), eleven: Vec>, twelve: Vec, } @@ -322,6 +322,11 @@ struct NullUnit { #[derive(Deserialize, Debug, PartialEq)] struct NullUnitInner; +#[derive(Deserialize, Debug, PartialEq)] +struct NullInArray { + foo: Vec> +} + #[derive(Deserialize, Debug, PartialEq)] struct Object { foo: SubObject, @@ -359,6 +364,31 @@ struct ReadmeExample { version: String, } +#[derive(Deserialize, Debug, PartialEq)] +struct QuotedKeys { + #[serde(rename="foo.bar")] + foo_bar: u8, + #[serde(rename="green.eggs")] + green_eggs: GreenEggs, + #[serde(rename="with spaces")] + with_spaces: bool, + #[serde(rename="escaped'quote")] + escaped_quote: bool, + #[serde(rename="escaped=equals")] + escaped_equals: i8 +} + +#[derive(Deserialize, Debug, PartialEq)] +struct GreenEggs { + and: And +} + +#[derive(Deserialize, Debug, PartialEq)] +struct And { + ham: String +} + + #[derive(Deserialize, Debug, PartialEq)] struct String_ { foo: String, @@ -432,9 +462,11 @@ generate_eq_tests!( (integer, Integer), (mixed_array, MixedArray), (null, Null), + (null_in_array, NullInArray), (object, Object), (object_in_array, ObjectInArray), (readme_example, ReadmeExample), + (quoted_keys, QuotedKeys), (string, String_), (string_interpolation, Basic), (value_after_table, ValueAfterTable), diff --git a/libcorn/tests/parser_tests.rs b/libcorn/tests/parser_tests.rs index f695b6d..79aedba 100644 --- a/libcorn/tests/parser_tests.rs +++ b/libcorn/tests/parser_tests.rs @@ -42,7 +42,8 @@ macro_rules! generate_eq_tests { let valid = fs::read_to_string(format!("../assets/outputs/toml/{}.toml", test_name)).unwrap().replace("\r", ""); let config = parse(input.as_str()).unwrap(); - let serialized = toml::to_string_pretty(&config).unwrap().replace("\r", ""); + // fall back to default as toml can fail due to no null + let serialized = toml_edit::ser::to_string_pretty(&config).unwrap_or_default().replace("\r", ""); assert_eq!(serialized.trim(), valid.trim()); } @@ -87,8 +88,10 @@ generate_eq_tests!( integer, mixed_array, null, + null_in_array, object, object_in_array, + quoted_keys, readme_example, spread, string,