Compare commits
15 Commits
Author | SHA1 | Date |
---|---|---|
Erin | 67e1d26c15 | |
ondra05 | dd261e5d6c | |
ondra05 | 4d6b30bcd0 | |
ondra05 | dbaa390113 | |
ondra05 | f220e5d12d | |
ondra05 | 1a9cf6c2a6 | |
ondra05 | 8ef7118dc1 | |
ondra05 | 8970dabcfd | |
ondra05 | 2f5306795f | |
ondra05 | daca854db4 | |
ondra05 | e2008be0e3 | |
ondra05 | b7c9a4b74d | |
ondra05 | 1bb33066ed | |
ondra05 | c4fda0c0ec | |
ondra05 | a9cdc03341 |
|
@ -4,7 +4,7 @@ version = 3
|
|||
|
||||
[[package]]
|
||||
name = "ablescript"
|
||||
version = "0.5.0"
|
||||
version = "0.5.4"
|
||||
dependencies = [
|
||||
"logos",
|
||||
"rand",
|
||||
|
@ -12,7 +12,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "ablescript_cli"
|
||||
version = "0.5.0"
|
||||
version = "0.5.4"
|
||||
dependencies = [
|
||||
"ablescript",
|
||||
"clap",
|
||||
|
@ -20,21 +20,52 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.14"
|
||||
name = "anstream"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
||||
checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
"winapi",
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
"anstyle-query",
|
||||
"anstyle-wincon",
|
||||
"colorchoice",
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
name = "anstyle"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-parse"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140"
|
||||
dependencies = [
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-query"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
|
||||
dependencies = [
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-wincon"
|
||||
version = "3.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "beef"
|
||||
|
@ -49,10 +80,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.73"
|
||||
name = "bitflags"
|
||||
version = "2.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
|
||||
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
|
@ -62,39 +93,61 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "3.2.8"
|
||||
version = "4.4.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "190814073e85d238f31ff738fcb0bf6910cedeb73376c87cd69291028966fd83"
|
||||
checksum = "41fffed7514f420abec6d183b1d3acfd9099c79c3a10a06ade4f8203f1411272"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"bitflags",
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "63361bae7eef3771745f02d8d892bec2fee5f6e34af316ba556e7f97a7069ff1"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
"clap_lex",
|
||||
"indexmap",
|
||||
"strsim",
|
||||
"termcolor",
|
||||
"textwrap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.2.4"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
|
||||
dependencies = [
|
||||
"os_str_bytes",
|
||||
]
|
||||
checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"
|
||||
|
||||
[[package]]
|
||||
name = "clipboard-win"
|
||||
version = "4.4.1"
|
||||
version = "4.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2f3e1238132dc01f081e1cbb9dace14e5ef4c3a51ee244bd982275fb514605db"
|
||||
checksum = "7191c27c2357d9b7ef96baac1773290d4ca63b24205b82a3fd8a0637afcf0362"
|
||||
dependencies = [
|
||||
"error-code",
|
||||
"str-buf",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "colorchoice"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
|
||||
|
||||
[[package]]
|
||||
name = "dirs-next"
|
||||
version = "2.0.0"
|
||||
|
@ -124,23 +177,12 @@ checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d"
|
|||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.2.8"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
|
||||
checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
|
||||
dependencies = [
|
||||
"errno-dragonfly",
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "errno-dragonfly"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -155,13 +197,13 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "fd-lock"
|
||||
version = "3.0.6"
|
||||
version = "3.0.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e11dcc7e4d79a8c89b9ab4c6f5c30b1fc4a83c420792da3542fd31179ed5f517"
|
||||
checksum = "ef033ed5e9bad94e55838ca0ca906db0e043f517adda0c8b79c7a8c66c93c1b5"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"rustix",
|
||||
"windows-sys",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -172,9 +214,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
|||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.7"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
|
||||
checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
|
@ -182,71 +224,54 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.1"
|
||||
name = "heck"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "io-lifetimes"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24c3f4eff5495aee4c0399d7b6a0dc2b6e81be84242ffbfcf253ebacccc1d0cb"
|
||||
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.126"
|
||||
version = "0.2.150"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
|
||||
checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.0.46"
|
||||
name = "libredox"
|
||||
version = "0.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
|
||||
checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"bitflags 2.4.1",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "logos"
|
||||
version = "0.12.1"
|
||||
name = "linux-raw-sys"
|
||||
version = "0.4.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf8b031682c67a8e3d5446840f9573eb7fe26efe7ec8d195c9ac4c0647c502f1"
|
||||
checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
|
||||
|
||||
[[package]]
|
||||
name = "logos"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c000ca4d908ff18ac99b93a062cb8958d331c3220719c52e77cb19cc6ac5d2c1"
|
||||
dependencies = [
|
||||
"logos-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "logos-derive"
|
||||
version = "0.12.1"
|
||||
name = "logos-codegen"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1d849148dbaf9661a6151d1ca82b13bb4c4c128146a88d05253b38d4e2f496c"
|
||||
checksum = "dc487311295e0002e452025d6b580b77bb17286de87b57138f3b5db711cded68"
|
||||
dependencies = [
|
||||
"beef",
|
||||
"fnv",
|
||||
|
@ -257,19 +282,19 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.5.0"
|
||||
name = "logos-derive"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
|
||||
checksum = "dbfc0d229f1f42d790440136d941afd806bc9e949e2bcb8faa813b0f00d1267e"
|
||||
dependencies = [
|
||||
"logos-codegen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.6.5"
|
||||
name = "memchr"
|
||||
version = "2.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
|
||||
|
||||
[[package]]
|
||||
name = "nibble_vec"
|
||||
|
@ -282,43 +307,35 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.23.1"
|
||||
version = "0.26.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6"
|
||||
checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cc",
|
||||
"bitflags 1.3.2",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"memoffset",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "os_str_bytes"
|
||||
version = "6.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa"
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.16"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
|
||||
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.40"
|
||||
version = "1.0.70"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7"
|
||||
checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.20"
|
||||
version = "1.0.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804"
|
||||
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
@ -356,60 +373,59 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.6.3"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
|
||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.13"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
|
||||
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bitflags 1.3.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_users"
|
||||
version = "0.4.3"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
|
||||
checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"redox_syscall",
|
||||
"libredox",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.26"
|
||||
version = "0.6.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64"
|
||||
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.35.6"
|
||||
version = "0.38.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef258c11e17f5c01979a10543a30a4e12faef6aab217a74266e747eefa3aed88"
|
||||
checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bitflags 2.4.1",
|
||||
"errno",
|
||||
"io-lifetimes",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustyline"
|
||||
version = "9.1.2"
|
||||
version = "11.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db7826789c0e25614b03e5a54a0717a86f9ff6e6e5247f92b369472869320039"
|
||||
checksum = "5dfc8644681285d1fb67a467fb3021bfea306b99b4146b166a1fe3ada965eece"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bitflags 1.3.2",
|
||||
"cfg-if",
|
||||
"clipboard-win",
|
||||
"dirs-next",
|
||||
|
@ -420,7 +436,6 @@ dependencies = [
|
|||
"nix",
|
||||
"radix_trie",
|
||||
"scopeguard",
|
||||
"smallvec",
|
||||
"unicode-segmentation",
|
||||
"unicode-width",
|
||||
"utf8parse",
|
||||
|
@ -429,15 +444,15 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.1.0"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.9.0"
|
||||
version = "1.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1"
|
||||
checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
|
||||
|
||||
[[package]]
|
||||
name = "str-buf"
|
||||
|
@ -453,44 +468,29 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.98"
|
||||
version = "2.0.39"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd"
|
||||
checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
|
||||
dependencies = [
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "textwrap"
|
||||
version = "0.15.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.31"
|
||||
version = "1.0.50"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a"
|
||||
checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.31"
|
||||
version = "1.0.50"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a"
|
||||
checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -499,27 +499,27 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.1"
|
||||
version = "1.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c"
|
||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "1.9.0"
|
||||
version = "1.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99"
|
||||
checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.9"
|
||||
version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
|
||||
checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85"
|
||||
|
||||
[[package]]
|
||||
name = "utf8parse"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "936e4b492acfd135421d8dca4b1aa80a7bfc26e702ef3af710e0752684df5372"
|
||||
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
|
@ -543,15 +543,6 @@ version = "0.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
|
@ -560,43 +551,132 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
|||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.36.1"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
|
||||
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
||||
dependencies = [
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_msvc",
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.36.1"
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
|
||||
dependencies = [
|
||||
"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.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.52.0",
|
||||
"windows_aarch64_msvc 0.52.0",
|
||||
"windows_i686_gnu 0.52.0",
|
||||
"windows_i686_msvc 0.52.0",
|
||||
"windows_x86_64_gnu 0.52.0",
|
||||
"windows_x86_64_gnullvm 0.52.0",
|
||||
"windows_x86_64_msvc 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
|
||||
|
||||
[[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.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.36.1"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
|
||||
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.36.1"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
|
||||
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.36.1"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
|
||||
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
|
||||
|
||||
[[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.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.36.1"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
|
||||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
[package]
|
||||
name = "ablescript"
|
||||
version = "0.5.0"
|
||||
authors = ["able <abl3theabove@gmail.com>"]
|
||||
name = "ablescript"
|
||||
version = "0.5.4"
|
||||
authors = ["AbleScript Developers"]
|
||||
edition = "2021"
|
||||
|
||||
description = "The best programming language"
|
||||
license = "MIT"
|
||||
description = "The best programming language"
|
||||
license = "MIT"
|
||||
documentation = "https://ablecorp.us/able-script-the-book/"
|
||||
repository = "https://git.ablecorp.us/AbleScript/able-script"
|
||||
repository = "https://git.ablecorp.us/AbleScript/able-script"
|
||||
|
||||
[dependencies]
|
||||
logos = "0.12"
|
||||
rand = "0.8"
|
||||
logos = "0.13"
|
||||
rand = "0.8"
|
||||
|
|
|
@ -168,7 +168,7 @@ pub enum Expr {
|
|||
Variable(String),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Hash)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
|
||||
pub enum Literal {
|
||||
Char(char),
|
||||
Int(isize),
|
||||
|
@ -185,7 +185,7 @@ impl From<Literal> for Value {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Hash)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
|
||||
pub enum BinOpKind {
|
||||
Add,
|
||||
Subtract,
|
||||
|
|
|
@ -221,15 +221,7 @@ impl<'a, I: BootlegRead> Interpreter<'a, I> {
|
|||
};
|
||||
Some((*counter, index))
|
||||
})
|
||||
.find_map(
|
||||
|(counter, index)| {
|
||||
if counter == 0 {
|
||||
Some(index)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
},
|
||||
)
|
||||
.find_map(|(counter, index)| (counter == 0).then_some(index))
|
||||
}
|
||||
|
||||
fn get_matching_opening_bracket(&mut self, closing: usize) -> Option<usize> {
|
||||
|
@ -245,15 +237,7 @@ impl<'a, I: BootlegRead> Interpreter<'a, I> {
|
|||
};
|
||||
Some((*counter, index))
|
||||
})
|
||||
.find_map(
|
||||
|(counter, index)| {
|
||||
if counter == 0 {
|
||||
Some(index)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
},
|
||||
)
|
||||
.find_map(|(counter, index)| (counter == 0).then_some(index))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
use crate::value::Variable;
|
||||
use std::collections::HashMap;
|
||||
|
||||
/// Host Environment Interface
|
||||
pub trait HostInterface {
|
||||
/// Initial variables for a stack frame
|
||||
fn initial_vars(&mut self) -> HashMap<String, Variable>;
|
||||
|
||||
/// Print a string
|
||||
fn print(&mut self, string: &str, new_line: bool) -> std::io::Result<()>;
|
||||
|
||||
|
@ -17,6 +23,10 @@ pub trait HostInterface {
|
|||
#[derive(Clone, Copy, Default)]
|
||||
pub struct Standard;
|
||||
impl HostInterface for Standard {
|
||||
fn initial_vars(&mut self) -> HashMap<String, Variable> {
|
||||
HashMap::default()
|
||||
}
|
||||
|
||||
fn print(&mut self, string: &str, new_line: bool) -> std::io::Result<()> {
|
||||
use std::io::Write;
|
||||
|
||||
|
|
|
@ -89,9 +89,14 @@ pub const READ_BITS: u8 = 3;
|
|||
impl<H: HostInterface> ExecEnv<H> {
|
||||
/// Create a new Scope with no predefined variable definitions or
|
||||
/// other information.
|
||||
pub fn with_host_interface(host_interface: H) -> Self {
|
||||
pub fn with_host_interface(mut host_interface: H) -> Self {
|
||||
Self {
|
||||
stack: vec![Default::default()],
|
||||
stack: vec![
|
||||
Default::default(),
|
||||
Scope {
|
||||
variables: host_interface.initial_vars(),
|
||||
},
|
||||
],
|
||||
read_buf: Default::default(),
|
||||
finalisers: vec![],
|
||||
host_interface,
|
||||
|
@ -99,16 +104,19 @@ impl<H: HostInterface> ExecEnv<H> {
|
|||
}
|
||||
|
||||
/// Create a new Scope with predefined variables
|
||||
pub fn new_with_vars<I>(host_interface: H, vars: I) -> Self
|
||||
pub fn new_with_vars<I>(mut host_interface: H, vars: I) -> Self
|
||||
where
|
||||
I: IntoIterator<Item = (String, Variable)>,
|
||||
{
|
||||
let scope = Scope {
|
||||
variables: ablescript_consts().into_iter().chain(vars).collect(),
|
||||
};
|
||||
|
||||
Self {
|
||||
stack: vec![scope],
|
||||
stack: vec![
|
||||
Scope {
|
||||
variables: ablescript_consts().into_iter().chain(vars).collect(),
|
||||
},
|
||||
Scope {
|
||||
variables: host_interface.initial_vars(),
|
||||
},
|
||||
],
|
||||
read_buf: Default::default(),
|
||||
finalisers: vec![],
|
||||
host_interface,
|
||||
|
@ -129,8 +137,10 @@ impl<H: HostInterface> ExecEnv<H> {
|
|||
}),
|
||||
}?;
|
||||
|
||||
for block in std::mem::take(&mut self.finalisers) {
|
||||
self.eval_stmts_hs(&block, true)?;
|
||||
while !self.finalisers.is_empty() {
|
||||
for block in std::mem::take(&mut self.finalisers) {
|
||||
self.eval_stmts_hs(&block, true)?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -523,18 +533,23 @@ impl<H: HostInterface> ExecEnv<H> {
|
|||
.take(n_alternations)
|
||||
.map(|chunk| ValueRef::clone(&chunk[0]))
|
||||
.chain(
|
||||
args[2 * n_alternations..]
|
||||
args.get(2 * n_alternations..)
|
||||
.iter()
|
||||
.copied()
|
||||
.flatten()
|
||||
.map(ValueRef::clone)
|
||||
.take(extra_l),
|
||||
)
|
||||
.collect(),
|
||||
args.chunks(2)
|
||||
.take(n_alternations)
|
||||
.map(|chunk| ValueRef::clone(&chunk[1]))
|
||||
.flat_map(|chunk| chunk.get(1))
|
||||
.map(ValueRef::clone)
|
||||
.chain(
|
||||
args[2 * n_alternations..]
|
||||
args.get(2 * n_alternations..)
|
||||
.iter()
|
||||
.copied()
|
||||
.flatten()
|
||||
.map(ValueRef::clone)
|
||||
.take(extra_r),
|
||||
)
|
||||
|
|
|
@ -1,141 +1,60 @@
|
|||
use logos::{Lexer, Logos};
|
||||
|
||||
#[derive(Logos, Debug, PartialEq, Clone)]
|
||||
#[derive(Logos, Debug, PartialEq, Eq, Clone)]
|
||||
#[logos(skip r"[ \t\n\f]+")]
|
||||
#[logos(skip r"owo .*")]
|
||||
#[rustfmt::skip]
|
||||
pub enum Token {
|
||||
// Symbols
|
||||
#[token("(")]
|
||||
LeftParen,
|
||||
|
||||
#[token(")")]
|
||||
RightParen,
|
||||
|
||||
#[token("[")]
|
||||
LeftBracket,
|
||||
|
||||
#[token("]")]
|
||||
RightBracket,
|
||||
|
||||
#[token("{")]
|
||||
LeftCurly,
|
||||
|
||||
#[token("}")]
|
||||
RightCurly,
|
||||
|
||||
#[token(";")]
|
||||
Semicolon,
|
||||
|
||||
#[token(",")]
|
||||
Comma,
|
||||
#[token("(")] LeftParen,
|
||||
#[token(")")] RightParen,
|
||||
#[token("[")] LeftBracket,
|
||||
#[token("]")] RightBracket,
|
||||
#[token("{")] LeftCurly,
|
||||
#[token("}")] RightCurly,
|
||||
#[token(";")] Semicolon,
|
||||
#[token(",")] Comma,
|
||||
|
||||
// Operators
|
||||
#[token("+")]
|
||||
Plus,
|
||||
|
||||
#[token("-")]
|
||||
Minus,
|
||||
|
||||
#[token("*")]
|
||||
Star,
|
||||
|
||||
#[token("/")]
|
||||
FwdSlash,
|
||||
|
||||
#[token("=:")]
|
||||
Assign,
|
||||
|
||||
#[token("<=")]
|
||||
Arrow,
|
||||
#[token("+")] Plus,
|
||||
#[token("-")] Minus,
|
||||
#[token("*")] Star,
|
||||
#[token("/")] FwdSlash,
|
||||
#[token("=:")] Assign,
|
||||
#[token("<=")] Arrow,
|
||||
|
||||
// Logical operators
|
||||
#[token("<")]
|
||||
LessThan,
|
||||
|
||||
#[token(">")]
|
||||
GreaterThan,
|
||||
|
||||
#[token("=")]
|
||||
Equals,
|
||||
|
||||
#[token("ain't")]
|
||||
Aint,
|
||||
#[token("<")] LessThan,
|
||||
#[token(">")] GreaterThan,
|
||||
#[token("=")] Equals,
|
||||
#[token("ain't")] Aint,
|
||||
|
||||
// Keywords
|
||||
#[token("functio")]
|
||||
Functio,
|
||||
|
||||
/// Brain fuck FFI
|
||||
#[token("bff")]
|
||||
Bff,
|
||||
|
||||
/// Variable bro
|
||||
#[token("dim")]
|
||||
Dim,
|
||||
|
||||
/// Prints the preceding things
|
||||
#[token("print")]
|
||||
Print,
|
||||
|
||||
/// Read input into preceding variable
|
||||
#[token("read")]
|
||||
Read,
|
||||
|
||||
/// Ban the following variable from ever being used again
|
||||
#[token("melo")]
|
||||
Melo,
|
||||
|
||||
#[token("T-Dark")]
|
||||
TDark,
|
||||
#[token("functio")] Functio,
|
||||
#[token("bff")] Bff,
|
||||
#[token("dim")] Dim,
|
||||
#[token("print")] Print,
|
||||
#[token("read")] Read,
|
||||
#[token("melo")] Melo,
|
||||
#[token("T-Dark")] TDark,
|
||||
|
||||
// Control flow keywords
|
||||
#[token("unless")]
|
||||
Unless,
|
||||
#[token("unless")] Unless,
|
||||
#[token("loop")] Loop,
|
||||
#[token("enough")] Enough,
|
||||
#[token("and again")] AndAgain,
|
||||
#[token("finally")] Finally,
|
||||
#[token("rlyeh")] Rlyeh,
|
||||
|
||||
#[token("loop")]
|
||||
Loop,
|
||||
|
||||
/// Break out of the loop
|
||||
#[token("enough")]
|
||||
Enough,
|
||||
|
||||
/// Jump at the start of the loop
|
||||
#[token("and again")]
|
||||
AndAgain,
|
||||
|
||||
/// Run at the end of the program
|
||||
#[token("finally")]
|
||||
Finally,
|
||||
|
||||
/// Crash with random error (see discussion #17)
|
||||
#[token("rlyeh")]
|
||||
Rlyeh,
|
||||
|
||||
#[token("rickroll")]
|
||||
Rickroll,
|
||||
#[token("rickroll")] Rickroll,
|
||||
|
||||
// Literals
|
||||
/// String
|
||||
#[token("/*", get_string)]
|
||||
String(String),
|
||||
|
||||
/// Integer
|
||||
#[regex(r"-?[0-9]+", get_value)]
|
||||
Integer(isize),
|
||||
|
||||
// A character (to be base-55 converted)
|
||||
#[regex(r"\p{XID_Start}", get_value)]
|
||||
Char(char),
|
||||
|
||||
/// An identifier
|
||||
#[token("/*", get_string)] String(String),
|
||||
#[regex(r"-?[0-9]+", get_value)] Integer(isize),
|
||||
#[regex(r"\p{XID_Start}", get_value)] Char(char),
|
||||
#[regex(r"\p{XID_Start}[\p{XID_Continue}]+", get_ident)]
|
||||
#[token("and ", |_| "and".to_owned())]
|
||||
Identifier(String),
|
||||
|
||||
#[regex(r"owo .*")]
|
||||
Comment,
|
||||
|
||||
#[regex(r"[ \t\n\f]+", logos::skip)]
|
||||
#[error]
|
||||
Error,
|
||||
}
|
||||
|
||||
fn get_value<T: std::str::FromStr>(lexer: &mut Lexer<Token>) -> Option<T> {
|
||||
|
@ -210,7 +129,7 @@ mod tests {
|
|||
RightCurly,
|
||||
];
|
||||
|
||||
let result: Vec<_> = Token::lexer(code).collect();
|
||||
let result: Vec<_> = Token::lexer(code).collect::<Result<_, _>>().unwrap();
|
||||
assert_eq!(result, expected);
|
||||
}
|
||||
|
||||
|
@ -219,7 +138,7 @@ mod tests {
|
|||
let code = r#"/*»"720B""722B""7195"«*/"#;
|
||||
let expected = &[Token::String("»にゃぁ«".to_owned())];
|
||||
|
||||
let result: Vec<_> = Token::lexer(code).collect();
|
||||
let result: Vec<_> = Token::lexer(code).collect::<Result<_, _>>().unwrap();
|
||||
assert_eq!(result, expected);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
//! <https://git.ablecorp.us/AbleScript/able-script> for more
|
||||
//! information.
|
||||
|
||||
#![forbid(unsafe_code, clippy::unwrap_used)]
|
||||
#![forbid(unsafe_code)]
|
||||
#![cfg_attr(not(test), forbid(clippy::unwrap_used))]
|
||||
|
||||
pub mod ast;
|
||||
pub mod error;
|
||||
|
|
|
@ -31,15 +31,12 @@ impl<'source> Parser<'source> {
|
|||
let mut ast = vec![];
|
||||
while let Some(token) = self.lexer.next() {
|
||||
match token {
|
||||
// Ignore comments
|
||||
Token::Comment => continue,
|
||||
// T-Dark block (replace `lang` with `script`)
|
||||
Ok(Token::TDark) => ast.extend(self.tdark_flow()?),
|
||||
Ok(token) => ast.push(self.parse_stmt(token)?),
|
||||
|
||||
// Invalid token
|
||||
Token::Error => return Err(Error::new(ErrorKind::InvalidToken, self.lexer.span())),
|
||||
|
||||
// T-Dark block (replace `lang` with `script`)
|
||||
Token::TDark => ast.extend(self.tdark_flow()?),
|
||||
token => ast.push(self.parse_stmt(token)?),
|
||||
Err(()) => return Err(Error::new(ErrorKind::InvalidToken, self.lexer.span())),
|
||||
}
|
||||
}
|
||||
Ok(ast)
|
||||
|
@ -49,16 +46,10 @@ impl<'source> Parser<'source> {
|
|||
///
|
||||
/// If EOF, return Error instead of None
|
||||
fn checked_next(&mut self) -> Result<Token, Error> {
|
||||
loop {
|
||||
match self
|
||||
.lexer
|
||||
.next()
|
||||
.ok_or_else(|| Error::unexpected_eoi(self.lexer.span().start))?
|
||||
{
|
||||
Token::Comment => (),
|
||||
Token::Error => break Err(Error::new(ErrorKind::InvalidToken, self.lexer.span())),
|
||||
token => break Ok(token),
|
||||
}
|
||||
match self.lexer.next() {
|
||||
Some(Ok(t)) => Ok(t),
|
||||
Some(Err(())) => Err(Error::new(ErrorKind::InvalidToken, self.lexer.span())),
|
||||
None => Err(Error::unexpected_eoi(self.lexer.span().start)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -471,16 +462,10 @@ impl<'source> Parser<'source> {
|
|||
|
||||
let mut code: Vec<u8> = vec![];
|
||||
loop {
|
||||
match self.checked_next()? {
|
||||
Token::Plus
|
||||
| Token::Minus
|
||||
| Token::Comma
|
||||
| Token::LeftBracket
|
||||
| Token::RightBracket
|
||||
| Token::LessThan
|
||||
| Token::GreaterThan => code.push(self.lexer.slice().as_bytes()[0]),
|
||||
Token::RightCurly => break,
|
||||
_ => (),
|
||||
match self.lexer.next() {
|
||||
Some(Ok(Token::RightCurly)) => break,
|
||||
Some(_) => code.push(self.lexer.slice().as_bytes()[0]),
|
||||
None => return Err(Error::unexpected_eoi(self.lexer.span().start)),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@ use super::ValueRef;
|
|||
use crate::ast::Block;
|
||||
use std::{hash::Hash, rc::Rc};
|
||||
|
||||
type BuiltinRc = Rc<dyn Fn(&[ValueRef]) -> Result<(), crate::error::ErrorKind>>;
|
||||
|
||||
/// AbleScript Function
|
||||
#[derive(Debug, PartialEq, Clone, Hash)]
|
||||
pub enum Functio {
|
||||
|
@ -49,13 +51,13 @@ impl Functio {
|
|||
/// Built-in Rust functio
|
||||
#[derive(Clone)]
|
||||
pub struct BuiltinFunctio {
|
||||
pub(super) function: Rc<dyn Fn(&[ValueRef]) -> Result<(), crate::error::ErrorKind>>,
|
||||
pub(super) function: BuiltinRc,
|
||||
pub(super) arity: usize,
|
||||
}
|
||||
|
||||
impl BuiltinFunctio {
|
||||
/// Wrap a Rust function into AbleScript's built-in functio
|
||||
///
|
||||
///
|
||||
/// Arity used for functio chaining, recommend value for variadic
|
||||
/// functions is the accepted minimum.
|
||||
pub fn new<F>(f: F, arity: usize) -> Self
|
||||
|
@ -100,7 +102,7 @@ impl Hash for BuiltinFunctio {
|
|||
}
|
||||
|
||||
/// A method of distributting parameters across functio chain
|
||||
#[derive(Debug, PartialEq, Copy, Clone, Hash)]
|
||||
#[derive(Debug, PartialEq, Eq, Copy, Clone, Hash)]
|
||||
pub enum FunctioChainKind {
|
||||
/// All parameters are equally distributed
|
||||
Equal,
|
||||
|
|
|
@ -58,7 +58,7 @@ impl Value {
|
|||
}
|
||||
|
||||
/// Three-state logic value
|
||||
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd)]
|
||||
pub enum Abool {
|
||||
Never = -1,
|
||||
Sometimes = 0,
|
||||
|
@ -163,7 +163,7 @@ impl Display for Value {
|
|||
}
|
||||
|
||||
/// Runtime borrow-checked, counted reference to a [Value]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct ValueRef(Rc<RefCell<Value>>);
|
||||
|
||||
impl ValueRef {
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
[package]
|
||||
name = "ablescript_cli"
|
||||
version = "0.5.0"
|
||||
authors = ["able <abl3theabove@gmail.com>"]
|
||||
version = "0.5.4"
|
||||
authors = ["AbleScript Developers"]
|
||||
edition = "2021"
|
||||
|
||||
description = "The best programming language"
|
||||
license = "MIT"
|
||||
documentation = "https://ablecorp.us/able-script-the-book/"
|
||||
repository = "https://git.ablecorp.us/AbleScript/able-script"
|
||||
description = "The best programming language"
|
||||
license = "MIT"
|
||||
documentation = "https://gblecorp.github.io/able-script-the-book"
|
||||
repository = "https://git.ablecorp.us/AbleScript/able-script"
|
||||
|
||||
[dependencies]
|
||||
ablescript = { version = "0.5.0", path = "../ablescript" }
|
||||
|
||||
clap = "3.2"
|
||||
rustyline = "9.1"
|
||||
ablescript = { version = "0.5.3", path = "../ablescript" }
|
||||
clap = { version = "4.2", features = ["derive"] }
|
||||
rustyline = "11.0"
|
||||
|
|
|
@ -1,50 +1,29 @@
|
|||
#![forbid(unsafe_code, clippy::unwrap_used)]
|
||||
#![forbid(unsafe_code)]
|
||||
|
||||
mod repl;
|
||||
|
||||
use ablescript::interpret::ExecEnv;
|
||||
use ablescript::parser::parse;
|
||||
use clap::{Arg, Command};
|
||||
use std::process::exit;
|
||||
use ablescript::{interpret::ExecEnv, parser::parse};
|
||||
use clap::Parser;
|
||||
use std::{path::PathBuf, process::exit};
|
||||
|
||||
fn main() {
|
||||
// variables::test(); // NOTE(Able): Add this as a test case
|
||||
let matches = Command::new("AbleScript")
|
||||
.version(env!("CARGO_PKG_VERSION"))
|
||||
.author("Able <abl3theabove@gmail.com>")
|
||||
.about("AbleScript interpreter")
|
||||
.arg(
|
||||
Arg::new("file")
|
||||
.short('f')
|
||||
.long("file")
|
||||
.value_name("FILE")
|
||||
.help("Set the path to interpret from")
|
||||
.takes_value(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("debug")
|
||||
.long("debug")
|
||||
.help("Enable debug AST printing"),
|
||||
)
|
||||
.get_matches();
|
||||
|
||||
let ast_print = matches.is_present("debug");
|
||||
|
||||
match matches.value_of("file") {
|
||||
let args = Args::parse();
|
||||
match args.file {
|
||||
Some(file_path) => {
|
||||
// Read file
|
||||
let source = match std::fs::read_to_string(file_path) {
|
||||
let source = match std::fs::read_to_string(&file_path) {
|
||||
Ok(s) => s,
|
||||
Err(e) => {
|
||||
println!("Failed to read file \"{}\": {}", file_path, e);
|
||||
println!("Failed to read file \"{:?}\": {}", file_path, e);
|
||||
exit(1)
|
||||
}
|
||||
};
|
||||
|
||||
// Parse & evaluate
|
||||
if let Err(e) = parse(&source).and_then(|ast| {
|
||||
if ast_print {
|
||||
println!("{:#?}", ast);
|
||||
if args.debug {
|
||||
eprintln!("{:#?}", ast);
|
||||
}
|
||||
ExecEnv::<ablescript::host_interface::Standard>::default().eval_stmts(&ast)
|
||||
}) {
|
||||
|
@ -58,7 +37,19 @@ fn main() {
|
|||
}
|
||||
None => {
|
||||
println!("Hi [AbleScript {}]", env!("CARGO_PKG_VERSION"));
|
||||
repl::repl(ast_print);
|
||||
repl::repl(args.debug);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(name = "AbleScript", version, about)]
|
||||
struct Args {
|
||||
/// File to execute
|
||||
#[arg(short, long)]
|
||||
file: Option<PathBuf>,
|
||||
|
||||
/// Dump AST to console
|
||||
#[arg(short, long)]
|
||||
debug: bool,
|
||||
}
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
use ablescript::interpret::ExecEnv;
|
||||
use ablescript::parser::parse;
|
||||
use rustyline::Editor;
|
||||
use ablescript::{interpret::ExecEnv, parser::parse};
|
||||
use rustyline::DefaultEditor;
|
||||
|
||||
pub fn repl(ast_print: bool) {
|
||||
let mut rl = Editor::<()>::new();
|
||||
let mut rl = match DefaultEditor::new() {
|
||||
Ok(rl) => rl,
|
||||
Err(e) => {
|
||||
eprintln!("Failed to create editor: {e}");
|
||||
std::process::exit(-1);
|
||||
}
|
||||
};
|
||||
|
||||
let mut env = ExecEnv::<ablescript::host_interface::Standard>::default();
|
||||
|
||||
// If this is `Some`, the user has previously entered an
|
||||
|
@ -14,7 +20,7 @@ pub fn repl(ast_print: bool) {
|
|||
match rl.readline(if partial.is_some() { ">> " } else { ":: " }) {
|
||||
Ok(readline) => {
|
||||
let readline = readline.trim_end();
|
||||
rl.add_history_entry(readline);
|
||||
let _ = rl.add_history_entry(readline);
|
||||
|
||||
let partial_data = match partial {
|
||||
Some(line) => line + readline,
|
||||
|
@ -23,7 +29,7 @@ pub fn repl(ast_print: bool) {
|
|||
|
||||
partial = match parse(&partial_data).and_then(|ast| {
|
||||
if ast_print {
|
||||
println!("{:#?}", &ast);
|
||||
eprintln!("{:#?}", &ast);
|
||||
}
|
||||
env.eval_stmts(&ast)
|
||||
}) {
|
||||
|
|
Loading…
Reference in New Issue