diff --git a/Cargo.lock b/Cargo.lock index 1570ae6..5e154f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" dependencies = [ "gimli", ] @@ -19,24 +19,24 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "anyhow" -version = "1.0.80" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "async-trait" -version = "0.1.77" +version = "0.1.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", @@ -45,9 +45,9 @@ dependencies = [ [[package]] name = "auto_impl" -version = "1.1.2" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "823b8bb275161044e2ac7a25879cb3e2480cb403e3943022c7c769c599b756aa" +checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", @@ -56,15 +56,15 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "17c6a35df3749d2e8bb1b7b21a976d82b15548788d2735b9d82f329268f71a11" dependencies = [ "addr2line", "cc", @@ -81,17 +81,23 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" + [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cc" -version = "1.0.86" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9fa1897e4325be0d68d48df6aa1a71ac2ed4d27723887e7754192705350730" +checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" [[package]] name = "cfg-if" @@ -213,21 +219,21 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "hermit-abi" -version = "0.3.6" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "httparse" @@ -247,9 +253,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "lazy_static" @@ -259,15 +265,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -279,7 +285,7 @@ version = "0.94.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c66bfd44a06ae10647fe3f8214762e9369fd4248df1350924b4ef9e770a85ea1" dependencies = [ - "bitflags", + "bitflags 1.3.2", "serde", "serde_json", "serde_repr", @@ -288,28 +294,28 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "wasi", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -324,9 +330,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.2" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "b8ec7ab813848ba4522158d5517a6093db1ded27575b070f4177b8d12b41db5e" dependencies = [ "memchr", ] @@ -339,9 +345,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -349,15 +355,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.52.5", ] [[package]] @@ -368,18 +374,18 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", @@ -388,9 +394,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -400,36 +406,36 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] [[package]] name = "redox_syscall" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" dependencies = [ - "bitflags", + "bitflags 2.5.0", ] [[package]] name = "regex" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", @@ -439,9 +445,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", @@ -450,21 +456,21 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "ryu" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "scopeguard" @@ -474,18 +480,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", @@ -494,9 +500,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa", "ryu", @@ -505,9 +511,9 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" +checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", @@ -516,9 +522,9 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ "libc", ] @@ -534,25 +540,25 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "syn" -version = "2.0.50" +version = "2.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" dependencies = [ "proc-macro2", "quote", @@ -561,18 +567,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.57" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.57" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", @@ -596,9 +602,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.36.0" +version = "1.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" dependencies = [ "backtrace", "bytes", @@ -610,14 +616,14 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", @@ -626,16 +632,15 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.10" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", - "tracing", ] [[package]] @@ -731,9 +736,9 @@ dependencies = [ [[package]] name = "tree-sitter" -version = "0.21.0" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "705bf7c0958d0171dd7d3a6542f2f4f21d87ed5f1dc8db52919d3a6bed9a359a" +checksum = "df7cc499ceadd4dcdf7ec6d4cbc34ece92c3fa07821e287aedecd4416c516dca" dependencies = [ "cc", "regex", @@ -749,9 +754,9 @@ dependencies = [ [[package]] name = "tree-sitter-highlight" -version = "0.21.0" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f8c0df4e17827db04b150377bc992fc59a4017e4177626640e91053c53b6aa0" +checksum = "eaca0fe34fa96eec6aaa8e63308dbe1bafe65a6317487c287f93938959b21907" dependencies = [ "lazy_static", "regex", @@ -804,7 +809,16 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[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]] @@ -813,13 +827,29 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 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.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[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]] @@ -828,38 +858,86 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[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.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[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.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[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.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[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.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[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.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[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.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" diff --git a/egglog-language-server/Cargo.toml b/egglog-language-server/Cargo.toml index 72999c3..05d66c7 100644 --- a/egglog-language-server/Cargo.toml +++ b/egglog-language-server/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" tokio = { version = "1.32.0", features = ["full"] } tower-lsp = "0.20.0" tree-sitter-egglog = { path = "../tree-sitter-egglog" } -tree-sitter = "0.21.0" -tree-sitter-highlight = "0.21.0" +tree-sitter = "0.22.6" +tree-sitter-highlight = "0.22.6" dashmap = "5.5.1" anyhow = "1.0.75" diff --git a/tree-sitter-egglog/.editorconfig b/tree-sitter-egglog/.editorconfig new file mode 100644 index 0000000..d3a8b5b --- /dev/null +++ b/tree-sitter-egglog/.editorconfig @@ -0,0 +1,39 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{json,toml,yml,gyp}] +indent_style = space +indent_size = 2 + +[*.js] +indent_style = space +indent_size = 2 + +[*.rs] +indent_style = space +indent_size = 4 + +[*.{c,cc,h}] +indent_style = space +indent_size = 4 + +[*.{py,pyi}] +indent_style = space +indent_size = 4 + +[*.swift] +indent_style = space +indent_size = 4 + +[*.go] +indent_style = tab +indent_size = 8 + +[Makefile] +indent_style = tab +indent_size = 8 diff --git a/tree-sitter-egglog/.gitattributes b/tree-sitter-egglog/.gitattributes new file mode 100644 index 0000000..ffb52ab --- /dev/null +++ b/tree-sitter-egglog/.gitattributes @@ -0,0 +1,11 @@ +* text eol=lf + +src/*.json linguist-generated +src/parser.c linguist-generated +src/tree_sitter/* linguist-generated + +bindings/** linguist-generated +binding.gyp linguist-generated +setup.py linguist-generated +Makefile linguist-generated +Package.swift linguist-generated diff --git a/tree-sitter-egglog/Cargo.toml b/tree-sitter-egglog/Cargo.toml index 4b7f749..65517a4 100644 --- a/tree-sitter-egglog/Cargo.toml +++ b/tree-sitter-egglog/Cargo.toml @@ -9,18 +9,13 @@ edition = "2018" license = "MIT" build = "bindings/rust/build.rs" -include = [ - "bindings/rust/*", - "grammar.js", - "queries/*", - "src/*", -] +include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*"] [lib] path = "bindings/rust/lib.rs" [dependencies] -tree-sitter = "~0.21.0" +tree-sitter = "~0.22.6" [build-dependencies] cc = "1.0" diff --git a/tree-sitter-egglog/Makefile b/tree-sitter-egglog/Makefile new file mode 100644 index 0000000..ca657c4 --- /dev/null +++ b/tree-sitter-egglog/Makefile @@ -0,0 +1,112 @@ +VERSION := 0.0.1 + +LANGUAGE_NAME := tree-sitter-egglog + +# repository +SRC_DIR := src + +PARSER_REPO_URL := $(shell git -C $(SRC_DIR) remote get-url origin 2>/dev/null) + +ifeq ($(PARSER_URL),) + PARSER_URL := $(subst .git,,$(PARSER_REPO_URL)) +ifeq ($(shell echo $(PARSER_URL) | grep '^[a-z][-+.0-9a-z]*://'),) + PARSER_URL := $(subst :,/,$(PARSER_URL)) + PARSER_URL := $(subst git@,https://,$(PARSER_URL)) +endif +endif + +TS ?= tree-sitter + +# ABI versioning +SONAME_MAJOR := $(word 1,$(subst ., ,$(VERSION))) +SONAME_MINOR := $(word 2,$(subst ., ,$(VERSION))) + +# install directory layout +PREFIX ?= /usr/local +INCLUDEDIR ?= $(PREFIX)/include +LIBDIR ?= $(PREFIX)/lib +PCLIBDIR ?= $(LIBDIR)/pkgconfig + +# source/object files +PARSER := $(SRC_DIR)/parser.c +EXTRAS := $(filter-out $(PARSER),$(wildcard $(SRC_DIR)/*.c)) +OBJS := $(patsubst %.c,%.o,$(PARSER) $(EXTRAS)) + +# flags +ARFLAGS ?= rcs +override CFLAGS += -I$(SRC_DIR) -std=c11 -fPIC + +# OS-specific bits +ifeq ($(OS),Windows_NT) + $(error "Windows is not supported") +else ifeq ($(shell uname),Darwin) + SOEXT = dylib + SOEXTVER_MAJOR = $(SONAME_MAJOR).dylib + SOEXTVER = $(SONAME_MAJOR).$(SONAME_MINOR).dylib + LINKSHARED := $(LINKSHARED)-dynamiclib -Wl, + ifneq ($(ADDITIONAL_LIBS),) + LINKSHARED := $(LINKSHARED)$(ADDITIONAL_LIBS), + endif + LINKSHARED := $(LINKSHARED)-install_name,$(LIBDIR)/lib$(LANGUAGE_NAME).$(SONAME_MAJOR).dylib,-rpath,@executable_path/../Frameworks +else + SOEXT = so + SOEXTVER_MAJOR = so.$(SONAME_MAJOR) + SOEXTVER = so.$(SONAME_MAJOR).$(SONAME_MINOR) + LINKSHARED := $(LINKSHARED)-shared -Wl, + ifneq ($(ADDITIONAL_LIBS),) + LINKSHARED := $(LINKSHARED)$(ADDITIONAL_LIBS) + endif + LINKSHARED := $(LINKSHARED)-soname,lib$(LANGUAGE_NAME).so.$(SONAME_MAJOR) +endif +ifneq ($(filter $(shell uname),FreeBSD NetBSD DragonFly),) + PCLIBDIR := $(PREFIX)/libdata/pkgconfig +endif + +all: lib$(LANGUAGE_NAME).a lib$(LANGUAGE_NAME).$(SOEXT) $(LANGUAGE_NAME).pc + +lib$(LANGUAGE_NAME).a: $(OBJS) + $(AR) $(ARFLAGS) $@ $^ + +lib$(LANGUAGE_NAME).$(SOEXT): $(OBJS) + $(CC) $(LDFLAGS) $(LINKSHARED) $^ $(LDLIBS) -o $@ +ifneq ($(STRIP),) + $(STRIP) $@ +endif + +$(LANGUAGE_NAME).pc: bindings/c/$(LANGUAGE_NAME).pc.in + sed -e 's|@URL@|$(PARSER_URL)|' \ + -e 's|@VERSION@|$(VERSION)|' \ + -e 's|@LIBDIR@|$(LIBDIR)|' \ + -e 's|@INCLUDEDIR@|$(INCLUDEDIR)|' \ + -e 's|@REQUIRES@|$(REQUIRES)|' \ + -e 's|@ADDITIONAL_LIBS@|$(ADDITIONAL_LIBS)|' \ + -e 's|=$(PREFIX)|=$${prefix}|' \ + -e 's|@PREFIX@|$(PREFIX)|' $< > $@ + +$(PARSER): $(SRC_DIR)/grammar.json + $(TS) generate --no-bindings $^ + +install: all + install -d '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter '$(DESTDIR)$(PCLIBDIR)' '$(DESTDIR)$(LIBDIR)' + install -m644 bindings/c/$(LANGUAGE_NAME).h '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/$(LANGUAGE_NAME).h + install -m644 $(LANGUAGE_NAME).pc '$(DESTDIR)$(PCLIBDIR)'/$(LANGUAGE_NAME).pc + install -m644 lib$(LANGUAGE_NAME).a '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).a + install -m755 lib$(LANGUAGE_NAME).$(SOEXT) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER) + ln -sf lib$(LANGUAGE_NAME).$(SOEXTVER) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) + ln -sf lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXT) + +uninstall: + $(RM) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).a \ + '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER) \ + '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) \ + '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXT) \ + '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/$(LANGUAGE_NAME).h \ + '$(DESTDIR)$(PCLIBDIR)'/$(LANGUAGE_NAME).pc + +clean: + $(RM) $(OBJS) $(LANGUAGE_NAME).pc lib$(LANGUAGE_NAME).a lib$(LANGUAGE_NAME).$(SOEXT) + +test: + $(TS) test + +.PHONY: all install uninstall clean test diff --git a/tree-sitter-egglog/Package.swift b/tree-sitter-egglog/Package.swift new file mode 100644 index 0000000..cead665 --- /dev/null +++ b/tree-sitter-egglog/Package.swift @@ -0,0 +1,47 @@ +// swift-tools-version:5.3 +import PackageDescription + +let package = Package( + name: "TreeSitterEgglog", + products: [ + .library(name: "TreeSitterEgglog", targets: ["TreeSitterEgglog"]), + ], + dependencies: [], + targets: [ + .target(name: "TreeSitterEgglog", + path: ".", + exclude: [ + "Cargo.toml", + "Makefile", + "binding.gyp", + "bindings/c", + "bindings/go", + "bindings/node", + "bindings/python", + "bindings/rust", + "prebuilds", + "grammar.js", + "package.json", + "package-lock.json", + "pyproject.toml", + "setup.py", + "test", + "examples", + ".editorconfig", + ".github", + ".gitignore", + ".gitattributes", + ".gitmodules", + ], + sources: [ + "src/parser.c", + // NOTE: if your language has an external scanner, add it here. + ], + resources: [ + .copy("queries") + ], + publicHeadersPath: "bindings/swift", + cSettings: [.headerSearchPath("src")]) + ], + cLanguageStandard: .c11 +) diff --git a/tree-sitter-egglog/binding.gyp b/tree-sitter-egglog/binding.gyp index 3677d98..e8f3649 100644 --- a/tree-sitter-egglog/binding.gyp +++ b/tree-sitter-egglog/binding.gyp @@ -2,18 +2,29 @@ "targets": [ { "target_name": "tree_sitter_egglog_binding", + "dependencies": [ + " -#include "nan.h" +#include -using namespace v8; +typedef struct TSLanguage TSLanguage; -extern "C" TSLanguage * tree_sitter_egglog(); +extern "C" TSLanguage *tree_sitter_egglog(); -namespace { +// "tree-sitter", "language" hashed with BLAKE2 +const napi_type_tag LANGUAGE_TYPE_TAG = { + 0x8AF2E5212AD58ABF, 0xD5006CAD83ABBA16 +}; -NAN_METHOD(New) {} - -void Init(Local exports, Local module) { - Local tpl = Nan::New(New); - tpl->SetClassName(Nan::New("Language").ToLocalChecked()); - tpl->InstanceTemplate()->SetInternalFieldCount(1); - - Local constructor = Nan::GetFunction(tpl).ToLocalChecked(); - Local instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked(); - Nan::SetInternalFieldPointer(instance, 0, tree_sitter_egglog()); - - Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("egglog").ToLocalChecked()); - Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance); +Napi::Object Init(Napi::Env env, Napi::Object exports) { + exports["name"] = Napi::String::New(env, "egglog"); + auto language = Napi::External::New(env, tree_sitter_egglog()); + language.TypeTag(&LANGUAGE_TYPE_TAG); + exports["language"] = language; + return exports; } -NODE_MODULE(tree_sitter_egglog_binding, Init) - -} // namespace +NODE_API_MODULE(tree_sitter_egglog_binding, Init) diff --git a/tree-sitter-egglog/bindings/node/index.d.ts b/tree-sitter-egglog/bindings/node/index.d.ts new file mode 100644 index 0000000..efe259e --- /dev/null +++ b/tree-sitter-egglog/bindings/node/index.d.ts @@ -0,0 +1,28 @@ +type BaseNode = { + type: string; + named: boolean; +}; + +type ChildNode = { + multiple: boolean; + required: boolean; + types: BaseNode[]; +}; + +type NodeInfo = + | (BaseNode & { + subtypes: BaseNode[]; + }) + | (BaseNode & { + fields: { [name: string]: ChildNode }; + children: ChildNode[]; + }); + +type Language = { + name: string; + language: unknown; + nodeTypeInfo: NodeInfo[]; +}; + +declare const language: Language; +export = language; diff --git a/tree-sitter-egglog/bindings/node/index.js b/tree-sitter-egglog/bindings/node/index.js index 5e2598a..6657bcf 100644 --- a/tree-sitter-egglog/bindings/node/index.js +++ b/tree-sitter-egglog/bindings/node/index.js @@ -1,18 +1,6 @@ -try { - module.exports = require("../../build/Release/tree_sitter_egglog_binding"); -} catch (error1) { - if (error1.code !== 'MODULE_NOT_FOUND') { - throw error1; - } - try { - module.exports = require("../../build/Debug/tree_sitter_egglog_binding"); - } catch (error2) { - if (error2.code !== 'MODULE_NOT_FOUND') { - throw error2; - } - throw error1 - } -} +const root = require("path").join(__dirname, "..", ".."); + +module.exports = require("node-gyp-build")(root); try { module.exports.nodeTypeInfo = require("../../src/node-types.json"); diff --git a/tree-sitter-egglog/bindings/python/tree_sitter_egglog/__init__.py b/tree-sitter-egglog/bindings/python/tree_sitter_egglog/__init__.py new file mode 100644 index 0000000..3eafbe8 --- /dev/null +++ b/tree-sitter-egglog/bindings/python/tree_sitter_egglog/__init__.py @@ -0,0 +1,5 @@ +"Egglog grammar for tree-sitter" + +from ._binding import language + +__all__ = ["language"] diff --git a/tree-sitter-egglog/bindings/python/tree_sitter_egglog/__init__.pyi b/tree-sitter-egglog/bindings/python/tree_sitter_egglog/__init__.pyi new file mode 100644 index 0000000..5416666 --- /dev/null +++ b/tree-sitter-egglog/bindings/python/tree_sitter_egglog/__init__.pyi @@ -0,0 +1 @@ +def language() -> int: ... diff --git a/tree-sitter-egglog/bindings/python/tree_sitter_egglog/binding.c b/tree-sitter-egglog/bindings/python/tree_sitter_egglog/binding.c new file mode 100644 index 0000000..3846148 --- /dev/null +++ b/tree-sitter-egglog/bindings/python/tree_sitter_egglog/binding.c @@ -0,0 +1,27 @@ +#include + +typedef struct TSLanguage TSLanguage; + +TSLanguage *tree_sitter_egglog(void); + +static PyObject* _binding_language(PyObject *self, PyObject *args) { + return PyLong_FromVoidPtr(tree_sitter_egglog()); +} + +static PyMethodDef methods[] = { + {"language", _binding_language, METH_NOARGS, + "Get the tree-sitter language for this grammar."}, + {NULL, NULL, 0, NULL} +}; + +static struct PyModuleDef module = { + .m_base = PyModuleDef_HEAD_INIT, + .m_name = "_binding", + .m_doc = NULL, + .m_size = -1, + .m_methods = methods +}; + +PyMODINIT_FUNC PyInit__binding(void) { + return PyModule_Create(&module); +} diff --git a/tree-sitter-egglog/bindings/python/tree_sitter_egglog/py.typed b/tree-sitter-egglog/bindings/python/tree_sitter_egglog/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/tree-sitter-egglog/bindings/rust/build.rs b/tree-sitter-egglog/bindings/rust/build.rs index c6061f0..4cc26f5 100644 --- a/tree-sitter-egglog/bindings/rust/build.rs +++ b/tree-sitter-egglog/bindings/rust/build.rs @@ -7,6 +7,9 @@ fn main() { .flag_if_supported("-Wno-unused-parameter") .flag_if_supported("-Wno-unused-but-set-variable") .flag_if_supported("-Wno-trigraphs"); + #[cfg(target_env = "msvc")] + c_config.flag("-utf-8"); + let parser_path = src_dir.join("parser.c"); c_config.file(&parser_path); diff --git a/tree-sitter-egglog/bindings/swift/TreeSitterEgglog/egglog.h b/tree-sitter-egglog/bindings/swift/TreeSitterEgglog/egglog.h new file mode 100644 index 0000000..c92c1c5 --- /dev/null +++ b/tree-sitter-egglog/bindings/swift/TreeSitterEgglog/egglog.h @@ -0,0 +1,16 @@ +#ifndef TREE_SITTER_EGGLOG_H_ +#define TREE_SITTER_EGGLOG_H_ + +typedef struct TSLanguage TSLanguage; + +#ifdef __cplusplus +extern "C" { +#endif + +const TSLanguage *tree_sitter_egglog(void); + +#ifdef __cplusplus +} +#endif + +#endif // TREE_SITTER_EGGLOG_H_ diff --git a/tree-sitter-egglog/package.json b/tree-sitter-egglog/package.json index 8e311b1..13fba72 100644 --- a/tree-sitter-egglog/package.json +++ b/tree-sitter-egglog/package.json @@ -3,16 +3,29 @@ "version": "0.0.1", "description": "", "main": "bindings/node", + "types": "bindings/node", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "install": "node-gyp-build", + "prebuildify": "prebuildify --napi --strip" }, "author": "", "license": "ISC", "dependencies": { - "nan": "^2.17.0" + "node-addon-api": "^7.1.0", + "node-gyp-build": "^4.8.0" + }, + "peerDependencies": { + "tree-sitter": "^0.21.0" + }, + "peerDependenciesMeta": { + "tree_sitter": { + "optional": true + } }, "devDependencies": { - "tree-sitter-cli": "^0.20.8" + "tree-sitter-cli": "^0.20.8", + "prebuildify": "^6.0.0" }, "tree-sitter": [ { @@ -21,5 +34,13 @@ "egg" ] } + ], + "files": [ + "grammar.js", + "binding.gyp", + "prebuilds/**", + "bindings/node/*", + "queries/*", + "src/**" ] -} \ No newline at end of file +} diff --git a/tree-sitter-egglog/pyproject.toml b/tree-sitter-egglog/pyproject.toml new file mode 100644 index 0000000..ec9534d --- /dev/null +++ b/tree-sitter-egglog/pyproject.toml @@ -0,0 +1,29 @@ +[build-system] +requires = ["setuptools>=42", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "tree-sitter-egglog" +description = "Egglog grammar for tree-sitter" +version = "0.0.1" +keywords = ["incremental", "parsing", "tree-sitter", "egglog"] +classifiers = [ + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Topic :: Software Development :: Compilers", + "Topic :: Text Processing :: Linguistic", + "Typing :: Typed" +] +requires-python = ">=3.8" +license.text = "MIT" +readme = "README.md" + +[project.urls] +Homepage = "https://github.com/tree-sitter/tree-sitter-egglog" + +[project.optional-dependencies] +core = ["tree-sitter~=0.21"] + +[tool.cibuildwheel] +build = "cp38-*" +build-frontend = "build" diff --git a/tree-sitter-egglog/setup.py b/tree-sitter-egglog/setup.py new file mode 100644 index 0000000..1a03944 --- /dev/null +++ b/tree-sitter-egglog/setup.py @@ -0,0 +1,60 @@ +from os.path import isdir, join +from platform import system + +from setuptools import Extension, find_packages, setup +from setuptools.command.build import build +from wheel.bdist_wheel import bdist_wheel + + +class Build(build): + def run(self): + if isdir("queries"): + dest = join(self.build_lib, "tree_sitter_egglog", "queries") + self.copy_tree("queries", dest) + super().run() + + +class BdistWheel(bdist_wheel): + def get_tag(self): + python, abi, platform = super().get_tag() + if python.startswith("cp"): + python, abi = "cp38", "abi3" + return python, abi, platform + + +setup( + packages=find_packages("bindings/python"), + package_dir={"": "bindings/python"}, + package_data={ + "tree_sitter_egglog": ["*.pyi", "py.typed"], + "tree_sitter_egglog.queries": ["*.scm"], + }, + ext_package="tree_sitter_egglog", + ext_modules=[ + Extension( + name="_binding", + sources=[ + "bindings/python/tree_sitter_egglog/binding.c", + "src/parser.c", + # NOTE: if your language uses an external scanner, add it here. + ], + extra_compile_args=[ + "-std=c11", + ] if system() != "Windows" else [ + "/std:c11", + "/utf-8", + ], + define_macros=[ + ("Py_LIMITED_API", "0x03080000"), + ("PY_SSIZE_T_CLEAN", None) + ], + include_dirs=["src"], + py_limited_api=True, + ) + ], + cmdclass={ + "build": Build, + "bdist_wheel": BdistWheel + }, + zip_safe=False +) diff --git a/tree-sitter-egglog/src/parser.c b/tree-sitter-egglog/src/parser.c index 8f18fd2..2585406 100644 --- a/tree-sitter-egglog/src/parser.c +++ b/tree-sitter-egglog/src/parser.c @@ -1,7 +1,6 @@ #include "tree_sitter/parser.h" #if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmissing-field-initializers" #endif @@ -954,37 +953,49 @@ static const TSStateId ts_primary_state_ids[STATE_COUNT] = { [270] = 220, }; +static TSCharacterRange sym_type_character_set_1[] = { + {'!', '!'}, {'%', '&'}, {'*', '+'}, {'-', '-'}, {'/', '/'}, {'<', '?'}, {'A', 'Z'}, {'^', '_'}, + {'a', 'z'}, {'|', '|'}, +}; + +static TSCharacterRange sym_type_character_set_2[] = { + {'!', '!'}, {'%', '&'}, {'*', '+'}, {'-', '-'}, {'/', '9'}, {'<', '?'}, {'A', 'Z'}, {'^', '_'}, + {'a', 'z'}, {'|', '|'}, +}; + static bool ts_lex(TSLexer *lexer, TSStateId state) { START_LEXER(); eof = lexer->eof(lexer); switch (state) { case 0: if (eof) ADVANCE(235); - if (lookahead == '"') ADVANCE(1); - if (lookahead == '(') ADVANCE(238); - if (lookahead == ')') ADVANCE(239); - if (lookahead == ',') ADVANCE(240); - if (lookahead == '-') ADVANCE(96); - if (lookahead == ':') ADVANCE(33); - if (lookahead == ';') ADVANCE(236); - if (lookahead == '=') ADVANCE(319); - if (lookahead == 'N') ADVANCE(10); - if (lookahead == '[') ADVANCE(317); - if (lookahead == ']') ADVANCE(318); - if (lookahead == 'b') ADVANCE(94); - if (lookahead == 'c') ADVANCE(11); - if (lookahead == 'd') ADVANCE(12); - if (lookahead == 'e') ADVANCE(221); - if (lookahead == 'f') ADVANCE(13); - if (lookahead == 'i') ADVANCE(124); - if (lookahead == 'l') ADVANCE(70); - if (lookahead == 'o') ADVANCE(210); - if (lookahead == 'p') ADVANCE(24); - if (lookahead == 'q') ADVANCE(217); - if (lookahead == 'r') ADVANCE(49); - if (lookahead == 's') ADVANCE(17); - if (lookahead == 't') ADVANCE(167); - if (lookahead == 'u') ADVANCE(134); + ADVANCE_MAP( + '"', 1, + '(', 238, + ')', 239, + ',', 240, + '-', 99, + ':', 36, + ';', 236, + '=', 319, + 'N', 13, + '[', 317, + ']', 318, + 'b', 97, + 'c', 14, + 'd', 15, + 'e', 224, + 'f', 16, + 'i', 127, + 'l', 73, + 'o', 213, + 'p', 27, + 'q', 220, + 'r', 52, + 's', 20, + 't', 170, + 'u', 137, + ); if (('\t' <= lookahead && lookahead <= '\r') || lookahead == ' ') ADVANCE(237); if (('0' <= lookahead && lookahead <= '9')) ADVANCE(327); @@ -1001,811 +1012,793 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (('0' <= lookahead && lookahead <= '9')) ADVANCE(332); END_STATE(); case 3: - if (lookahead == '-') ADVANCE(87); + if (lookahead == '-') ADVANCE(90); END_STATE(); case 4: if (lookahead == '-') ADVANCE(232); if (('0' <= lookahead && lookahead <= '9')) ADVANCE(332); END_STATE(); case 5: - if (lookahead == '-') ADVANCE(82); + if (lookahead == '-') ADVANCE(85); END_STATE(); case 6: + if (lookahead == ':') ADVANCE(35); if (lookahead == ';') ADVANCE(236); - if (lookahead == '=') ADVANCE(320); + if (lookahead == ')' || + lookahead == ']') ADVANCE(239); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') ADVANCE(237); + if ((set_contains(sym_type_character_set_1, 10, lookahead)) && + (lookahead < 'A' || 'Z' < lookahead) && + (lookahead < 'a' || 'z' < lookahead)) ADVANCE(322); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(321); + END_STATE(); + case 7: + if (lookahead == ':') ADVANCE(221); + if (lookahead == ';') ADVANCE(236); + if (lookahead == '(' || + lookahead == '[') ADVANCE(238); + if (lookahead == ')' || + lookahead == ']') ADVANCE(239); if (('\t' <= lookahead && lookahead <= '\r') || lookahead == ' ') ADVANCE(237); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(328); if (lookahead == '!' || lookahead == '%' || lookahead == '&' || lookahead == '*' || lookahead == '+' || lookahead == '-' || - lookahead == '/' || - ('<' <= lookahead && lookahead <= '?') || + ('/' <= lookahead && lookahead <= '?') || lookahead == '^' || lookahead == '_' || lookahead == '|') ADVANCE(500); if (('A' <= lookahead && lookahead <= 'Z') || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(499); END_STATE(); - case 7: + case 8: if (lookahead == ';') ADVANCE(236); - if (lookahead == 'r') ADVANCE(79); - if (lookahead == 's') ADVANCE(18); + if (lookahead == '=') ADVANCE(320); if (('\t' <= lookahead && lookahead <= '\r') || lookahead == ' ') ADVANCE(237); - END_STATE(); - case 8: - if (lookahead == 'N') ADVANCE(329); + if ((set_contains(sym_type_character_set_1, 10, lookahead)) && + (lookahead < 'A' || 'Z' < lookahead) && + (lookahead < 'a' || 'z' < lookahead)) ADVANCE(500); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(499); END_STATE(); case 9: - if (lookahead == '_') ADVANCE(123); + ADVANCE_MAP( + ';', 236, + 'd', 384, + 'e', 493, + 'l', 381, + 'p', 350, + 'u', 429, + '(', 238, + '[', 238, + ); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') ADVANCE(237); + if ((set_contains(sym_type_character_set_1, 10, lookahead)) && + (lookahead < 'A' || 'Z' < lookahead) && + (lookahead < 'a' || 'z' < lookahead)) ADVANCE(500); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(499); END_STATE(); case 10: - if (lookahead == 'a') ADVANCE(8); + if (lookahead == ';') ADVANCE(236); + if (lookahead == 'r') ADVANCE(82); + if (lookahead == 's') ADVANCE(21); + if (('\t' <= lookahead && lookahead <= '\r') || + lookahead == ' ') ADVANCE(237); END_STATE(); case 11: - if (lookahead == 'a') ADVANCE(109); - if (lookahead == 'h') ADVANCE(68); + if (lookahead == 'N') ADVANCE(329); END_STATE(); case 12: - if (lookahead == 'a') ADVANCE(192); - if (lookahead == 'e') ADVANCE(38); + if (lookahead == '_') ADVANCE(126); END_STATE(); case 13: - if (lookahead == 'a') ADVANCE(98); - if (lookahead == 'u') ADVANCE(135); + if (lookahead == 'a') ADVANCE(11); END_STATE(); case 14: - if (lookahead == 'a') ADVANCE(31); + if (lookahead == 'a') ADVANCE(112); + if (lookahead == 'h') ADVANCE(71); END_STATE(); case 15: - if (lookahead == 'a') ADVANCE(122); + if (lookahead == 'a') ADVANCE(195); + if (lookahead == 'e') ADVANCE(41); END_STATE(); case 16: - if (lookahead == 'a') ADVANCE(159); + if (lookahead == 'a') ADVANCE(101); + if (lookahead == 'u') ADVANCE(138); END_STATE(); case 17: - if (lookahead == 'a') ADVANCE(193); - if (lookahead == 'e') ADVANCE(155); - if (lookahead == 'i') ADVANCE(121); - if (lookahead == 'o') ADVANCE(161); + if (lookahead == 'a') ADVANCE(34); END_STATE(); case 18: - if (lookahead == 'a') ADVANCE(193); - if (lookahead == 'e') ADVANCE(154); + if (lookahead == 'a') ADVANCE(125); END_STATE(); case 19: - if (lookahead == 'a') ADVANCE(212); + if (lookahead == 'a') ADVANCE(162); END_STATE(); case 20: - if (lookahead == 'a') ADVANCE(44); + if (lookahead == 'a') ADVANCE(196); + if (lookahead == 'e') ADVANCE(158); + if (lookahead == 'i') ADVANCE(124); + if (lookahead == 'o') ADVANCE(164); END_STATE(); case 21: - if (lookahead == 'a') ADVANCE(191); + if (lookahead == 'a') ADVANCE(196); + if (lookahead == 'e') ADVANCE(157); END_STATE(); case 22: - if (lookahead == 'a') ADVANCE(184); + if (lookahead == 'a') ADVANCE(215); END_STATE(); case 23: - if (lookahead == 'a') ADVANCE(197); + if (lookahead == 'a') ADVANCE(47); END_STATE(); case 24: - if (lookahead == 'a') ADVANCE(136); - if (lookahead == 'o') ADVANCE(148); - if (lookahead == 'r') ADVANCE(100); - if (lookahead == 'u') ADVANCE(173); + if (lookahead == 'a') ADVANCE(194); END_STATE(); case 25: - if (lookahead == 'a') ADVANCE(165); + if (lookahead == 'a') ADVANCE(187); END_STATE(); case 26: - if (lookahead == 'a') ADVANCE(41); + if (lookahead == 'a') ADVANCE(200); END_STATE(); case 27: - if (lookahead == 'a') ADVANCE(138); + if (lookahead == 'a') ADVANCE(139); + if (lookahead == 'o') ADVANCE(151); + if (lookahead == 'r') ADVANCE(103); + if (lookahead == 'u') ADVANCE(176); END_STATE(); case 28: - if (lookahead == 'a') ADVANCE(42); + if (lookahead == 'a') ADVANCE(168); END_STATE(); case 29: - if (lookahead == 'a') ADVANCE(201); + if (lookahead == 'a') ADVANCE(44); END_STATE(); case 30: - if (lookahead == 'a') ADVANCE(205); + if (lookahead == 'a') ADVANCE(141); END_STATE(); case 31: - if (lookahead == 'b') ADVANCE(119); + if (lookahead == 'a') ADVANCE(45); END_STATE(); case 32: - if (lookahead == 'c') ADVANCE(141); + if (lookahead == 'a') ADVANCE(204); END_STATE(); case 33: - if (lookahead == 'c') ADVANCE(141); - if (lookahead == 'd') ADVANCE(67); - if (lookahead == 'm') ADVANCE(71); - if (lookahead == 'n') ADVANCE(15); - if (lookahead == 'o') ADVANCE(126); - if (lookahead == 'r') ADVANCE(209); - if (lookahead == 'u') ADVANCE(127); - if (lookahead == 'v') ADVANCE(16); - if (lookahead == 'w') ADVANCE(91); + if (lookahead == 'a') ADVANCE(208); END_STATE(); case 34: - if (lookahead == 'c') ADVANCE(141); - if (lookahead == 'd') ADVANCE(67); - if (lookahead == 'm') ADVANCE(71); - if (lookahead == 'n') ADVANCE(15); - if (lookahead == 'o') ADVANCE(126); - if (lookahead == 'r') ADVANCE(209); - if (lookahead == 'u') ADVANCE(127); - if (lookahead == 'w') ADVANCE(91); + if (lookahead == 'b') ADVANCE(122); END_STATE(); case 35: - if (lookahead == 'c') ADVANCE(275); + if (lookahead == 'c') ADVANCE(144); END_STATE(); case 36: - if (lookahead == 'c') ADVANCE(108); + ADVANCE_MAP( + 'c', 144, + 'd', 70, + 'm', 74, + 'n', 18, + 'o', 129, + 'r', 212, + 'u', 130, + 'v', 19, + 'w', 94, + ); END_STATE(); case 37: - if (lookahead == 'c') ADVANCE(313); + ADVANCE_MAP( + 'c', 144, + 'd', 70, + 'm', 74, + 'n', 18, + 'o', 129, + 'r', 212, + 'u', 130, + 'w', 94, + ); END_STATE(); case 38: - if (lookahead == 'c') ADVANCE(113); - if (lookahead == 'l') ADVANCE(75); + if (lookahead == 'c') ADVANCE(275); END_STATE(); case 39: - if (lookahead == 'c') ADVANCE(112); - if (lookahead == 'f') ADVANCE(333); - if (lookahead == 'p') ADVANCE(214); + if (lookahead == 'c') ADVANCE(111); END_STATE(); case 40: - if (lookahead == 'c') ADVANCE(203); + if (lookahead == 'c') ADVANCE(313); END_STATE(); case 41: - if (lookahead == 'c') ADVANCE(185); + if (lookahead == 'c') ADVANCE(116); + if (lookahead == 'l') ADVANCE(78); END_STATE(); case 42: - if (lookahead == 'c') ADVANCE(189); + if (lookahead == 'c') ADVANCE(115); + if (lookahead == 'f') ADVANCE(333); + if (lookahead == 'p') ADVANCE(217); END_STATE(); case 43: - if (lookahead == 'c') ADVANCE(92); + if (lookahead == 'c') ADVANCE(206); END_STATE(); case 44: - if (lookahead == 'c') ADVANCE(198); + if (lookahead == 'c') ADVANCE(188); END_STATE(); case 45: - if (lookahead == 'c') ADVANCE(206); + if (lookahead == 'c') ADVANCE(192); END_STATE(); case 46: - if (lookahead == 'd') ADVANCE(67); - if (lookahead == 'r') ADVANCE(209); - if (lookahead == 'v') ADVANCE(16); - if (lookahead == 'w') ADVANCE(91); + if (lookahead == 'c') ADVANCE(95); END_STATE(); case 47: - if (lookahead == 'd') ADVANCE(58); + if (lookahead == 'c') ADVANCE(201); END_STATE(); case 48: - if (lookahead == 'd') ADVANCE(216); + if (lookahead == 'c') ADVANCE(209); END_STATE(); case 49: - if (lookahead == 'e') ADVANCE(120); - if (lookahead == 'u') ADVANCE(115); + if (lookahead == 'd') ADVANCE(70); + if (lookahead == 'r') ADVANCE(212); + if (lookahead == 'v') ADVANCE(19); + if (lookahead == 'w') ADVANCE(94); END_STATE(); case 50: - if (lookahead == 'e') ADVANCE(220); + if (lookahead == 'd') ADVANCE(61); END_STATE(); case 51: - if (lookahead == 'e') ADVANCE(258); + if (lookahead == 'd') ADVANCE(219); END_STATE(); case 52: - if (lookahead == 'e') ADVANCE(323); + if (lookahead == 'e') ADVANCE(123); + if (lookahead == 'u') ADVANCE(118); END_STATE(); case 53: - if (lookahead == 'e') ADVANCE(261); + if (lookahead == 'e') ADVANCE(223); END_STATE(); case 54: - if (lookahead == 'e') ADVANCE(325); + if (lookahead == 'e') ADVANCE(258); END_STATE(); case 55: - if (lookahead == 'e') ADVANCE(250); + if (lookahead == 'e') ADVANCE(323); END_STATE(); case 56: - if (lookahead == 'e') ADVANCE(309); + if (lookahead == 'e') ADVANCE(261); END_STATE(); case 57: - if (lookahead == 'e') ADVANCE(252); + if (lookahead == 'e') ADVANCE(325); END_STATE(); case 58: - if (lookahead == 'e') ADVANCE(302); + if (lookahead == 'e') ADVANCE(250); END_STATE(); case 59: - if (lookahead == 'e') ADVANCE(262); + if (lookahead == 'e') ADVANCE(309); END_STATE(); case 60: - if (lookahead == 'e') ADVANCE(242); + if (lookahead == 'e') ADVANCE(252); END_STATE(); case 61: - if (lookahead == 'e') ADVANCE(304); + if (lookahead == 'e') ADVANCE(302); END_STATE(); case 62: - if (lookahead == 'e') ADVANCE(249); + if (lookahead == 'e') ADVANCE(262); END_STATE(); case 63: - if (lookahead == 'e') ADVANCE(265); + if (lookahead == 'e') ADVANCE(242); END_STATE(); case 64: - if (lookahead == 'e') ADVANCE(294); + if (lookahead == 'e') ADVANCE(304); END_STATE(); case 65: - if (lookahead == 'e') ADVANCE(284); + if (lookahead == 'e') ADVANCE(249); END_STATE(); case 66: - if (lookahead == 'e') ADVANCE(248); + if (lookahead == 'e') ADVANCE(265); END_STATE(); case 67: - if (lookahead == 'e') ADVANCE(86); + if (lookahead == 'e') ADVANCE(294); END_STATE(); case 68: - if (lookahead == 'e') ADVANCE(36); + if (lookahead == 'e') ADVANCE(284); END_STATE(); case 69: - if (lookahead == 'e') ADVANCE(48); + if (lookahead == 'e') ADVANCE(248); END_STATE(); case 70: - if (lookahead == 'e') ADVANCE(178); + if (lookahead == 'e') ADVANCE(89); END_STATE(); case 71: - if (lookahead == 'e') ADVANCE(156); + if (lookahead == 'e') ADVANCE(39); END_STATE(); case 72: - if (lookahead == 'e') ADVANCE(177); + if (lookahead == 'e') ADVANCE(51); END_STATE(); case 73: - if (lookahead == 'e') ADVANCE(157); + if (lookahead == 'e') ADVANCE(181); END_STATE(); case 74: - if (lookahead == 'e') ADVANCE(128); + if (lookahead == 'e') ADVANCE(159); END_STATE(); case 75: - if (lookahead == 'e') ADVANCE(199); + if (lookahead == 'e') ADVANCE(180); END_STATE(); case 76: - if (lookahead == 'e') ADVANCE(186); + if (lookahead == 'e') ADVANCE(160); END_STATE(); case 77: - if (lookahead == 'e') ADVANCE(188); + if (lookahead == 'e') ADVANCE(131); END_STATE(); case 78: - if (lookahead == 'e') ADVANCE(166); + if (lookahead == 'e') ADVANCE(202); END_STATE(); case 79: - if (lookahead == 'e') ADVANCE(150); - if (lookahead == 'u') ADVANCE(133); + if (lookahead == 'e') ADVANCE(189); END_STATE(); case 80: - if (lookahead == 'e') ADVANCE(22); + if (lookahead == 'e') ADVANCE(191); END_STATE(); case 81: - if (lookahead == 'e') ADVANCE(222); - if (lookahead == 't') ADVANCE(101); + if (lookahead == 'e') ADVANCE(169); END_STATE(); case 82: - if (lookahead == 'e') ADVANCE(223); + if (lookahead == 'e') ADVANCE(153); + if (lookahead == 'u') ADVANCE(136); END_STATE(); case 83: - if (lookahead == 'f') ADVANCE(335); + if (lookahead == 'e') ADVANCE(25); END_STATE(); case 84: - if (lookahead == 'f') ADVANCE(282); + if (lookahead == 'e') ADVANCE(225); + if (lookahead == 't') ADVANCE(104); END_STATE(); case 85: - if (lookahead == 'f') ADVANCE(224); + if (lookahead == 'e') ADVANCE(226); END_STATE(); case 86: - if (lookahead == 'f') ADVANCE(19); + if (lookahead == 'f') ADVANCE(335); END_STATE(); case 87: - if (lookahead == 'f') ADVANCE(219); - if (lookahead == 's') ADVANCE(93); + if (lookahead == 'f') ADVANCE(282); END_STATE(); case 88: - if (lookahead == 'g') ADVANCE(55); + if (lookahead == 'f') ADVANCE(227); END_STATE(); case 89: - if (lookahead == 'g') ADVANCE(62); + if (lookahead == 'f') ADVANCE(22); END_STATE(); case 90: - if (lookahead == 'h') ADVANCE(288); + if (lookahead == 'f') ADVANCE(222); + if (lookahead == 's') ADVANCE(96); END_STATE(); case 91: - if (lookahead == 'h') ADVANCE(74); + if (lookahead == 'g') ADVANCE(58); END_STATE(); case 92: - if (lookahead == 'h') ADVANCE(69); + if (lookahead == 'g') ADVANCE(65); END_STATE(); case 93: - if (lookahead == 'i') ADVANCE(227); - if (lookahead == 't') ADVANCE(23); + if (lookahead == 'h') ADVANCE(288); END_STATE(); case 94: - if (lookahead == 'i') ADVANCE(160); + if (lookahead == 'h') ADVANCE(77); END_STATE(); case 95: - if (lookahead == 'i') ADVANCE(144); + if (lookahead == 'h') ADVANCE(72); END_STATE(); case 96: - if (lookahead == 'i') ADVANCE(125); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(327); + if (lookahead == 'i') ADVANCE(230); + if (lookahead == 't') ADVANCE(26); END_STATE(); case 97: - if (lookahead == 'i') ADVANCE(85); + if (lookahead == 'i') ADVANCE(163); END_STATE(); case 98: - if (lookahead == 'i') ADVANCE(110); - if (lookahead == 'l') ADVANCE(176); + if (lookahead == 'i') ADVANCE(147); END_STATE(); case 99: - if (lookahead == 'i') ADVANCE(37); + if (lookahead == 'i') ADVANCE(128); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(327); END_STATE(); case 100: - if (lookahead == 'i') ADVANCE(137); + if (lookahead == 'i') ADVANCE(88); END_STATE(); case 101: - if (lookahead == 'i') ADVANCE(111); + if (lookahead == 'i') ADVANCE(113); + if (lookahead == 'l') ADVANCE(179); END_STATE(); case 102: - if (lookahead == 'i') ADVANCE(27); + if (lookahead == 'i') ADVANCE(40); END_STATE(); case 103: - if (lookahead == 'i') ADVANCE(145); + if (lookahead == 'i') ADVANCE(140); END_STATE(); case 104: - if (lookahead == 'i') ADVANCE(200); + if (lookahead == 'i') ADVANCE(114); END_STATE(); case 105: - if (lookahead == 'i') ADVANCE(146); + if (lookahead == 'i') ADVANCE(30); END_STATE(); case 106: - if (lookahead == 'i') ADVANCE(147); + if (lookahead == 'i') ADVANCE(148); END_STATE(); case 107: - if (lookahead == 'i') ADVANCE(202); + if (lookahead == 'i') ADVANCE(203); END_STATE(); case 108: - if (lookahead == 'k') ADVANCE(280); + if (lookahead == 'i') ADVANCE(149); END_STATE(); case 109: - if (lookahead == 'l') ADVANCE(35); + if (lookahead == 'i') ADVANCE(150); END_STATE(); case 110: - if (lookahead == 'l') ADVANCE(300); + if (lookahead == 'i') ADVANCE(205); END_STATE(); case 111: - if (lookahead == 'l') ADVANCE(272); + if (lookahead == 'k') ADVANCE(280); END_STATE(); case 112: - if (lookahead == 'l') ADVANCE(208); + if (lookahead == 'l') ADVANCE(38); END_STATE(); case 113: - if (lookahead == 'l') ADVANCE(25); + if (lookahead == 'l') ADVANCE(300); END_STATE(); case 114: - if (lookahead == 'l') ADVANCE(97); + if (lookahead == 'l') ADVANCE(272); END_STATE(); case 115: - if (lookahead == 'l') ADVANCE(51); - if (lookahead == 'n') ADVANCE(271); + if (lookahead == 'l') ADVANCE(211); END_STATE(); case 116: - if (lookahead == 'l') ADVANCE(72); + if (lookahead == 'l') ADVANCE(28); END_STATE(); case 117: - if (lookahead == 'l') ADVANCE(187); + if (lookahead == 'l') ADVANCE(100); END_STATE(); case 118: - if (lookahead == 'l') ADVANCE(65); + if (lookahead == 'l') ADVANCE(54); + if (lookahead == 'n') ADVANCE(271); END_STATE(); case 119: - if (lookahead == 'l') ADVANCE(66); + if (lookahead == 'l') ADVANCE(75); END_STATE(); case 120: - if (lookahead == 'l') ADVANCE(30); - if (lookahead == 'p') ADVANCE(80); - if (lookahead == 'w') ADVANCE(163); + if (lookahead == 'l') ADVANCE(190); END_STATE(); case 121: - if (lookahead == 'm') ADVANCE(149); + if (lookahead == 'l') ADVANCE(68); END_STATE(); case 122: - if (lookahead == 'm') ADVANCE(53); + if (lookahead == 'l') ADVANCE(69); END_STATE(); case 123: - if (lookahead == 'm') ADVANCE(78); + if (lookahead == 'l') ADVANCE(33); + if (lookahead == 'p') ADVANCE(83); + if (lookahead == 'w') ADVANCE(166); END_STATE(); case 124: - if (lookahead == 'n') ADVANCE(39); + if (lookahead == 'm') ADVANCE(152); END_STATE(); case 125: - if (lookahead == 'n') ADVANCE(83); + if (lookahead == 'm') ADVANCE(56); END_STATE(); case 126: - if (lookahead == 'n') ADVANCE(9); + if (lookahead == 'm') ADVANCE(81); END_STATE(); case 127: - if (lookahead == 'n') ADVANCE(81); + if (lookahead == 'n') ADVANCE(42); END_STATE(); case 128: - if (lookahead == 'n') ADVANCE(264); + if (lookahead == 'n') ADVANCE(86); END_STATE(); case 129: - if (lookahead == 'n') ADVANCE(311); + if (lookahead == 'n') ADVANCE(12); END_STATE(); case 130: - if (lookahead == 'n') ADVANCE(246); + if (lookahead == 'n') ADVANCE(84); END_STATE(); case 131: - if (lookahead == 'n') ADVANCE(254); + if (lookahead == 'n') ADVANCE(264); END_STATE(); case 132: - if (lookahead == 'n') ADVANCE(292); + if (lookahead == 'n') ADVANCE(311); END_STATE(); case 133: - if (lookahead == 'n') ADVANCE(269); + if (lookahead == 'n') ADVANCE(246); END_STATE(); case 134: - if (lookahead == 'n') ADVANCE(95); + if (lookahead == 'n') ADVANCE(254); END_STATE(); case 135: - if (lookahead == 'n') ADVANCE(40); + if (lookahead == 'n') ADVANCE(292); END_STATE(); case 136: - if (lookahead == 'n') ADVANCE(99); + if (lookahead == 'n') ADVANCE(269); END_STATE(); case 137: - if (lookahead == 'n') ADVANCE(182); + if (lookahead == 'n') ADVANCE(98); END_STATE(); case 138: - if (lookahead == 'n') ADVANCE(196); + if (lookahead == 'n') ADVANCE(43); END_STATE(); case 139: - if (lookahead == 'n') ADVANCE(194); + if (lookahead == 'n') ADVANCE(102); END_STATE(); case 140: - if (lookahead == 'n') ADVANCE(45); + if (lookahead == 'n') ADVANCE(185); END_STATE(); case 141: - if (lookahead == 'o') ADVANCE(175); + if (lookahead == 'n') ADVANCE(199); END_STATE(); case 142: - if (lookahead == 'o') ADVANCE(143); + if (lookahead == 'n') ADVANCE(197); END_STATE(); case 143: - if (lookahead == 'o') ADVANCE(84); + if (lookahead == 'n') ADVANCE(48); END_STATE(); case 144: - if (lookahead == 'o') ADVANCE(129); + if (lookahead == 'o') ADVANCE(178); END_STATE(); case 145: - if (lookahead == 'o') ADVANCE(130); + if (lookahead == 'o') ADVANCE(146); END_STATE(); case 146: - if (lookahead == 'o') ADVANCE(131); + if (lookahead == 'o') ADVANCE(87); END_STATE(); case 147: if (lookahead == 'o') ADVANCE(132); END_STATE(); case 148: - if (lookahead == 'p') ADVANCE(290); + if (lookahead == 'o') ADVANCE(133); END_STATE(); case 149: - if (lookahead == 'p') ADVANCE(114); + if (lookahead == 'o') ADVANCE(134); END_STATE(); case 150: - if (lookahead == 'p') ADVANCE(80); + if (lookahead == 'o') ADVANCE(135); END_STATE(); case 151: - if (lookahead == 'p') ADVANCE(158); + if (lookahead == 'p') ADVANCE(290); END_STATE(); case 152: - if (lookahead == 'p') ADVANCE(60); + if (lookahead == 'p') ADVANCE(117); END_STATE(); case 153: - if (lookahead == 'p') ADVANCE(215); + if (lookahead == 'p') ADVANCE(83); END_STATE(); case 154: - if (lookahead == 'q') ADVANCE(305); + if (lookahead == 'p') ADVANCE(161); END_STATE(); case 155: - if (lookahead == 'q') ADVANCE(305); - if (lookahead == 't') ADVANCE(308); + if (lookahead == 'p') ADVANCE(63); END_STATE(); case 156: - if (lookahead == 'r') ADVANCE(88); + if (lookahead == 'p') ADVANCE(218); END_STATE(); case 157: - if (lookahead == 'r') ADVANCE(225); + if (lookahead == 'q') ADVANCE(305); END_STATE(); case 158: - if (lookahead == 'r') ADVANCE(142); + if (lookahead == 'q') ADVANCE(305); + if (lookahead == 't') ADVANCE(308); END_STATE(); case 159: - if (lookahead == 'r') ADVANCE(102); + if (lookahead == 'r') ADVANCE(91); END_STATE(); case 160: - if (lookahead == 'r') ADVANCE(50); + if (lookahead == 'r') ADVANCE(228); END_STATE(); case 161: - if (lookahead == 'r') ADVANCE(179); + if (lookahead == 'r') ADVANCE(145); END_STATE(); case 162: - if (lookahead == 'r') ADVANCE(26); + if (lookahead == 'r') ADVANCE(105); END_STATE(); case 163: - if (lookahead == 'r') ADVANCE(104); + if (lookahead == 'r') ADVANCE(53); END_STATE(); case 164: - if (lookahead == 'r') ADVANCE(20); + if (lookahead == 'r') ADVANCE(182); END_STATE(); case 165: - if (lookahead == 'r') ADVANCE(57); + if (lookahead == 'r') ADVANCE(29); END_STATE(); case 166: - if (lookahead == 'r') ADVANCE(89); + if (lookahead == 'r') ADVANCE(107); END_STATE(); case 167: - if (lookahead == 'r') ADVANCE(213); + if (lookahead == 'r') ADVANCE(23); END_STATE(); case 168: - if (lookahead == 'r') ADVANCE(29); + if (lookahead == 'r') ADVANCE(60); END_STATE(); case 169: - if (lookahead == 'r') ADVANCE(28); + if (lookahead == 'r') ADVANCE(92); END_STATE(); case 170: - if (lookahead == 'r') ADVANCE(107); + if (lookahead == 'r') ADVANCE(216); END_STATE(); case 171: - if (lookahead == 's') ADVANCE(279); + if (lookahead == 'r') ADVANCE(32); END_STATE(); case 172: - if (lookahead == 's') ADVANCE(286); + if (lookahead == 'r') ADVANCE(31); END_STATE(); case 173: - if (lookahead == 's') ADVANCE(90); + if (lookahead == 'r') ADVANCE(110); END_STATE(); case 174: - if (lookahead == 's') ADVANCE(43); + if (lookahead == 's') ADVANCE(279); END_STATE(); case 175: - if (lookahead == 's') ADVANCE(180); + if (lookahead == 's') ADVANCE(286); END_STATE(); case 176: - if (lookahead == 's') ADVANCE(54); + if (lookahead == 's') ADVANCE(93); END_STATE(); case 177: - if (lookahead == 's') ADVANCE(77); + if (lookahead == 's') ADVANCE(46); END_STATE(); case 178: - if (lookahead == 't') ADVANCE(267); + if (lookahead == 's') ADVANCE(183); END_STATE(); case 179: - if (lookahead == 't') ADVANCE(244); + if (lookahead == 's') ADVANCE(57); END_STATE(); case 180: - if (lookahead == 't') ADVANCE(307); + if (lookahead == 's') ADVANCE(80); END_STATE(); case 181: - if (lookahead == 't') ADVANCE(296); + if (lookahead == 't') ADVANCE(267); END_STATE(); case 182: - if (lookahead == 't') ADVANCE(3); + if (lookahead == 't') ADVANCE(244); END_STATE(); case 183: - if (lookahead == 't') ADVANCE(298); + if (lookahead == 't') ADVANCE(307); END_STATE(); case 184: - if (lookahead == 't') ADVANCE(306); + if (lookahead == 't') ADVANCE(296); END_STATE(); case 185: - if (lookahead == 't') ADVANCE(315); + if (lookahead == 't') ADVANCE(3); END_STATE(); case 186: - if (lookahead == 't') ADVANCE(256); + if (lookahead == 't') ADVANCE(298); END_STATE(); case 187: - if (lookahead == 't') ADVANCE(251); + if (lookahead == 't') ADVANCE(306); END_STATE(); case 188: - if (lookahead == 't') ADVANCE(260); + if (lookahead == 't') ADVANCE(315); END_STATE(); case 189: - if (lookahead == 't') ADVANCE(277); + if (lookahead == 't') ADVANCE(256); END_STATE(); case 190: - if (lookahead == 't') ADVANCE(153); + if (lookahead == 't') ADVANCE(251); END_STATE(); case 191: - if (lookahead == 't') ADVANCE(226); + if (lookahead == 't') ADVANCE(260); END_STATE(); case 192: - if (lookahead == 't') ADVANCE(21); + if (lookahead == 't') ADVANCE(277); END_STATE(); case 193: - if (lookahead == 't') ADVANCE(211); + if (lookahead == 't') ADVANCE(156); END_STATE(); case 194: - if (lookahead == 't') ADVANCE(101); + if (lookahead == 't') ADVANCE(229); END_STATE(); case 195: - if (lookahead == 't') ADVANCE(162); + if (lookahead == 't') ADVANCE(24); END_STATE(); case 196: - if (lookahead == 't') ADVANCE(171); + if (lookahead == 't') ADVANCE(214); END_STATE(); case 197: - if (lookahead == 't') ADVANCE(172); + if (lookahead == 't') ADVANCE(104); END_STATE(); case 198: - if (lookahead == 't') ADVANCE(14); + if (lookahead == 't') ADVANCE(165); END_STATE(); case 199: - if (lookahead == 't') ADVANCE(56); + if (lookahead == 't') ADVANCE(174); END_STATE(); case 200: - if (lookahead == 't') ADVANCE(59); + if (lookahead == 't') ADVANCE(175); END_STATE(); case 201: - if (lookahead == 't') ADVANCE(61); + if (lookahead == 't') ADVANCE(17); END_STATE(); case 202: - if (lookahead == 't') ADVANCE(63); + if (lookahead == 't') ADVANCE(59); END_STATE(); case 203: - if (lookahead == 't') ADVANCE(103); + if (lookahead == 't') ADVANCE(62); END_STATE(); case 204: - if (lookahead == 't') ADVANCE(164); + if (lookahead == 't') ADVANCE(64); END_STATE(); case 205: - if (lookahead == 't') ADVANCE(105); + if (lookahead == 't') ADVANCE(66); END_STATE(); case 206: if (lookahead == 't') ADVANCE(106); END_STATE(); case 207: - if (lookahead == 't') ADVANCE(169); + if (lookahead == 't') ADVANCE(167); END_STATE(); case 208: - if (lookahead == 'u') ADVANCE(47); + if (lookahead == 't') ADVANCE(108); END_STATE(); case 209: - if (lookahead == 'u') ADVANCE(116); + if (lookahead == 't') ADVANCE(109); END_STATE(); case 210: - if (lookahead == 'u') ADVANCE(190); + if (lookahead == 't') ADVANCE(172); END_STATE(); case 211: - if (lookahead == 'u') ADVANCE(168); + if (lookahead == 'u') ADVANCE(50); END_STATE(); case 212: - if (lookahead == 'u') ADVANCE(117); + if (lookahead == 'u') ADVANCE(119); END_STATE(); case 213: - if (lookahead == 'u') ADVANCE(52); + if (lookahead == 'u') ADVANCE(193); END_STATE(); case 214: - if (lookahead == 'u') ADVANCE(181); + if (lookahead == 'u') ADVANCE(171); END_STATE(); case 215: - if (lookahead == 'u') ADVANCE(183); + if (lookahead == 'u') ADVANCE(120); END_STATE(); case 216: - if (lookahead == 'u') ADVANCE(118); + if (lookahead == 'u') ADVANCE(55); END_STATE(); case 217: - if (lookahead == 'u') ADVANCE(73); + if (lookahead == 'u') ADVANCE(184); END_STATE(); case 218: - if (lookahead == 'u') ADVANCE(139); + if (lookahead == 'u') ADVANCE(186); END_STATE(); case 219: - if (lookahead == 'u') ADVANCE(140); + if (lookahead == 'u') ADVANCE(121); END_STATE(); case 220: - if (lookahead == 'w') ADVANCE(170); + if (lookahead == 'u') ADVANCE(76); END_STATE(); case 221: - if (lookahead == 'x') ADVANCE(195); + if (lookahead == 'u') ADVANCE(142); END_STATE(); case 222: - if (lookahead == 'x') ADVANCE(204); + if (lookahead == 'u') ADVANCE(143); END_STATE(); case 223: - if (lookahead == 'x') ADVANCE(207); + if (lookahead == 'w') ADVANCE(173); END_STATE(); case 224: - if (lookahead == 'y') ADVANCE(273); + if (lookahead == 'x') ADVANCE(198); END_STATE(); case 225: - if (lookahead == 'y') ADVANCE(5); + if (lookahead == 'x') ADVANCE(207); END_STATE(); case 226: - if (lookahead == 'y') ADVANCE(152); + if (lookahead == 'x') ADVANCE(210); END_STATE(); case 227: - if (lookahead == 'z') ADVANCE(64); + if (lookahead == 'y') ADVANCE(273); END_STATE(); case 228: - if (lookahead == '(' || - lookahead == '[') ADVANCE(238); - if (lookahead == ';') ADVANCE(236); - if (lookahead == 'd') ADVANCE(384); - if (lookahead == 'e') ADVANCE(493); - if (lookahead == 'l') ADVANCE(381); - if (lookahead == 'p') ADVANCE(350); - if (lookahead == 'u') ADVANCE(429); - if (('\t' <= lookahead && lookahead <= '\r') || - lookahead == ' ') ADVANCE(237); - if (lookahead == '!' || - lookahead == '%' || - lookahead == '&' || - lookahead == '*' || - lookahead == '+' || - lookahead == '-' || - lookahead == '/' || - ('<' <= lookahead && lookahead <= '?') || - lookahead == '^' || - lookahead == '_' || - lookahead == '|') ADVANCE(500); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(499); + if (lookahead == 'y') ADVANCE(5); END_STATE(); case 229: - if (lookahead == '(' || - lookahead == '[') ADVANCE(238); - if (lookahead == ')' || - lookahead == ']') ADVANCE(239); - if (lookahead == ':') ADVANCE(218); - if (lookahead == ';') ADVANCE(236); - if (('\t' <= lookahead && lookahead <= '\r') || - lookahead == ' ') ADVANCE(237); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(328); - if (lookahead == '!' || - lookahead == '%' || - lookahead == '&' || - lookahead == '*' || - lookahead == '+' || - lookahead == '-' || - ('/' <= lookahead && lookahead <= '?') || - lookahead == '^' || - lookahead == '_' || - lookahead == '|') ADVANCE(500); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(499); + if (lookahead == 'y') ADVANCE(155); END_STATE(); case 230: - if (lookahead == ')' || - lookahead == ']') ADVANCE(239); - if (lookahead == ':') ADVANCE(32); - if (lookahead == ';') ADVANCE(236); - if (('\t' <= lookahead && lookahead <= '\r') || - lookahead == ' ') ADVANCE(237); - if (lookahead == '!' || - lookahead == '%' || - lookahead == '&' || - lookahead == '*' || - lookahead == '+' || - lookahead == '-' || - lookahead == '/' || - ('<' <= lookahead && lookahead <= '?') || - lookahead == '^' || - lookahead == '_' || - lookahead == '|') ADVANCE(322); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(321); + if (lookahead == 'z') ADVANCE(67); END_STATE(); case 231: if (('0' <= lookahead && lookahead <= '9')) ADVANCE(331); @@ -1815,18 +1808,20 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { END_STATE(); case 233: if (eof) ADVANCE(235); - if (lookahead == '"') ADVANCE(1); - if (lookahead == '(' || - lookahead == '[') ADVANCE(238); - if (lookahead == ')' || - lookahead == ']') ADVANCE(239); - if (lookahead == '-') ADVANCE(402); - if (lookahead == ':') ADVANCE(46); - if (lookahead == ';') ADVANCE(236); - if (lookahead == 'N') ADVANCE(343); - if (lookahead == 'f') ADVANCE(345); - if (lookahead == 'i') ADVANCE(428); - if (lookahead == 't') ADVANCE(455); + ADVANCE_MAP( + '"', 1, + '-', 402, + ':', 49, + ';', 236, + 'N', 343, + 'f', 345, + 'i', 428, + 't', 455, + '(', 238, + '[', 238, + ')', 239, + ']', 239, + ); if (('\t' <= lookahead && lookahead <= '\r') || lookahead == ' ') ADVANCE(237); if (('0' <= lookahead && lookahead <= '9')) ADVANCE(327); @@ -1844,25 +1839,27 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { END_STATE(); case 234: if (eof) ADVANCE(235); - if (lookahead == '(' || - lookahead == '[') ADVANCE(238); - if (lookahead == ')' || - lookahead == ']') ADVANCE(239); - if (lookahead == ':') ADVANCE(34); - if (lookahead == ';') ADVANCE(236); - if (lookahead == 'b') ADVANCE(395); - if (lookahead == 'c') ADVANCE(341); - if (lookahead == 'd') ADVANCE(342); - if (lookahead == 'e') ADVANCE(493); - if (lookahead == 'f') ADVANCE(344); - if (lookahead == 'i') ADVANCE(421); - if (lookahead == 'l') ADVANCE(381); - if (lookahead == 'o') ADVANCE(486); - if (lookahead == 'p') ADVANCE(349); - if (lookahead == 'q') ADVANCE(485); - if (lookahead == 'r') ADVANCE(366); - if (lookahead == 's') ADVANCE(383); - if (lookahead == 'u') ADVANCE(429); + ADVANCE_MAP( + ':', 37, + ';', 236, + 'b', 395, + 'c', 341, + 'd', 342, + 'e', 493, + 'f', 344, + 'i', 421, + 'l', 381, + 'o', 486, + 'p', 349, + 'q', 485, + 'r', 366, + 's', 383, + 'u', 429, + '(', 238, + '[', 238, + ')', 239, + ']', 239, + ); if (('\t' <= lookahead && lookahead <= '\r') || lookahead == ' ') ADVANCE(237); if (('0' <= lookahead && lookahead <= '9')) ADVANCE(328); @@ -2052,7 +2049,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { END_STATE(); case 258: ACCEPT_TOKEN(anon_sym_rule); - if (lookahead == 's') ADVANCE(76); + if (lookahead == 's') ADVANCE(79); END_STATE(); case 259: ACCEPT_TOKEN(anon_sym_rule); @@ -2163,7 +2160,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { END_STATE(); case 271: ACCEPT_TOKEN(anon_sym_run); - if (lookahead == '-') ADVANCE(174); + if (lookahead == '-') ADVANCE(177); END_STATE(); case 272: ACCEPT_TOKEN(anon_sym_COLONuntil); @@ -2233,7 +2230,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { END_STATE(); case 280: ACCEPT_TOKEN(anon_sym_check); - if (lookahead == '-') ADVANCE(151); + if (lookahead == '-') ADVANCE(154); END_STATE(); case 281: ACCEPT_TOKEN(anon_sym_check); @@ -2578,17 +2575,9 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { END_STATE(); case 320: ACCEPT_TOKEN(anon_sym_EQ); - if (lookahead == '!' || - lookahead == '%' || - lookahead == '&' || - lookahead == '*' || - lookahead == '+' || - lookahead == '-' || - lookahead == '/' || - ('<' <= lookahead && lookahead <= '?') || - lookahead == '^' || - lookahead == '_' || - lookahead == '|') ADVANCE(500); + if ((set_contains(sym_type_character_set_1, 10, lookahead)) && + (lookahead < 'A' || 'Z' < lookahead) && + (lookahead < 'a' || 'z' < lookahead)) ADVANCE(500); if (('A' <= lookahead && lookahead <= 'Z') || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(499); END_STATE(); @@ -2611,17 +2600,9 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { END_STATE(); case 322: ACCEPT_TOKEN(sym_type); - if (lookahead == '!' || - lookahead == '%' || - lookahead == '&' || - lookahead == '*' || - lookahead == '+' || - lookahead == '-' || - lookahead == '/' || - ('<' <= lookahead && lookahead <= '?') || - lookahead == '^' || - lookahead == '_' || - lookahead == '|') ADVANCE(322); + if ((set_contains(sym_type_character_set_1, 10, lookahead)) && + (lookahead < 'A' || 'Z' < lookahead) && + (lookahead < 'a' || 'z' < lookahead)) ADVANCE(322); if (('A' <= lookahead && lookahead <= 'Z') || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(321); END_STATE(); @@ -3927,17 +3908,9 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { ACCEPT_TOKEN(sym_ident); if (lookahead == 'i') ADVANCE(430); if (('0' <= lookahead && lookahead <= '9')) ADVANCE(327); - if (lookahead == '!' || - lookahead == '%' || - lookahead == '&' || - lookahead == '*' || - lookahead == '+' || - lookahead == '-' || - lookahead == '/' || - ('<' <= lookahead && lookahead <= '?') || - lookahead == '^' || - lookahead == '_' || - lookahead == '|') ADVANCE(500); + if ((set_contains(sym_type_character_set_2, 10, lookahead)) && + (lookahead < 'A' || 'Z' < lookahead) && + (lookahead < 'a' || 'z' < lookahead)) ADVANCE(500); if (('A' <= lookahead && lookahead <= 'Z') || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(499); END_STATE(); @@ -5690,17 +5663,9 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { END_STATE(); case 500: ACCEPT_TOKEN(sym_ident); - if (lookahead == '!' || - lookahead == '%' || - lookahead == '&' || - lookahead == '*' || - lookahead == '+' || - lookahead == '-' || - lookahead == '/' || - ('<' <= lookahead && lookahead <= '?') || - lookahead == '^' || - lookahead == '_' || - lookahead == '|') ADVANCE(500); + if ((set_contains(sym_type_character_set_1, 10, lookahead)) && + (lookahead < 'A' || 'Z' < lookahead) && + (lookahead < 'a' || 'z' < lookahead)) ADVANCE(500); if (('A' <= lookahead && lookahead <= 'Z') || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(499); END_STATE(); @@ -5776,7 +5741,7 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = { [60] = {.lex_state = 233}, [61] = {.lex_state = 233}, [62] = {.lex_state = 234}, - [63] = {.lex_state = 228}, + [63] = {.lex_state = 9}, [64] = {.lex_state = 234}, [65] = {.lex_state = 234}, [66] = {.lex_state = 234}, @@ -5802,40 +5767,40 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = { [86] = {.lex_state = 234}, [87] = {.lex_state = 234}, [88] = {.lex_state = 234}, - [89] = {.lex_state = 229}, - [90] = {.lex_state = 229}, - [91] = {.lex_state = 229}, - [92] = {.lex_state = 229}, + [89] = {.lex_state = 7}, + [90] = {.lex_state = 7}, + [91] = {.lex_state = 7}, + [92] = {.lex_state = 7}, [93] = {.lex_state = 234}, - [94] = {.lex_state = 229}, + [94] = {.lex_state = 7}, [95] = {.lex_state = 234}, - [96] = {.lex_state = 229}, + [96] = {.lex_state = 7}, [97] = {.lex_state = 234}, - [98] = {.lex_state = 229}, + [98] = {.lex_state = 7}, [99] = {.lex_state = 234}, [100] = {.lex_state = 234}, - [101] = {.lex_state = 230}, + [101] = {.lex_state = 6}, [102] = {.lex_state = 234}, [103] = {.lex_state = 234}, - [104] = {.lex_state = 229}, + [104] = {.lex_state = 7}, [105] = {.lex_state = 234}, [106] = {.lex_state = 234}, - [107] = {.lex_state = 229}, - [108] = {.lex_state = 230}, + [107] = {.lex_state = 7}, + [108] = {.lex_state = 6}, [109] = {.lex_state = 234}, - [110] = {.lex_state = 229}, - [111] = {.lex_state = 229}, + [110] = {.lex_state = 7}, + [111] = {.lex_state = 7}, [112] = {.lex_state = 234}, [113] = {.lex_state = 234}, [114] = {.lex_state = 234}, [115] = {.lex_state = 234}, [116] = {.lex_state = 234}, [117] = {.lex_state = 234}, - [118] = {.lex_state = 7}, + [118] = {.lex_state = 10}, [119] = {.lex_state = 234}, [120] = {.lex_state = 234}, - [121] = {.lex_state = 230}, - [122] = {.lex_state = 7}, + [121] = {.lex_state = 6}, + [122] = {.lex_state = 10}, [123] = {.lex_state = 234}, [124] = {.lex_state = 234}, [125] = {.lex_state = 234}, @@ -5843,14 +5808,14 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = { [127] = {.lex_state = 234}, [128] = {.lex_state = 234}, [129] = {.lex_state = 234}, - [130] = {.lex_state = 229}, + [130] = {.lex_state = 7}, [131] = {.lex_state = 234}, - [132] = {.lex_state = 229}, - [133] = {.lex_state = 229}, - [134] = {.lex_state = 229}, - [135] = {.lex_state = 229}, - [136] = {.lex_state = 230}, - [137] = {.lex_state = 229}, + [132] = {.lex_state = 7}, + [133] = {.lex_state = 7}, + [134] = {.lex_state = 7}, + [135] = {.lex_state = 7}, + [136] = {.lex_state = 6}, + [137] = {.lex_state = 7}, [138] = {.lex_state = 234}, [139] = {.lex_state = 234}, [140] = {.lex_state = 234}, @@ -5859,22 +5824,22 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = { [143] = {.lex_state = 234}, [144] = {.lex_state = 234}, [145] = {.lex_state = 234}, - [146] = {.lex_state = 229}, + [146] = {.lex_state = 7}, [147] = {.lex_state = 234}, [148] = {.lex_state = 234}, [149] = {.lex_state = 234}, [150] = {.lex_state = 234}, [151] = {.lex_state = 234}, - [152] = {.lex_state = 229}, + [152] = {.lex_state = 7}, [153] = {.lex_state = 234}, [154] = {.lex_state = 234}, [155] = {.lex_state = 234}, [156] = {.lex_state = 234}, - [157] = {.lex_state = 230}, - [158] = {.lex_state = 230}, + [157] = {.lex_state = 6}, + [158] = {.lex_state = 6}, [159] = {.lex_state = 234}, [160] = {.lex_state = 234}, - [161] = {.lex_state = 230}, + [161] = {.lex_state = 6}, [162] = {.lex_state = 234}, [163] = {.lex_state = 234}, [164] = {.lex_state = 234}, @@ -5887,7 +5852,7 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = { [171] = {.lex_state = 234}, [172] = {.lex_state = 234}, [173] = {.lex_state = 234}, - [174] = {.lex_state = 229}, + [174] = {.lex_state = 7}, [175] = {.lex_state = 234}, [176] = {.lex_state = 234}, [177] = {.lex_state = 234}, @@ -5895,13 +5860,13 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = { [179] = {.lex_state = 234}, [180] = {.lex_state = 234}, [181] = {.lex_state = 234}, - [182] = {.lex_state = 6}, + [182] = {.lex_state = 8}, [183] = {.lex_state = 234}, [184] = {.lex_state = 234}, [185] = {.lex_state = 234}, [186] = {.lex_state = 234}, - [187] = {.lex_state = 229}, - [188] = {.lex_state = 229}, + [187] = {.lex_state = 7}, + [188] = {.lex_state = 7}, [189] = {.lex_state = 234}, [190] = {.lex_state = 234}, [191] = {.lex_state = 234}, @@ -5910,29 +5875,29 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = { [194] = {.lex_state = 234}, [195] = {.lex_state = 234}, [196] = {.lex_state = 234}, - [197] = {.lex_state = 229}, + [197] = {.lex_state = 7}, [198] = {.lex_state = 234}, [199] = {.lex_state = 234}, - [200] = {.lex_state = 229}, - [201] = {.lex_state = 229}, + [200] = {.lex_state = 7}, + [201] = {.lex_state = 7}, [202] = {.lex_state = 0}, [203] = {.lex_state = 234}, [204] = {.lex_state = 234}, - [205] = {.lex_state = 230}, + [205] = {.lex_state = 6}, [206] = {.lex_state = 234}, - [207] = {.lex_state = 229}, + [207] = {.lex_state = 7}, [208] = {.lex_state = 0}, [209] = {.lex_state = 234}, [210] = {.lex_state = 0}, [211] = {.lex_state = 234}, [212] = {.lex_state = 0}, - [213] = {.lex_state = 229}, - [214] = {.lex_state = 229}, + [213] = {.lex_state = 7}, + [214] = {.lex_state = 7}, [215] = {.lex_state = 0}, - [216] = {.lex_state = 229}, + [216] = {.lex_state = 7}, [217] = {.lex_state = 234}, [218] = {.lex_state = 234}, - [219] = {.lex_state = 229}, + [219] = {.lex_state = 7}, [220] = {.lex_state = 234}, [221] = {.lex_state = 234}, [222] = {.lex_state = 234}, @@ -5940,13 +5905,13 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = { [224] = {.lex_state = 234}, [225] = {.lex_state = 0}, [226] = {.lex_state = 234}, - [227] = {.lex_state = 229}, - [228] = {.lex_state = 229}, + [227] = {.lex_state = 7}, + [228] = {.lex_state = 7}, [229] = {.lex_state = 234}, [230] = {.lex_state = 234}, - [231] = {.lex_state = 230}, + [231] = {.lex_state = 6}, [232] = {.lex_state = 234}, - [233] = {.lex_state = 229}, + [233] = {.lex_state = 7}, [234] = {.lex_state = 234}, [235] = {.lex_state = 234}, [236] = {.lex_state = 0}, @@ -5959,30 +5924,30 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = { [243] = {.lex_state = 0}, [244] = {.lex_state = 234}, [245] = {.lex_state = 0}, - [246] = {.lex_state = 229}, - [247] = {.lex_state = 229}, + [246] = {.lex_state = 7}, + [247] = {.lex_state = 7}, [248] = {.lex_state = 234}, [249] = {.lex_state = 234}, - [250] = {.lex_state = 229}, + [250] = {.lex_state = 7}, [251] = {.lex_state = 234}, [252] = {.lex_state = 234}, [253] = {.lex_state = 234}, - [254] = {.lex_state = 230}, + [254] = {.lex_state = 6}, [255] = {.lex_state = 234}, [256] = {.lex_state = 234}, [257] = {.lex_state = 234}, [258] = {.lex_state = 234}, - [259] = {.lex_state = 230}, - [260] = {.lex_state = 229}, - [261] = {.lex_state = 229}, + [259] = {.lex_state = 6}, + [260] = {.lex_state = 7}, + [261] = {.lex_state = 7}, [262] = {.lex_state = 234}, - [263] = {.lex_state = 229}, - [264] = {.lex_state = 229}, - [265] = {.lex_state = 229}, - [266] = {.lex_state = 229}, + [263] = {.lex_state = 7}, + [264] = {.lex_state = 7}, + [265] = {.lex_state = 7}, + [266] = {.lex_state = 7}, [267] = {.lex_state = 0}, [268] = {.lex_state = 234}, - [269] = {.lex_state = 229}, + [269] = {.lex_state = 7}, [270] = {.lex_state = 234}, }; @@ -9988,7 +9953,7 @@ static const TSParseActionEntry ts_parse_actions[] = { [0] = {.entry = {.count = 0, .reusable = false}}, [1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(), [3] = {.entry = {.count = 1, .reusable = true}}, SHIFT_EXTRA(), - [5] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 0), + [5] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 0, 0, 0), [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(267), [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(129), @@ -10032,14 +9997,14 @@ static const TSParseActionEntry ts_parse_actions[] = { [87] = {.entry = {.count = 1, .reusable = true}}, SHIFT(163), [89] = {.entry = {.count = 1, .reusable = true}}, SHIFT(49), [91] = {.entry = {.count = 1, .reusable = true}}, SHIFT(25), - [93] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_command_repeat2, 2), SHIFT_REPEAT(188), - [96] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_command_repeat2, 2), - [98] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_command_repeat2, 2), SHIFT_REPEAT(50), - [101] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_command_repeat2, 2), SHIFT_REPEAT(51), - [104] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_command_repeat2, 2), SHIFT_REPEAT(52), - [107] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_command_repeat2, 2), SHIFT_REPEAT(52), - [110] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_command_repeat2, 2), SHIFT_REPEAT(53), - [113] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_command_repeat2, 2), SHIFT_REPEAT(54), + [93] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_command_repeat2, 2, 0, 0), SHIFT_REPEAT(188), + [96] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_command_repeat2, 2, 0, 0), + [98] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_command_repeat2, 2, 0, 0), SHIFT_REPEAT(50), + [101] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_command_repeat2, 2, 0, 0), SHIFT_REPEAT(51), + [104] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_command_repeat2, 2, 0, 0), SHIFT_REPEAT(52), + [107] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_command_repeat2, 2, 0, 0), SHIFT_REPEAT(52), + [110] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_command_repeat2, 2, 0, 0), SHIFT_REPEAT(53), + [113] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_command_repeat2, 2, 0, 0), SHIFT_REPEAT(54), [116] = {.entry = {.count = 1, .reusable = true}}, SHIFT(253), [118] = {.entry = {.count = 1, .reusable = true}}, SHIFT(31), [120] = {.entry = {.count = 1, .reusable = true}}, SHIFT(226), @@ -10048,54 +10013,54 @@ static const TSParseActionEntry ts_parse_actions[] = { [126] = {.entry = {.count = 1, .reusable = true}}, SHIFT(255), [128] = {.entry = {.count = 1, .reusable = true}}, SHIFT(131), [130] = {.entry = {.count = 1, .reusable = true}}, SHIFT(222), - [132] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_callexpr, 3), - [134] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_callexpr, 3), - [136] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_callexpr, 4), - [138] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_callexpr, 4), - [140] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_bool, 1), - [142] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_bool, 1), - [144] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_literal, 1), - [146] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_literal, 1), - [148] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_f64, 1), - [150] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_f64, 1), - [152] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expr, 1), - [154] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_expr, 1), - [156] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_symstring, 1), - [158] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_symstring, 1), - [160] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_unit, 2), - [162] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_unit, 2), - [164] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_command_repeat2, 1), + [132] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_callexpr, 3, 0, 0), + [134] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_callexpr, 3, 0, 0), + [136] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_callexpr, 4, 0, 0), + [138] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_callexpr, 4, 0, 0), + [140] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_bool, 1, 0, 0), + [142] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_bool, 1, 0, 0), + [144] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_literal, 1, 0, 0), + [146] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_literal, 1, 0, 0), + [148] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_f64, 1, 0, 0), + [150] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_f64, 1, 0, 0), + [152] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_expr, 1, 0, 0), + [154] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_expr, 1, 0, 0), + [156] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_symstring, 1, 0, 0), + [158] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_symstring, 1, 0, 0), + [160] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_unit, 2, 0, 0), + [162] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_unit, 2, 0, 0), + [164] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_command_repeat2, 1, 0, 0), [166] = {.entry = {.count = 1, .reusable = true}}, SHIFT(185), - [168] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_command_repeat2, 1), - [170] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_schedule, 5), - [172] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_schedule, 5), - [174] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_schedule, 1), - [176] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_schedule, 1), - [178] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_schedule, 3), - [180] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_schedule, 3), - [182] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_schedule, 6), - [184] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_schedule, 6), - [186] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_schedule, 4), - [188] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_schedule, 4), + [168] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_command_repeat2, 1, 0, 0), + [170] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_schedule, 5, 0, 0), + [172] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_schedule, 5, 0, 0), + [174] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_schedule, 1, 0, 0), + [176] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_schedule, 1, 0, 0), + [178] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_schedule, 3, 0, 0), + [180] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_schedule, 3, 0, 0), + [182] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_schedule, 6, 0, 0), + [184] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_schedule, 6, 0, 0), + [186] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_schedule, 4, 0, 0), + [188] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_schedule, 4, 0, 0), [190] = {.entry = {.count = 1, .reusable = true}}, SHIFT(116), [192] = {.entry = {.count = 1, .reusable = true}}, SHIFT(256), [194] = {.entry = {.count = 1, .reusable = true}}, SHIFT(34), [196] = {.entry = {.count = 1, .reusable = true}}, SHIFT(29), [198] = {.entry = {.count = 1, .reusable = true}}, SHIFT(257), [200] = {.entry = {.count = 1, .reusable = false}}, SHIFT(200), - [202] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), - [204] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2), SHIFT_REPEAT(2), - [207] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1), + [202] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2, 0, 0), + [204] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_source_file_repeat1, 2, 0, 0), SHIFT_REPEAT(2), + [207] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1, 0, 0), [209] = {.entry = {.count = 1, .reusable = true}}, SHIFT(63), [211] = {.entry = {.count = 1, .reusable = true}}, SHIFT(148), [213] = {.entry = {.count = 1, .reusable = true}}, SHIFT(160), [215] = {.entry = {.count = 1, .reusable = true}}, SHIFT(145), [217] = {.entry = {.count = 1, .reusable = true}}, SHIFT(151), - [219] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_command_repeat3, 2), SHIFT_REPEAT(63), - [222] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_command_repeat3, 2), - [224] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_schema, 3), + [219] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_command_repeat3, 2, 0, 0), SHIFT_REPEAT(63), + [222] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_command_repeat3, 2, 0, 0), + [224] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_schema, 3, 0, 0), [226] = {.entry = {.count = 1, .reusable = true}}, SHIFT(125), - [228] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_schema, 4), + [228] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_schema, 4, 0, 0), [230] = {.entry = {.count = 1, .reusable = true}}, SHIFT(159), [232] = {.entry = {.count = 1, .reusable = true}}, SHIFT(156), [234] = {.entry = {.count = 1, .reusable = true}}, SHIFT(182), @@ -10107,7 +10072,7 @@ static const TSParseActionEntry ts_parse_actions[] = { [246] = {.entry = {.count = 1, .reusable = true}}, SHIFT(61), [248] = {.entry = {.count = 1, .reusable = true}}, SHIFT(132), [250] = {.entry = {.count = 1, .reusable = true}}, SHIFT(162), - [252] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_cost, 2), + [252] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_cost, 2, 0, 0), [254] = {.entry = {.count = 1, .reusable = true}}, SHIFT(206), [256] = {.entry = {.count = 1, .reusable = true}}, SHIFT(218), [258] = {.entry = {.count = 1, .reusable = true}}, SHIFT(118), @@ -10116,11 +10081,11 @@ static const TSParseActionEntry ts_parse_actions[] = { [264] = {.entry = {.count = 1, .reusable = true}}, SHIFT(59), [266] = {.entry = {.count = 1, .reusable = true}}, SHIFT(57), [268] = {.entry = {.count = 1, .reusable = true}}, SHIFT(191), - [270] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_command_repeat5, 2), SHIFT_REPEAT(182), - [273] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_command_repeat5, 2), - [275] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_command_repeat7, 2), SHIFT_REPEAT(118), - [278] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_command_repeat7, 2), - [280] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_command_repeat7, 2), SHIFT_REPEAT(137), + [270] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_command_repeat5, 2, 0, 0), SHIFT_REPEAT(182), + [273] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_command_repeat5, 2, 0, 0), + [275] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_command_repeat7, 2, 0, 0), SHIFT_REPEAT(118), + [278] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_command_repeat7, 2, 0, 0), + [280] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_command_repeat7, 2, 0, 0), SHIFT_REPEAT(137), [283] = {.entry = {.count = 1, .reusable = true}}, SHIFT(60), [285] = {.entry = {.count = 1, .reusable = true}}, SHIFT(179), [287] = {.entry = {.count = 1, .reusable = true}}, SHIFT(121), @@ -10132,18 +10097,18 @@ static const TSParseActionEntry ts_parse_actions[] = { [299] = {.entry = {.count = 1, .reusable = true}}, SHIFT(199), [301] = {.entry = {.count = 1, .reusable = true}}, SHIFT(45), [303] = {.entry = {.count = 1, .reusable = true}}, SHIFT(47), - [305] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_command_repeat6, 2), SHIFT_REPEAT(233), - [308] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_command_repeat6, 2), - [310] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_command_repeat1, 2), SHIFT_REPEAT(266), - [313] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_command_repeat1, 2), + [305] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_command_repeat6, 2, 0, 0), SHIFT_REPEAT(233), + [308] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_command_repeat6, 2, 0, 0), + [310] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_command_repeat1, 2, 0, 0), SHIFT_REPEAT(266), + [313] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_command_repeat1, 2, 0, 0), [315] = {.entry = {.count = 1, .reusable = true}}, SHIFT(130), [317] = {.entry = {.count = 1, .reusable = true}}, SHIFT(107), [319] = {.entry = {.count = 1, .reusable = true}}, SHIFT(270), [321] = {.entry = {.count = 1, .reusable = true}}, SHIFT(266), [323] = {.entry = {.count = 1, .reusable = true}}, SHIFT(233), [325] = {.entry = {.count = 1, .reusable = true}}, SHIFT(15), - [327] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_command_repeat4, 2), - [329] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_command_repeat4, 2), SHIFT_REPEAT(121), + [327] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_command_repeat4, 2, 0, 0), + [329] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_command_repeat4, 2, 0, 0), SHIFT_REPEAT(121), [332] = {.entry = {.count = 1, .reusable = true}}, SHIFT(152), [334] = {.entry = {.count = 1, .reusable = true}}, SHIFT(90), [336] = {.entry = {.count = 1, .reusable = true}}, SHIFT(220), @@ -10151,40 +10116,40 @@ static const TSParseActionEntry ts_parse_actions[] = { [340] = {.entry = {.count = 1, .reusable = true}}, SHIFT(149), [342] = {.entry = {.count = 1, .reusable = true}}, SHIFT(28), [344] = {.entry = {.count = 1, .reusable = true}}, SHIFT(26), - [346] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_nonletaction, 7), - [348] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 1), - [350] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_nonletaction, 1), - [352] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_top_parens, 2), + [346] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_nonletaction, 7, 0, 0), + [348] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 1, 0, 0), + [350] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_nonletaction, 1, 0, 0), + [352] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_top_parens, 2, 0, 0), [354] = {.entry = {.count = 1, .reusable = true}}, SHIFT(109), [356] = {.entry = {.count = 1, .reusable = true}}, SHIFT(170), - [358] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_nonletaction, 4), + [358] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_nonletaction, 4, 0, 0), [360] = {.entry = {.count = 1, .reusable = true}}, SHIFT(231), - [362] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 15), - [364] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_nonletaction, 5), - [366] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 14), - [368] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 5), - [370] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 13), - [372] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 12), - [374] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 11), + [362] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 15, 0, 0), + [364] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_nonletaction, 5, 0, 0), + [366] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 14, 0, 0), + [368] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 5, 0, 0), + [370] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 13, 0, 0), + [372] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 12, 0, 0), + [374] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 11, 0, 0), [376] = {.entry = {.count = 1, .reusable = true}}, SHIFT(144), [378] = {.entry = {.count = 1, .reusable = true}}, SHIFT(42), [380] = {.entry = {.count = 1, .reusable = true}}, SHIFT(38), [382] = {.entry = {.count = 1, .reusable = true}}, SHIFT(122), [384] = {.entry = {.count = 1, .reusable = true}}, SHIFT(58), - [386] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 10), + [386] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 10, 0, 0), [388] = {.entry = {.count = 1, .reusable = true}}, SHIFT(147), [390] = {.entry = {.count = 1, .reusable = true}}, SHIFT(24), [392] = {.entry = {.count = 1, .reusable = true}}, SHIFT(43), - [394] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 9), - [396] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 6), + [394] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 9, 0, 0), + [396] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 6, 0, 0), [398] = {.entry = {.count = 1, .reusable = true}}, SHIFT(227), [400] = {.entry = {.count = 1, .reusable = true}}, SHIFT(225), [402] = {.entry = {.count = 1, .reusable = true}}, SHIFT(82), [404] = {.entry = {.count = 1, .reusable = true}}, SHIFT(169), - [406] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 8), + [406] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 8, 0, 0), [408] = {.entry = {.count = 1, .reusable = true}}, SHIFT(269), [410] = {.entry = {.count = 1, .reusable = true}}, SHIFT(268), - [412] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_nonletaction, 8), + [412] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_nonletaction, 8, 0, 0), [414] = {.entry = {.count = 1, .reusable = true}}, SHIFT(153), [416] = {.entry = {.count = 1, .reusable = true}}, SHIFT(214), [418] = {.entry = {.count = 1, .reusable = true}}, SHIFT(215), @@ -10196,16 +10161,16 @@ static const TSParseActionEntry ts_parse_actions[] = { [430] = {.entry = {.count = 1, .reusable = true}}, SHIFT(202), [432] = {.entry = {.count = 1, .reusable = true}}, SHIFT(32), [434] = {.entry = {.count = 1, .reusable = true}}, SHIFT(22), - [436] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 4), - [438] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 7), - [440] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 3), - [442] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_nonletaction, 6), - [444] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_identsort, 4), + [436] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 4, 0, 0), + [438] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 7, 0, 0), + [440] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_command, 3, 0, 0), + [442] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_nonletaction, 6, 0, 0), + [444] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_identsort, 4, 0, 0), [446] = {.entry = {.count = 1, .reusable = true}}, SHIFT(219), - [448] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 1), + [448] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 1, 0, 0), [450] = {.entry = {.count = 1, .reusable = true}}, SHIFT(106), [452] = {.entry = {.count = 1, .reusable = true}}, SHIFT(113), - [454] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_variant, 3), + [454] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_variant, 3, 0, 0), [456] = {.entry = {.count = 1, .reusable = true}}, SHIFT(142), [458] = {.entry = {.count = 1, .reusable = true}}, SHIFT(37), [460] = {.entry = {.count = 1, .reusable = true}}, SHIFT(143), @@ -10213,17 +10178,17 @@ static const TSParseActionEntry ts_parse_actions[] = { [464] = {.entry = {.count = 1, .reusable = true}}, SHIFT(186), [466] = {.entry = {.count = 1, .reusable = true}}, SHIFT(234), [468] = {.entry = {.count = 1, .reusable = true}}, SHIFT(243), - [470] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 5), - [472] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_fact, 1), - [474] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_variant, 4), + [470] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 5, 0, 0), + [472] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_fact, 1, 0, 0), + [474] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_variant, 4, 0, 0), [476] = {.entry = {.count = 1, .reusable = true}}, SHIFT(236), [478] = {.entry = {.count = 1, .reusable = false}}, SHIFT(18), [480] = {.entry = {.count = 1, .reusable = true}}, SHIFT(203), - [482] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_fact, 5), + [482] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_fact, 5, 0, 0), [484] = {.entry = {.count = 1, .reusable = true}}, SHIFT(87), [486] = {.entry = {.count = 1, .reusable = true}}, SHIFT(55), [488] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12), - [490] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_variant, 5), + [490] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_variant, 5, 0, 0), [492] = {.entry = {.count = 1, .reusable = true}}, SHIFT(228), [494] = {.entry = {.count = 1, .reusable = true}}, SHIFT(79), [496] = {.entry = {.count = 1, .reusable = true}}, SHIFT(216), @@ -10287,11 +10252,15 @@ static const TSParseActionEntry ts_parse_actions[] = { #ifdef __cplusplus extern "C" { #endif -#ifdef _WIN32 -#define extern __declspec(dllexport) +#ifdef TREE_SITTER_HIDE_SYMBOLS +#define TS_PUBLIC +#elif defined(_WIN32) +#define TS_PUBLIC __declspec(dllexport) +#else +#define TS_PUBLIC __attribute__((visibility("default"))) #endif -extern const TSLanguage *tree_sitter_egglog(void) { +TS_PUBLIC const TSLanguage *tree_sitter_egglog(void) { static const TSLanguage language = { .version = LANGUAGE_VERSION, .symbol_count = SYMBOL_COUNT, diff --git a/tree-sitter-egglog/src/tree_sitter/alloc.h b/tree-sitter-egglog/src/tree_sitter/alloc.h new file mode 100644 index 0000000..1f4466d --- /dev/null +++ b/tree-sitter-egglog/src/tree_sitter/alloc.h @@ -0,0 +1,54 @@ +#ifndef TREE_SITTER_ALLOC_H_ +#define TREE_SITTER_ALLOC_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +// Allow clients to override allocation functions +#ifdef TREE_SITTER_REUSE_ALLOCATOR + +extern void *(*ts_current_malloc)(size_t); +extern void *(*ts_current_calloc)(size_t, size_t); +extern void *(*ts_current_realloc)(void *, size_t); +extern void (*ts_current_free)(void *); + +#ifndef ts_malloc +#define ts_malloc ts_current_malloc +#endif +#ifndef ts_calloc +#define ts_calloc ts_current_calloc +#endif +#ifndef ts_realloc +#define ts_realloc ts_current_realloc +#endif +#ifndef ts_free +#define ts_free ts_current_free +#endif + +#else + +#ifndef ts_malloc +#define ts_malloc malloc +#endif +#ifndef ts_calloc +#define ts_calloc calloc +#endif +#ifndef ts_realloc +#define ts_realloc realloc +#endif +#ifndef ts_free +#define ts_free free +#endif + +#endif + +#ifdef __cplusplus +} +#endif + +#endif // TREE_SITTER_ALLOC_H_ diff --git a/tree-sitter-egglog/src/tree_sitter/array.h b/tree-sitter-egglog/src/tree_sitter/array.h new file mode 100644 index 0000000..15a3b23 --- /dev/null +++ b/tree-sitter-egglog/src/tree_sitter/array.h @@ -0,0 +1,290 @@ +#ifndef TREE_SITTER_ARRAY_H_ +#define TREE_SITTER_ARRAY_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "./alloc.h" + +#include +#include +#include +#include +#include + +#ifdef _MSC_VER +#pragma warning(disable : 4101) +#elif defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-variable" +#endif + +#define Array(T) \ + struct { \ + T *contents; \ + uint32_t size; \ + uint32_t capacity; \ + } + +/// Initialize an array. +#define array_init(self) \ + ((self)->size = 0, (self)->capacity = 0, (self)->contents = NULL) + +/// Create an empty array. +#define array_new() \ + { NULL, 0, 0 } + +/// Get a pointer to the element at a given `index` in the array. +#define array_get(self, _index) \ + (assert((uint32_t)(_index) < (self)->size), &(self)->contents[_index]) + +/// Get a pointer to the first element in the array. +#define array_front(self) array_get(self, 0) + +/// Get a pointer to the last element in the array. +#define array_back(self) array_get(self, (self)->size - 1) + +/// Clear the array, setting its size to zero. Note that this does not free any +/// memory allocated for the array's contents. +#define array_clear(self) ((self)->size = 0) + +/// Reserve `new_capacity` elements of space in the array. If `new_capacity` is +/// less than the array's current capacity, this function has no effect. +#define array_reserve(self, new_capacity) \ + _array__reserve((Array *)(self), array_elem_size(self), new_capacity) + +/// Free any memory allocated for this array. Note that this does not free any +/// memory allocated for the array's contents. +#define array_delete(self) _array__delete((Array *)(self)) + +/// Push a new `element` onto the end of the array. +#define array_push(self, element) \ + (_array__grow((Array *)(self), 1, array_elem_size(self)), \ + (self)->contents[(self)->size++] = (element)) + +/// Increase the array's size by `count` elements. +/// New elements are zero-initialized. +#define array_grow_by(self, count) \ + do { \ + if ((count) == 0) break; \ + _array__grow((Array *)(self), count, array_elem_size(self)); \ + memset((self)->contents + (self)->size, 0, (count) * array_elem_size(self)); \ + (self)->size += (count); \ + } while (0) + +/// Append all elements from one array to the end of another. +#define array_push_all(self, other) \ + array_extend((self), (other)->size, (other)->contents) + +/// Append `count` elements to the end of the array, reading their values from the +/// `contents` pointer. +#define array_extend(self, count, contents) \ + _array__splice( \ + (Array *)(self), array_elem_size(self), (self)->size, \ + 0, count, contents \ + ) + +/// Remove `old_count` elements from the array starting at the given `index`. At +/// the same index, insert `new_count` new elements, reading their values from the +/// `new_contents` pointer. +#define array_splice(self, _index, old_count, new_count, new_contents) \ + _array__splice( \ + (Array *)(self), array_elem_size(self), _index, \ + old_count, new_count, new_contents \ + ) + +/// Insert one `element` into the array at the given `index`. +#define array_insert(self, _index, element) \ + _array__splice((Array *)(self), array_elem_size(self), _index, 0, 1, &(element)) + +/// Remove one element from the array at the given `index`. +#define array_erase(self, _index) \ + _array__erase((Array *)(self), array_elem_size(self), _index) + +/// Pop the last element off the array, returning the element by value. +#define array_pop(self) ((self)->contents[--(self)->size]) + +/// Assign the contents of one array to another, reallocating if necessary. +#define array_assign(self, other) \ + _array__assign((Array *)(self), (const Array *)(other), array_elem_size(self)) + +/// Swap one array with another +#define array_swap(self, other) \ + _array__swap((Array *)(self), (Array *)(other)) + +/// Get the size of the array contents +#define array_elem_size(self) (sizeof *(self)->contents) + +/// Search a sorted array for a given `needle` value, using the given `compare` +/// callback to determine the order. +/// +/// If an existing element is found to be equal to `needle`, then the `index` +/// out-parameter is set to the existing value's index, and the `exists` +/// out-parameter is set to true. Otherwise, `index` is set to an index where +/// `needle` should be inserted in order to preserve the sorting, and `exists` +/// is set to false. +#define array_search_sorted_with(self, compare, needle, _index, _exists) \ + _array__search_sorted(self, 0, compare, , needle, _index, _exists) + +/// Search a sorted array for a given `needle` value, using integer comparisons +/// of a given struct field (specified with a leading dot) to determine the order. +/// +/// See also `array_search_sorted_with`. +#define array_search_sorted_by(self, field, needle, _index, _exists) \ + _array__search_sorted(self, 0, _compare_int, field, needle, _index, _exists) + +/// Insert a given `value` into a sorted array, using the given `compare` +/// callback to determine the order. +#define array_insert_sorted_with(self, compare, value) \ + do { \ + unsigned _index, _exists; \ + array_search_sorted_with(self, compare, &(value), &_index, &_exists); \ + if (!_exists) array_insert(self, _index, value); \ + } while (0) + +/// Insert a given `value` into a sorted array, using integer comparisons of +/// a given struct field (specified with a leading dot) to determine the order. +/// +/// See also `array_search_sorted_by`. +#define array_insert_sorted_by(self, field, value) \ + do { \ + unsigned _index, _exists; \ + array_search_sorted_by(self, field, (value) field, &_index, &_exists); \ + if (!_exists) array_insert(self, _index, value); \ + } while (0) + +// Private + +typedef Array(void) Array; + +/// This is not what you're looking for, see `array_delete`. +static inline void _array__delete(Array *self) { + if (self->contents) { + ts_free(self->contents); + self->contents = NULL; + self->size = 0; + self->capacity = 0; + } +} + +/// This is not what you're looking for, see `array_erase`. +static inline void _array__erase(Array *self, size_t element_size, + uint32_t index) { + assert(index < self->size); + char *contents = (char *)self->contents; + memmove(contents + index * element_size, contents + (index + 1) * element_size, + (self->size - index - 1) * element_size); + self->size--; +} + +/// This is not what you're looking for, see `array_reserve`. +static inline void _array__reserve(Array *self, size_t element_size, uint32_t new_capacity) { + if (new_capacity > self->capacity) { + if (self->contents) { + self->contents = ts_realloc(self->contents, new_capacity * element_size); + } else { + self->contents = ts_malloc(new_capacity * element_size); + } + self->capacity = new_capacity; + } +} + +/// This is not what you're looking for, see `array_assign`. +static inline void _array__assign(Array *self, const Array *other, size_t element_size) { + _array__reserve(self, element_size, other->size); + self->size = other->size; + memcpy(self->contents, other->contents, self->size * element_size); +} + +/// This is not what you're looking for, see `array_swap`. +static inline void _array__swap(Array *self, Array *other) { + Array swap = *other; + *other = *self; + *self = swap; +} + +/// This is not what you're looking for, see `array_push` or `array_grow_by`. +static inline void _array__grow(Array *self, uint32_t count, size_t element_size) { + uint32_t new_size = self->size + count; + if (new_size > self->capacity) { + uint32_t new_capacity = self->capacity * 2; + if (new_capacity < 8) new_capacity = 8; + if (new_capacity < new_size) new_capacity = new_size; + _array__reserve(self, element_size, new_capacity); + } +} + +/// This is not what you're looking for, see `array_splice`. +static inline void _array__splice(Array *self, size_t element_size, + uint32_t index, uint32_t old_count, + uint32_t new_count, const void *elements) { + uint32_t new_size = self->size + new_count - old_count; + uint32_t old_end = index + old_count; + uint32_t new_end = index + new_count; + assert(old_end <= self->size); + + _array__reserve(self, element_size, new_size); + + char *contents = (char *)self->contents; + if (self->size > old_end) { + memmove( + contents + new_end * element_size, + contents + old_end * element_size, + (self->size - old_end) * element_size + ); + } + if (new_count > 0) { + if (elements) { + memcpy( + (contents + index * element_size), + elements, + new_count * element_size + ); + } else { + memset( + (contents + index * element_size), + 0, + new_count * element_size + ); + } + } + self->size += new_count - old_count; +} + +/// A binary search routine, based on Rust's `std::slice::binary_search_by`. +/// This is not what you're looking for, see `array_search_sorted_with` or `array_search_sorted_by`. +#define _array__search_sorted(self, start, compare, suffix, needle, _index, _exists) \ + do { \ + *(_index) = start; \ + *(_exists) = false; \ + uint32_t size = (self)->size - *(_index); \ + if (size == 0) break; \ + int comparison; \ + while (size > 1) { \ + uint32_t half_size = size / 2; \ + uint32_t mid_index = *(_index) + half_size; \ + comparison = compare(&((self)->contents[mid_index] suffix), (needle)); \ + if (comparison <= 0) *(_index) = mid_index; \ + size -= half_size; \ + } \ + comparison = compare(&((self)->contents[*(_index)] suffix), (needle)); \ + if (comparison == 0) *(_exists) = true; \ + else if (comparison < 0) *(_index) += 1; \ + } while (0) + +/// Helper macro for the `_sorted_by` routines below. This takes the left (existing) +/// parameter by reference in order to work with the generic sorting function above. +#define _compare_int(a, b) ((int)*(a) - (int)(b)) + +#ifdef _MSC_VER +#pragma warning(default : 4101) +#elif defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif + +#ifdef __cplusplus +} +#endif + +#endif // TREE_SITTER_ARRAY_H_ diff --git a/tree-sitter-egglog/src/tree_sitter/parser.h b/tree-sitter-egglog/src/tree_sitter/parser.h index 17b4fde..17f0e94 100644 --- a/tree-sitter-egglog/src/tree_sitter/parser.h +++ b/tree-sitter-egglog/src/tree_sitter/parser.h @@ -86,6 +86,11 @@ typedef union { } entry; } TSParseActionEntry; +typedef struct { + int32_t start; + int32_t end; +} TSCharacterRange; + struct TSLanguage { uint32_t version; uint32_t symbol_count; @@ -125,6 +130,24 @@ struct TSLanguage { const TSStateId *primary_state_ids; }; +static inline bool set_contains(TSCharacterRange *ranges, uint32_t len, int32_t lookahead) { + uint32_t index = 0; + uint32_t size = len - index; + while (size > 1) { + uint32_t half_size = size / 2; + uint32_t mid_index = index + half_size; + TSCharacterRange *range = &ranges[mid_index]; + if (lookahead >= range->start && lookahead <= range->end) { + return true; + } else if (lookahead > range->end) { + index = mid_index; + } + size -= half_size; + } + TSCharacterRange *range = &ranges[index]; + return (lookahead >= range->start && lookahead <= range->end); +} + /* * Lexer Macros */ @@ -154,6 +177,17 @@ struct TSLanguage { goto next_state; \ } +#define ADVANCE_MAP(...) \ + { \ + static const uint16_t map[] = { __VA_ARGS__ }; \ + for (uint32_t i = 0; i < sizeof(map) / sizeof(map[0]); i += 2) { \ + if (map[i] == lookahead) { \ + state = map[i + 1]; \ + goto next_state; \ + } \ + } \ + } + #define SKIP(state_value) \ { \ skip = true; \ @@ -203,14 +237,15 @@ struct TSLanguage { } \ }} -#define REDUCE(symbol_val, child_count_val, ...) \ - {{ \ - .reduce = { \ - .type = TSParseActionTypeReduce, \ - .symbol = symbol_val, \ - .child_count = child_count_val, \ - __VA_ARGS__ \ - }, \ +#define REDUCE(symbol_name, children, precedence, prod_id) \ + {{ \ + .reduce = { \ + .type = TSParseActionTypeReduce, \ + .symbol = symbol_name, \ + .child_count = children, \ + .dynamic_precedence = precedence, \ + .production_id = prod_id \ + }, \ }} #define RECOVER() \