diff --git a/Cargo.lock b/Cargo.lock index d1eeaee09..158202646 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -41,9 +41,9 @@ dependencies = [ [[package]] name = "aligned-vec" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e0966165eaf052580bd70eb1b32cb3d6245774c0104d1b2793e9650bf83b52a" +checksum = "af15ccceeacb9304119d97925de463bc97ae3555ee8dc8056f67b119f66e5934" dependencies = [ "equator", ] @@ -152,9 +152,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.95" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" +checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" [[package]] name = "arrayref" @@ -214,6 +214,21 @@ dependencies = [ "backtrace", ] +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -222,15 +237,15 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] name = "blake3" -version = "1.5.5" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8ee0c1824c4dea5b5f81736aff91bae041d2c07ee1192bec91054e10e3e601e" +checksum = "675f87afced0413c9bb02843499dbbd3882a237645883f71a2b59644a6d2f753" dependencies = [ "arrayref", "arrayvec", @@ -261,9 +276,9 @@ dependencies = [ [[package]] name = "built" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c360505aed52b7ec96a3636c3f039d99103c37d1d9b4f7a8c743d3ea9ffcd03b" +checksum = "56ed6191a7e78c36abdb16ab65341eefd73d64d303fffccdbb00d51e4205967b" dependencies = [ "chrono", "git2", @@ -271,15 +286,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.16.0" +version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "bytemuck" -version = "1.21.0" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3" +checksum = "b6b1fc10dbac614ebc03540c9dbd60e83887fda27794998c6528f1782047d540" [[package]] name = "byteorder" @@ -289,9 +304,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.9.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "cast" @@ -301,9 +316,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.9" +version = "1.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8293772165d9345bdaaa39b45b2109591e63fe5e6fbc23c6ff930a048aa310b" +checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c" dependencies = [ "jobserver", "libc", @@ -377,9 +392,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.26" +version = "4.5.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8eb5e908ef3a6efbe1ed62520fb7287959888c88485abe072543190ecc66783" +checksum = "027bb0d98429ae334a8698531da7077bdf906419543a35a55c2cb1b66437d767" dependencies = [ "clap_builder", "clap_derive", @@ -387,9 +402,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.26" +version = "4.5.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96b01801b5fc6a0a232407abc821660c9c6d25a1cafc0d4f85f29fb8d9afc121" +checksum = "5589e0cba072e0f3d23791efac0fd8627b49c829c196a492e88168e6a669d863" dependencies = [ "anstream", "anstyle", @@ -399,14 +414,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.24" +version = "4.5.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54b755194d6389280185988721fffba69495eed5ee9feeee9a599b53db80318c" +checksum = "bf4ced95c6f4a675af3da73304b9ac4ed991640c36374e4b46795c49e17cf1ed" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", ] [[package]] @@ -518,13 +533,22 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ "libc", ] +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + [[package]] name = "criterion" version = "0.5.1" @@ -603,7 +627,7 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.0", "crossterm_winapi", "parking_lot", "rustix", @@ -621,9 +645,9 @@ dependencies = [ [[package]] name = "crunchy" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" [[package]] name = "crypto-common" @@ -649,9 +673,9 @@ dependencies = [ [[package]] name = "csv-core" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70" +checksum = "7d02f3b0da4c6504f86e9cd789d8dbafab48c2321be74e9987593de5a894d93d" dependencies = [ "memchr", ] @@ -668,9 +692,9 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e60eed09d8c01d3cee5b7d30acb059b76614c918fa0f992e0dd6eeb10daad6f" +checksum = "575f75dfd25738df5b91b8e43e14d44bda14637a58fae779fd2b064f8bf3e010" [[package]] name = "debugid" @@ -681,6 +705,15 @@ dependencies = [ "uuid", ] +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + [[package]] name = "difflib" version = "0.4.0" @@ -726,7 +759,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", ] [[package]] @@ -737,9 +770,9 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" [[package]] name = "either" -version = "1.13.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] name = "endian-type" @@ -795,29 +828,29 @@ dependencies = [ [[package]] name = "equator" -version = "0.2.2" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c35da53b5a021d2484a7cc49b2ac7f2d840f8236a286f84202369bd338d761ea" +checksum = "4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc" dependencies = [ "equator-macro", ] [[package]] name = "equator-macro" -version = "0.2.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bf679796c0322556351f287a51b49e48f7c4986e727b5dd78c972d30e2e16cc" +checksum = "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", ] [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" @@ -894,6 +927,22 @@ dependencies = [ "winapi", ] +[[package]] +name = "flate2" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11faaf5a5236997af9848be0bef4db95824b1d534ebc64d0f0c6cf3e67bd38dc" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + [[package]] name = "foldhash" version = "0.1.4" @@ -974,7 +1023,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", ] [[package]] @@ -1056,11 +1105,11 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "git2" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" +checksum = "3fda788993cc341f69012feba8bf45c0ba4f3291fcc08e214b4d5a7332d88aff" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.0", "libc", "libgit2-sys", "log", @@ -1274,7 +1323,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", ] [[package]] @@ -1300,9 +1349,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.7.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" +checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" dependencies = [ "equivalent", "hashbrown", @@ -1311,9 +1360,9 @@ dependencies = [ [[package]] name = "indoc" -version = "2.0.5" +version = "2.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" +checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd" [[package]] name = "inferno" @@ -1328,7 +1377,7 @@ dependencies = [ "log", "num-format", "once_cell", - "quick-xml", + "quick-xml 0.26.0", "rgb", "str_stack", ] @@ -1339,7 +1388,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.0", "inotify-sys", "libc", ] @@ -1371,13 +1420,13 @@ checksum = "cf370abdafd54d13e54a620e8c3e1145f28e46cc9d704bc6d94414559df41763" [[package]] name = "is-terminal" -version = "0.4.13" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" +checksum = "e19b23d53f35ce9f56aebc7d1bb4e6ac1e9c0db7ac85c8d1760c04379edced37" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1403,9 +1452,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "jni" @@ -1501,15 +1550,15 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.169" +version = "0.2.170" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" +checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828" [[package]] name = "libgit2-sys" -version = "0.17.0+1.8.1" +version = "0.18.0+1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224" +checksum = "e1a117465e7e1597e8febea8bb0c410f1c7fb93b1e1cddf34363f8390367ffec" dependencies = [ "cc", "libc", @@ -1543,7 +1592,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.0", "libc", "redox_syscall", ] @@ -1561,9 +1610,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.20" +version = "1.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" +checksum = "df9b68e50e6e0b26f672573834882eb57759f6db9b3be2ea3c35c91188bb4eaa" dependencies = [ "cc", "libc", @@ -1576,7 +1625,7 @@ name = "limbo" version = "0.0.18-pre.2" dependencies = [ "limbo_core", - "thiserror 2.0.11", + "thiserror 2.0.12", "tokio", ] @@ -1593,7 +1642,7 @@ version = "0.0.18-pre.2" dependencies = [ "jni", "limbo_core", - "thiserror 2.0.11", + "thiserror 2.0.12", ] [[package]] @@ -1623,7 +1672,9 @@ dependencies = [ "env_logger 0.10.2", "limbo_core", "miette", + "nu-ansi-term 0.50.1", "rustyline", + "syntect", "tracing", "tracing-subscriber", ] @@ -1741,7 +1792,7 @@ version = "0.0.18-pre.2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", ] [[package]] @@ -1805,7 +1856,7 @@ dependencies = [ name = "limbo_sqlite3_parser" version = "0.0.18-pre.2" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.0", "cc", "env_logger 0.11.6", "fallible-iterator", @@ -1841,7 +1892,7 @@ dependencies = [ "mimalloc", "strum", "strum_macros", - "thiserror 2.0.11", + "thiserror 2.0.12", ] [[package]] @@ -1854,23 +1905,29 @@ dependencies = [ ] [[package]] -name = "linkme" -version = "0.3.31" +name = "linked-hash-map" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "566336154b9e58a4f055f6dd4cbab62c7dc0826ce3c0a04e63b2d2ecd784cdae" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + +[[package]] +name = "linkme" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22d227772b5999ddc0690e733f734f95ca05387e329c4084fe65678c51198ffe" dependencies = [ "linkme-impl", ] [[package]] name = "linkme-impl" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edbe595006d355eaf9ae11db92707d4338cd2384d16866131cc1afdbdd35d8d9" +checksum = "71a98813fa0073a317ed6a8055dcd4722a49d9b862af828ee68449adb799b6be" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", ] [[package]] @@ -1881,9 +1938,9 @@ checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[package]] name = "litemap" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" +checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" [[package]] name = "lock_api" @@ -1951,9 +2008,9 @@ dependencies = [ [[package]] name = "miette" -version = "7.4.0" +version = "7.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317f146e2eb7021892722af37cf1b971f0a70c8406f487e24952667616192c64" +checksum = "1a955165f87b37fd1862df2a59547ac542c77ef6d17c666f619d1ad22dd89484" dependencies = [ "backtrace", "backtrace-ext", @@ -1971,13 +2028,13 @@ dependencies = [ [[package]] name = "miette-derive" -version = "7.4.0" +version = "7.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c9b935fbe1d6cbd1dac857b54a688145e2d93f48db36010514d0f612d0ad67" +checksum = "bf45bf44ab49be92fd1227a3be6fc6f617f1a337c06af54981048574d8783147" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", ] [[package]] @@ -1997,9 +2054,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8402cab7aefae129c6977bb0ff1b8fd9a04eb5b51efc50a70bea51cda0c7924" +checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5" dependencies = [ "adler2", ] @@ -2042,7 +2099,7 @@ version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.0", "cfg-if", "libc", ] @@ -2053,7 +2110,7 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.0", "cfg-if", "cfg_aliases", "libc", @@ -2075,7 +2132,7 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fee8403b3d66ac7b26aee6e40a897d85dc5ce26f44da36b8b73e987cc52e943" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.0", "filetime", "fsevent-sys", "inotify", @@ -2104,6 +2161,21 @@ dependencies = [ "winapi", ] +[[package]] +name = "nu-ansi-term" +version = "0.50.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-format" version = "0.4.4" @@ -2134,9 +2206,31 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.2" +version = "1.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" + +[[package]] +name = "onig" +version = "6.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c4b31c8722ad9171c6d77d3557db078cab2bd50afcc9d09c8b315c59df8ca4f" +dependencies = [ + "bitflags 1.3.2", + "libc", + "once_cell", + "onig_sys", +] + +[[package]] +name = "onig_sys" +version = "69.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b829e3d7e9cc74c7e315ee8edb185bf4190da5acde74afd7fc59c35b1f086e7" +dependencies = [ + "cc", + "pkg-config", +] [[package]] name = "oorandom" @@ -2167,9 +2261,9 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "owo-colors" -version = "4.1.0" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb37767f6569cd834a413442455e0f066d0d522de8630436e2a1761d9726ba56" +checksum = "1036865bb9422d3300cf723f657c2851d0e9ab12567854b1f4eba3d77decf564" [[package]] name = "parking_lot" @@ -2207,7 +2301,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" dependencies = [ "memchr", - "thiserror 2.0.11", + "thiserror 2.0.12", "ucd-trie", ] @@ -2231,7 +2325,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", ] [[package]] @@ -2298,9 +2392,22 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "plist" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42cf17e9a1800f5f396bc67d193dc9411b59012a5876445ef450d449881e1016" +dependencies = [ + "base64", + "indexmap", + "quick-xml 0.32.0", + "serde", + "time", +] [[package]] name = "plotters" @@ -2347,9 +2454,15 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" +checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e" + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "pprof" @@ -2412,9 +2525,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.93" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] @@ -2478,7 +2591,7 @@ dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", - "syn 2.0.96", + "syn 2.0.99", ] [[package]] @@ -2491,7 +2604,7 @@ dependencies = [ "proc-macro2", "pyo3-build-config", "quote", - "syn 2.0.96", + "syn 2.0.99", ] [[package]] @@ -2503,6 +2616,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "quick-xml" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d3a6e5838b60e0e8fa7a43f22ade549a37d61f8bdbe636d0d7816191de969c2" +dependencies = [ + "memchr", +] + [[package]] name = "quickcheck" version = "1.0.3" @@ -2527,9 +2649,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.38" +version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" +checksum = "c1f1914ce909e1658d9907913b4b91947430c7d9be598b15a1912935b8c04801" dependencies = [ "proc-macro2", ] @@ -2562,8 +2684,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" dependencies = [ "rand_chacha 0.9.0", - "rand_core 0.9.0", - "zerocopy 0.8.14", + "rand_core 0.9.3", + "zerocopy 0.8.22", ] [[package]] @@ -2583,7 +2705,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", - "rand_core 0.9.0", + "rand_core 0.9.3", ] [[package]] @@ -2597,12 +2719,11 @@ dependencies = [ [[package]] name = "rand_core" -version = "0.9.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b08f3c9802962f7e1b25113931d94f43ed9725bebc59db9d0c3e9a23b67e15ff" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ "getrandom 0.3.1", - "zerocopy 0.8.14", ] [[package]] @@ -2627,11 +2748,11 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.8" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" +checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.0", ] [[package]] @@ -2719,15 +2840,14 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.8" +version = "0.17.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +checksum = "ed9b823fa29b721a59671b41d6b06e66b29e0628e207e8b1c3ceeda701ec928d" dependencies = [ "cc", "cfg-if", "getrandom 0.2.15", "libc", - "spin", "untrusted", "windows-sys 0.52.0", ] @@ -2757,7 +2877,7 @@ dependencies = [ "regex", "relative-path", "rustc_version", - "syn 2.0.96", + "syn 2.0.99", "unicode-ident", ] @@ -2767,7 +2887,7 @@ version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c6d5e5acb6f6129fe3f7ba0a7fc77bca1942cb568535e18e7bc40262baf3110" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.0", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -2802,11 +2922,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.43" +version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.0", "errno", "libc", "linux-raw-sys", @@ -2815,9 +2935,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" [[package]] name = "rustyline" @@ -2825,7 +2945,7 @@ version = "15.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ee1e066dc922e513bda599c6ccb5f3bb2b0ea5870a579448f2622993f0a9a2f" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.0", "cfg-if", "clipboard-win", "fd-lock", @@ -2850,14 +2970,14 @@ checksum = "327e9d075f6df7e25fbf594f1be7ef55cf0d567a6cb5112eeccbbd51ceb48e0d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", ] [[package]] name = "ryu" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "same-file" @@ -2876,35 +2996,35 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "semver" -version = "1.0.24" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" [[package]] name = "serde" -version = "1.0.217" +version = "1.0.218" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" +checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.217" +version = "1.0.218" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" +checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", ] [[package]] name = "serde_json" -version = "1.0.139" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44f86c3acccc9c65b153fe1b85a3be07fe5515274ec9f0653b4a0875731c72a6" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ "indexmap", "itoa", @@ -2965,9 +3085,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.2" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" [[package]] name = "socket2" @@ -2979,12 +3099,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" - [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -3022,7 +3136,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.96", + "syn 2.0.99", ] [[package]] @@ -3048,9 +3162,9 @@ checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" [[package]] name = "symbolic-common" -version = "12.13.2" +version = "12.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8150eae9699e3c73a3e6431dc1f80d87748797c0457336af23e94c1de619ed24" +checksum = "66135c8273581acaab470356f808a1c74a707fe7ec24728af019d7247e089e71" dependencies = [ "debugid", "memmap2", @@ -3060,9 +3174,9 @@ dependencies = [ [[package]] name = "symbolic-demangle" -version = "12.13.2" +version = "12.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95f4a9846f7a8933b6d198c022faa2c9bd89e1a970bed9d9a98d25708bf8de17" +checksum = "42bcacd080282a72e795864660b148392af7babd75691d5ae9a3b77e29c98c77" dependencies = [ "cpp_demangle", "rustc-demangle", @@ -3082,9 +3196,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.96" +version = "2.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" +checksum = "e02e925281e18ffd9d640e234264753c43edc62d64b2d4cf898f1bc5e75f3fc2" dependencies = [ "proc-macro2", "quote", @@ -3099,7 +3213,29 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", +] + +[[package]] +name = "syntect" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "874dcfa363995604333cf947ae9f751ca3af4522c60886774c4963943b4746b1" +dependencies = [ + "bincode", + "bitflags 1.3.2", + "flate2", + "fnv", + "once_cell", + "onig", + "plist", + "regex-syntax 0.8.5", + "serde", + "serde_derive", + "serde_json", + "thiserror 1.0.69", + "walkdir", + "yaml-rust", ] [[package]] @@ -3110,13 +3246,13 @@ checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a" [[package]] name = "tempfile" -version = "3.15.0" +version = "3.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704" +checksum = "22e5a0acb1f3f55f65cc4a866c361b2fb2a0ff6366785ae6fbb5f85df07ba230" dependencies = [ "cfg-if", "fastrand", - "getrandom 0.2.15", + "getrandom 0.3.1", "once_cell", "rustix", "windows-sys 0.59.0", @@ -3166,17 +3302,17 @@ checksum = "888d0c3c6db53c0fdab160d2ed5e12ba745383d3e85813f2ea0f2b1475ab553f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", ] [[package]] name = "textwrap" -version = "0.16.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" +checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057" dependencies = [ "unicode-linebreak", - "unicode-width 0.1.14", + "unicode-width 0.2.0", ] [[package]] @@ -3190,11 +3326,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.11" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ - "thiserror-impl 2.0.11", + "thiserror-impl 2.0.12", ] [[package]] @@ -3205,18 +3341,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", ] [[package]] name = "thiserror-impl" -version = "2.0.11" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", ] [[package]] @@ -3229,6 +3365,37 @@ dependencies = [ "once_cell", ] +[[package]] +name = "time" +version = "0.3.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dad298b01a40a23aac4580b67e3dbedb7cc8402f3592d7f49469de2ea4aecdd8" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "765c97a5b985b7c11d7bc27fa927dc4fe6af3a6dfb021d28deb60d3bf51e76ef" + +[[package]] +name = "time-macros" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8093bc3e81c3bc5f7879de09619d06c9a5a5e45ca44dfeeb7225bae38005c5c" +dependencies = [ + "num-conv", + "time-core", +] + [[package]] name = "tinystr" version = "0.7.6" @@ -3275,7 +3442,7 @@ checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", ] [[package]] @@ -3297,7 +3464,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", ] [[package]] @@ -3328,7 +3495,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", - "nu-ansi-term", + "nu-ansi-term 0.46.0", "once_cell", "regex", "sharded-slab", @@ -3341,9 +3508,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] name = "ucd-trie" @@ -3362,9 +3529,9 @@ dependencies = [ [[package]] name = "unicode-ident" -version = "1.0.14" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "unicode-linebreak" @@ -3392,9 +3559,9 @@ checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" [[package]] name = "unindent" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" +checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3" [[package]] name = "untrusted" @@ -3439,11 +3606,11 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.12.0" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "744018581f9a3454a9e15beb8a33b017183f1e7c0cd170232a2d1453b23a51c4" +checksum = "e0f540e3240398cce6128b64ba83fdbdd86129c16a3aa1a3a252efd66eb3d587" dependencies = [ - "getrandom 0.2.15", + "getrandom 0.3.1", ] [[package]] @@ -3466,9 +3633,9 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wait-timeout" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" dependencies = [ "libc", ] @@ -3520,7 +3687,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", "wasm-bindgen-shared", ] @@ -3555,7 +3722,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3845,7 +4012,7 @@ version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" dependencies = [ - "bitflags 2.8.0", + "bitflags 2.9.0", ] [[package]] @@ -3860,6 +4027,15 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "yoke" version = "0.7.5" @@ -3880,7 +4056,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", "synstructure", ] @@ -3896,11 +4072,11 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.14" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a367f292d93d4eab890745e75a778da40909cab4d6ff8173693812f79c4a2468" +checksum = "09612fda0b63f7cb9e0af7e5916fe5a1f8cdcb066829f10f36883207628a4872" dependencies = [ - "zerocopy-derive 0.8.14", + "zerocopy-derive 0.8.22", ] [[package]] @@ -3911,38 +4087,38 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", ] [[package]] name = "zerocopy-derive" -version = "0.8.14" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3931cb58c62c13adec22e38686b559c86a30565e16ad6e8510a337cedc611e1" +checksum = "79f81d38d7a2ed52d8f034e62c568e111df9bf8aba2f7cf19ddc5bf7bd89d520" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", ] [[package]] name = "zerofrom" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", "synstructure", ] @@ -3965,5 +4141,5 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.96", + "syn 2.0.99", ] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index c78dae6b8..9ad47aa79 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,14 +1,14 @@ # Copyright 2023 the Limbo authors. All rights reserved. MIT license. [package] -name = "limbo_cli" -version.workspace = true authors.workspace = true default-run = "limbo" +description = "The Limbo interactive SQL shell" edition.workspace = true license.workspace = true +name = "limbo_cli" repository.workspace = true -description = "The Limbo interactive SQL shell" +version.workspace = true [package.metadata.dist] dist = true @@ -36,7 +36,14 @@ miette = { version = "7.4.0", features = ["fancy"] } cfg-if = "1.0.0" tracing-subscriber = { version = "0.3.19", features = ["env-filter"] } tracing = "0.1.41" +syntect = "5.2.0" +nu-ansi-term = "0.50.1" + [features] default = ["io_uring"] io_uring = ["limbo_core/io_uring"] + +[build-dependencies] +syntect = "5.2.0" + diff --git a/cli/SQL.sublime-syntax b/cli/SQL.sublime-syntax new file mode 100644 index 000000000..511725452 --- /dev/null +++ b/cli/SQL.sublime-syntax @@ -0,0 +1,1669 @@ +%YAML 1.2 +--- +name: SQL +scope: source.sql +version: 2 +hidden: true + +variables: + string_escape: (?:\\.) + simple_identifier: (?:\w+) + simple_identifier_break: (?!\w) + + toplevel_reserved: |- + (?xi: alter | create | cross | delete | drop | from | grant | group | inner | insert | join + | left | on | order | outer | right | select | set | truncate | union + | update | where ) + additional_toplevel_reserved: (?!) + # TODO: not all are supported by all dialects! + ddl_target: |- + (?xi: {{ddl_target_other}} + | (?: {{ddl_target_function_modifier}} \s+ )? {{ddl_target_function}} + | (?: {{ddl_target_index_modifier}} \s+ )? index + | (?: {{ddl_target_table_modifier}} \s+ )? table ) + ddl_target_function: |- + (?xi: procedure | function ) + ddl_target_other: |- + (?xi: aggregate | column | constraint | conversion | database | domain | group + | language | member | operator\s+class | operator | role | rule | schema | sequence + | tablespace | trigger | type | user | view ) + + ddl_target_inside_alter_table: |- + (?xi: constraint ) + + ddl_target_function_modifier: |- + (?xi: aggregate ) + ddl_target_index_modifier: |- + (?xi: clustered | fulltext | spatial | unique ) + ddl_target_table_modifier: |- + (?xi: temp(?:orary)? ) + + function_parameter_modifier: |- + (?xi: inout | in | out ) + + simple_types: |- + (?xi: boolean | bool | year ) + + types_with_optional_number: |- + (?xi: bit | datetime | int | number | n?(?:var)?char | varbinary ) + + type_modifiers: |- + (?xi: signed | unsigned | zerofill ) + + builtin_scalar_functions: |- + (?xi: current_(?: date | time(?:stamp)? ) ) + + builtin_user_functions: |- + (?xi: (?: current | session | system )_user ) + +contexts: + prototype: + - include: comments + + main: + - include: sql + + sql: + - include: statements + - include: statement-terminators + - include: expressions-or-column-names + + statements: + - include: create-statements + - include: drop-statements + - include: alter-statements + - include: dml-statements + - include: grant-statements + - include: revoke-statements + - include: other-statements + + ###[ COMMENTS ]################################################################ + + comments: + - include: double-dash-comments + - include: block-comments + + double-dash-comments: + - match: "--" + scope: punctuation.definition.comment.sql + push: inside-double-dash-comment + + block-comments: + - match: /\*(?:\*(?!/))+ + scope: punctuation.definition.comment.begin.sql + push: inside-comment-docblock + - match: /\* + scope: punctuation.definition.comment.begin.sql + push: inside-comment-block + + inside-double-dash-comment: + - meta_include_prototype: false + - meta_scope: comment.line.double-dash.sql + - match: \n + pop: 1 + + inside-comment-docblock: + - meta_include_prototype: false + - meta_scope: comment.block.documentation.sql + - match: \*+/ + scope: punctuation.definition.comment.end.sql + pop: 1 + - match: ^\s*(\*)(?!\**/) + captures: + 1: punctuation.definition.comment.sql + + inside-comment-block: + - meta_include_prototype: false + - meta_scope: comment.block.sql + - match: \*+/ + scope: punctuation.definition.comment.end.sql + pop: 1 + + ###[ DDL CREATE STATEMENTS ]################################################### + + create-statements: + - match: \b(?i:create)\b + scope: keyword.other.ddl.sql + push: + - create-meta + - create-target + + create-meta: + - meta_include_prototype: false + - meta_scope: meta.statement.create.sql + - include: immediately-pop + + create-target: + - include: create-function + - include: create-index + - include: create-table + - include: create-other + - include: else-pop + + create-function: + - match: \b(?:({{ddl_target_function_modifier}})\s+)?({{ddl_target_function}})\b + captures: + 1: keyword.other.ddl.sql + 2: keyword.other.ddl.sql + set: + - expect-function-characteristics + - expect-function-parameters + - expect-function-creation-name + - create-function-condition + + create-function-condition: + - meta_include_prototype: false + - include: maybe-condition + + create-index: + - match: \b(?i:(?:({{ddl_target_index_modifier}})\s+)?(index))\b + captures: + 1: keyword.other.ddl.sql + 2: keyword.other.ddl.sql + set: + - create-index-args + - expect-index-creation-name + - create-index-condition + + create-index-condition: + - meta_include_prototype: false + - include: maybe-condition + + create-index-args: + - meta_scope: meta.index.sql + - include: on-table-names + - include: create-common-args + + create-table: + - match: \b(?i:(?:({{ddl_target_table_modifier}})\s+)?(table))\b + captures: + 1: keyword.other.ddl.sql + 2: keyword.other.ddl.sql + set: + - create-table-args + - maybe-column-declaration-list + - expect-table-creation-name + - create-table-condition + + create-table-condition: + - meta_include_prototype: false + - include: maybe-condition + + create-table-args: + - meta_scope: meta.table.sql + - include: create-common-args + + create-other: + - match: \b{{ddl_target_other}}\b + scope: keyword.other.ddl.sql + set: + - create-other-args + - expect-other-creation-name + - create-other-condition + + create-other-condition: + - meta_include_prototype: false + - include: maybe-condition + + create-other-args: + - match: \b(?i:(as)\s+(table))\b + captures: + 1: keyword.context.block.sql + 2: support.type.sql + set: maybe-column-declaration-list + - match: \b(?i:as)\b + scope: keyword.context.block.sql + pop: 1 + - include: grant + - include: on-table-names + - include: create-common-args + + create-common-args: + - include: expressions + - include: pop-on-top-level-reserved-word + + ###[ DDL DROP STATEMENTS ]##################################################### + + drop-statements: + - match: \b(?i:drop)\b + scope: keyword.other.ddl.sql + push: + - drop-meta + - drop-target + + drop-meta: + - meta_include_prototype: false + - meta_scope: meta.statement.drop.sql + - include: immediately-pop + + drop-target: + - include: drop-function + - include: drop-index + - include: drop-table + - include: drop-other + - include: else-pop + + drop-function: + - match: \b{{ddl_target_function}}\b + scope: keyword.other.ddl.sql + set: + - drop-function-args + - expect-function-name + - drop-function-condition + + drop-function-condition: + - meta_include_prototype: false + - include: maybe-condition + + drop-function-args: + - meta_include_prototype: false + - meta_scope: meta.function.sql + - include: immediately-pop + + drop-index: + - match: \b(?i:index)\b + scope: keyword.other.ddl.sql + set: + - drop-index-args + - expect-index-name + - drop-index-condition + + drop-index-condition: + - meta_include_prototype: false + - include: maybe-condition + + drop-index-args: + - meta_scope: meta.index.sql + - include: maybe-on-table-name + + drop-table: + - match: \b(?i:(?:({{ddl_target_table_modifier}})\s+)?(table))\b + captures: + 1: keyword.other.ddl.sql + 2: keyword.other.ddl.sql + set: + - drop-table-args + - expect-table-name + - drop-table-condition + + drop-table-condition: + - meta_include_prototype: false + - include: maybe-condition + + drop-table-args: + - meta_include_prototype: false + - meta_scope: meta.table.sql + - include: immediately-pop + + drop-other: + - match: \b(?i:user)\b + scope: storage.type.sql + set: + - expect-user-name + - maybe-condition + - match: \b{{ddl_target_other}}\b + scope: keyword.other.ddl.sql + set: + - drop-other-args + - expect-other-name + - drop-other-condition + + drop-other-condition: + - meta_include_prototype: false + - include: maybe-condition + + drop-other-args: + - include: maybe-on-table-name + + ###[ DDL ALTER STATEMENTS ]#################################################### + + alter-statements: + - match: \b(?i:alter)\b + scope: keyword.other.ddl.sql + push: + - alter-meta + - alter-target + + alter-meta: + - meta_include_prototype: false + - meta_scope: meta.statement.alter.sql + - include: immediately-pop + + alter-target: + - include: alter-function + - include: alter-index + - include: alter-table + - include: alter-other + - include: else-pop + + ###[ DDL ALTER FUNCTION STATEMENTS ]########################################### + + alter-function: + - match: \b(?:({{ddl_target_function_modifier}})\s+)?({{ddl_target_function}})\b + captures: + 1: keyword.other.ddl.sql + 2: keyword.other.ddl.sql + set: + - expect-function-characteristics + - expect-function-parameters + - expect-function-name + - alter-function-condition + + alter-function-condition: + - meta_include_prototype: false + - include: maybe-condition + + ###[ DDL ALTER INDEX STATEMENTS ]############################################## + + alter-index: + - match: \b(?i:(?:({{ddl_target_index_modifier}})\s+)?(index))\b + captures: + 1: keyword.other.ddl.sql + 2: keyword.other.ddl.sql + set: + - alter-index-args + - expect-index-name + - alter-index-condition + + alter-index-condition: + - meta_include_prototype: false + - include: maybe-condition + + alter-index-args: + - include: alter-common + - include: pop-on-top-level-reserved-word + - include: expressions-or-column-names + + ###[ DDL ALTER TABLE STATEMENTS ]############################################## + + alter-table: + - match: \b(?i:(?:({{ddl_target_table_modifier}})\s+)?(table))\b + captures: + 1: keyword.other.ddl.sql + 2: keyword.other.ddl.sql + set: + - alter-table-args + - expect-table-name + - alter-table-condition + + alter-table-condition: + - meta_include_prototype: false + - include: maybe-condition + + alter-table-args: + - include: alter-columns + - include: alter-common + - include: pop-on-top-level-reserved-word + - include: expressions-or-column-names + + alter-other: + - match: \b{{ddl_target_other}}\b + scope: keyword.other.ddl.sql + set: + - alter-other-args + - expect-other-name + - alter-other-condition + + alter-other-condition: + - meta_include_prototype: false + - include: maybe-condition + + alter-other-args: + - include: alter-common + - include: else-pop + + alter-columns: + - match: \b(?i:(?:(add|alter)\b(?:\s+(column)\b|(?!\s+(?:table|{{ddl_target_inside_alter_table}})\b)))) + captures: + 1: keyword.other.ddl.sql + 2: keyword.other.ddl.sql + push: + - expect-type + - expect-column-name-declaration + - match: \b(?i:(drop)(?:\s+(column)\b|(?!\s+{{ddl_target}}\b))) + scope: keyword.other.ddl.sql + push: expect-column-name + + alter-common: + - match: \b(?i:(add)\s+(constraint))\b + captures: + 1: keyword.other.ddl.sql + 2: keyword.other.ddl.sql + push: + - maybe-column-modifier + - expect-constraint-name + - match: \b(?i:(add)\s+(?:({{ddl_target_index_modifier}})\s+)?(index))\b + captures: + 1: keyword.other.ddl.sql + 2: keyword.other.ddl.sql + 3: keyword.other.ddl.sql + - match: \b(?i:(add)\s+(primary|foreign)\s+(key))\b + captures: + 1: keyword.other.ddl.sql + 2: keyword.other.ddl.sql + 3: keyword.other.ddl.sql + + ###[ DDL STATEMENT PROTOTYPES ]################################################ + + maybe-on-table-name: + - include: on-table-names + - include: else-pop + + on-table-names: + - match: \b(?i:on)\b + scope: keyword.other.sql + push: expect-table-name + + ###[ DML STATEMENTS ]########################################################## + + dml-statements: + - match: \b(?i:select)\b + scope: keyword.other.dml.sql + - match: \b(?i:union(?:\s+all)?)\b + scope: keyword.other.dml.sql + - match: \b(?i:(?:delete(?:\s+from)?))\b + scope: keyword.other.dml.sql + push: dml-delete + - match: \b(?i:update)\b + scope: keyword.other.dml.sql + push: dml-update + - match: \b(?i:(?:insert\s+into|truncate))\b + scope: keyword.other.dml.sql + push: expect-table-name + - include: set-statements + # expressions + - match: \b(?i:(?:default\s+)?values)\b + scope: keyword.other.dml.II.sql + - include: distinct + - include: join-expressions + - match: \b(?i:group\s+by|order\s+by|having|where)\b + scope: keyword.other.dml.sql + - match: \b(?i:from)\b + scope: keyword.other.dml.sql + push: table-name-or-subquery + - match: \b(?i:asc|desc)\b + scope: keyword.other.order.sql + + dml-delete: + - include: expect-table-name + + dml-update: + - match: (?={{simple_identifier}}\s*=) + pop: 1 + - include: expect-table-name + + distinct: + - match: \b(?i:distinct)\b + scope: keyword.other.dml.sql + + join-expressions: + - match: \b(?i:(?:(?:cross|inner|(?:full|left|right)(?:\s+outer)?)\s+)?join)\b + scope: keyword.other.dml.sql + push: + - join-condition + - table-name-or-subquery + + join-condition: + - match: \b(?i:on)\b + scope: keyword.control.conditional.sql + set: conditional-expression + - include: else-pop + + conditional-expression: + - match: (?=[,;)}]|\b(?:{{toplevel_reserved}}|{{additional_toplevel_reserved}})\b) + pop: 1 + - include: expressions + - include: expect-column-names + + ###[ DML SET STATEMENTS ]###################################################### + + set-statements: + - match: \b(?i:set)\b(?!\s*\() + scope: keyword.other.dml.sql + push: + - set-meta + - set-target + + set-meta: + - meta_include_prototype: false + - meta_scope: meta.statement.set.sql + - include: immediately-pop + + set-target: + - include: else-pop + + ###[ GRANT STATEMENTS ]######################################################## + + grant-statements: + - match: \b(?i:grant(?:\s+with\s+grant\s+option)?)\b + scope: keyword.other.authorization.sql + push: + - grant-meta + - grant + + grant-meta: + - meta_include_prototype: false + - meta_scope: meta.statement.grant.sql + - include: immediately-pop + + ###[ REVOKE STATEMENTS ]####################################################### + + revoke-statements: + - match: \b(?i:revoke)\b + scope: keyword.other.ddl.sql + push: + - revoke-meta + - grant + + revoke-meta: + - meta_include_prototype: false + - meta_scope: meta.statement.revoke.sql + - include: immediately-pop + + ###[ OTHER STATEMENTS ]######################################################## + + other-statements: [] + + ###[ EXPRESSIONS ]############################################################# + + expressions-or-column-names: + - include: wildcard-identifiers + - include: expressions + - include: expect-column-names + + expressions: + - include: groups + - include: comma-separators + - include: operators + - include: column-alias-expressions + - include: case-expressions + - include: collate-expressions + - include: constraint-expressions + - include: literals-and-variables + - include: function-calls + - include: illegal-stray-brackets + - include: illegal-stray-parens + - match: (?=;) + pop: 1 + + column-alias-expressions: + - match: \b(?i:as)\b + scope: keyword.operator.assignment.alias.sql + push: expect-column-alias-name + + table-alias-expression: + - match: \b(?i:as)\b + scope: keyword.operator.assignment.alias.sql + set: expect-table-alias-name + + case-expressions: + - match: \b(?i:case)\b + scope: keyword.control.conditional.case.sql + push: inside-case-expression + + inside-case-expression: + - meta_scope: meta.statement.conditional.case.sql + - match: \b(?i:end)\b + scope: keyword.control.conditional.end.sql + pop: 1 + - match: \b(?i:(case)\s+(when))\b + captures: + 1: keyword.control.conditional.case.sql + 2: keyword.control.conditional.when.sql + - match: \b(?i:when)\b + scope: keyword.control.conditional.when.sql + - match: \b(?i:then)\b + scope: keyword.control.conditional.then.sql + - match: \b(?i:else)\b + scope: keyword.control.conditional.else.sql + - include: expressions-or-column-names + + collate-expressions: + - match: \b(?i:collate)\b + scope: keyword.other.sql + push: inside-collate-expression + + inside-collate-expression: + - match: "{{simple_identifier}}" + scope: support.constant.sql + pop: 1 + - include: else-pop + + constraint-expressions: + - match: \b(?i:constraint)\b + scope: storage.modifier.sql + push: expect-constraint-name + + maybe-check: + - match: \b(?i:check)\b + scope: keyword.other.sql + set: maybe-group + - include: else-pop + + maybe-column: + - match: \b(?i:column)\b + scope: keyword.other.ddl.sql + pop: 1 + - include: else-pop + + maybe-to: + - match: \b(?i:to)\b + scope: keyword.other.ddl.sql + pop: 1 + - include: else-pop + + ###[ FUNCTION EXPRESSIONS ]#################################################### + + function-calls: + - include: built-in-aggregate-function-calls + - include: built-in-scalar-function-calls + - include: built-in-user-function-calls + - include: user-defined-function-calls + + built-in-aggregate-function-calls: + # List of SQL99 built-in functions from http://www.oreilly.com/catalog/sqlnut/chapter/ch04.html + - match: \b(?i:AVG|COUNT|MIN|MAX|SUM)(?=\s*\() + scope: support.function.aggregate.sql + push: function-call-arguments + + built-in-scalar-function-calls: + # List of SQL99 built-in functions from http://www.oreilly.com/catalog/sqlnut/chapter/ch04.html + - match: \b{{builtin_scalar_functions}}\b + scope: support.function.scalar.sql + push: function-call-arguments + + built-in-user-function-calls: + - match: \b{{builtin_user_functions}}\b + scope: support.function.user.sql + push: function-call-arguments + + built-in-user-function-call: + - match: \b{{builtin_user_functions}}\b + scope: support.function.user.sql + set: function-call-arguments + + user-defined-function-calls: + - match: \b{{simple_identifier}}(?=\s*\() + scope: support.function.sql + push: function-call-arguments + + function-call-arguments: + - meta_include_prototype: false + - meta_scope: meta.function-call.sql + - match: \( + scope: meta.group.sql punctuation.section.arguments.begin.sql + set: inside-function-call-arguments + - include: else-pop + + inside-function-call-arguments: + - meta_content_scope: meta.function-call.sql meta.group.sql + - match: \) + scope: meta.function-call.sql meta.group.sql punctuation.section.arguments.end.sql + pop: 1 + - match: "," + scope: punctuation.separator.arguments.sql + - include: distinct + - include: expressions-or-column-names + + ###[ GROUPS EXPRESSIONS ]###################################################### + + maybe-group: + - include: group + - include: else-pop + + group: + - match: \( + scope: punctuation.section.group.begin.sql + set: inside-group + + groups: + - match: \( + scope: punctuation.section.group.begin.sql + push: inside-group + + inside-group: + - meta_scope: meta.group.sql + - match: \) + scope: punctuation.section.group.end.sql + pop: 1 + - include: sql + + ###[ COLUMN EXPRESSIONS ]###################################################### + + expect-column-declaration: + - include: column-declaration-list + - match: (?=\S) + set: + - maybe-column-modifier + - after-type + - expect-type + - column-name-declaration + - single-identifier + + maybe-column-declaration-list: + - include: column-declaration-list + - include: else-pop + + column-declaration-list: + - match: \( + scope: punctuation.section.group.begin.sql + set: inside-column-declaration-list + + inside-column-declaration-list: + - meta_scope: meta.group.table-columns.sql + - match: \) + scope: punctuation.section.group.end.sql + pop: 1 + - include: column-modifiers + - include: expressions + - include: expect-column-declarations + + expect-column-declarations: + - match: (?=\S) + push: + - maybe-column-modifier + - after-type + - expect-type + - column-name-declaration + - single-identifier + + maybe-column-modifier: + - include: column-modifiers + - include: else-pop + + column-modifiers: + - match: \b(?i:check)\b + scope: keyword.other.sql + - match: |- + \b(?xi: + (?: (?: fulltext | primary | unique ) \s+ )? key + | on \s+ (?: delete | update ) (?: \s+ cascade )? + | default + )\b + scope: storage.modifier.sql + - match: |- + \b(?xi: + foreign\s+key + )\b + scope: storage.modifier.sql + push: column-name-list + - match: \b(?i:unique)\b + scope: storage.modifier.sql + push: maybe-column-name-list + - match: \b(?i:references)\b + scope: storage.modifier.sql + push: + - maybe-column-name-list + - expect-table-name + + maybe-column-name-list: + - include: column-name-list + - include: else-pop + + column-name-list: + - match: \( + scope: punctuation.section.group.begin.sql + set: inside-column-name-list + + column-name-lists: + - match: \( + scope: punctuation.section.group.begin.sql + push: inside-column-name-list + + inside-column-name-list: + - meta_scope: meta.group.table-columns.sql + - match: \) + scope: punctuation.section.group.end.sql + pop: 1 + - include: expressions-or-column-names + + ###[ FUNCTION EXPRESSIONS ]#################################################### + + expect-function-parameters: + - match: \( + scope: punctuation.section.group.begin.sql + set: inside-function-parameters + - include: else-pop + + inside-function-parameters: + - clear_scopes: 1 + - meta_scope: meta.function.parameters.sql meta.group.sql + - match: \) + scope: punctuation.section.group.end.sql + pop: 1 + - include: comma-separators + - match: (?=\S) + push: + - expect-type + - expect-parameter-name + - maybe-parameter-modifier + + expect-parameter-name: + - match: "{{simple_identifier}}" + scope: variable.parameter.sql + pop: 1 + - include: else-pop + + maybe-parameter-modifier: + - match: \b{{function_parameter_modifier}}\b + scope: storage.modifier.sql + pop: 1 + - include: else-pop + + expect-function-characteristics: + - meta_scope: meta.function.sql + - match: \b(?i:as|return)\b + scope: keyword.context.block.sql + pop: 1 + - match: \b(?i:language)\b + scope: storage.modifier.sql + push: expect-function-language-name + - match: \b(?i:returns)\b + scope: keyword.other.ddl.sql + push: expect-type + - include: create-common-args + + expect-function-language-name: + - match: "{{simple_identifier}}" + scope: constant.other.language.sql + pop: 1 + - include: else-pop + + ###[ USER MANAGEMENT EXPRESSIONS ]############################################# + + grant: + - match: \b(?i:to)\b + scope: keyword.context.sql + push: expect-user-name + - include: comma-separators + - include: user-privileges + - include: pop-on-top-level-reserved-word + + user-privileges: + - include: column-name-lists + - match: \b(?i:all(?:\s+privileges)?)\b + scope: constant.language.sql + - match: \b(?i:(?:alter|create|drop|grant|revoke)\s+{{ddl_target}})\b + scope: constant.language.sql + - match: \b(?i:select|insert|update|delete|truncate|execute)\b + scope: constant.language.sql + + ###[ TABLE NAMES OR SUBQUERIES ]############################################### + + table-name-or-subquery: + - meta_include_prototype: false + - include: table-subquery + - include: table-name-or-function-call + + table-subquery: + - match: (?=\() + set: + - maybe-table-alias + - group + + table-name-or-function-call: + - match: (?=\S) + pop: 1 # pop `table-name-or-subquery` before evaluating branches + branch_point: table-name-or-function-call + branch: + - table-name-not-function-call + - table-valued-function-call + + table-name-not-function-call: + - meta_include_prototype: false + - match: "" + set: + - maybe-table-alias + - table-name-fail-if-function-call + - table-name + - single-identifier + + table-name-fail-if-function-call: + - meta_include_prototype: false + - match: (?=\() + fail: table-name-or-function-call + - match: (?=\S) + pop: 1 + + table-valued-function-call: + - meta_include_prototype: false + - match: "" + set: + - maybe-table-alias + - function-call-arguments + - table-valued-function-name + - single-identifier + + table-valued-function-name: + - meta_include_prototype: false + - meta_content_scope: meta.table-valued-function-name.sql + - include: immediately-pop + + maybe-table-alias: + - include: pop-on-top-level-reserved-word + - include: table-timespecs + - include: table-alias-expression + - include: expect-table-alias-name + + table-timespecs: + - match: \b(?i:for\s+system_time)\b + scope: keyword.other.dml.sql + push: table-timespec-args + + table-timespec-args: + - match: \b(?i:as\s+of|between|and|from|to)\b + scope: keyword.operator.logical.sql + push: + - table-timespec-expression + - table-timespec-type + - match: \b(?i:all)\b + scope: constant.other.sql + pop: 1 + - include: else-pop + + table-timespec-type: + - match: \b(?i:timestamp|transaction)\b + scope: storage.type.sql + set: else-pop + - include: else-pop + + table-timespec-expression: + - include: expressions + - include: immediately-pop + + ###[ TYPES ]################################################################### + + expect-type: + - meta_include_prototype: false + - include: comments + - include: built-in-type + - include: expect-user-type + + built-in-types: + - match: \b(?i:enum)\b + scope: storage.type.sql + push: + - after-type + - maybe-group + - match: |- + (?x) + \b(?: {{simple_types}} | {{types_with_optional_number}} ) + (?: ((\()(\d+)(?:\s*(,)\s*(\d+))?(\)) | \b(?!\s*\() ) ) + scope: storage.type.sql + captures: + 1: meta.parens.sql + 2: punctuation.definition.parens.begin.sql + 3: meta.number.integer.decimal.sql constant.numeric.value.sql + 4: punctuation.separator.sequence.sql + 5: meta.number.integer.decimal.sql constant.numeric.value.sql + 6: punctuation.definition.parens.end.sql + push: after-type + - match: \b{{type_modifiers}}\b + scope: storage.modifier.sql + + built-in-type: + - match: \b(?i:enum)\b + scope: storage.type.sql + set: + - after-type + - maybe-group + - match: |- + (?x) + \b(?: {{simple_types}} | {{types_with_optional_number}} ) + (?: ((\()(\d+)(?:\s*(,)\s*(\d+))?(\)) | \b(?!\s*\() ) ) + scope: storage.type.sql + captures: + 1: meta.parens.sql + 2: punctuation.definition.parens.begin.sql + 3: meta.number.integer.decimal.sql constant.numeric.value.sql + 4: punctuation.separator.sequence.sql + 5: meta.number.integer.decimal.sql constant.numeric.value.sql + 6: punctuation.definition.parens.end.sql + set: after-type + + expect-user-type: + - match: (?=\S) + set: [maybe-group, after-type, inside-user-type] + + inside-user-type: + # note: may contain foreign variable interpolation + - meta_scope: support.type.sql + - match: "{{simple_identifier_break}}" + pop: 1 + + after-type: + - match: \b{{type_modifiers}}\b + scope: storage.modifier.sql + pop: 1 + - include: assignment-operators + - include: else-pop + + ###[ IDENTIFIERS ]############################################################# + + expect-table-alias-name: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - include: comments + - match: (?=\S) + set: [table-alias-name, single-identifier] + + expect-column-alias-name: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - include: comments + - match: (?=\S) + set: [column-alias-name, single-identifier] + + table-alias-name: + - meta_include_prototype: false + - meta_content_scope: meta.alias.table.sql + - include: immediately-pop + + column-alias-name: + - meta_include_prototype: false + - meta_content_scope: meta.alias.column.sql + - include: immediately-pop + + expect-column-names: + - match: (?=\S) + push: [maybe-operator, column-name, single-identifier] + + expect-column-name: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - include: comments + - match: (?=\S) + set: [column-name, single-identifier] + + column-name: + - meta_include_prototype: false + - meta_content_scope: meta.column-name.sql + - include: immediately-pop + + expect-column-name-declaration: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - include: comments + - match: (?=\S) + set: [column-name-declaration, single-identifier] + + column-name-declaration: + - meta_include_prototype: false + - meta_content_scope: meta.column-name.sql variable.other.member.declaration.sql + - include: immediately-pop + + expect-constraint-name: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - match: (?=(?i:check|foreign|primary|unique|index|key|using|with)\b) + pop: 1 + - include: comments + - match: (?=\S) + set: [constraint-name, single-identifier] + + constraint-name: + - meta_include_prototype: false + - meta_content_scope: meta.constraint-name.sql + - include: immediately-pop + + expect-database-creation-name: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - include: comments + - match: (?=\S) + set: [database-creation-name, single-identifier] + + database-creation-name: + - meta_include_prototype: false + - meta_content_scope: entity.name.struct.database.sql + - include: immediately-pop + + expect-database-name: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - include: comments + - match: (?=\S) + set: [database-name, single-identifier] + + database-name: + - meta_include_prototype: false + - meta_content_scope: meta.database-name.sql + - include: immediately-pop + + expect-event-creation-name: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - include: comments + - match: (?=\S) + set: [event-creation-name, single-identifier] + + event-creation-name: + - meta_include_prototype: false + - meta_scope: entity.name.event.sql + - include: immediately-pop + + expect-event-name: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - include: comments + - match: (?=\S) + set: [event-name, single-identifier] + + event-name: + - meta_include_prototype: false + - meta_scope: meta.event-name.sql + - include: immediately-pop + + expect-index-creation-name: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - include: comments + - match: (?=\S) + set: [index-creation-name, single-identifier] + + index-creation-name: + - meta_include_prototype: false + - meta_scope: entity.name.struct.index.sql + - include: immediately-pop + + expect-index-names: + - match: (?=\S) + push: [index-name, single-identifier] + + expect-index-name: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - include: comments + - match: (?=\S) + set: [index-name, single-identifier] + + index-name: + - meta_include_prototype: false + - meta_scope: meta.index-name.sql + - include: immediately-pop + + expect-function-creation-name: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - include: comments + - match: (?=\S) + set: [procedure-creation-name, single-identifier] + + expect-partition-creation-name: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - include: comments + - match: (?=\S) + set: [partition-creation-name, single-identifier] + + partition-creation-name: + - meta_include_prototype: false + - meta_scope: entity.name.struct.partition.sql + - include: immediately-pop + + expect-partition-names: + - match: (?=\S) + push: [partition-name, single-identifier] + + expect-partition-name: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - include: comments + - match: (?=\S) + set: [partition-name, single-identifier] + + partition-name: + - meta_include_prototype: false + - meta_scope: meta.partition-name.sql + - include: immediately-pop + + procedure-creation-name: + - meta_include_prototype: false + - meta_content_scope: entity.name.function.sql + - include: immediately-pop + + expect-function-name: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - include: comments + - match: (?=\S) + set: [procedure-name, single-identifier] + + procedure-name: + - meta_include_prototype: false + - meta_content_scope: meta.procedure-name.sql + - include: immediately-pop + + expect-table-creation-name: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - include: comments + - match: (?=\S) + set: [table-creation-name, single-identifier] + + table-creation-name: + - meta_include_prototype: false + - meta_scope: entity.name.struct.table.sql + - include: immediately-pop + + expect-table-names: + - match: (?=\S) + push: [table-name, single-identifier] + + expect-table-name: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - include: comments + - match: (?=\S) + set: [table-name, single-identifier] + + table-name: + - meta_include_prototype: false + - meta_content_scope: meta.table-name.sql + - include: immediately-pop + + expect-user-name: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - include: comments + - include: built-in-user-function-call + - match: (?=\S) + set: [user-name, single-identifier] + + user-name: + - meta_include_prototype: false + - meta_content_scope: meta.username.sql + - include: immediately-pop + + expect-user-name-declaration: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - include: comments + - match: (?=\S) + set: [user-name-declaration, single-identifier] + + user-name-declaration: + - meta_include_prototype: false + - meta_content_scope: entity.name.user.sql + - include: immediately-pop + + expect-type-creation-name: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - include: comments + - match: (?=\S) + set: [type-creation-name, single-identifier] + + type-creation-name: + - meta_include_prototype: false + - meta_scope: entity.name.type.cql + - include: immediately-pop + + expect-other-creation-name: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - include: comments + - match: (?=\S) + set: [other-creation-name, single-identifier] + + other-creation-name: + - meta_include_prototype: false + - meta_scope: entity.name.struct.other.sql + - include: immediately-pop + + expect-other-name: + # prevent prototypes from inheriting syntaxes + - meta_include_prototype: false + - include: comments + - match: (?=\S) + set: [other-name, single-identifier] + + other-name: + - meta_include_prototype: false + - meta_scope: meta.other-name.sql + - include: immediately-pop + + single-identifier: + - meta_include_prototype: false + - include: pop-on-top-level-reserved-word + - match: "" + set: + - maybe-identifier-accessor + - identifier-part + + maybe-identifier-accessor: + - meta_include_prototype: false + - match: \s*(\.)\s*(\*) + captures: + 1: punctuation.accessor.dot.sql + 2: constant.other.wildcard.asterisk.sql + pop: 1 + - match: \s*(\.) + captures: + 1: punctuation.accessor.dot.sql + set: single-identifier + - include: immediately-pop + + identifier-part: + - meta_include_prototype: false + - include: backtick-quoted-identifier-part + - include: double-quoted-identifier-part + - include: single-quoted-identifier-part + - include: simple-identifier-part + + backtick-quoted-identifier-part: + - match: \` + scope: punctuation.definition.identifier.begin.sql + set: inside-backtick-quoted-identifier-part + + inside-backtick-quoted-identifier-part: + # note: may contain foreign variable interpolation + - match: \` + scope: punctuation.definition.identifier.end.sql + pop: 1 + + double-quoted-identifier-part: + - match: \" + scope: punctuation.definition.identifier.begin.sql + set: inside-double-quoted-identifier-part + + inside-double-quoted-identifier-part: + # note: may contain foreign variable interpolation + - match: \" + scope: punctuation.definition.identifier.end.sql + pop: 1 + + single-quoted-identifier-part: + - match: \' + scope: punctuation.definition.identifier.begin.sql + set: inside-single-quoted-identifier-part + + inside-single-quoted-identifier-part: + # note: may contain foreign variable interpolation + - match: \' + scope: punctuation.definition.identifier.end.sql + pop: 1 + + simple-identifier-part: + - match: (?=\S) + set: inside-simple-identifier-part + + inside-simple-identifier-part: + # note: may contain foreign variable interpolation + - match: "{{simple_identifier_break}}" + pop: 1 + + wildcard-identifiers: + - match: \* + scope: constant.other.wildcard.asterisk.sql + + ###[ LITERALS ]################################################################ + + literals-and-variables: + - include: built-in-types + - include: constants + - include: numbers + - include: strings + + constants: + - match: \b(?i:null)\b + scope: constant.language.null.sql + + booleans: + - match: \b(?i:true)\b + scope: constant.language.boolean.true.sql + - match: \b(?i:false)\b + scope: constant.language.boolean.false.sql + + numbers: + - match: \b\d+(\.)\d+\b + scope: meta.number.float.decimal.sql constant.numeric.value.sql + captures: + 1: punctuation.separator.decimal.sql + - match: \b\d+\b + scope: meta.number.integer.decimal.sql constant.numeric.value.sql + + strings: + - match: \' + scope: punctuation.definition.string.begin.sql + push: inside-single-quoted-string + + inside-single-quoted-string: + - meta_include_prototype: false + - meta_scope: meta.string.sql string.quoted.single.sql + - match: \'\' + scope: constant.character.escape.sql + - match: \' + scope: punctuation.definition.string.end.sql + pop: 1 + - include: string-escapes + + string-escapes: + - match: "{{string_escape}}" + scope: constant.character.escape.sql + + ###[ LIKE EXPRESSIONS ]######################################################## + + like-expressions: + - match: \b(?i:like)\b + scope: keyword.operator.logical.sql + branch_point: like-expressions + branch: + - like-string-not-followed-by-escape + - like-string-followed-by-escape-slash + - like-string-followed-by-escape-caret + - like-string-followed-by-escape-hash + - like-string-followed-by-unknown-escape + + like-string-not-followed-by-escape: + - meta_include_prototype: false + - match: \' + scope: punctuation.definition.string.begin.sql + set: + - like-escape-fail + - inside-like-single-quoted-string + - include: else-pop + + like-string-followed-by-escape-slash: + - meta_include_prototype: false + - match: \' + scope: punctuation.definition.string.begin.sql + set: + - like-escape-character-slash + - like-escape + - inside-like-single-quoted-string-slash-escape + - include: else-pop + + like-string-followed-by-escape-caret: + - meta_include_prototype: false + - match: \' + scope: punctuation.definition.string.begin.sql + set: + - like-escape-character-caret + - like-escape + - inside-like-single-quoted-string-caret-escape + - include: else-pop + + like-string-followed-by-escape-hash: + - meta_include_prototype: false + - match: \' + scope: punctuation.definition.string.begin.sql + set: + - like-escape-character-hash + - like-escape + - inside-like-single-quoted-string-hash-escape + - include: else-pop + + like-string-followed-by-unknown-escape: + - meta_include_prototype: false + - match: \' + scope: punctuation.definition.string.begin.sql + set: + - like-escape-character-any + - like-escape + - inside-like-single-quoted-string + - include: else-pop + + inside-like-single-quoted-string-slash-escape: + - meta_include_prototype: false + - meta_scope: meta.string.like.sql string.quoted.single.sql + - match: \\. + scope: constant.character.escape.sql + - include: inside-like-single-quoted-string + + inside-like-single-quoted-string-caret-escape: + - meta_include_prototype: false + - meta_scope: meta.string.like.sql string.quoted.single.sql + - match: \^. + scope: constant.character.escape.sql + - include: inside-like-single-quoted-string + + inside-like-single-quoted-string-hash-escape: + - meta_include_prototype: false + - meta_scope: meta.string.like.sql string.quoted.single.sql + - match: "#." + scope: constant.character.escape.sql + - include: inside-like-single-quoted-string + + inside-like-single-quoted-string: + - meta_include_prototype: false + - meta_scope: meta.string.like.sql string.quoted.single.sql + - match: \' + scope: punctuation.definition.string.end.sql + pop: 1 + - match: "%" + scope: constant.other.wildcard.percent.sql + - match: "_" + scope: constant.other.wildcard.underscore.sql + + like-else-fail: + - match: (?=\S) + fail: like-expressions + + like-escape-fail: + - match: \b(?i:escape)\b + fail: like-expressions + - include: else-pop + + like-escape: + - match: \b(?i:escape)\b + scope: keyword.operator.word.sql + pop: 1 + - include: else-pop + + like-escape-character-any: + - meta_include_prototype: false + - match: (\')([^'])(\') + scope: meta.string.escape.sql string.quoted.single.sql + captures: + 1: punctuation.definition.string.begin.sql + 2: constant.character.escape.sql + 3: punctuation.definition.string.end.sql + pop: 1 + - include: else-pop + + like-escape-character-caret: + - meta_include_prototype: false + - match: (\')(\^)(\') + scope: meta.string.escape.sql string.quoted.single.sql + captures: + 1: punctuation.definition.string.begin.sql + 2: constant.character.escape.sql + 3: punctuation.definition.string.end.sql + pop: 1 + - include: like-else-fail + + like-escape-character-slash: + - meta_include_prototype: false + - match: (\')(\\)(\') + scope: meta.string.escape.sql string.quoted.single.sql + captures: + 1: punctuation.definition.string.begin.sql + 2: constant.character.escape.sql + 3: punctuation.definition.string.end.sql + pop: 1 + - include: like-else-fail + + like-escape-character-hash: + - meta_include_prototype: false + - match: (\')(#)(\') + scope: meta.string.escape.sql string.quoted.single.sql + captures: + 1: punctuation.definition.string.begin.sql + 2: constant.character.escape.sql + 3: punctuation.definition.string.end.sql + pop: 1 + - include: like-else-fail + + ###[ OPERATORS ]############################################################### + + maybe-condition: + - meta_include_prototype: false + - include: conditions + - include: else-pop + + conditions: + - match: \b(?i:if)\b + scope: keyword.control.conditional.if.sql + - include: logical-operators + + maybe-operator: + - meta_include_prototype: false + - match: "<=>|[!<>]?=|<>|<|>" + scope: keyword.operator.comparison.sql + pop: 1 + - match: "[-+/*]" + scope: keyword.operator.arithmetic.sql + pop: 1 + - match: \b(?i:and|or|having|exists|between|in|not|is)\b + scope: keyword.operator.logical.sql + pop: 1 + - include: assignment-operators + - include: else-pop + + operators: + - match: "<=>|[!<>]?=|<>|<|>" + scope: keyword.operator.comparison.sql + - match: "[-+/*]" + scope: keyword.operator.arithmetic.sql + - include: logical-operators + + assignment-operators: + - match: "=" + scope: keyword.operator.assignment.sql + + logical-operators: + - match: \b(?i:and|or|having|exists|between|in|not|is)\b + scope: keyword.operator.logical.sql + + comma-separators: + - match: "," + scope: punctuation.separator.sequence.sql + + statement-terminators: + - match: ";" + scope: punctuation.terminator.statement.sql + + ###[ ILLEGALS ]################################################################ + + illegal-stray-brackets: + - match: \] + scope: invalid.illegal.stray.sql + + illegal-stray-parens: + - match: \) + scope: invalid.illegal.stray.sql + + ###[ PROTOTYPES ]############################################################## + + else-pop: + - match: (?=\S) + pop: 1 + + immediately-pop: + - match: "" + pop: 1 + + pop-on-top-level-reserved-word: + - match: (?=[;)}]|\b(?:{{toplevel_reserved}}|{{additional_toplevel_reserved}})\b) + pop: 1 diff --git a/cli/app.rs b/cli/app.rs index 2c1239d61..1a063bbfb 100644 --- a/cli/app.rs +++ b/cli/app.rs @@ -4,7 +4,7 @@ use crate::{ input::{get_io, get_writer, DbLocation, OutputMode, Settings, HELP_MSG}, opcodes_dictionary::OPCODE_DESCRIPTIONS, }; -use comfy_table::{Attribute, Cell, CellAlignment, ContentArrangement, Row, Table}; +use comfy_table::{Attribute, Cell, CellAlignment, Color, ContentArrangement, Row, Table}; use limbo_core::{Database, LimboError, OwnedValue, Statement, StepResult}; use clap::{Parser, ValueEnum}; @@ -200,6 +200,8 @@ macro_rules! query_internal { }}; } +static COLORS: &[Color] = &[Color::DarkRed, Color::DarkGreen, Color::DarkBlue]; + impl<'a> Limbo<'a> { pub fn new(rl: &'a mut rustyline::Editor) -> anyhow::Result { let opts = Opts::parse(); @@ -249,6 +251,7 @@ impl<'a> Limbo<'a> { opts: Settings::from(&opts), rl, }; + if opts.sql.is_some() { app.handle_first_input(opts.sql.as_ref().unwrap()); } @@ -752,7 +755,9 @@ impl<'a> Limbo<'a> { let header = (0..rows.num_columns()) .map(|i| { let name = rows.get_column_name(i); - Cell::new(name).add_attribute(Attribute::Bold) + Cell::new(name) + .add_attribute(Attribute::Bold) + .fg(Color::AnsiValue(49)) // Green color for headers }) .collect::>(); table.set_header(header); @@ -763,7 +768,7 @@ impl<'a> Limbo<'a> { let record = rows.row().unwrap(); let mut row = Row::new(); row.max_height(1); - for value in record.get_values() { + for (idx, value) in record.get_values().iter().enumerate() { let (content, alignment) = match value { OwnedValue::Null => { (self.opts.null_value.clone(), CellAlignment::Left) @@ -781,7 +786,11 @@ impl<'a> Limbo<'a> { ), _ => unreachable!(), }; - row.add_cell(Cell::new(content).set_alignment(alignment)); + row.add_cell( + Cell::new(content) + .set_alignment(alignment) + .fg(COLORS[idx % COLORS.len()]), + ); } table.add_row(row); } diff --git a/cli/build.rs b/cli/build.rs new file mode 100644 index 000000000..a47762294 --- /dev/null +++ b/cli/build.rs @@ -0,0 +1,26 @@ +//! Build.rs script to generate a binary syntax set for syntect +//! based on the SQL.sublime-syntax file. + +use std::env; +use std::path::Path; + +use syntect::dumps::dump_to_uncompressed_file; +use syntect::parsing::SyntaxDefinition; +use syntect::parsing::SyntaxSet; + +fn main() { + println!("cargo::rerun-if-changed=SQL.sublime-syntax"); + println!("cargo::rerun-if-changed=build.rs"); + + let out_dir = env::var_os("OUT_DIR").unwrap(); + let syntax = + SyntaxDefinition::load_from_str(include_str!("./SQL.sublime-syntax"), false, None).unwrap(); + let mut ps = SyntaxSet::new().into_builder(); + ps.add(syntax); + let ps = ps.build(); + dump_to_uncompressed_file( + &ps, + Path::new(&out_dir).join("SQL_syntax_set_dump.packdump"), + ) + .unwrap(); +} diff --git a/cli/helper.rs b/cli/helper.rs index 3d809741f..37cd462b8 100644 --- a/cli/helper.rs +++ b/cli/helper.rs @@ -2,9 +2,16 @@ use std::rc::Rc; use std::sync::Arc; use limbo_core::{Connection, StepResult}; +use nu_ansi_term::{Color, Style}; use rustyline::completion::{extract_word, Completer, Pair}; use rustyline::highlight::Highlighter; +use rustyline::hint::HistoryHinter; use rustyline::{Completer, Helper, Hinter, Validator}; +use syntect::dumps::from_uncompressed_data; +use syntect::easy::HighlightLines; +use syntect::highlighting::ThemeSet; +use syntect::parsing::{Scope, SyntaxSet}; +use syntect::util::{as_24_bit_terminal_escaped, LinesWithEndings}; macro_rules! try_result { ($expr:expr, $err:expr) => { @@ -19,17 +26,92 @@ macro_rules! try_result { pub struct LimboHelper { #[rustyline(Completer)] completer: SqlCompleter, + syntax_set: SyntaxSet, + theme_set: ThemeSet, + #[rustyline(Hinter)] + hinter: HistoryHinter, } impl LimboHelper { pub fn new(conn: Rc, io: Arc) -> Self { + // Load only predefined syntax + let ps = from_uncompressed_data(include_bytes!(concat!( + env!("OUT_DIR"), + "/SQL_syntax_set_dump.packdump" + ))) + .unwrap(); + let ts = ThemeSet::load_defaults(); LimboHelper { completer: SqlCompleter::new(conn, io), + syntax_set: ps, + theme_set: ts, + hinter: HistoryHinter::new(), } } } -impl Highlighter for LimboHelper {} +impl Highlighter for LimboHelper { + fn highlight<'l>(&self, line: &'l str, pos: usize) -> std::borrow::Cow<'l, str> { + let _ = pos; + // TODO use lifetimes to store highlight lines + let syntax = self + .syntax_set + .find_syntax_by_scope(Scope::new("source.sql").unwrap()) + .unwrap(); + let mut h = HighlightLines::new(syntax, &self.theme_set.themes["base16-ocean.dark"]); + let ranges = { + let mut ret_ranges = Vec::new(); + for new_line in LinesWithEndings::from(line) { + let ranges: Vec<(syntect::highlighting::Style, &str)> = + h.highlight_line(new_line, &self.syntax_set).unwrap(); + ret_ranges.extend(ranges); + } + ret_ranges + }; + let mut ret_line = as_24_bit_terminal_escaped(&ranges[..], false); + // Push this escape sequence to reset color modes at the end of the string + ret_line.push_str("\x1b[0m"); + std::borrow::Cow::Owned(ret_line) + } + + fn highlight_prompt<'b, 's: 'b, 'p: 'b>( + &'s self, + prompt: &'p str, + default: bool, + ) -> std::borrow::Cow<'b, str> { + let _ = default; + // Make prompt bold + let style = Style::new().bold().fg(Color::Green); + let styled_str = style.paint(prompt); + std::borrow::Cow::Owned(styled_str.to_string()) + } + + fn highlight_hint<'h>(&self, hint: &'h str) -> std::borrow::Cow<'h, str> { + let style = Style::new() + .bold() + .dimmed() + .underline() + .fg(Color::Fixed(246)); + let styled_str = style.paint(hint); + std::borrow::Cow::Owned(styled_str.to_string()) // Bold dim grey underline + } + + fn highlight_candidate<'c>( + &self, + candidate: &'c str, + completion: rustyline::CompletionType, + ) -> std::borrow::Cow<'c, str> { + let _ = completion; + let style = Style::new().fg(Color::Fixed(69)); + let styled_str = style.paint(candidate); + std::borrow::Cow::Owned(styled_str.to_string()) + } + + fn highlight_char(&self, line: &str, pos: usize, kind: rustyline::highlight::CmdKind) -> bool { + let _ = (line, pos); + !matches!(kind, rustyline::highlight::CmdKind::MoveCursor) + } +} pub struct SqlCompleter { conn: Rc, diff --git a/simulator/Cargo.toml b/simulator/Cargo.toml index fd61c5dbd..a99f5536d 100644 --- a/simulator/Cargo.toml +++ b/simulator/Cargo.toml @@ -23,7 +23,7 @@ tempfile = "3.0.7" env_logger = "0.10.1" regex = "1.11.1" regex-syntax = { version = "0.8.5", default-features = false, features = ["unicode"] } -anarchist-readable-name-generator-lib = "0.1.2" +anarchist-readable-name-generator-lib = "=0.1.2" clap = { version = "4.5", features = ["derive"] } serde = { version = "1.0", features = ["derive"] } serde_json = { version = "1.0" }